From 177de6ad43147e5c4e848cd78fb91a4875b3f7a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 30 Aug 2026 16:40:35 +0300 Subject: [PATCH] fix(av1): three refusals claimed the encoder never writes what it writes Measured, not reasoned: five default-settings aomenc streams through the decoder, one command each. testsrc2 192x128 at --cpu-used=0 refuses with "a partition type this encoder never writes" -- a claim about the world, disproved by the stream that produced it. The same family sits at the 32x32 level for both the intra and inter paths. All three now say what this decoder does not code, which is the true and useful statement: "a superblock-level partition type other than NONE or SPLIT (this decoder's intra tile path codes only those two at 64x64)" "a 32x32 partition type this decoder does not code (value={part32})" "an INTER 32x32 partition type this decoder does not code (value={part32})" Finding those needed a fix to the inventory itself: its scanner stopped at `unsupported(` and so never saw `unsupported(format!("..."))`. Two refusals were invisible to it, one of them the INTER claim above. It steps through format! now, and both are pinned. Where a default-settings stream stops today, measured this run: palette (Y); delta_q/delta_lf, twice; the inter path's non-SPLIT superblock partition; and the intra path's, at cpu-used=0. Four of the five are owned by live lanes; the superblock-level partition family is not, and is the next lane to arm. Suite 243 passed / 0 failed. --- crates/ec-av1/examples/decode_probe.rs | 9 +++++++++ crates/ec-av1/src/decode.rs | 9 ++++++--- crates/ec-av1/src/refusal_inventory.rs | 9 ++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 crates/ec-av1/examples/decode_probe.rs diff --git a/crates/ec-av1/examples/decode_probe.rs b/crates/ec-av1/examples/decode_probe.rs new file mode 100644 index 00000000..2c9a4a1f --- /dev/null +++ b/crates/ec-av1/examples/decode_probe.rs @@ -0,0 +1,9 @@ +//! Temporary probe: decode an IVF and print what the decoder says. +fn main() { + let path = std::env::args().nth(1).expect("usage: decode_probe "); + let data = std::fs::read(&path).expect("read"); + match ec_av1::stream::decode_stream(&data) { + Ok(frames) => println!("OK: {} frames decoded", frames.len()), + Err(e) => println!("REFUSED: {e}"), + } +} diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 10d1291b..2ef5a36d 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -5283,14 +5283,17 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( } _ => { return Err(unsupported(format!( - "a partition type this encoder never writes (value={part32})" + "a 32x32 partition type this decoder does not code (value={part32})" ))); } } } } _ => { - return Err(unsupported("a partition type this encoder never writes")); + return Err(unsupported( + "a superblock-level partition type other than NONE or SPLIT (this \ + decoder's intra tile path codes only those two at 64x64)", + )); } } } @@ -10885,7 +10888,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( } _ => { return Err(unsupported(format!( - "an INTER 32x32 partition type this encoder never writes (value={part32})" + "an INTER 32x32 partition type this decoder does not code (value={part32})" ))); } } diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index f48b900b..03746427 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -29,7 +29,6 @@ const CAPABILITY_CLAIMS: &[&str] = &[ "a nonzero angle delta (this encoder never writes one)", "a partition below 16x16 other than a clean split (this encoder never writes one)", "a partition below 8x8 (this encoder never writes one)", - "a partition type this encoder never writes", "a tx_type symbol on a rectangular transform (never expected at this size)", ]; @@ -38,7 +37,11 @@ const REFUSALS: &[&str] = &[ "GLOBALMV (round 3)", "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", + "a 32x32 partition type this decoder does not code (value={part32})", "a Golomb tail longer than this decoder reads", + "a tx_type symbol outside its CDF's own set: {t}", + "an INTER 32x32 partition type this decoder does not code (value={part32})", + "a superblock-level partition type other than NONE or SPLIT (this decoder's intra tile path codes only those two at 64x64)", "a HORZ/VERT intra strip in a screen-content frame (palette syntax is consumed for square blocks only)", "a HORZ/VERT intra strip with a split transform (per-unit rect prediction is not ported)", "a block that actually uses a palette (UV) -- reconstruction is out of scope", @@ -107,6 +110,10 @@ mod tests { for (start, _) in src.match_indices("unsupported(") { // `Error::unsupported(` and the bare helper both end here. let mut i = start + "unsupported(".len(); + // `unsupported(format!("..."))` is the same refusal, one layer in. + if src[i..].starts_with("format!(") { + i += "format!(".len(); + } let mut last: Option = None; loop { while i < bytes.len() && (bytes[i] as char).is_whitespace() {