forge
Explore
Log in

Don't you dare go Hollow

Lane-gm r1 charter (global motion decode

Browse files at this commit

491d2a6c90aebff0b992484e6dd0a5b7668f99b7Ahmet Kaan GümüşParent: f03f2a3
  • docs
    • lane-gm r1 charter (global motion decode
    • recon pre-anchored)
Show full message
docs(av1): lane-gm r1 charter (global motion decode; recon pre-anchored)
lanes/gm-r1.charter.mdadded+82 -0
@@ -0,0 +1,82 @@
1+# lane-gm r1 charter — non-IDENTITY global motion decodes (GLOBALMV + global warp MC)
2+
3+## Where you are
4+Worktree /home/user/Documents/Code/Rust/edith_codecs-gm, branch lane-gm @ 2143b92.
5+Build/test ONLY: `env CARGO_TARGET_DIR=$HOME/.cache/cargo-target-gm cargo test -p ec-av1 --release --lib <name> -- --nocapture`
6+FOREGROUND, `nice -n 19`, `CARGO_BUILD_JOBS=4`. Never push; never touch other worktrees; fixtures/ is a symlink.
7+BUDGET ~60 calls: WIP COMMIT after every green milestone; commit compiling state + report by call 45. Recon is pre-done below — do not re-derive it.
8+
9+## Measured motivation
10+The wedge-interintra gate refuses 25-29/40 attempts with "global motion ...
11+not IDENTITY" — mandelbrot's pan/zoom makes aomenc code ROTZOOM/TRANSLATION
12+global motion. Killing this refusal converts those attempts to decodes.
13+
14+## Recon already done (anchors, do not re-search)
15+- Frame-header params ALREADY PARSED: ec-av1-syntax frame.rs
16+ read_global_motion_params (~1709) fills header.global_motion[7] with
17+ WarpParams { model: WarpModel, params/wmmat }. Read its struct shape first.
18+- The whole-frame refusal to remove: crates/ec-av1/src/stream.rs ~204-218
19+ (`any(|gm| gm.model != WarpModel::Identity)`).
20+- Single-ref GLOBALMV site: decode.rs ~6041-6070 (`is_globalmv = !not_zero`;
21+ the GLOBALMV arm currently assigns mv (0,0)).
22+- Compound GLOBAL_GLOBALMV: decode.rs ~5378 (`compound_mode == 6`), also
23+ assigns zeros today.
24+- mvstack pad/default candidates: crates/ec-av1/src/mvstack.rs — the stack
25+ pads short lists with (0,0) entries; libaom pads with
26+ gm_get_motion_vector results for the block's ref (setup_ref_mv_list's
27+ gm_mv_candidates). grep `0, 0` pad sites + the module doc.
28+- Our warp machinery (from WARPED_CAUSAL): crates/ec-av1/src/warp.rs
29+ `warp_affine` (~329) + shear derivation. Global warp MC reuses it with the
30+ GLOBAL wmmat instead of the locally-derived one.
31+- Interp-filter read suppression: decode.rs ~6166-6200 comments
32+ (`is_nontrans_global_motion`, warp-verify caveat: current suppression
33+ assumes IDENTITY globals). libaom av1_is_interp_needed
34+ (av1/common/reconinter.c) returns false when the block uses a
35+ NON-TRANSLATION global model spanning >=8x8 — with non-IDENTITY globals
36+ live this read-suppression condition MUST be ported exactly or every
37+ GLOBALMV block bit-drifts.
38+
39+## libaom ground truth (read these, transcribe exactly)
40+- /tmp/libaom-src/av1/common/mv.h:231 gm_get_motion_vector: block-center
41+ derivation, TRANSLATION/ROTZOOM/AFFINE cases, allow_hp/force_integer
42+ rounding (is_integer), the >>3 / OFFSET semantics. This feeds BOTH
43+ assign_mv and the mvstack gm candidates.
44+- /tmp/libaom-src/av1/common/reconinter.c av1_allow_warp + the
45+ global-warp branch of av1_build_inter_predictor / warp path selection
46+ (when is_global fires warp_plane vs plain MC with the derived mv):
47+ block >=8x8, no scaling here.
48+- /tmp/libaom-src/av1/common/warped_motion.c av1_get_shear_params — global
49+ params must pass shear validation or fall back (av1_warp checks
50+ wm->invalid? read how decode handles invalid global params).
51+
52+## Scope (in order, WIP commit each)
53+1. Port gm_get_motion_vector into decode (or warp.rs) with unit tests
54+ pinning a few (wmmat, center, hp/int) -> mv values TRANSCRIBED from a
55+ hand-run of the C formula (show the arithmetic in the test comments).
56+2. Thread header.global_motion into decode_inter_block/decode_inter_block8:
57+ GLOBALMV single-ref + GLOBAL_GLOBALMV compound assign the derived mv;
58+ mvstack gm candidates (pass the gm params into find_mv_stack pad sites
59+ per libaom setup_ref_mv_list).
60+3. MC: blocks whose mode is GLOBALMV (or whose selected mv comes from a
61+ non-translation global model per av1_allow_warp) go through warp_affine
62+ with the global wmmat + shear params; TRANSLATION model = plain MC with
63+ the derived mv. Port av1_is_interp_needed's global condition at the
64+ interp-filter read.
65+4. Remove the stream.rs whole-frame refusal.
66+5. GATE LADDER: (a) 14-pin default list; (b) wedge-interintra gate
67+ a_real_aomenc_stream_with_interintra_wedge (its 25-29/40 global-motion
68+ refusals must DROP — print before/after refusal counts in the report;
69+ any new mismatch = EC_AV1_GATE_DUMP self-pin /tmp/claude-1000/gm-flake-N.obu,
70+ report the pin + recon-diff location, do NOT guess-fix);
71+ (c) free-partition + AB gates; (d) full lib suite EXCEPT run the wedge
72+ gate separately (it is slow): `-- --skip a_real_aomenc_stream_with_interintra_wedge`.
73+6. If mismatches appear (likely — this is a value-heavy port): pin, localize
74+ with EC_AV1_PREFILT_DUMP both sides + the EC_AV1_TELL ladder, fix the
75+ earliest divergence only, iterate. Landing with SOME streams still
76+ mismatching = report the pins and leave the stream.rs refusal for exactly
77+ the model kinds still broken (e.g. keep refusing AFFINE, decode
78+ TRANSLATION/ROTZOOM) rather than shipping a wrong decode.
79+
80+## Done criteria
81+Refusal narrowed or gone with pixel-exact evidence; gates green; wip commits;
82+REPORT lanes/gm-r1.report.md, verdict FIRST line, refusal-count before/after.