lane-av1unwritten r5: stop asserting the nondeterminism as measured fact
Browse files at this commit4561b9eb16076b5d786df7032eae03fc48d25c51Parent: 22c01112 changed files +54 -62
- crates/ec-av1/src/decode.rs +23 -15
- lanes/av1unwritten.report.md +31 -47
crates/ec-av1/src/decode.rsmodified+23 -15
| @@ -21354,22 +21354,30 @@ fn plane_sentinel_on() -> bool { | ||
| 21354 | 21354 | /// aom_internal_error(xd->error_info, AOM_CODEC_CORRUPT_FRAME, |
| 21355 | 21355 | /// "Block size %dx%d invalid with this subsampling mode", ...); |
| 21356 | 21356 | /// ``` |
| 21357 | -/// (`decodeframe.c:1449-1458`). Only the four cells that are ever BLOCK_INVALID | |
| 21358 | -/// are listed, from that table's rows: | |
| 21359 | -/// BLOCK_4X8 `{BLOCK_4X8, BLOCK_4X4 | BLOCK_INVALID, BLOCK_4X4}`, | |
| 21360 | -/// BLOCK_8X4 `{BLOCK_8X4, BLOCK_INVALID | BLOCK_4X4, BLOCK_4X4}`, | |
| 21361 | -/// BLOCK_8X16 `{BLOCK_8X16, BLOCK_8X8 | BLOCK_INVALID, BLOCK_4X8}`, | |
| 21362 | -/// BLOCK_16X4 `{BLOCK_16X4, BLOCK_INVALID | BLOCK_8X8, BLOCK_4X4}`. | |
| 21357 | +/// (`decodeframe.c:1449-1458`). | |
| 21358 | +/// | |
| 21359 | +/// So at 4:2:2 a 4x8, 8x16, 16x32, 32x64, 64x128, 4x16, 8x32 or 16x64 | |
| 21360 | +/// subsize is NOT DECODABLE: libaom rejects the frame outright and never | |
| 21361 | +/// reaches a transform size for it. This decoder walked those subsizes anyway, | |
| 21362 | +/// covering a chroma plane block whose shape did not match the luma one. | |
| 21363 | +/// | |
| 21364 | +/// Two independent facts justify refusing rather than decoding, and NEITHER is | |
| 21365 | +/// this lane's pixel measurement: | |
| 21366 | +/// | |
| 21367 | +/// 1. libaom REFUSES the shape. `aomdec` on the pinned | |
| 21368 | +/// `440_request_is_422.obu` (a 4:2:2 sequence header over a 4:2:0 key | |
| 21369 | +/// frame's tile) prints `Failed to decode frame 1: Corrupt frame detected` | |
| 21370 | +/// and `Block size 8x16 invalid with this subsampling mode`. | |
| 21371 | +/// 2. libaom's own ENCODER never emits it: `partition_search.c:3383-3389` | |
| 21372 | +/// gates `partition_rect_allowed` on this same table, so no conformant | |
| 21373 | +/// 4:2:2 stream can contain the shape and the refusal cannot reject legal | |
| 21374 | +/// content. | |
| 21375 | +/// | |
| 21376 | +/// What led here was this lane's own pre-deblock census | |
| 21377 | +/// ([`census_unwritten`]), which reported unwritten chroma samples on THIS | |
| 21378 | +/// lane's tree at r1. That is a lane-tree measurement with a lane-only | |
| 21379 | +/// instrument and is cited as such; the refusal stands on (1) and (2). | |
| 21363 | 21380 | /// |
| 21364 | -/// So at 4:2:2 a 4x8, 8x16 or 16x4 subsize is NOT DECODABLE: libaom rejects | |
| 21365 | -/// the frame outright and never reaches a transform size for it. This decoder | |
| 21366 | -/// walked those subsizes anyway, and the chroma plane block it then covered was | |
| 21367 | -/// a different shape than the luma one -- on the pinned | |
| 21368 | -/// `440_request_is_422.obu` (a 4:2:2 sequence header over a 4:2:0 key frame's | |
| 21369 | -/// tile) that left whole 4x4 chroma blocks unwritten and the output hash | |
| 21370 | -/// CHANGED RUN TO RUN. `aomdec` on the same file: | |
| 21371 | -/// `Failed to decode frame 1: Corrupt frame detected` / `Block size 8x16 | |
| 21372 | -/// invalid with this subsampling mode`. | |
| 21373 | 21381 | /// `av1_ss_size_lookup`'s `BLOCK_INVALID` cells, transcribed verbatim: |
| 21374 | 21382 | /// `(common_data.c:17-41`, rows in `BLOCK_SIZES_ALL` order, indexed |
| 21375 | 21383 | /// `[subsampling_x][subsampling_y])`. Every entry below is an (luma width, |
lanes/av1unwritten.report.mdmodified+31 -47
| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | 4:2:0 tile, so its partition symbols name subsizes (8x16 among them) with NO |
| 5 | 5 | chroma plane block at ss (1,0) — libaom calls that `AOM_CODEC_CORRUPT_FRAME` |
| 6 | 6 | ("Block size 8x16 invalid with this subsampling mode") and `aomdec` refuses the |
| 7 | -file outright; we walked those subsizes, and the nondeterministic output was the | |
| 8 | -symptom. The fix mirrors libaom's own check and returns a named refusal; the | |
| 9 | -sentinel census that found the class is kept as the instrument.** | |
| 7 | +file outright, and libaom's own encoder never emits such a shape; we walked those | |
| 8 | +subsizes anyway. The fix mirrors libaom's check and returns a named refusal; the | |
| 9 | +sentinel census that led here is kept as the instrument.** | |
| 10 | 10 | |
| 11 | 11 | Branch `lane/av1unwritten`, base `main` = `8d6998d7`. No push. |
| 12 | 12 | |
| @@ -107,49 +107,30 @@ exactly one of the four libaom refuses. | ||
| 107 | 107 | |
| 108 | 108 | --- |
| 109 | 109 | |
| 110 | -## 2. What the symptom looked like, and how the census found it | |
| 110 | +## 2. What led here, and what it is worth | |
| 111 | 111 | |
| 112 | -`440_request_is_422.obu` is what `examples/gen_coverage_cells.rs` produces when | |
| 113 | -the writer is handed `subsampling (0, 1)` at profile 2: the header lands on 4:2:2 | |
| 114 | -and the frame OBU behind it is a real 4:2:0 key frame's, byte for byte. The | |
| 115 | -header/tile chroma mismatch is exactly what produces a subsize whose plane block | |
| 116 | -does not exist. | |
| 112 | +The refusal rests on two facts about libaom, both verified first-hand: | |
| 117 | 113 | |
| 118 | -``` | |
| 119 | -$ for i in 1 2 3 4 5; do EC_AV1_FINAL_DUMP=/tmp/wt_aw/u$i \ | |
| 120 | - ./target/debug/examples/decode_probe crates/ec-av1/fixtures/440_request_is_422.obu \ | |
| 121 | - >/dev/null 2>&1; sha256sum /tmp/wt_aw/u$i.f0; done | |
| 122 | -de5051156b7cfd00dc7ed5f2c6ad404e2a49822a8a728bc027a938aac00219f1 /tmp/wt_aw/u1.f0 | |
| 123 | -eb0e513ff07d9780b03e70861d1a7f507f540e4724f62384511a71e06c386aa9 /tmp/wt_aw/u2.f0 | |
| 124 | -2985b82874579807efb8bc88136d1b8f5f1f0121410cde26723d5be7e6ba8715 /tmp/wt_aw/u3.f0 | |
| 125 | -204645ad20d7e557d7b04f0027d9aafd5790fe685dc39bdf7cfb117d9dd1f0fc /tmp/wt_aw/u4.f0 | |
| 126 | -80908a1712c4fe78070a6a3ad57464e8bd6a9d0b8d73e86e8f9cf7ea7cbd3496 /tmp/wt_aw/u5.f0 | |
| 127 | -``` | |
| 128 | - | |
| 129 | -Five hashes from one file, with every census count identical — the difference was | |
| 130 | -purely the samples the walk never wrote. | |
| 114 | +1. **libaom refuses the shape.** `aomdec --rawvideo` on | |
| 115 | + `440_request_is_422.obu` prints `Failed to decode frame 1: Corrupt frame | |
| 116 | + detected` / `Block size 8x16 invalid with this subsampling mode` | |
| 117 | + (`decodeframe.c:1449-1458`). | |
| 118 | +2. **libaom's encoder never emits it.** `partition_search.c:3383-3389` gates | |
| 119 | + `partition_rect_allowed` on this same table, so no conformant 4:2:2 stream | |
| 120 | + can contain the shape and the refusal cannot reject legal content. | |
| 131 | 121 | |
| 132 | -`EC_AV1_PLANE_SENTINEL=1` (the census has no separate flag) plus the new | |
| 133 | -`EC_AV1_SENTINEL_CENSUS` printout — the shipped form of the four-line temporary | |
| 134 | -scan `lanes/av1422seed.report.md` §3 used and explicitly did not commit — gave an | |
| 135 | -exact census at each frame's pre-deblock point: | |
| 122 | +Neither of those is this lane's pixel measurement. What led here was the lane's | |
| 123 | +own pre-deblock census (`census_unwritten`, §5), which on THIS LANE'S TREE at | |
| 124 | +r1 reported 112 unwritten chroma samples per plane (224 total) on the witness — | |
| 125 | +a lane-tree measurement made with a lane-only instrument, cited as such and not | |
| 126 | +as a property of `main`. An earlier version of this report asserted more | |
| 127 | +strongly that the witness's output hash "changed run to run"; that sentence has | |
| 128 | +been removed as not established on `main` (Main re-measured on `main` | |
| 129 | +`8d6998d7` with a provenance-checked probe and did not reproduce it). | |
| 136 | 130 | |
| 137 | -``` | |
| 138 | -SENTINEL_CENSUS idx=0 plane=Y extent=64x64 unwritten=0 | |
| 139 | -SENTINEL_CENSUS idx=0 plane=U extent=32x64 unwritten=112 spans=24: (six 4x4 blocks) | |
| 140 | -SENTINEL_CENSUS idx=0 plane=V extent=32x64 unwritten=112 spans=24: (identical) | |
| 141 | -``` | |
| 142 | - | |
| 143 | -Whole 4x4 chroma blocks, and each was the lower half of the plane block of one of | |
| 144 | -the subsizes §1 says are not decodable. That is the whole chain: the walk | |
| 145 | -accepted a subsize libaom refuses, and the chroma plane block it then covered | |
| 146 | -was shaped differently from the luma one. | |
| 147 | - | |
| 148 | -The instrument is **kept**: it is env-gated, off by default, and it is the only | |
| 149 | -way to ask "did the tile walk write every sample it was handed" (a wrong-sample | |
| 150 | -diff cannot tell an unwritten sample from a mis-predicted one). | |
| 151 | - | |
| 152 | ---- | |
| 131 | +The instrument is **kept** regardless: it is env-gated, off by default, and it | |
| 132 | +is the only way to ask "did the tile walk write every sample it was handed" (a | |
| 133 | +wrong-sample diff cannot tell an unwritten sample from a mis-predicted one). | |
| 153 | 134 | |
| 154 | 135 | ## 3. The fix |
| 155 | 136 | |
| @@ -321,11 +302,14 @@ test stream::tests::a_422_header_over_a_420_tile_refuses_the_subsize_libaom_call | ||
| 321 | 302 | test result: ok. 1 passed; 0 failed; ... |
| 322 | 303 | ``` |
| 323 | 304 | |
| 324 | -**Determinism, now a consequence rather than the pinned property.** The witness | |
| 325 | -no longer produces output at all, so there is no hash to vary. Before the fix, | |
| 326 | -`for i in 1..5` gave five hashes (top of §2); after, the file refuses. The | |
| 327 | -nondeterminism was never a property of the pin worth pinning — it was the shape | |
| 328 | -of a stream we should not have decoded at all. | |
| 305 | +**No pixel property is pinned, because there is none to pin.** The witness no | |
| 306 | +longer produces output at all — it refuses, which is the contract. An earlier | |
| 307 | +version of this report pinned "the output hash must not change run to run" and | |
| 308 | +justified it with five differing hashes on the lane tree; that measurement is not | |
| 309 | +established on `main` (Main re-measured on `8d6998d7` with a | |
| 310 | +provenance-checked probe and did not reproduce it), so the sentence and the | |
| 311 | +assertion are both gone. The gate asserts the refusal and a positive control, | |
| 312 | +which is what libaom actually does. | |
| 329 | 313 | |
| 330 | 314 | **Mutation.** Deleting the two `chroma_plane_block_codable` call sites puts the |
| 331 | 315 | witness back to `OK: 1 frames decoded` and the gate's `unwrap_or_else` panics |