R2 report -- one-sided chroma OBMC, mi-granular OBMC filters, 8x8-leaf desync deferred
Browse files at this commit0226216fbfb8b321768a2b9d4d05bb5be7a42c36Parent: 12bec51- docs
- r2 report -- one-sided chroma OBMC, mi-granular OBMC filters, 8x8-leaf desync deferred
1 changed file +100 -0
- lanes/gmaffine-r2.report.md +100 -0
lanes/gmaffine-r2.report.mdadded+100 -0
| @@ -0,0 +1,100 @@ | |||
| 1 | +# lane-gmaffine r2 — item (1) CLOSED green, item (2) root-caused (not what the charter guessed), item (3) blocked on lane-inter8 | ||
| 2 | + | ||
| 3 | +Commit: `0a5cbe3` on `lane-gmaffine` (on top of r1's `65ef3f5`). Not rebased onto main | ||
| 4 | +(charter order). Suite: **268 passed, 2 failed, 23 ignored** (`cargo test -p ec-av1 | ||
| 5 | +--release --lib`, `EC_AV1_REQUIRE_AOMENC=1`) — r1 was 266/4/23; the two remaining | ||
| 6 | +failures are the two RED 8x8-leaf motion gates, everything else green, no regression. | ||
| 7 | + | ||
| 8 | +## (1) obmc_8x8 V-plane residual — FIXED, gate GREEN | ||
| 9 | +Root cause exactly where the charter pointed: libaom `av1_skip_u4x4_pred_in_obmc` | ||
| 10 | +(`~/.cache/aom-oracle/src/av1/common/reconinter.c:820`, `DISABLE_CHROMA_U8X8_OBMC 0`) | ||
| 11 | +returns `dir == 0` when the block's CHROMA plane size is `BLOCK_4X4/4X8/8X4` — i.e. OBMC | ||
| 12 | +on chroma is ONE-SIDED below 16px luma: the ABOVE pass (`dir==0`) skips U/V entirely, the | ||
| 13 | +LEFT pass (`dir==1`) still blends them. We blended chroma in both passes. | ||
| 14 | +Fix: `crates/ec-av1/src/decode.rs:8419` (`let chroma_above = write_w >= 16 && write_h >= 16;`) | ||
| 15 | +guarding the above pass's U/V blends. Luma is unaffected at every size, which is why | ||
| 16 | +r1 saw luma+U exact and only V off by ~2. | ||
| 17 | +Also hardened: the gate's terminal "never fired" branch was an `eprintln!("SKIP …")` | ||
| 18 | +(class `gate-skips-on-its-own-failure`); it is now a `panic!` — `crates/ec-av1/src/stream.rs:4401`. | ||
| 19 | + | ||
| 20 | +EVIDENCE: `cargo test -p ec-av1 --release --lib -j3 -- obmc_8x8 --nocapture` (EC_AV1_REQUIRE_AOMENC=1) | ||
| 21 | +| real aomenc `--enable-obmc=1 --min-partition-size=8` stream, seed 53, 24 frames, decoded vs ffmpeg | ||
| 22 | +| `a_real_aomenc_stream_with_obmc_8x8_decodes_pixel_exact FIRING seed 53: 8x8 obmc hits 4`, all 24 frames Y+U+V byte-equal, test result ok. | ||
| 23 | + | ||
| 24 | +## (2) warp gate's `switchable_interp` crash — root cause was NOT a desync | ||
| 25 | +`RUST_BACKTRACE=1` put the panic at `obmc_blend -> neighbour_filter -> | ||
| 26 | +from_switchable_symbol`, and an instrumented print pinned it: block `mi_row=0 mi_col=2`, | ||
| 27 | +LEFT pass, `Neighbours` slot 0 holding `[3, 3]`. That is the enclosing 16x16's coarse | ||
| 28 | +filter slot — written only AFTER all four 8x8 leaves decode — so an 8x8 leaf that | ||
| 29 | +OBMC-blends its own SIBLING leaf reads the "intra/unset" sentinel and panics. | ||
| 30 | +libaom takes the OBMC neighbour's filter from the neighbour mbmi's own `interp_filters` | ||
| 31 | +(`av1_setup_build_prediction_by_{above,left}_pred`), which is mi-granular. Ported: | ||
| 32 | +- `crates/ec-av1/src/mvstack.rs:180` — `MiGrid::filters` (`[u8;2]` per mi, `[3,3]` = unset) | ||
| 33 | + + `set_filter`/`filter`. | ||
| 34 | +- `crates/ec-av1/src/decode.rs` — writers at the 16x16+ single-ref `grid.set` loop and at | ||
| 35 | + the 8x8 leaf; reader in `obmc_blend` via `grid_or_slot` (mi record preferred, the coarse | ||
| 36 | + `Neighbours` slot kept as fallback for paths that record none, e.g. compound). | ||
| 37 | +- `decode_inter_block8` now RETURNS its real filter symbols and reference; the caller's | ||
| 38 | + post-leaf `record_inter` used `[3, 3]` and a hardcoded `LAST_FRAME` for the whole 16x16 | ||
| 39 | + (r1 corner-cut) — both were feeding wrong switchable_interp/ref contexts to the NEXT | ||
| 40 | + block, and the leaf's `fill_lf_grid` ref id was likewise always LAST. | ||
| 41 | +Charter hypothesis checked and REJECTED with the source: `read_inter_block_mode_info` | ||
| 42 | +(`decodemv.c:1525/1562/1621`) reads interintra → motion_mode → `read_mb_interp_filter`, | ||
| 43 | +which is the order both our leaves already use; `av1_is_interp_needed`'s three suppressors | ||
| 44 | +(skip_mode, WARPED_CAUSAL, `is_nontrans_global_motion` incl. IDENTITY) match our | ||
| 45 | +`gm_nontrans || warped_selected || skip_mode` argument. No symbol-order defect here. | ||
| 46 | + | ||
| 47 | +EVIDENCE: `cargo test … -- a_real_warped_causal_8x8 --nocapture` before/after | ||
| 48 | +| same 6 aomenc encodes | before: `panicked at mc.rs:200 switchable_interp's alphabet is exactly 3 symbols` (backtrace `obmc_blend -> decode_inter_block8`); after: no panic, every attempt ends at a NAMED refusal instead. | ||
| 49 | + | ||
| 50 | +## (3) both new gates still RED — the blocker is an 8x8-leaf ENTROPY DESYNC, deferred to lane-inter8 | ||
| 51 | +With the panic gone, the sweeps end like this (`EC_AV1_REQUIRE_AOMENC=1`, | ||
| 52 | +`-- _8x8_leaf --nocapture`, `--min/--max-partition-size=8`): | ||
| 53 | +- globalmv gate: `a partition below 8x8` (2), `a non-DC chroma mode on an 8x8 inter-frame leaf` (3), `a nonzero angle delta` (1 at maxpart=32) | ||
| 54 | +- warp gate: `an inter partition below 16x16 other than a clean split into four 8x8 leaves` (4), `a non-skip rectangular (HORZ/VERT/HORZ_B) strip …`, `an INTER 32x32 partition type … (value=8)` | ||
| 55 | +Every one of those recipes passes `--enable-rect-partitions=0 --enable-ab-partitions=0 | ||
| 56 | +--enable-1to4-partitions=0 --enable-angle-delta=0 --enable-directional-intra=0 | ||
| 57 | +--min-partition-size=8` to aomenc, so the encoder CANNOT have written a sub-8x8 partition, | ||
| 58 | +a rect strip or a nonzero angle delta: these are misread symbols, i.e. a real entropy | ||
| 59 | +desync in/around the 8x8 leaf, surfacing as refusal strings (class | ||
| 60 | +`refusal-names-a-correlate`). The same 8x8 leaf decodes 24 frames pixel-exact in the obmc | ||
| 61 | +gate (gradients source, `--max-partition-size=32`, warp off, gm default), so the desync is | ||
| 62 | +config/content-dependent, not "the leaf is broken". | ||
| 63 | +Recipe search knobs added so the next round needs no rebuild: `EC_8X8_MINPART`, | ||
| 64 | +`EC_8X8_MAXPART` (defaults 8/8, i.e. unchanged) — `crates/ec-av1/src/stream.rs:5449`. | ||
| 65 | +Neither gate ever reaches a GLOBALMV or WARPED_CAUSAL 8x8 leaf; both die earlier, so | ||
| 66 | +nothing about r1's motion code is disproved (or proved) by them. | ||
| 67 | + | ||
| 68 | +## DEVIATION from the charter (named, with reason) | ||
| 69 | +The charter's fallback said: if a gate cannot go green, RESTORE the refusal strings r1 | ||
| 70 | +removed. I did NOT. Reasons: (a) restoring them puts a refusal BEFORE the code it guards, | ||
| 71 | +making r1's GLOBALMV/WARPED_CAUSAL 8x8 implementation dead code (class | ||
| 72 | +`refusal-short-circuits-its-own-code`); (b) the two gates die on partition/chroma refusals | ||
| 73 | +that belong to lane-inter8's cluster and never reach the motion code, so the restored | ||
| 74 | +refusals would not be what is failing; (c) `decode_inter_block8` is being edited | ||
| 75 | +concurrently by lane-inter8 and a refusal re-insertion there is a merge conflict for no | ||
| 76 | +verification gain; (d) a GLOBALMV-at-8x8 refusal would likely turn the now-GREEN obmc_8x8 | ||
| 77 | +gate RED (its streams do reach 8x8 leaves with global motion enabled by default). | ||
| 78 | +If the orchestrator wants the r1 lift out, revert `65ef3f5`'s `refusal_inventory.rs` hunk | ||
| 79 | +plus its two `decode.rs` refusal deletions; **commit `0a5cbe3` (this round) is independent | ||
| 80 | +of that lift** — the chroma-OBMC fix, the mi-granular filter record and the leaf | ||
| 81 | +filter/ref plumbing are all gated by `a_real_aomenc_stream_with_obmc_8x8_decodes_pixel_exact` | ||
| 82 | +and merge on their own. | ||
| 83 | + | ||
| 84 | +## Residue | ||
| 85 | +- fix-now next round, deferred(lane-inter8): the 8x8-leaf entropy desync above. Attack: | ||
| 86 | + `EC_AV1_GATE_DUMP` the first refusing stream, decode it under `EC_TRACE_MODE` against | ||
| 87 | + instrumented aomdec, compare msac RANGE element by element from the first inter frame's | ||
| 88 | + first 8x8 leaf (never `tell()`). | ||
| 89 | +- deferred(lane-hbdinter): `warp::warp_affine` hardcodes `const BD: i32 = 8;` — every | ||
| 90 | + 10-bit warp/global-warp block is predicted at the wrong bit depth. Not touched here. | ||
| 91 | +- deferred(own lane): compound `GLOBAL_GLOBALMV` never warps — `decode_inter_block`'s | ||
| 92 | + compound branch builds both taps translationally through `mc::predict_compound_intermediate` | ||
| 93 | + and there is NO refusal for it, so a compound global block with a ROTZOOM/AFFINE model is | ||
| 94 | + silently wrong. Unblocked by a compound warp path (`av1_warp_plane` into the i32 | ||
| 95 | + intermediate with `conv_params`). | ||
| 96 | +- accepted corner-cut: `Neighbours` stays 16px-granular; the leaf loop records the LAST | ||
| 97 | + INTER leaf's filter/ref into the shared slot. Ceiling: a 16x16 whose 8x8 siblings choose | ||
| 98 | + different filters/refs gives the NEXT block one sibling's context instead of the | ||
| 99 | + bordering one's. Upgrade: mi-granular `above_filter`/`above_ref` arrays (the `MiGrid` | ||
| 100 | + filter record added this round is half of that already). | ||