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 {
1351 WII_HITS.with(|c| c.get())1351 WII_HITS.with(|c| c.get())
1352 }1352 }
1353 1353
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+
1354 /// Current value of [`OBMC_HITS_8`].1367 /// Current value of [`OBMC_HITS_8`].
1355 pub(crate) fn obmc_hits_8() -> usize {1368 pub(crate) fn obmc_hits_8() -> usize {
1356 OBMC_HITS_8.with(|c| c.get())1369 OBMC_HITS_8.with(|c| c.get())
@@ -12827,18 +12840,17 @@ fn obmc_blend(
12827 5..=8 => 3,12840 5..=8 => 3,
12828 _ => 4,12841 _ => 4,
12829 };12842 };
12830- // lane-inter4 r3: OBMC on a 16-level rect inter leaf mismatches ffmpeg12843+ // lane-inter4 r4: r3 refused OBMC on a 16x8/8x16 leaf (5302 luma pixels
12831- // (192x128 testsrc-style motion, cq 22, `--enable-obmc=1`: 5302 luma12844+ // of one frame wrong). Re-measured on this tree with an `EC_OBMC` rung in
12832- // pixels of frame 5 wrong, max |delta| 84, while the SAME recipe with12845+ // both decoders on that exact stream: the neighbour lists agree entry for
12833- // `--enable-obmc=0` decodes 5 rect-leaf-carrying attempts pixel-exact).12846+ // entry (position, span, mv, ref, size, filter) and all six pre-filter
12834- // The blend geometry here matches libaom `build_obmc_inter_pred_*` for12847+ // frames are byte-identical to the instrumented aomdec's. The refusal is
12835- // these shapes, so the cause is upstream (neighbour walk or mv stack for12848+ // gone; the counter below is what the gate's `--enable-obmc=1` arm reads.
12836- // a 2:1 leaf) and unidentified -- refuse by name rather than ship wrong12849+ // The only decode-path change between r3's measurement and this one is the
12837- // pixels. Deleting this block is the whole lift once it is found.12850+ // lane-interbis merge (`build_motion_field`'s compound slot walk), which
12851+ // moves temporal MV candidates -- not bisected further.
12838 if matches!((write_w, write_h), (16, 8) | (8, 16)) {12852 if matches!((write_w, write_h), (16, 8) | (8, 16)) {
12839- return Err(unsupported(12853+ OBMC_RECT_LEAF_HITS.with(|c| c.set(c.get() + 1));
12840- "OBMC on a 16x8/8x16 inter leaf (blend mismatches the reference on this shape)",
12841- ));
12842 }12854 }
12843 let overlap_above = write_h / 2;12855 let overlap_above = write_h / 2;
12844 let overlap_left = write_w / 2;12856 let overlap_left = write_w / 2;
crates/ec-av1/src/refusal_inventory.rsmodified+0 -1
@@ -65,7 +65,6 @@ const REFUSALS: &[&str] = &[
65 "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)",65 "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)",
66 "a masked compound 64x64 inter block (compound_type is inferred, not coded, at this size)",66 "a masked compound 64x64 inter block (compound_type is inferred, not coded, at this size)",
67 "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)",67 "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)",
69 "an intra mode this decoder does not code (round 2)",68 "an intra mode this decoder does not code (round 2)",
70 "an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder does not code yet",69 "an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder does not code yet",
71 // Lifted for the 16x8/8x16 leaf by lane-fistrip; still live one level70 // 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 {
1945 // masked compound, palette, ...) are other lanes' work;1945 // masked compound, palette, ...) are other lanes' work;
1946 // this gate is about hidden frames, not about them.1946 // this gate is about hidden frames, not about them.
1947 "--enable-warped-motion=0",1947 "--enable-warped-motion=0",
1948- // lane-inter4 r3: OBMC on a 16x8/8x16 leaf is a NAMED1948+ // OBMC stays off HERE (this gate is about hidden frames);
1949- // REFUSAL (see decode.rs `obmc_blend`) -- it mismatches1949+ // the tool's own coverage is the `obmc*` gates and, on a
1950- // the reference on this shape, so the gate spells the1950+ // 16x8/8x16 leaf, the `--enable-obmc=1` arm of
1951- // tool off rather than counting its refusals as passes.1951+ // `..._with_a_16_level_rect_leaf_...` (lane-inter4 r4).
1952 "--enable-obmc=0",1952 "--enable-obmc=0",
1953 "--enable-masked-comp=0",1953 "--enable-masked-comp=0",
1954 "--enable-interintra-comp=0",1954 "--enable-interintra-comp=0",
@@ -4891,7 +4891,15 @@ mod tests {
4891 // shape additionally needs `default_inter_ext_tx_cdf[2][TX_8X8]` (the4891 // shape additionally needs `default_inter_ext_tx_cdf[2][TX_8X8]` (the
4892 // 12-symbol DTT9_IDTX_1DDCT row, only reachable through a rect4892 // 12-symbol DTT9_IDTX_1DDCT row, only reachable through a rect
4893 // transform), which this round did not add. See lanes/inter4-r2.report.md.4893 // 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"]
4895 fn a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact() {4903 fn a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact() {
4896 const NAME: &str =4904 const NAME: &str =
4897 "a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact";4905 "a_real_aomenc_inter_sequence_with_a_coded_rectangular_residual_decodes_pixel_exact";
@@ -5089,7 +5097,14 @@ mod tests {
5089 (0u32, 0u32, 0u32, 0u32);5097 (0u32, 0u32, 0u32, 0u32);
5090 let (mut tu_proved, mut split_proved) = (0usize, 0usize);5098 let (mut tu_proved, mut split_proved) = (0usize, 0usize);
5091 let (mut horz_proved, mut vert_proved, mut sub16_split) = (0u32, 0u32, 0usize);5099 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;
5093 // Two sources (a translating textured ramp, and testsrc2's5108 // Two sources (a translating textured ramp, and testsrc2's
5094 // natural motion) x two quantisers x two tx-size-search arms x5109 // natural motion) x two quantisers x two tx-size-search arms x
5095 // two motion steps.5110 // two motion steps.
@@ -5152,7 +5167,7 @@ mod tests {
5152 "--enable-rect-partitions=1", "--enable-ab-partitions=0",5167 "--enable-rect-partitions=1", "--enable-ab-partitions=0",
5153 "--enable-1to4-partitions=0", "--min-partition-size=8",5168 "--enable-1to4-partitions=0", "--min-partition-size=8",
5154 "--max-partition-size=16",5169 "--max-partition-size=16",
5155- "--enable-obmc=0",5170+ obmc_arg,
5156 "--obu", "-o", "-", "-",5171 "--obu", "-o", "-", "-",
5157 ];5172 ];
5158 let mut child = Command::new(aomenc_path())5173 let mut child = Command::new(aomenc_path())
@@ -5176,6 +5191,7 @@ mod tests {
5176 );5191 );
5177 let stream = out.stdout;5192 let stream = out.stdout;
5178 let before = (decode::rect_inter_tu_hits(), decode::rect_inter_txsplit_hits());5193 let before = (decode::rect_inter_tu_hits(), decode::rect_inter_txsplit_hits());
5194+ let before_obmc_leaf = decode::obmc_rect_leaf_hits();
5179 let before_leaf = (5195 let before_leaf = (
5180 decode::inter_leaf16_horz_hits(),5196 decode::inter_leaf16_horz_hits(),
5181 decode::inter_leaf16_vert_hits(),5197 decode::inter_leaf16_vert_hits(),
@@ -5197,6 +5213,7 @@ mod tests {
5197 };5213 };
5198 let after = (decode::rect_inter_tu_hits(), decode::rect_inter_txsplit_hits());5214 let after = (decode::rect_inter_tu_hits(), decode::rect_inter_txsplit_hits());
5199 let (tu, split) = (after.0 - before.0, after.1 - before.1);5215 let (tu, split) = (after.0 - before.0, after.1 - before.1);
5216+ let obmc_leaf = decode::obmc_rect_leaf_hits() - before_obmc_leaf;
5200 let (horz, vert, splits16) = (5217 let (horz, vert, splits16) = (
5201 decode::inter_leaf16_horz_hits() - before_leaf.0,5218 decode::inter_leaf16_horz_hits() - before_leaf.0,
5202 decode::inter_leaf16_vert_hits() - before_leaf.1,5219 decode::inter_leaf16_vert_hits() - before_leaf.1,
@@ -5253,6 +5270,7 @@ mod tests {
5253 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (attempt {attempt}, {bit_depth}-bit, tx_search={tx_search})");5270 assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (attempt {attempt}, {bit_depth}-bit, tx_search={tx_search})");
5254 }5271 }
5255 tu_proved += tu;5272 tu_proved += tu;
5273+ obmc_leaf_proved += obmc_leaf;
5256 split_proved += split;5274 split_proved += split;
5257 sub16_split += splits16;5275 sub16_split += splits16;
5258 if horz > 0 {5276 if horz > 0 {
@@ -5267,7 +5285,8 @@ mod tests {
5267 "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {matched} pixel-exact \5285 "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {matched} pixel-exact \
5268 attempts carrying a 16-level rect inter leaf, 16x8-carrying={horz_proved}, \5286 attempts carrying a 16-level rect inter leaf, 16x8-carrying={horz_proved}, \
5269 8x16-carrying={vert_proved}, whole-block rect TUs={tu_proved}, rect trees that \5287 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 \
5271 carried none ({oos_mismatch} of them mismatched)"5290 carried none ({oos_mismatch} of them mismatched)"
5272 );5291 );
5273 assert_eq!(5292 assert_eq!(
@@ -5282,6 +5301,11 @@ mod tests {
5282 SPLITs={sub16_split}, {named_refusals} refusals, {out_of_scope} out of \5301 SPLITs={sub16_split}, {named_refusals} refusals, {out_of_scope} out of \
5283 scope) -- gate proved nothing"5302 scope) -- gate proved nothing"
5284 );5303 );
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+ );
5285 tu_total += tu_proved;5309 tu_total += tu_proved;
5286 }5310 }
5287 assert!(5311 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.