The 1:4 gates fail an out-of-scope pixel mismatch
Browse files at this commita57d66d28e6a719ec708cb9692fcc9117887d94dParent: e4a75c6- test
- the 1:4 gates fail an out-of-scope pixel mismatch
- restore decode_stream's docs
2 changed files +81 -10
- crates/ec-av1/src/stream.rs +24 -10
- lanes/tx64x16-r5.report.md +57 -0
crates/ec-av1/src/stream.rsmodified+24 -10
| @@ -54,6 +54,16 @@ fn final_dump_prefix() -> Option<String> { | ||
| 54 | 54 | .or_else(|| std::env::var("EC_AV1_FINAL_DUMP").ok()) |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | +/// 32x32-level 1:4 strip counters, for `decode_probe`'s fixture search: | |
| 58 | +/// (HORZ_4 strips, VERT_4 strips, strips that read coefficients). | |
| 59 | +pub fn rect4_32_counters() -> (usize, usize, usize) { | |
| 60 | + ( | |
| 61 | + crate::decode::rect4_32_horz_hits(), | |
| 62 | + crate::decode::rect4_32_vert_hits(), | |
| 63 | + crate::decode::rect4_coeff_hits(), | |
| 64 | + ) | |
| 65 | +} | |
| 66 | + | |
| 57 | 67 | /// Decode every frame in a raw AV1 OBU stream, in coding order. |
| 58 | 68 | /// |
| 59 | 69 | /// A key frame becomes the reference for the inter frames that follow it, |
| @@ -69,16 +79,6 @@ fn final_dump_prefix() -> Option<String> { | ||
| 69 | 79 | /// [`Av1Parser`] reports it), when a frame header names anything this |
| 70 | 80 | /// crate's tile decoders do not reconstruct (see their own docs), or when an |
| 71 | 81 | /// inter frame appears before any key frame has supplied a reference. |
| 72 | -/// 32x32-level 1:4 strip counters, for `decode_probe`'s fixture search: | |
| 73 | -/// (HORZ_4 strips, VERT_4 strips, strips that read coefficients). | |
| 74 | -pub fn rect4_32_counters() -> (usize, usize, usize) { | |
| 75 | - ( | |
| 76 | - crate::decode::rect4_32_horz_hits(), | |
| 77 | - crate::decode::rect4_32_vert_hits(), | |
| 78 | - crate::decode::rect4_coeff_hits(), | |
| 79 | - ) | |
| 80 | -} | |
| 81 | - | |
| 82 | 82 | pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { |
| 83 | 83 | let final_dump = final_dump_prefix(); |
| 84 | 84 | let mut parser = Av1Parser::new(); |
| @@ -13141,6 +13141,15 @@ mod tests { | ||
| 13141 | 13141 | {out_of_scope} attempts carried no 1:4 block ({out_of_scope_mismatch} of them \ |
| 13142 | 13142 | mismatched -- other lanes' shapes)" |
| 13143 | 13143 | ); |
| 13144 | + // Class gate-skips-on-its-own-failure: an attempt that decoded but | |
| 13145 | + // does not carry this gate's shape is still a decode this crate got | |
| 13146 | + // wrong. Counted separately so the message names the other shape, | |
| 13147 | + // never tolerated. | |
| 13148 | + assert_eq!( | |
| 13149 | + out_of_scope_mismatch, 0, | |
| 13150 | + "{NAME}: {out_of_scope_mismatch} attempt(s) with no 1:4 block decoded but \ | |
| 13151 | + mismatched ffmpeg -- a defect of another shape, not a pass" | |
| 13152 | + ); | |
| 13144 | 13153 | } |
| 13145 | 13154 | |
| 13146 | 13155 | /// lane-tx64x16 r3: the 32x32-LEVEL 1:4 pair -- `PARTITION_HORZ_4` / |
| @@ -13369,6 +13378,11 @@ mod tests { | ||
| 13369 | 13378 | strips={vert_proved}, coded strips={coeff_proved}, {out_of_scope} attempts \ |
| 13370 | 13379 | carried no 32-level 1:4 block ({out_of_scope_mismatch} mismatched)" |
| 13371 | 13380 | ); |
| 13381 | + assert_eq!( | |
| 13382 | + out_of_scope_mismatch, 0, | |
| 13383 | + "{NAME}: {bit_depth}-bit: {out_of_scope_mismatch} attempt(s) with zero 32-level \ | |
| 13384 | + 1:4 blocks decoded but mismatched ffmpeg -- a defect of another shape, not a pass" | |
| 13385 | + ); | |
| 13372 | 13386 | } |
| 13373 | 13387 | } |
| 13374 | 13388 | } |
lanes/tx64x16-r5.report.mdadded+57 -0
| @@ -0,0 +1,57 @@ | ||
| 1 | +# lane-tx64x16 r5 — the seed-47 "desync" is not a desync | |
| 2 | + | |
| 3 | +## 1. Seed 47 refusal: genuine, pre-existing on main, and the flag that was | |
| 4 | +## supposed to prevent it is inert | |
| 5 | + | |
| 6 | +Pinned stream: regenerated from the gate recipe (8-bit, seed 47 = attempt 5: | |
| 7 | +axis X, step 91, noise 9, cq 32), `sha256 51c0a8c16b2c339cbf042cd60bcf835075ff1dca4ce37362ee5fb63a23b5ffb5` | |
| 8 | +— identical to the sha in the r4 verifier report, so the fixture is reproducible. | |
| 9 | + | |
| 10 | +Range ladder, ours (`EC_AV1_TRACE=1 decode_probe`) vs instrumented aomdec (`EC_TRACE=1`), | |
| 11 | +from the first block of the first tile: | |
| 12 | + | |
| 13 | +| element | aomdec | ours | | |
| 14 | +|---|---|---| | |
| 15 | +| partition bsize=12 (64x64) mi 0,0 | value=3 (SPLIT), rng in 32768 | value=3 | | |
| 16 | +| partition bsize=9 (32x32) mi 0,0 | value=3 (SPLIT), rng in 51744 | value=3, rng out 56592 | | |
| 17 | +| partition bsize=6 (16x16) mi 0,0 | ctx=4, rng in **56592**, value=**6 (PARTITION_VERT_A)** | ctx=0 (per-width table), value=**6** | | |
| 18 | + | |
| 19 | +Our range entering the 16x16 partition symbol equals aomdec's (56592) and we decode the | |
| 20 | +same value. There is NO divergent element: the stream really contains a `PARTITION_VERT_A` | |
| 21 | +at 16x16, which this decoder does not code. The refusal is truthful, not the | |
| 22 | +`refusal-from-own-desync` class. | |
| 23 | + | |
| 24 | +`--enable-ab-partitions=0` does not suppress it: encoding the same y4m with `=0` and `=1` | |
| 25 | +(everything else identical) gives **byte-identical output**, md5 `ef8c8be0664b…` both ways — | |
| 26 | +the knob never reached the tool (class knob-never-reached-the-tool). aomdec's partition | |
| 27 | +histogram for that stream: `bsize=6 value=6` ×1 (the VERT_A), `bsize=9 value=9` ×4 (this | |
| 28 | +lane's VERT_4), rest NONE/VERT/SPLIT. | |
| 29 | + | |
| 30 | +Main `df5d630` refuses the same stream with the same message (built from a detached | |
| 31 | +scratch worktree, own CARGO_TARGET_DIR, removed after) — **this lane did not introduce it**. | |
| 32 | + | |
| 33 | +Disposition: **deferred(16x16 HORZ_A/HORZ_B/VERT_A decode — lane-ab16's cluster, not this | |
| 34 | +lane's shape)**. Making seed 47 decode pixel-exact requires implementing AB partitions at | |
| 35 | +16x16, which is a different refusal and a different lane. The gate counts it as a named | |
| 36 | +refusal and still proves its own shape on the other attempts. | |
| 37 | + | |
| 38 | +EVIDENCE: /tmp/.../scratchpad/s47.obu (sha256 51c0a8c1…) | EC_TRACE=1 aomdec vs EC_AV1_TRACE=1 decode_probe, element-by-element from block 0 | ranges equal at 56592, both read partition value 6 (VERT_A) at bsize=6; ab-partitions=0 vs =1 md5-identical; main df5d630 refuses identically | |
| 39 | + | |
| 40 | +## 2. Gate hardening (class gate-skips-on-its-own-failure) | |
| 41 | + | |
| 42 | +`crates/ec-av1/src/stream.rs` — both 1:4 gates (superblock-level and the 32x32-level one) | |
| 43 | +now `assert_eq!(out_of_scope_mismatch, 0, ...)`: an attempt that decoded but carried none of | |
| 44 | +this gate's blocks and still mismatched ffmpeg is a failure, no longer a printed number. | |
| 45 | +Counters and the per-attempt message are kept. | |
| 46 | + | |
| 47 | +## 3. `rect4_32_counters` no longer inside `decode_stream`'s doc comment | |
| 48 | + | |
| 49 | +`crates/ec-av1/src/stream.rs` — the getter had been spliced between the `# Errors` section | |
| 50 | +and `pub fn decode_stream`, silently eating half of `decode_stream`'s documentation. Moved | |
| 51 | +above the doc block; `decode_stream`'s docs are whole again. | |
| 52 | +Deviation from the charter: it stays `pub`, not `pub(crate)` — `examples/decode_probe.rs:32` | |
| 53 | +calls `ec_av1::stream::rect4_32_counters()` from outside the crate (that is why it was made | |
| 54 | +`pub` in r4); `pub(crate)` would break the probe, which is a first-class instrument here. | |
| 55 | + | |
| 56 | +## 4. Gate + suite results | |
| 57 | + |