From e7ae36ef5d82257abb106310e70f81ff7144c04a 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:41:10 +0300 Subject: [PATCH] docs(av1): document decode_probe, which 2be815f added without saying so The previous commit measured where five real streams stop, and quietly carried the tool that measured them -- a nine-line example with the comment 'Temporary probe'. It is not temporary: it is the instrument that disproved three refusal strings, and the next lane will want it. Documented as such, with usage, the --obu-not-IVF trap spelled out (an IVF decodes as zero frames rather than as an error, which reads as success), and that case now reported instead of printing 'OK: 0 frames decoded'. --- crates/ec-av1/examples/decode_probe.rs | 35 +++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/crates/ec-av1/examples/decode_probe.rs b/crates/ec-av1/examples/decode_probe.rs index 2c9a4a1f..a7edca41 100644 --- a/crates/ec-av1/examples/decode_probe.rs +++ b/crates/ec-av1/examples/decode_probe.rs @@ -1,8 +1,37 @@ -//! Temporary probe: decode an IVF and print what the decoder says. +//! Where does a real stream stop? Decode one AV1 file and print the answer. +//! +//! The gates in [`ec_av1::stream`] each pin one capability against one encoder +//! recipe. This asks the complementary question -- given a stream someone +//! actually produced, which refusal comes first -- and it is how the refusal +//! distribution in commit 2be815f was measured rather than reasoned about: +//! +//! ```text +//! aomenc --codec=av1 --obu -o s.obu --passes=1 --cpu-used=4 --limit=4 in.y4m +//! cargo run -p ec-av1 --example decode_probe -- s.obu +//! ``` +//! +//! Note `--obu`: [`ec_av1::stream::decode_stream`] takes a raw OBU stream, and +//! an IVF file decodes as zero frames rather than as an error. +//! +//! That run is also what disproved three refusal strings claiming an encoder +//! never writes a case it demonstrably writes, so this is a first-class +//! instrument, not a scratch file. fn main() { - let path = std::env::args().nth(1).expect("usage: decode_probe "); - let data = std::fs::read(&path).expect("read"); + let Some(path) = std::env::args().nth(1) else { + eprintln!("usage: decode_probe "); + std::process::exit(2); + }; + let data = match std::fs::read(&path) { + Ok(data) => data, + Err(e) => { + eprintln!("{path}: {e}"); + std::process::exit(2); + } + }; match ec_av1::stream::decode_stream(&data) { + Ok(frames) if frames.is_empty() => { + println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?"); + } Ok(frames) => println!("OK: {} frames decoded", frames.len()), Err(e) => println!("REFUSED: {e}"), }