lane-av1unwritten r5: restore the determinism evidence, correctly attributed
Browse files at this commitd0f3f8add5d7c0ae3a750ba3a82314193bde3fd0Parent: 4561b9e2 changed files +72 -30
- crates/ec-av1/src/decode.rs +14 -4
- lanes/av1unwritten.report.md +58 -26
crates/ec-av1/src/decode.rsmodified+14 -4
| @@ -21373,10 +21373,20 @@ fn plane_sentinel_on() -> bool { | |||
| 21373 | /// 4:2:2 stream can contain the shape and the refusal cannot reject legal | 21373 | /// 4:2:2 stream can contain the shape and the refusal cannot reject legal |
| 21374 | /// content. | 21374 | /// content. |
| 21375 | /// | 21375 | /// |
| 21376 | -/// What led here was this lane's own pre-deblock census | 21376 | +/// What led here was the observation that this decoder's output for such a |
| 21377 | -/// ([`census_unwritten`]), which reported unwritten chroma samples on THIS | 21377 | +/// witness DEPENDS ON UNWRITTEN PLANE CONTENT. Measured on `8d6998d7` by two |
| 21378 | -/// lane's tree at r1. That is a lane-tree measurement with a lane-only | 21378 | +/// independent builds (`EC_AV1_FINAL_DUMP=<dir>/x`, the directory created |
| 21379 | -/// instrument and is cited as such; the refusal stands on (1) and (2). | 21379 | +/// FIRST -- the dump writes nothing if it does not exist): five runs with |
| 21380 | +/// uninitialised planes give TWO different output hashes, five runs with | ||
| 21381 | +/// `EC_AV1_PLANE_SENTINEL=1` give ONE hash, and the sentinel output differs | ||
| 21382 | +/// from the plain one. At 8-bit the sentinel survives in the dump as the single | ||
| 21383 | +/// byte `0xAD`, not the pair `DE AD` -- `PLANE_SENTINEL`'s u16 narrows in | ||
| 21384 | +/// [`crate::stream`]'s u8 write path, so counting a two-byte `0xDEAD` in an | ||
| 21385 | +/// 8-bit dump cannot find it. The lane's own pre-deblock census | ||
| 21386 | +/// ([`census_unwritten`]) then localised the unwritten samples on THIS lane's | ||
| 21387 | +/// tree: 112 per chroma plane on the witness, 224 total. That census number is a | ||
| 21388 | +/// lane-tree measurement with a lane-only instrument and is cited as such; | ||
| 21389 | +/// (1) and (2) are what make the refusal correct. | ||
| 21380 | /// | 21390 | /// |
| 21381 | /// `av1_ss_size_lookup`'s `BLOCK_INVALID` cells, transcribed verbatim: | 21391 | /// `av1_ss_size_lookup`'s `BLOCK_INVALID` cells, transcribed verbatim: |
| 21382 | /// `(common_data.c:17-41`, rows in `BLOCK_SIZES_ALL` order, indexed | 21392 | /// `(common_data.c:17-41`, rows in `BLOCK_SIZES_ALL` order, indexed |
lanes/av1unwritten.report.mdmodified+58 -26
| @@ -5,8 +5,9 @@ | |||
| 5 | chroma plane block at ss (1,0) — libaom calls that `AOM_CODEC_CORRUPT_FRAME` | 5 | chroma plane block at ss (1,0) — libaom calls that `AOM_CODEC_CORRUPT_FRAME` |
| 6 | ("Block size 8x16 invalid with this subsampling mode") and `aomdec` refuses the | 6 | ("Block size 8x16 invalid with this subsampling mode") and `aomdec` refuses the |
| 7 | file outright, and libaom's own encoder never emits such a shape; we walked those | 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 | 8 | +subsizes anyway, and our output for that witness depends on unwritten plane |
| 9 | -sentinel census that led here is kept as the instrument.** | 9 | +content. The fix mirrors libaom's check and returns a named refusal; the sentinel |
| 10 | +census that led here is kept as the instrument.** | ||
| 10 | 11 | ||
| 11 | Branch `lane/av1unwritten`, base `main` = `8d6998d7`. No push. | 12 | Branch `lane/av1unwritten`, base `main` = `8d6998d7`. No push. |
| 12 | 13 | ||
| @@ -109,28 +110,61 @@ exactly one of the four libaom refuses. | |||
| 109 | 110 | ||
| 110 | ## 2. What led here, and what it is worth | 111 | ## 2. What led here, and what it is worth |
| 111 | 112 | ||
| 112 | -The refusal rests on two facts about libaom, both verified first-hand: | 113 | +### 2.1 The observation (on `8d6998d7`, by two independent builds) |
| 113 | 114 | ||
| 114 | -1. **libaom refuses the shape.** `aomdec --rawvideo` on | 115 | +``` |
| 115 | - `440_request_is_422.obu` prints `Failed to decode frame 1: Corrupt frame | 116 | +$ mkdir -p /tmp/wt_aw/same # the dump writes NOTHING if the directory |
| 116 | - detected` / `Block size 8x16 invalid with this subsampling mode` | 117 | + # does not exist -- create it first |
| 117 | - (`decodeframe.c:1449-1458`). | 118 | +$ for i in 1 2 3 4 5; do EC_AV1_FINAL_DUMP=/tmp/wt_aw/same/x \ |
| 119 | + ./target/debug/examples/decode_probe crates/ec-av1/fixtures/440_request_is_422.obu \ | ||
| 120 | + >/dev/null 2>&1; sha256sum /tmp/wt_aw/same/x.f0; done | ||
| 121 | +727ea647b2362b22520de232c2f6a0ce541dbfa90f02495f572af4aa2297116d | ||
| 122 | +ba2957e1709507b8336e53cd908b7dfe2a59dc2064b1f5eb4bea9b3149a4653d | ||
| 123 | +2e245bcc6abb2ef81e80254711fe042cadd3409c622faa46b9ee393dd14ffa96 | ||
| 124 | +``` | ||
| 125 | + | ||
| 126 | +Two distinct output hashes from one file with uninitialised planes; and with | ||
| 127 | +`EC_AV1_PLANE_SENTINEL=1` five runs give ONE hash, which differs from the plain | ||
| 128 | +one (1984 bytes). Reproduced independently on a fresh `8d6998d7` worktree with | ||
| 129 | +its own target dir (Main: `d35d59cce59cfa2b` / `5b38d5079a6578a8` plain, | ||
| 130 | +`3a2ae6dbec390f26` sentinel x5). | ||
| 131 | + | ||
| 132 | +**Provenance note, because it nearly inverted this section.** The first | ||
| 133 | +counter-measurement said main was deterministic; that reading came from a binary | ||
| 134 | +whose embedded source paths pointed at THIS worktree, not at main -- the | ||
| 135 | +stale-binary class. Provenance has to come from the binary's own strings, not | ||
| 136 | +from what `cargo build` last reported. With a path-verified build the | ||
| 137 | +nondeterminism is real, and this is the observation that started the lane. | ||
| 138 | + | ||
| 139 | +**Byte width matters for the census.** `EC_AV1_FINAL_DUMP` writes **u8** for an | ||
| 140 | +8-bit stream, so `PLANE_SENTINEL = 0xDEAD` narrows to the single byte `0xAD`: | ||
| 141 | +65 such bytes in a sentinel dump against a 33 baseline in a plain one. Counting | ||
| 142 | +a two-byte `0xDEAD` in an 8-bit dump cannot find it. | ||
| 143 | + | ||
| 144 | +### 2.2 The census, on this lane's tree | ||
| 145 | + | ||
| 146 | +`census_unwritten` at each frame's pre-deblock point, on the lane tree at r1: | ||
| 147 | +**112 unwritten samples per chroma plane, 224 total**, in whole 4x4 chroma | ||
| 148 | +blocks, each the lower half of a plane block whose luma subsize is one §1 says | ||
| 149 | +is not decodable. That number is a lane-tree measurement with a lane-only | ||
| 150 | +instrument and is cited as such; the fix does not rest on it. | ||
| 151 | + | ||
| 152 | +### 2.3 Why refusing is the right contract | ||
| 153 | + | ||
| 154 | +Neither of these is this lane's pixel measurement: | ||
| 155 | + | ||
| 156 | +1. **libaom refuses the shape.** `aomdec --rawvideo` on the pin prints | ||
| 157 | + `Failed to decode frame 1: Corrupt frame detected` / `Block size 8x16 invalid | ||
| 158 | + with this subsampling mode` (`decodeframe.c:1449-1458`). | ||
| 118 | 2. **libaom's encoder never emits it.** `partition_search.c:3383-3389` gates | 159 | 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 | 160 | `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. | 161 | can contain the shape and the refusal cannot reject legal content. |
| 121 | 162 | ||
| 122 | -Neither of those is this lane's pixel measurement. What led here was the lane's | 163 | +§2.1 explains why anyone looked; §2.3 is why the fix is right. |
| 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). | ||
| 130 | 164 | ||
| 131 | -The instrument is **kept** regardless: it is env-gated, off by default, and it | 165 | +The instrument is **kept**: env-gated, off by default, and the only way to ask |
| 132 | -is the only way to ask "did the tile walk write every sample it was handed" (a | 166 | +"did the tile walk write every sample it was handed" (a wrong-sample diff cannot |
| 133 | -wrong-sample diff cannot tell an unwritten sample from a mis-predicted one). | 167 | +tell an unwritten sample from a mis-predicted one). |
| 134 | 168 | ||
| 135 | ## 3. The fix | 169 | ## 3. The fix |
| 136 | 170 | ||
| @@ -302,14 +336,12 @@ test stream::tests::a_422_header_over_a_420_tile_refuses_the_subsize_libaom_call | |||
| 302 | test result: ok. 1 passed; 0 failed; ... | 336 | test result: ok. 1 passed; 0 failed; ... |
| 303 | ``` | 337 | ``` |
| 304 | 338 | ||
| 305 | -**No pixel property is pinned, because there is none to pin.** The witness no | 339 | +**The pin.** The witness no longer produces output at all — it refuses, which is |
| 306 | -longer produces output at all — it refuses, which is the contract. An earlier | 340 | +the contract libaom has (§2.3). §2.1 records the observation that made the |
| 307 | -version of this report pinned "the output hash must not change run to run" and | 341 | +stream worth looking at (varying output with uninitialised planes, one hash |
| 308 | -justified it with five differing hashes on the lane tree; that measurement is not | 342 | +under the sentinel); it is reported, not gated, because the gate's job is the |
| 309 | -established on `main` (Main re-measured on `8d6998d7` with a | 343 | +contract and the contract is the refusal. The determinism is then a consequence |
| 310 | -provenance-checked probe and did not reproduce it), so the sentence and the | 344 | +of the refusal, not a second assertion. |
| 311 | -assertion are both gone. The gate asserts the refusal and a positive control, | ||
| 312 | -which is what libaom actually does. | ||
| 313 | 345 | ||
| 314 | **Mutation.** Deleting the two `chroma_plane_block_codable` call sites puts the | 346 | **Mutation.** Deleting the two `chroma_plane_block_codable` call sites puts the |
| 315 | witness back to `OK: 1 frames decoded` and the gate's `unwrap_or_else` panics | 347 | witness back to `OK: 1 frames decoded` and the gate's `unwrap_or_else` panics |