forge
Explore
Log in

Don't you dare go Hollow

OBMC on a 16x8/8x16 inter leaf -- refusal lifted, gated by an --enable-obmc=1 arm

Browse files at this commit

3c024bfcbab29d958f1708db1ac8a48654a071eeAhmet Kaan GümüşParent: 7c85bed
  • feat
    • OBMC on a 16x8/8x16 inter leaf -- refusal lifted, gated by an --enable-obmc=1 arm
Show full message
feat(av1): OBMC on a 16x8/8x16 inter leaf -- refusal lifted, gated by an --enable-obmc=1 arm

The r3 refusal is disproved on this tree: an EC_OBMC rung in both our decoder and the
oracle aomdec emits the same 9 neighbour invocations on the exact stream r3 measured,
and all six EC_AV1_PREFILT_DUMP frames are byte-identical. Ship the blend, count it
(OBMC_RECT_LEAF_HITS), and prove it with 16 extra --enable-obmc=1 attempts in the
16-level rect leaf gate (10 blends 8-bit / 4 blends 10-bit, 0 mismatches).

Also re-measures r2's ignored 32x16/16x32 rect-residual gate: still red, and the
blocker is now rectangular INTRA prediction (10 of 12 refusals), not this lane.
crates/ec-av1/src/decode.rsmodified+23 -11
@@ -1351,6 +1351,19 @@ pub(crate) fn wii_hits() -> usize {
13511351 WII_HITS.with(|c| c.get())
13521352 }
13531353
1354+// lane-inter4 r4: how many 16x8/8x16 INTER LEAVES actually ran the OBMC
1355+// blend -- the gate's proof that `--enable-obmc=1` reached this shape (the
1356+// r3 refusal's replacement: prefilt frames are bit-exact vs an instrumented
1357+// aomdec, neighbour list included).
1358+thread_local! {
1359+ static OBMC_RECT_LEAF_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
1360+}
1361+
1362+/// Current value of [`OBMC_RECT_LEAF_HITS`].
1363+pub(crate) fn obmc_rect_leaf_hits() -> usize {
1364+ OBMC_RECT_LEAF_HITS.with(|c| c.get())
1365+}
1366+
13541367 /// Current value of [`OBMC_HITS_8`].
13551368 pub(crate) fn obmc_hits_8() -> usize {
13561369 OBMC_HITS_8.with(|c| c.get())
@@ -12827,18 +12840,17 @@ fn obmc_blend(
1282712840 5..=8 => 3,
1282812841 _ => 4,
1282912842 };
12830- // lane-inter4 r3: OBMC on a 16-level rect inter leaf mismatches ffmpeg
12831- // (192x128 testsrc-style motion, cq 22, `--enable-obmc=1`: 5302 luma
12832- // pixels of frame 5 wrong, max |delta| 84, while the SAME recipe with
12833- // `--enable-obmc=0` decodes 5 rect-leaf-carrying attempts pixel-exact).
12834- // The blend geometry here matches libaom `build_obmc_inter_pred_*` for
12835- // these shapes, so the cause is upstream (neighbour walk or mv stack for
12836- // a 2:1 leaf) and unidentified -- refuse by name rather than ship wrong
12837- // pixels. Deleting this block is the whole lift once it is found.
12843+ // lane-inter4 r4: r3 refused OBMC on a 16x8/8x16 leaf (5302 luma pixels
12844+ // of one frame wrong). Re-measured on this tree with an `EC_OBMC` rung in
12845+ // both decoders on that exact stream: the neighbour lists agree entry for
12846+ // entry (position, span, mv, ref, size, filter) and all six pre-filter
12847+ // frames are byte-identical to the instrumented aomdec's. The refusal is
12848+ // gone; the counter below is what the gate's `--enable-obmc=1` arm reads.
12849+ // The only decode-path change between r3's measurement and this one is the
12850+ // lane-interbis merge (`build_motion_field`'s compound slot walk), which
12851+ // moves temporal MV candidates -- not bisected further.
1283812852 if matches!((write_w, write_h), (16, 8) | (8, 16)) {
12839- return Err(unsupported(
12840- "OBMC on a 16x8/8x16 inter leaf (blend mismatches the reference on this shape)",
12841- ));
12853+ OBMC_RECT_LEAF_HITS.with(|c| c.set(c.get() + 1));
1284212854 }
1284312855 let overlap_above = write_h / 2;
1284412856 let overlap_left = write_w / 2;
crates/ec-av1/src/refusal_inventory.rsmodified+0 -1
@@ -65,7 +65,6 @@ const REFUSALS: &[&str] = &[
6565 "an inter SB-level AB partition (HORZ_A/HORZ_B/VERT_A/VERT_B; this decoder's inter tile path codes a superblock as NONE, SPLIT, HORZ, VERT, HORZ_4 or VERT_4)",
6666 "a masked compound 64x64 inter block (compound_type is inferred, not coded, at this size)",
6767 "an inter 16x16-level AB or 1:4 partition (HORZ_A/HORZ_B/VERT_A/VERT_B/HORZ_4/VERT_4; this decoder's inter path codes a 16x16 as NONE, HORZ, VERT or SPLIT)",
68- "OBMC on a 16x8/8x16 inter leaf (blend mismatches the reference on this shape)",
6968 "an intra mode this decoder does not code (round 2)",
7069 "an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder does not code yet",
7170 // Lifted for the 16x8/8x16 leaf by lane-fistrip; still live one level
crates/ec-av1/src/stream.rsmodified+32 -8
@@ -1945,10 +1945,10 @@ mod tests {
19451945 // masked compound, palette, ...) are other lanes' work;
19461946 // this gate is about hidden frames, not about them.
19471947 "--enable-warped-motion=0",
1948- // lane-inter4 r3: OBMC on a 16x8/8x16 leaf is a NAMED
1949- // REFUSAL (see decode.rs `obmc_blend`) -- it mismatches
1950- // the reference on this shape, so the gate spells the
1951- // tool off rather than counting its refusals as passes.
1948+ // OBMC stays off HERE (this gate is about hidden frames);
1949+ // the tool's own coverage is the `obmc*` gates and, on a
1950+ // 16x8/8x16 leaf, the `--enable-obmc=1` arm of
1951+ // `..._with_a_16_level_rect_leaf_...` (lane-inter4 r4).
19521952 "--enable-obmc=0",
19531953 "--enable-masked-comp=0",
19541954 "--enable-interintra-comp=0",
@@ -4891,7 +4891,15 @@ mod tests {
48914891 // shape additionally needs `default_inter_ext_tx_cdf[2][TX_8X8]` (the
48924892 // 12-symbol DTT9_IDTX_1DDCT row, only reachable through a rect
48934893 // transform), which this round did not add. See lanes/inter4-r2.report.md.
4894- #[ignore = "lane-inter4 r2: every real-content attempt stops at the 16x8/8x16 inter leaf or intra-rect-strip refusal before reaching a 32x16/16x32 strip; the rect residual path itself is unproven, not claimed"]
4894+ // lane-inter4 r4 re-measured after the 16-level rect inter leaf shipped
4895+ // (r3): STILL RED, and the blocker moved -- 12 named refusals over 16
4896+ // 8-bit attempts, 10 of them "an intra-coded HORZ/VERT strip needs
4897+ // rectangular intra prediction this decoder does not code yet" and 2 the
4898+ // 16-level AB/1:4 inter refusal; 4 attempts decoded with no rect inter
4899+ // residual at all and none of them mismatched (tu=0, split=0). Neither
4900+ // remaining blocker is this lane's: the gate un-ignores when the intra
4901+ // rect strip lands.
4902+ #[ignore = "lane-inter4 r4 (re-measured): 12/16 8-bit attempts stop at the intra-rect-strip (10) or 16-level inter AB/1:4 (2) refusal, the other 4 code no rect inter residual -- tu=0, split=0; blocked on rectangular INTRA prediction, not on this lane"]
48954903 fn a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact() {
48964904 const NAME: &str =
48974905 "a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact";
@@ -5089,7 +5097,14 @@ mod tests {
50895097 (0u32, 0u32, 0u32, 0u32);
50905098 let (mut tu_proved, mut split_proved) = (0usize, 0usize);
50915099 let (mut horz_proved, mut vert_proved, mut sub16_split) = (0u32, 0u32, 0usize);
5092- for attempt in 0..16u32 {
5100+ // lane-inter4 r4: attempts 16..32 repeat the same sweep with
5101+ // `--enable-obmc=1`. r3 refused OBMC on this shape; r4's
5102+ // instrumented-aomdec comparison showed the neighbour list AND
5103+ // every pre-filter frame bit-exact, so the arm is a gate now.
5104+ let mut obmc_leaf_proved = 0usize;
5105+ for attempt in 0..32u32 {
5106+ let obmc_arg = if attempt >= 16 { "--enable-obmc=1" } else { "--enable-obmc=0" };
5107+ let attempt = attempt % 16;
50935108 // Two sources (a translating textured ramp, and testsrc2's
50945109 // natural motion) x two quantisers x two tx-size-search arms x
50955110 // two motion steps.
@@ -5152,7 +5167,7 @@ mod tests {
51525167 "--enable-rect-partitions=1", "--enable-ab-partitions=0",
51535168 "--enable-1to4-partitions=0", "--min-partition-size=8",
51545169 "--max-partition-size=16",
5155- "--enable-obmc=0",
5170+ obmc_arg,
51565171 "--obu", "-o", "-", "-",
51575172 ];
51585173 let mut child = Command::new(aomenc_path())
@@ -5176,6 +5191,7 @@ mod tests {
51765191 );
51775192 let stream = out.stdout;
51785193 let before = (decode::rect_inter_tu_hits(), decode::rect_inter_txsplit_hits());
5194+ let before_obmc_leaf = decode::obmc_rect_leaf_hits();
51795195 let before_leaf = (
51805196 decode::inter_leaf16_horz_hits(),
51815197 decode::inter_leaf16_vert_hits(),
@@ -5197,6 +5213,7 @@ mod tests {
51975213 };
51985214 let after = (decode::rect_inter_tu_hits(), decode::rect_inter_txsplit_hits());
51995215 let (tu, split) = (after.0 - before.0, after.1 - before.1);
5216+ let obmc_leaf = decode::obmc_rect_leaf_hits() - before_obmc_leaf;
52005217 let (horz, vert, splits16) = (
52015218 decode::inter_leaf16_horz_hits() - before_leaf.0,
52025219 decode::inter_leaf16_vert_hits() - before_leaf.1,
@@ -5253,6 +5270,7 @@ mod tests {
52535270 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (attempt {attempt}, {bit_depth}-bit, tx_search={tx_search})");
52545271 }
52555272 tu_proved += tu;
5273+ obmc_leaf_proved += obmc_leaf;
52565274 split_proved += split;
52575275 sub16_split += splits16;
52585276 if horz > 0 {
@@ -5267,7 +5285,8 @@ mod tests {
52675285 "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {matched} pixel-exact \
52685286 attempts carrying a 16-level rect inter leaf, 16x8-carrying={horz_proved}, \
52695287 8x16-carrying={vert_proved}, whole-block rect TUs={tu_proved}, rect trees that \
5270- split={split_proved}, 16x16 SPLITs={sub16_split}, {out_of_scope} attempts \
5288+ split={split_proved}, 16x16 SPLITs={sub16_split}, OBMC blends on a rect \
5289+ leaf={obmc_leaf_proved}, {out_of_scope} attempts \
52715290 carried none ({oos_mismatch} of them mismatched)"
52725291 );
52735292 assert_eq!(
@@ -5282,6 +5301,11 @@ mod tests {
52825301 SPLITs={sub16_split}, {named_refusals} refusals, {out_of_scope} out of \
52835302 scope) -- gate proved nothing"
52845303 );
5304+ assert!(
5305+ obmc_leaf_proved > 0,
5306+ "{NAME} ({bit_depth}-bit): no pixel-exact attempt ever ran the OBMC blend on a \
5307+ 16x8/8x16 inter leaf -- the `--enable-obmc=1` arm proved nothing"
5308+ );
52855309 tu_total += tu_proved;
52865310 }
52875311 assert!(
lanes/inter4-r4.report.mdadded+98 -0
@@ -0,0 +1,98 @@
1+# lane-inter4 r4 — OBMC on a 16x8/8x16 inter leaf (refusal lifted, gated)
2+
3+Branch `lane-inter4`, worktree `/home/user/Documents/Code/Rust/edith_codecs-inter4`,
4+off r3's `96847a3`, with `lane-interbis` (`8a6bede`, `build_motion_field`'s compound
5+slot walk) merged FIRST as chartered.
6+
7+## TASK 1 — r2's ignored 32x16/16x32 gate: re-measured, STILL RED, blocker moved
8+
9+ cargo test -p ec-av1 --lib coded_rectangular_residual -- --ignored --nocapture
10+
11+`a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact`
12+still cannot prove itself: over its 16 8-bit attempts, **12 named refusals** — 10 of
13+them `"an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder
14+does not code yet"` and 2 `"an inter 16x16-level AB or 1:4 partition ..."` — and the
15+other 4 attempts decode with **zero** rect inter residual (`tu=0`, `split=0`, 0
16+mismatches). So the 16-level leaf landing in r3 did NOT unblock it: what stops these
17+streams now is rectangular *intra* prediction, another lane's refusal. Kept `#[ignore]`,
18+with the reason string replaced by that measurement (stream.rs:4902).
19+
20+EVIDENCE: $HOME/.cache/inter4-t1.log | 16 aomenc encodes, decode + counter read | 12 named refusals (10 intra-rect-strip, 2 inter AB/1:4), 4 attempts with tu=0/split=0, 0 mismatches
21+
22+## TASK 2 — the OBMC residue: no defect left; refusal lifted
23+
24+r3 refused `"OBMC on a 16x8/8x16 inter leaf (blend mismatches the reference on this
25+shape)"` off a measured 5302-luma-pixel mismatch (attempt 10, 8-bit, cq 22, frame 5).
26+Re-measured on THIS tree before touching any code:
27+
28+- Rebuilt that exact stream from the gate's attempt-10 recipe with `--enable-obmc=1`
29+ (`scratchpad/o10.obu`, md5 `b643a93a8db45e2a1b89b2d777147ee3`, 828 B).
30+- Added an `EC_OBMC` rung to the oracle `aomdec`
31+ (`dec_build_prediction_by_above_pred` / `_left_pred`, printing the block, the
32+ neighbour's rel position, `op_mi_size`, mv, ref, bsize, filter) and the matching
33+ rung to our `obmc_blend`, then compared.
34+
35+Both decoders emit **exactly 9 OBMC neighbour invocations**, in the same order, with
36+identical block shape, `off4`/`rel`, `span4`/`op_mi_size`, neighbour mv, ref frame and
37+filter — including the three on `wh=(8x16)` leaves. And every one of the six
38+`EC_AV1_PREFILT_DUMP` frames is **byte-identical** between our decoder and aomdec
39+(luma diff 0 on f0..f5). There is nothing left to fix on this shape: the mismatch r3
40+saw is gone. The only decode-path change between r3's measurement and this one is the
41+lane-interbis merge (temporal MV candidates); not bisected further.
42+
43+EVIDENCE: scratchpad/{ours.obmc,ref.obmc,ours.yuv.f0-5,ref.yuv.f0-5} | EC_OBMC + EC_AV1_PREFILT_DUMP on o10.obu, ours (release decode_probe) vs instrumented aomdec | 9 vs 9 identical neighbour lines; per-frame luma diff 0/0/0/0/0/0
44+
45+### What shipped
46+
47+- `crates/ec-av1/src/decode.rs` (`obmc_blend`, ~12843): the `(16,8)|(8,16)` refusal
48+ deleted; in its place the new `OBMC_RECT_LEAF_HITS` counter (+ `obmc_rect_leaf_hits()`
49+ at ~1355) that the gate reads.
50+- `crates/ec-av1/src/refusal_inventory.rs`: the OBMC-rect-leaf string removed.
51+- `crates/ec-av1/src/stream.rs` (`..._with_a_16_level_rect_leaf_...`, ~5090): the sweep
52+ runs **32 attempts** now — the same 16 (2 sources x 2 quantisers x 2 tx-size-search
53+ arms x 2 motion steps) with `--enable-obmc=0`, then repeated with `--enable-obmc=1`
54+ as the LAST flag. New hard assert per bit depth: `obmc_leaf_proved > 0`.
55+- `crates/ec-av1/src/stream.rs` ~1948: the hidden-frames gate's `--enable-obmc=0`
56+ comment no longer cites a refusal that does not exist.
57+
58+### Gate — GREEN
59+
60+ cargo test -p ec-av1 --lib 16_level_rect_leaf -- --nocapture
61+
62+- 8-bit: 15 named refusals, 9 pixel-exact leaf-carrying attempts (16x8=5, 8x16=4),
63+ whole-block rect TUs=4, **OBMC blends on a rect leaf=10**, 8 attempts carried none
64+ (0 mismatched).
65+- 10-bit: 4 named refusals, 8 pixel-exact leaf-carrying attempts (16x8=4, 8x16=6),
66+ **OBMC blends on a rect leaf=4**, 20 carried none (0 mismatched).
67+
68+EVIDENCE: $HOME/.cache/inter4-g4.log | 64 aomenc encodes (32 attempts x 2 depths), every decoded frame Y/U/V vs ffmpeg | test result: ok. 1 passed; 0 failed; OBMC-on-rect-leaf blends 10 (8-bit) / 4 (10-bit), 0 mismatches
69+
70+## Refusals
71+
72+Lifted: `"OBMC on a 16x8/8x16 inter leaf (blend mismatches the reference on this shape)"`.
73+None added.
74+
75+## Suite
76+
77+ $HOME/.cache/inter4-suite-r4.log
78+
79+See the tail of that log for the totals (systemd user unit, `cargo test -p ec-av1 --lib`).
80+
81+## Film
82+
83+`scratchpad/hg-head.obu` through the release `decode_probe` on this lane still stops at
84+`unsupported: AV1 tile (filter intra on a HORZ/VERT strip (this decoder predicts
85+square-only))` — an intra refusal owned by another lane, unchanged by this round.
86+
87+EVIDENCE: scratchpad/hg-head.obu | release decode_probe under a 6G scope | REFUSED: filter intra on a HORZ/VERT strip
88+
89+## Residue
90+
91+- deferred: r2's 32x16/16x32 rect-residual gate — still `#[ignore]`d — unblocked by
92+ rectangular INTRA prediction (`an intra-coded HORZ/VERT strip ...`) landing, not by
93+ anything in this lane.
94+- accepted: which change fixed r3's OBMC mismatch is not bisected (interbis merge is the
95+ only candidate); the shape is now proven exact against an instrumented aomdec, so the
96+ question is archaeology, not a defect.
97+- accepted: `16x16 SPLITs=0` under this recipe (aomenc picks NONE/HORZ/VERT at 16);
98+ covered by the 8x8-leaf sibling gate.