forge
Explore
Log in

Don't you dare go Hollow

Document decode_probe, which 2be815f added without saying so

Browse files at this commit

e7ae36ef5d82257abb106310e70f81ff7144c04aAhmet Kaan GümüşParent: 177de6a
  • docs
    • document decode_probe, which 2be815f added without saying so
Show full message
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.rsmodified+32 -3
@@ -1,8 +1,37 @@
1-//! Temporary probe: decode an IVF and print what the decoder says.
1+//! Where does a real stream stop? Decode one AV1 file and print the answer.
2+//!
3+//! The gates in [`ec_av1::stream`] each pin one capability against one encoder
4+//! recipe. This asks the complementary question -- given a stream someone
5+//! actually produced, which refusal comes first -- and it is how the refusal
6+//! distribution in commit 2be815f was measured rather than reasoned about:
7+//!
8+//! ```text
9+//! aomenc --codec=av1 --obu -o s.obu --passes=1 --cpu-used=4 --limit=4 in.y4m
10+//! cargo run -p ec-av1 --example decode_probe -- s.obu
11+//! ```
12+//!
13+//! Note `--obu`: [`ec_av1::stream::decode_stream`] takes a raw OBU stream, and
14+//! an IVF file decodes as zero frames rather than as an error.
15+//!
16+//! That run is also what disproved three refusal strings claiming an encoder
17+//! never writes a case it demonstrably writes, so this is a first-class
18+//! instrument, not a scratch file.
219 fn main() {
3- let path = std::env::args().nth(1).expect("usage: decode_probe <file.ivf>");
4- let data = std::fs::read(&path).expect("read");
20+ let Some(path) = std::env::args().nth(1) else {
21+ eprintln!("usage: decode_probe <stream.obu>");
22+ std::process::exit(2);
23+ };
24+ let data = match std::fs::read(&path) {
25+ Ok(data) => data,
26+ Err(e) => {
27+ eprintln!("{path}: {e}");
28+ std::process::exit(2);
29+ }
30+ };
531 match ec_av1::stream::decode_stream(&data) {
32+ Ok(frames) if frames.is_empty() => {
33+ println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?");
34+ }
635 Ok(frames) => println!("OK: {} frames decoded", frames.len()),
736 Err(e) => println!("REFUSED: {e}"),
837 }