Interintra r1 charter
Browse files at this commit1f0e3854f7eaf059f77cca17eed9e8f215b8fb97Parent: d45c7f8- chore
- interintra r1 charter
1 changed file +64 -0
lanes/interintra-r1.charter.mdadded+64 -0
| @@ -0,0 +1,64 @@ | |||
| 1 | +# lane-interintra r1 charter — implement non-wedge interintra prediction (decode) | ||
| 2 | + | ||
| 3 | +## Where you are | ||
| 4 | +Worktree /home/user/Documents/Code/Rust/edith_codecs-interintra, branch lane-interintra @ 8f90552. | ||
| 5 | +Build/test ONLY: `env CARGO_TARGET_DIR=$HOME/.cache/cargo-target-interintra cargo test -p ec-av1 --release --lib <name> -- --nocapture` | ||
| 6 | +Never plain workspace cargo test; never touch other worktrees; never push; fixtures/ is a symlink — never write into it except NEW pinned .obu streams captured by a gate. | ||
| 7 | + | ||
| 8 | +## Current state (do not re-derive) | ||
| 9 | +- The interintra SYMBOL is consumed and interintra==1 is a NAMED refusal at | ||
| 10 | + crates/ec-av1/src/decode.rs:5645-5654 (single-ref path, side 16/32, gated | ||
| 11 | + enable_interintra_compound && !skip_mode). This round replaces the refusal with the port. | ||
| 12 | +- Warp/OBMC/skip_mode/interp-suppression all landed and merged — leave them alone. | ||
| 13 | +- Reference: libaom at /tmp/libaom-src (decodemv.c read_interintra_mode_info ~1100, | ||
| 14 | + reconinter.c av1_build_interintra_predictor / combine_interintra, | ||
| 15 | + reconintra.c av1_build_intra_predictors_for_interintra). Patched aomdec (EC_TRACE2 prints) | ||
| 16 | + builds in /tmp/libaom-build; libaom examples/inspect exists there for ground truth | ||
| 17 | + (wrap OBU in IVF first: ffmpeg -i x.obu -c copy x.ivf). ffmpeg is the pixel oracle. | ||
| 18 | + | ||
| 19 | +## Scope, r1 = NON-WEDGE interintra only | ||
| 20 | +1. Syntax (decodemv.c read_interintra_mode_info): after interintra==1 read | ||
| 21 | + interintra_mode (4-ary, interintra_mode_cdf[size_group]); if seq | ||
| 22 | + enable_interintra_wedge && bsize in wedge-allowed set: read wedge_interintra flag — | ||
| 23 | + if THAT reads 1, keep a NAMED refusal ("wedge interintra unimplemented") for r2; | ||
| 24 | + wedge flag 0 → non-wedge path below. CDFs: interintra_mode + wedge_interintra flags | ||
| 25 | + exist in libaom's default tables — add to cdf.rs/cdf_state.rs mirroring how the | ||
| 26 | + interintra flag CDF was added (grep cdfs.interintra for the pattern; remember CDF | ||
| 27 | + adaptation: new tables join the adapt map the same way). | ||
| 28 | +2. Semantics: ref_frame[1] = INTRA_FRAME. CRITICAL cross-cutting sweep (class | ||
| 29 | + tx-class-cross-cutting + neighbour-votes-all-its-fields): interintra blocks are | ||
| 30 | + single-ref for mvstack purposes but their neighbour RECORD carries ref1=INTRA_FRAME | ||
| 31 | + in libaom — grep every context gathered from ref1/compound-ness (comp_inter ctx, | ||
| 32 | + comp_ref ctx, filter ctx ref-match) and match libaom's read of an interintra | ||
| 33 | + neighbour. motion_mode is NOT read for interintra blocks (ref_frame[1]==INTRA_FRAME | ||
| 34 | + fails is_motion_variation_allowed) — the current code reads motion_mode after the | ||
| 35 | + refusal site; make interintra==1 skip that read exactly as libaom does. | ||
| 36 | +3. Prediction (reconinter.c): build the intra predictor for the block's interintra mode | ||
| 37 | + (II_DC/II_V/II_H/II_SMOOTH map to DC/V/H/SMOOTH intra preds with | ||
| 38 | + use_filter_intra=0, from the block's own above/left recon like a normal intra block), | ||
| 39 | + then combine_interintra: weighted blend of inter and intra preds with the | ||
| 40 | + ii_weights_1d table (mode-dependent direction), all planes (chroma at subsampled | ||
| 41 | + size; interintra applies to chroma too — check av1_build_interintra_predictor plane loop). | ||
| 42 | +4. Gate: clone the warp gate shape (stream.rs a_real_aomenc_stream_with_warped_motion_ | ||
| 43 | + refuses_or_matches, ~3311): new test a_real_aomenc_stream_with_interintra_decodes_ | ||
| 44 | + pixel_exact with aomenc flags from that gate BUT --enable-interintra-comp=1 | ||
| 45 | + --enable-interintra-wedge=0 --enable-smooth-interintra=1, warp/obmc ON (they are | ||
| 46 | + supported now); non-wedge interintra refusals FORBIDDEN, wedge refusal allowed | ||
| 47 | + (should not fire with wedge=0), EC_AV1_GATE_DUMP self-pin on mismatch, and assert the | ||
| 48 | + interintra counter fired (add an INTERINTRA_HITS atomic like WARP_SELECTED_HITS). | ||
| 49 | +5. Any pixel mismatch: pin the stream (cp into fixtures/), diff with | ||
| 50 | + /tmp/libaom-build/examples/inspect + patched aomdec EC_TRACE2, range-ladder first | ||
| 51 | + (TRACE part32_pre rng= exists under EC_AV1_TRACE; aomdec prints EC_PART rng=): | ||
| 52 | + ranges exact everywhere = prediction-side; divergent = consumption. Fix, rerun. | ||
| 53 | + | ||
| 54 | +## Done criteria | ||
| 55 | +1. New interintra gate green with interintra blocks actually fired (counter > 0), run 3x. | ||
| 56 | +2. Existing suite: `cargo test -p ec-av1 --release --lib` 217+ passed, 0 failed. | ||
| 57 | +3. All work committed to lane-interintra (`wip(av1): interintra r1 ...`), even on HANDOFF. | ||
| 58 | +4. REPORT FILE lanes/interintra-r1.report.md, verdict FIRST line, evidence excerpts. | ||
| 59 | + | ||
| 60 | +## Hard rules | ||
| 61 | +<=60 tool calls. AT CALL 45: commit whatever compiles + write the report as HANDOFF. | ||
| 62 | +Charter-sized: if the port cannot fit, land syntax+semantics (entropy-exact, prediction | ||
| 63 | +still refused by name) as r1 and hand prediction to r2 — an entropy-exact refusal is | ||
| 64 | +mergeable progress; a half-blended prediction is not. | ||