forge
Explore
Log in

Don't you dare go Hollow

Lane-gm r2 charter (r1 open items resolved

Browse files at this commit

897660b4a0499b2ef8a5b5b0f87966fd19473ee1Ahmet Kaan GümüşParent: 5932267
  • docs
    • lane-gm r2 charter (r1 open items resolved
    • tpl zero_mv_ctx gm site added)
Show full message
docs(av1): lane-gm r2 charter (r1 open items resolved; tpl zero_mv_ctx gm site added)
lanes/gm-r2.charter.mdadded+81 -0
@@ -0,0 +1,81 @@
1+# lane-gm r2 charter — CONTINUATION. r1 was pure recon; its HANDOFF is committed at lanes/gm-r1.handoff.md (d9890e3). READ THAT FIRST, then this.
2+
3+Worktree /home/user/Documents/Code/Rust/edith_codecs-gm, branch lane-gm (main merged: the aomenc oracle now lives at ~/.cache/aom-oracle, gates work).
4+Build/test ONLY: `env CARGO_TARGET_DIR=$HOME/.cache/cargo-target-gm CARGO_BUILD_JOBS=4 nice -n 19 cargo test -p ec-av1 --release --lib <name> -- --nocapture`
5+FOREGROUND. Never push. BUDGET ~55 calls: WIP COMMIT after every green milestone; commit + report by call 45.
6+libaom source oracle: ~/.cache/aom-oracle/src (NOT /tmp any more).
7+
8+## r1's open items — ALL RESOLVED by the orchestrator, do NOT re-read these
9+1. `gm_get_motion_vector` (mv.h:231) confirmed verbatim, incl. the spec's
10+ swapped-axis TRANSLATION bug (`row = wmmat[0] >> 13`, `col = wmmat[1] >> 13`,
11+ GM_TRANS_ONLY_PREC_DIFF = 16-3). ROTZOOM/AFFINE:
12+ `x = block_center_x(mi_col,bsize)`, `y = block_center_y(mi_row,bsize)`,
13+ `xc = (mat[2] - (1<<16))*x + mat[3]*y + mat[0]`,
14+ `yc = mat[4]*x + (mat[5] - (1<<16))*y + mat[1]`,
15+ `row = convert_to_trans_prec(hp, yc)`, `col = convert_to_trans_prec(hp, xc)`.
16+ `convert_to_trans_prec(hp,c)` = `ROUND_POWER_OF_TWO_SIGNED(c, 13)` when hp
17+ else `ROUND_POWER_OF_TWO_SIGNED(c, 14) * 2`.
18+ `is_integer` (force_integer_mv) -> `integer_mv_precision`: per component,
19+ `mod = v % 8; if mod != 0 { v -= mod; if abs(mod) > 4 { v += mod > 0 ? 8 : -8 } }`.
20+2. WarpParams (crates/ec-av1-syntax/src/frame.rs:366): `params[0..6]` IS
21+ `wmmat[0..6]`, same order, same WARPEDMODEL_PREC_BITS fixed point; `model`
22+ is GmType; `invalid` is already computed (`warp_valid`). Nothing to add
23+ to the parser.
24+3. gm candidates are NOT clamped in add_ref_mv_candidate; they are passed in
25+ as `gm_mv_candidates[2]` computed ONCE per block (mvref_common.c:795-830)
26+ from the CURRENT block's centre, and every scan receives them.
27+
28+## One site r1 MISSED (orchestrator found it) — must be in scope
29+`setup_ref_mv_list`'s temporal path compares candidates against the gm mv, not
30+against zero: mvref_common.c:369-370 (single) and :397-400 (compound) use
31+`abs(this_refmv - gm_mv_candidates[0]) >= 16` for the `zero_mv_ctx` decision.
32+Ours hardcodes the zero comparison in mvstack.rs (`first_sample_far =
33+cand.mv.0.abs() >= 16 || cand.mv.1.abs() >= 16`). That is a MODE CONTEXT input,
34+so getting it wrong is an ENTROPY desync, not a pixel error. Fix it with the
35+rest.
36+
37+## Implementation order (WIP commit each)
38+1. `gm_get_motion_vector` port + unit tests: one TRANSLATION case and one
39+ ROTZOOM case, expected values hand-computed IN THE TEST COMMENT showing the
40+ arithmetic (both hp and !hp), plus a force_integer_mv case.
41+2. mvstack: thread `gm_mv: [(i32,i32); 2]` + a per-neighbour `is_global_mv`
42+ flag (new `MiInfo` field; ctor sites decode.rs ~5416/~6348/~6600 per r1)
43+ into `find_mv_stack_with_sign_bias` and `find_mv_stack_compound`:
44+ - a neighbour that `is_global_mv_block` contributes the CURRENT block's
45+ `gm_mv[ref]`, not its own mv (mvref_common.c:88-92, 116-117);
46+ - `is_global_mv_block` = mode is GLOBALMV/GLOBAL_GLOBALMV AND bsize >= 8x8
47+ AND `gm.wmtype > TRANSLATION` (blockd.h; IDENTITY and TRANSLATION are
48+ both FALSE here);
49+ - the `zero_mv_ctx` comparison above.
50+ Square/IDENTITY callers must be unchanged — the 14-pin list proves it.
51+3. decode.rs: GLOBALMV single-ref (~6041-6070, currently hardcodes (0,0)) and
52+ GLOBAL_GLOBALMV compound (~5378) assign the derived mv(s).
53+4. Filter suppression — THE TRAP, two DIFFERENT predicates, never unify:
54+ `is_nontrans_global_motion` (reconinter.h ~420, used by
55+ `av1_is_interp_needed`) is false ONLY when `wmtype == TRANSLATION`, so
56+ IDENTITY COUNTS AS NONTRANS. Our `resolve_interp_filter` suppress arg is
57+ `is_globalmv || warped_selected` today, which is right only because every
58+ model is IDENTITY; it must become
59+ `(is_globalmv && gm.model != Translation) || warped_selected`.
60+5. motion_mode: `motion_mode_allowed` returns SIMPLE_TRANSLATION for an
61+ `is_global_mv_block` block when `!cur_frame_force_integer_mv` — so those
62+ blocks read NO motion_mode symbol (sites ~6180 and the 8x8 leaf ~6965).
63+ GLOBALMV under a TRANSLATION model still reads OBMC/WARPED normally.
64+6. MC: no new warp path (r1 verified) — global blocks predict through the
65+ existing `inter_predict` with the derived mv.
66+7. stream.rs: narrow/remove the whole-frame refusal (~203-218).
67+
68+## Gate ladder (in order)
69+(a) 14-pin default list (`pinned_warp_stream_decodes_pixel_exact -- --ignored`);
70+(b) `a_real_aomenc_stream_with_interintra_wedge` — its 25-29/40 global-motion
71+ refusals MUST drop; print before/after counts in the report;
72+(c) free-partition + AB gates; (d) full lib
73+ `-- --skip a_real_aomenc_stream_with_interintra_wedge`.
74+Any mismatch: `EC_AV1_GATE_DUMP=/tmp/claude-1000/gm-flake-N.obu` self-pin, then
75+report the pin + the recon-diff location (EC_AV1_PREFILT_DUMP both sides).
76+Do NOT guess-fix. Landing with AFFINE still refused while TRANSLATION/ROTZOOM
77+decode pixel-exact is a GOOD outcome; shipping a wrong decode is not.
78+
79+## Done criteria
80+Refusal narrowed or gone with pixel-exact evidence + refusal-count delta;
81+gates green; wip commits; report lanes/gm-r2.report.md, verdict FIRST line.