diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 86fb12bc..787fee5f 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -54,6 +54,16 @@ fn final_dump_prefix() -> Option { .or_else(|| std::env::var("EC_AV1_FINAL_DUMP").ok()) } +/// 32x32-level 1:4 strip counters, for `decode_probe`'s fixture search: +/// (HORZ_4 strips, VERT_4 strips, strips that read coefficients). +pub fn rect4_32_counters() -> (usize, usize, usize) { + ( + crate::decode::rect4_32_horz_hits(), + crate::decode::rect4_32_vert_hits(), + crate::decode::rect4_coeff_hits(), + ) +} + /// Decode every frame in a raw AV1 OBU stream, in coding order. /// /// A key frame becomes the reference for the inter frames that follow it, @@ -69,16 +79,6 @@ fn final_dump_prefix() -> Option { /// [`Av1Parser`] reports it), when a frame header names anything this /// crate's tile decoders do not reconstruct (see their own docs), or when an /// inter frame appears before any key frame has supplied a reference. -/// 32x32-level 1:4 strip counters, for `decode_probe`'s fixture search: -/// (HORZ_4 strips, VERT_4 strips, strips that read coefficients). -pub fn rect4_32_counters() -> (usize, usize, usize) { - ( - crate::decode::rect4_32_horz_hits(), - crate::decode::rect4_32_vert_hits(), - crate::decode::rect4_coeff_hits(), - ) -} - pub fn decode_stream(data: &[u8]) -> Result> { let final_dump = final_dump_prefix(); let mut parser = Av1Parser::new(); @@ -13141,6 +13141,15 @@ mod tests { {out_of_scope} attempts carried no 1:4 block ({out_of_scope_mismatch} of them \ mismatched -- other lanes' shapes)" ); + // Class gate-skips-on-its-own-failure: an attempt that decoded but + // does not carry this gate's shape is still a decode this crate got + // wrong. Counted separately so the message names the other shape, + // never tolerated. + assert_eq!( + out_of_scope_mismatch, 0, + "{NAME}: {out_of_scope_mismatch} attempt(s) with no 1:4 block decoded but \ + mismatched ffmpeg -- a defect of another shape, not a pass" + ); } /// lane-tx64x16 r3: the 32x32-LEVEL 1:4 pair -- `PARTITION_HORZ_4` / @@ -13369,6 +13378,11 @@ mod tests { strips={vert_proved}, coded strips={coeff_proved}, {out_of_scope} attempts \ carried no 32-level 1:4 block ({out_of_scope_mismatch} mismatched)" ); + assert_eq!( + out_of_scope_mismatch, 0, + "{NAME}: {bit_depth}-bit: {out_of_scope_mismatch} attempt(s) with zero 32-level \ + 1:4 blocks decoded but mismatched ffmpeg -- a defect of another shape, not a pass" + ); } } } diff --git a/lanes/tx64x16-r5.report.md b/lanes/tx64x16-r5.report.md new file mode 100644 index 00000000..ccf33bdd --- /dev/null +++ b/lanes/tx64x16-r5.report.md @@ -0,0 +1,57 @@ +# lane-tx64x16 r5 — the seed-47 "desync" is not a desync + +## 1. Seed 47 refusal: genuine, pre-existing on main, and the flag that was +## supposed to prevent it is inert + +Pinned stream: regenerated from the gate recipe (8-bit, seed 47 = attempt 5: +axis X, step 91, noise 9, cq 32), `sha256 51c0a8c16b2c339cbf042cd60bcf835075ff1dca4ce37362ee5fb63a23b5ffb5` +— identical to the sha in the r4 verifier report, so the fixture is reproducible. + +Range ladder, ours (`EC_AV1_TRACE=1 decode_probe`) vs instrumented aomdec (`EC_TRACE=1`), +from the first block of the first tile: + +| element | aomdec | ours | +|---|---|---| +| partition bsize=12 (64x64) mi 0,0 | value=3 (SPLIT), rng in 32768 | value=3 | +| partition bsize=9 (32x32) mi 0,0 | value=3 (SPLIT), rng in 51744 | value=3, rng out 56592 | +| partition bsize=6 (16x16) mi 0,0 | ctx=4, rng in **56592**, value=**6 (PARTITION_VERT_A)** | ctx=0 (per-width table), value=**6** | + +Our range entering the 16x16 partition symbol equals aomdec's (56592) and we decode the +same value. There is NO divergent element: the stream really contains a `PARTITION_VERT_A` +at 16x16, which this decoder does not code. The refusal is truthful, not the +`refusal-from-own-desync` class. + +`--enable-ab-partitions=0` does not suppress it: encoding the same y4m with `=0` and `=1` +(everything else identical) gives **byte-identical output**, md5 `ef8c8be0664b…` both ways — +the knob never reached the tool (class knob-never-reached-the-tool). aomdec's partition +histogram for that stream: `bsize=6 value=6` ×1 (the VERT_A), `bsize=9 value=9` ×4 (this +lane's VERT_4), rest NONE/VERT/SPLIT. + +Main `df5d630` refuses the same stream with the same message (built from a detached +scratch worktree, own CARGO_TARGET_DIR, removed after) — **this lane did not introduce it**. + +Disposition: **deferred(16x16 HORZ_A/HORZ_B/VERT_A decode — lane-ab16's cluster, not this +lane's shape)**. Making seed 47 decode pixel-exact requires implementing AB partitions at +16x16, which is a different refusal and a different lane. The gate counts it as a named +refusal and still proves its own shape on the other attempts. + +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 + +## 2. Gate hardening (class gate-skips-on-its-own-failure) + +`crates/ec-av1/src/stream.rs` — both 1:4 gates (superblock-level and the 32x32-level one) +now `assert_eq!(out_of_scope_mismatch, 0, ...)`: an attempt that decoded but carried none of +this gate's blocks and still mismatched ffmpeg is a failure, no longer a printed number. +Counters and the per-attempt message are kept. + +## 3. `rect4_32_counters` no longer inside `decode_stream`'s doc comment + +`crates/ec-av1/src/stream.rs` — the getter had been spliced between the `# Errors` section +and `pub fn decode_stream`, silently eating half of `decode_stream`'s documentation. Moved +above the doc block; `decode_stream`'s docs are whole again. +Deviation from the charter: it stays `pub`, not `pub(crate)` — `examples/decode_probe.rs:32` +calls `ec_av1::stream::rect4_32_counters()` from outside the crate (that is why it was made +`pub` in r4); `pub(crate)` would break the probe, which is a first-class instrument here. + +## 4. Gate + suite results +