Reach::top_right/bottom_left shadowed the block's position row with the table-row index -- the sub8 merge's has_tr_4x4/has_bl_4x4 row lookup rebound `row`, so the bit index (row * table_stride + col) read the wrong bit for EVERY block size
Browse files at this commit5c19acd1701ebc58e0328f8e929b4faa3bd34c93Parent: ff5e206- fix
- Reach::top_right/bottom_left shadowed the block's position row with the table-row index -- the sub8 merge's has_tr_4x4/has_bl_4x4 row lookup rebound `row`, so the bit index (row * table_stride + col) read the wrong bit for EVERY block size
- split_transform_horz_vert seed 55 (3080 luma samples) and the sub8 gate both green again
3 changed files +81 -9
- crates/ec-av1/src/decode.rs +0 -1
- crates/ec-av1/src/encode.rs +14 -8
- lanes/sub8merge-r1.report.md +67 -0
crates/ec-av1/src/decode.rsmodified+0 -1
| @@ -6975,7 +6975,6 @@ fn decode_leaf_split4( | ||
| 6975 | 6975 | // one a neighbour to its RIGHT sees (its top-right 4x4, mi(row, col-1)). |
| 6976 | 6976 | ) -> Result<(usize, usize)> { |
| 6977 | 6977 | SUB8_SPLIT_HITS.with(|c| c.set(c.get() + 1)); |
| 6978 | - if std::env::var_os("EC_ABLATE_SUB8").is_some() { return Err(unsupported("ablate: sub8 split")); } | |
| 6979 | 6978 | let (r, c) = outer_at; |
| 6980 | 6979 | let mut above_mode = neighbours.above_mode[c]; |
| 6981 | 6980 | let mut left_mode = neighbours.left_mode[r]; |
crates/ec-av1/src/encode.rsmodified+14 -8
| @@ -1231,11 +1231,14 @@ impl Reach { | ||
| 1231 | 1231 | // -- a reach over-estimate (extra above-right reference pixels), |
| 1232 | 1232 | // never a stream desync. Ceiling: transcribe `has_tr_vert_4x4` / |
| 1233 | 1233 | // `has_bl_vert_4x4` and extend the VERT tables to four rows. |
| 1234 | - let row = Self::table(side); | |
| 1235 | - let table = if VERT_AB_PARTITION.with(std::cell::Cell::get) && row < HAS_TOP_RIGHT_VERT.len() { | |
| 1236 | - HAS_TOP_RIGHT_VERT[row] | |
| 1234 | + // NB: named `table_row`, not `row` -- `row` above is the block's | |
| 1235 | + // position inside the superblock and is what the bit index below | |
| 1236 | + // steps by (a merge that shadowed it desynced every block size). | |
| 1237 | + let table_row = Self::table(side); | |
| 1238 | + let table = if VERT_AB_PARTITION.with(std::cell::Cell::get) && table_row < HAS_TOP_RIGHT_VERT.len() { | |
| 1239 | + HAS_TOP_RIGHT_VERT[table_row] | |
| 1237 | 1240 | } else { |
| 1238 | - HAS_TOP_RIGHT[row] | |
| 1241 | + HAS_TOP_RIGHT[table_row] | |
| 1239 | 1242 | }; |
| 1240 | 1243 | Self::bit( |
| 1241 | 1244 | table, |
| @@ -1263,11 +1266,14 @@ impl Reach { | ||
| 1263 | 1266 | // -- a reach over-estimate (extra above-right reference pixels), |
| 1264 | 1267 | // never a stream desync. Ceiling: transcribe `has_tr_vert_4x4` / |
| 1265 | 1268 | // `has_bl_vert_4x4` and extend the VERT tables to four rows. |
| 1266 | - let row = Self::table(side); | |
| 1267 | - let table = if VERT_AB_PARTITION.with(std::cell::Cell::get) && row < HAS_BOTTOM_LEFT_VERT.len() { | |
| 1268 | - HAS_BOTTOM_LEFT_VERT[row] | |
| 1269 | + // NB: named `table_row`, not `row` -- `row` above is the block's | |
| 1270 | + // position inside the superblock and is what the bit index below | |
| 1271 | + // steps by (a merge that shadowed it desynced every block size). | |
| 1272 | + let table_row = Self::table(side); | |
| 1273 | + let table = if VERT_AB_PARTITION.with(std::cell::Cell::get) && table_row < HAS_BOTTOM_LEFT_VERT.len() { | |
| 1274 | + HAS_BOTTOM_LEFT_VERT[table_row] | |
| 1269 | 1275 | } else { |
| 1270 | - HAS_BOTTOM_LEFT[row] | |
| 1276 | + HAS_BOTTOM_LEFT[table_row] | |
| 1271 | 1277 | }; |
| 1272 | 1278 | Self::bit( |
| 1273 | 1279 | table, |
lanes/sub8merge-r1.report.mdadded+67 -0
| @@ -0,0 +1,67 @@ | ||
| 1 | +# lane-sub8merge report (round 1) -- merge cross-product defect closed | |
| 2 | + | |
| 3 | +## Root cause (one line, one variable) | |
| 4 | + | |
| 5 | +The merge resolution of `Reach::top_right` / `Reach::bottom_left` | |
| 6 | +(`crates/ec-av1/src/encode.rs:1237,1272`) introduced | |
| 7 | + | |
| 8 | +```rust | |
| 9 | +let row = Self::table(side); // 0..=3, the TABLE row | |
| 10 | +``` | |
| 11 | + | |
| 12 | +which SHADOWS the block's position row bound eight lines above | |
| 13 | +(`let (row, col, per_side) = Self::position(side, x, y);`) and is then used by | |
| 14 | +the bit index `(row * Self::table_stride(side) + col)`. Main computed the table | |
| 15 | +index inline (`HAS_TOP_RIGHT[Self::table(side)]`) and kept `row` = position. | |
| 16 | +So on the merged tree EVERY block size read `has_top_right`/`has_bottom_left` | |
| 17 | +at the wrong bit: the reach (above-right / below-left reference availability) | |
| 18 | +was wrong for ordinary square blocks, not just sub-8x8 -- which is exactly why | |
| 19 | +each side was green alone and the merged tree failed a gate whose stream | |
| 20 | +contains zero sub8 splits and zero split-tx strips (seed 55 printed | |
| 21 | +"split-tx strips this stream: 0"). | |
| 22 | + | |
| 23 | +Fix: rename to `table_row` in both functions, restoring `row` as the position | |
| 24 | +row, plus a NB comment naming the shadowing hazard. | |
| 25 | +`crates/ec-av1/src/encode.rs:1234-1241,1269-1276`. | |
| 26 | + | |
| 27 | +Class: `adjacent same-typed args` / shadowing sibling -- a merge that renames a | |
| 28 | +value into an identifier already live in scope. Sweep: `grep -n "let row = \|let col = " crates/ec-av1/src/encode.rs` | |
| 29 | +returns nothing else; the only two `Self::position*` consumers are these two. | |
| 30 | + | |
| 31 | +Also removed the previous agent's leftover ablation hook | |
| 32 | +`EC_ABLATE_SUB8` in `decode_leaf_split4` (`crates/ec-av1/src/decode.rs:6978`). | |
| 33 | + | |
| 34 | +The charter's untested suspects (the six `smooth_neighbor_uv` sites, the | |
| 35 | +per-tile mi-map resets, `Neighbours::new`, `record_split_luma_rect`) are all | |
| 36 | +INNOCENT: they are unchanged by this round and both gates are green. | |
| 37 | + | |
| 38 | +## Gates | |
| 39 | + | |
| 40 | +EVIDENCE: $HOME/.cache/sub8merge-suite.log | `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib split_transform_horz_vert` on the merged tree before and after the rename | before: FAILED, seed 55 first luma mismatch (191,76) ours=127 ffmpeg=128, 3080 samples, bbox x94..191 y76..127; after: ok, 1 passed (8.55 s) | |
| 41 | +EVIDENCE: same log | `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib sub8` after the rename | ok, 1 passed (5.10 s, 3 tile arms x 4 firing+pixel-exact runs) | |
| 42 | +EVIDENCE: $HOME/.cache/sub8merge-suite.log | full `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib` (1228 s) | 298 passed, 1 failed, 27 ignored -- every sibling gate named in the charter (sub8, tiny_frame_size_sweep, tx_select, an_8x8_leaf_split, split_transform_horz_vert, filter_intra_on_a_horz, superblock_level_*, refusal_inventory, gate_coverage) green | |
| 43 | + | |
| 44 | +## The one failure is INHERITED FROM MAIN, not this lane | |
| 45 | + | |
| 46 | +`decode::tests::nz_map_ctx_offset_tables_match_the_rect_rule` fails: | |
| 47 | +`32x64 nz_map offset at display (row 0, col 2): left 6, right 11` | |
| 48 | +(decode.rs:16837). `cdf.rs` is byte-identical between the merge base 61c6a5b, | |
| 49 | +this branch, and current main df5d630, and the test body is identical on | |
| 50 | +df5d630 (`git show df5d630:crates/ec-av1/src/decode.rs`, lines 16299-16321) -- | |
| 51 | +so main itself is red on this test. `NZ_MAP_CTX_OFFSET_32X64` row 2 is | |
| 52 | +`[6, 6, 21, 21, 21]`, i.e. under the column-major read the table gives 6 where | |
| 53 | +the rule (w<h, display row<2) wants 11 for display rows 0/1 at columns 2/3. | |
| 54 | +Either the lane-rectsplit table or its rule test is wrong. | |
| 55 | +Disposition: **deferred(the rectsplit owner)** -- changing the table changes | |
| 56 | +real coefficient contexts and needs its own aomenc gate run; out of this merge | |
| 57 | +lane's scope and demonstrably not caused by it. | |
| 58 | + | |
| 59 | +## Suite | |
| 60 | +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib`: 298 passed, 1 failed | |
| 61 | +(inherited, above), 27 ignored, 1228 s. Log: `$HOME/.cache/sub8merge-suite.log`. | |
| 62 | + | |
| 63 | +## Refusals | |
| 64 | +None lifted or added this round; the merge's own bookkeeping (refusal string | |
| 65 | +narrowed to "a sub-8x8 leaf that uses intrabc" + inventory entry, gate_coverage | |
| 66 | +8-bit list dropping enable-1to4-partitions) came in with ea90092 and both | |
| 67 | +`refusal_inventory` and `gate_coverage` tests are green. |