forge
Explore
Log in

Don't you dare go Hollow

Merge lane-part32 r6: intra 16-level PARTITION_VERT_B takes the vert has_tr/has_bl tables (last unguarded VERT_A/B site); table pin test; class closed at every level (270/0/24 on branch)

Browse files at this commit

9f289601afeba726e27cb86b405640cc6426e17bAhmet Kaan GümüşParent: bde15d81f9bde4
crates/ec-av1/src/decode.rsmodified+12 -0
@@ -7927,6 +7927,18 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
79277927 }
79287928 if part16 == PARTITION_VERT_B {
79297929 VERT_B_INTRA_HITS.with(|c| c.set(c.get() + 1));
7930+ // lane-part32 r6: same availability
7931+ // defect r5 fixed one level up --
7932+ // the TR/BR 8x8 squares below are
7933+ // visited out of raster order, so
7934+ // they need libaom's
7935+ // `has_tr_vert_*`/`has_bl_vert_*`
7936+ // tables (the left 8x16 rect goes
7937+ // through `Reach::of_rect`, which
7938+ // the guard deliberately does not
7939+ // affect).
7940+ let _vert_ab =
7941+ crate::encode::Reach::vert_ab_partition();
79307942 // Left rect: 8x16, real
79317943 // `decode_block_rect`, sat at the
79327944 // 16x16 parent's own origin (no
crates/ec-av1/src/encode.rsmodified+39 -0
@@ -3564,6 +3564,45 @@ mod tests {
35643564 }
35653565 }
35663566
3567+ /// lane-part32 r6: inside a `PARTITION_VERT_A`/`_B` the 8x8 squares are
3568+ /// visited TL, BL, TR, BR, so the TR square (even 8x8 row, odd 8x8
3569+ /// column inside the superblock) may read the below-left samples the
3570+ /// raster table forbids: `has_bl_8x8` is 0 at exactly those 16 slots
3571+ /// where `has_bl_vert_8x8` is 1. Pinned here because no aomenc recipe
3572+ /// swept in r6 produced a decodable 16x16-level VERT_B stream (every
3573+ /// stream that partitions that small first hits the still-refused
3574+ /// HORZ_A/HORZ_B/VERT_A-below-16 or coded-rect-strip-below-16 arms).
3575+ #[test]
3576+ fn vert_ab_partition_flips_below_left_for_the_top_right_8x8() {
3577+ let (width, height) = (SUPERBLOCK * 3, SUPERBLOCK * 3);
3578+ // Interior superblock, so neither the frame edge nor the col == 0 /
3579+ // last-row early returns answer instead of the table.
3580+ let (sb_x, sb_y) = (SUPERBLOCK, SUPERBLOCK);
3581+ let mut flipped = 0;
3582+ for row in 0..8 {
3583+ for col in 1..8 {
3584+ let (x, y) = (sb_x + col * 8, sb_y + row * 8);
3585+ let raster = Reach::of(8, x, y, width, height).below_left;
3586+ let vert = {
3587+ let _guard = Reach::vert_ab_partition();
3588+ Reach::of(8, x, y, width, height).below_left
3589+ };
3590+ // The TR square of a VERT_A/_B sits at an even row, odd
3591+ // column; every other slot must be untouched by the guard.
3592+ if row % 2 == 0 && col % 2 == 1 {
3593+ assert!(!raster, "raster below_left at row={row} col={col}");
3594+ assert!(vert, "vert below_left at row={row} col={col}");
3595+ flipped += 1;
3596+ } else {
3597+ assert_eq!(raster, vert, "guard moved row={row} col={col}");
3598+ }
3599+ }
3600+ }
3601+ assert_eq!(flipped, 4 * 4, "expected the 16 8x8 TR slots to flip");
3602+ // The guard is scoped: it must not leak past its own block.
3603+ assert!(!Reach::of(8, sb_x + 8, sb_y, width, height).below_left);
3604+ }
3605+
35673606 /// An odd width or height is refused by name, not by however the padder
35683607 /// or the block coder would happen to fail on it.
35693608 #[test]
lanes/part32-r6.report.mdadded+89 -0
@@ -0,0 +1,89 @@
1+# lane-part32 r6 — the 16x16-level VERT_B arm was the one AB site r5 missed
2+
3+Branch `lane-part32`, on top of r5 `02dbbd6`.
4+
5+## Class sweep: every VERT_A/VERT_B site in decode.rs
6+
7+`grep -n "PARTITION_VERT_A\|PARTITION_VERT_B" crates/ec-av1/src/decode.rs`, all
8+levels, intra and inter:
9+
10+| site | level | path | guard at r5 |
11+|---|---|---|---|
12+| `decode.rs:7008` | 16 | intra VERT_B (8x16 rect + TR/BR 8x8 `decode_leaf8`) | **MISSING — fixed this round** |
13+| `decode.rs:7538/7612` | 32 | intra VERT_A / VERT_B | present (r5) |
14+| `decode.rs:7779` | 64 (SB) | AB arm, vert arms only | present (r5) |
15+| `decode.rs:13445/13606` | 32 | inter VERT_A / VERT_B | present (r5) |
16+
17+No other site exists: the 16-level inter path has no AB arms (they are refused by
18+name, "a HORZ_A/HORZ_B/VERT_A partition below 16x16"), and 8-level partitions
19+below that are SPLIT-only. So one missed site, now guarded — the class is closed
20+for VERT_A/_B.
21+
22+The verifier's computation is confirmed exactly (checked bit by bit against the
23+transcribed tables in `encode.rs`): `has_bl_8x8` reads **0** where
24+`has_bl_vert_8x8` reads **1** at all 16 even-8x8-row / odd-8x8-column slots of a
25+superblock — that slot is precisely the TR square of a VERT_A/_B — so the TR
26+square's `below_left` was wrongly false for the bottom-left-reading directional
27+modes (angle > 180: `D203_PRED`, `D157_PRED` with a positive angle delta).
28+Mirror-image for `has_tr_8x8` vs `has_tr_vert_8x8` (1 -> 0) at odd-row /
29+even-column slots, which VERT_A/_B never visit at 8x8 (no BL square in either).
30+
31+## Files changed
32+
33+- `crates/ec-av1/src/decode.rs:7010` — the intra 16-level `PARTITION_VERT_B` arm
34+ takes `crate::encode::Reach::vert_ab_partition()` for the whole arm; the left
35+ 8x16 rect is unaffected by design (`Reach::of_rect`, libaom's own comment says
36+ vertical rectangles keep the non-vert table), the two `decode_leaf8` squares
37+ now read the vert tables.
38+- `crates/ec-av1/src/encode.rs:3565` — `vert_ab_partition_flips_below_left_for_the_top_right_8x8`,
39+ a table pin next to the existing libaom-availability test: all 16 TR slots flip
40+ `below_left` false -> true under the guard, every other slot is untouched, and
41+ the guard does not leak past its scope.
42+
43+## Gate: attempted, could not be built — the fix stays source-verified
44+
45+The charter's stream gate (a real-aomenc 16-level VERT_B, directional modes on,
46+decoded and compared pixel-exact) was written and run, and it cannot fire on this
47+aomenc build. Bounded sweep, all with
48+`--min-partition-size=8 --max-partition-size=16 --enable-rect-partitions=1
49+--enable-1to4-partitions=0 --enable-directional-intra=1 --enable-angle-delta=1
50+--cpu-used=0 --kf-max-dist=0 --passes=1`, 64x64 grey mandelbrot key frames:
51+
52+| recipe | attempts | decoded | refusals |
53+|---|---|---|---|
54+| cq=45, `--enable-ab-partitions=1` | 40 | 0 | 40 (below-16 HORZ_A/HORZ_B/VERT_A, or a coded non-skip rect strip below 16) |
55+| cq=45, ab={0,1} | 10 + 10 | 0 | 8 AB-below-16 + 2 coded-rect-strip, each |
56+| cq=63, ab={0,1} | 40 + 10 | all | none — but `partition_w16` never resolves to VERT_B (value=7): the frame stays at 16x16 NONE |
57+| cq={55,57,60}, mandelbrot / testsrc2 / cellauto | 12 | 3 | same two below-16 refusals |
58+
59+`EC_AV1_TRACE=1` `partition_w16` value histogram over every decoded stream: 0
60+occurrences of value=7 at any quality that decodes. Every stream that partitions
61+small enough to *reach* a 16-level VERT_B hits one of the two still-refused
62+below-16 capabilities first (HORZ_A/HORZ_B/VERT_A-below-16, coded rect strip
63+below-16), which abort the tile before the VERT_B arm. Writing a gate that
64+decodes only cq=63 streams would have been vacuous
65+(`gate-blind-to-feature`), so the sweep gate was **removed** rather than
66+committed green, and the pin above carries the fix instead.
67+
68+EVIDENCE: /tmp/.../scratchpad (r6 sweep, shell loop above) | 40+40+20+12 real aomenc encodes, `EC_AV1_TRACE=1 decode_probe` on each | 0 streams with `partition_w16 value=7`; at cq=45 40/40 refused with the two named below-16 refusals, at cq=63 50/50 decoded with 0 VERT_B
69+
70+EVIDENCE: `cargo test -p ec-av1 --lib -- vert_ab_partition_flips` | table pin of the guard at all 64 8x8 slots of an interior superblock | `test result: ok. 1 passed`; 16 TR slots flip false->true, 48 unchanged
71+
72+EVIDENCE: /tmp/.../scratchpad/r6full.txt | `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib` | `test result: ok. 270 passed; 0 failed; 24 ignored; 0 measured` in 1585s (269 before this round's new pin)
73+
74+## Refusals
75+
76+None lifted or added this round (the two below-16 refusals above are other
77+lanes'). `refusal_inventory` and `gate_coverage` unchanged and green in the run
78+above.
79+
80+## Residue
81+
82+- deferred(a lane that ports HORZ_A/HORZ_B/VERT_A below 16x16, or the coded
83+ non-skip rect strip below 16x16): the pixel-exact stream gate for the 16-level
84+ VERT_B arm. Both refusals fire before the arm on every recipe swept; once
85+ either lands, re-run the sweep in this report and the gate becomes writable
86+ as-is.
87+- accepted: the fix is source-verified + table-pinned, not stream-proven. It is a
88+ one-bit availability change of exactly the shape r5 proved by pixel comparison
89+ one level up (4683 wrong luma samples there).