From db2cc7578b31ca0e9283d50d34df940b6f5291d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Dec 2026 13:33:31 +0300 Subject: [PATCH] U5: drop ec-vp8 debug examples dbg_first, dump_frame, throughput Diagnostic probes with no test or caller; the examples are not part of the decoder. --- crates/ec-vp8/examples/dbg_first.rs | 18 --------- crates/ec-vp8/examples/dump_frame.rs | 58 ---------------------------- crates/ec-vp8/examples/throughput.rs | 38 ------------------ 3 files changed, 114 deletions(-) delete mode 100644 crates/ec-vp8/examples/dbg_first.rs delete mode 100644 crates/ec-vp8/examples/dump_frame.rs delete mode 100644 crates/ec-vp8/examples/throughput.rs diff --git a/crates/ec-vp8/examples/dbg_first.rs b/crates/ec-vp8/examples/dbg_first.rs deleted file mode 100644 index 36e27020..00000000 --- a/crates/ec-vp8/examples/dbg_first.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Decode frame 0 of an IVF with decision tracing (EC_VP8_TRACE=1). -use ec_vp8::decode::Decoder; - -fn main() { - let path = std::env::args().nth(1).expect("ivf path"); - let bytes = std::fs::read(path).unwrap(); - let sz = u32::from_le_bytes([bytes[32], bytes[33], bytes[34], bytes[35]]) as usize; - let frame = &bytes[44..44 + sz]; - let mut dec = Decoder::new(); - match dec.decode(frame) { - Ok(Some(pic)) => println!( - "OUT {}x{} y[0..8]={:?}", - pic.width, pic.height, &pic.y[..8] - ), - Ok(None) => println!("OUT hidden"), - Err(e) => println!("OUT ERR {e}"), - } -} diff --git a/crates/ec-vp8/examples/dump_frame.rs b/crates/ec-vp8/examples/dump_frame.rs deleted file mode 100644 index 31bca7de..00000000 --- a/crates/ec-vp8/examples/dump_frame.rs +++ /dev/null @@ -1,58 +0,0 @@ -//! Dump decoded frame N of an IVF as raw yuv420p (ffmpeg-comparable: -//! `ffmpeg -i in.ivf -f rawvideo -pix_fmt yuv420p -` streams the same -//! layout, frame after frame). Usage: `dump_frame -//! `. Decoding stops at the first frame the crate cannot yet -//! decode (e.g. inter frames before M3), reporting it on stderr. - -use ec_vp8::decode::Decoder; - -fn main() { - let args: Vec = std::env::args().collect(); - assert_eq!(args.len(), 4, "usage: dump_frame "); - let want: usize = args[2].parse().expect("frame index"); - let bytes = std::fs::read(&args[1]).unwrap(); - - // IVF: 32-byte file header, then (4-byte LE size, 8-byte pts, data). - let mut frames = Vec::new(); - let mut pos = 32; - while pos + 12 <= bytes.len() { - let sz = u32::from_le_bytes(bytes[pos..pos + 4].try_into().unwrap()) as usize; - frames.push(&bytes[pos + 12..pos + 12 + sz]); - pos += 12 + sz; - } - - let mut dec = Decoder::new(); - for (i, f) in frames.iter().enumerate() { - match dec.decode(f) { - Ok(Some(pic)) if i == want => { - let mut out = Vec::with_capacity( - pic.y.len() + pic.u.len() + pic.v.len(), - ); - for row in 0..usize::from(pic.height) { - let s = row * pic.stride; - out.extend_from_slice(&pic.y[s..s + usize::from(pic.width)]); - } - let (cw, ch) = ( - usize::from(pic.width + 1) / 2, - usize::from(pic.height + 1) / 2, - ); - for plane in [&pic.u, &pic.v] { - for row in 0..ch { - let s = row * pic.uv_stride; - out.extend_from_slice(&plane[s..s + cw]); - } - } - std::fs::write(&args[3], out).unwrap(); - return; - } - Ok(Some(_)) => {} - Ok(None) => {} - Err(e) => { - eprintln!("frame {i}: {e}"); - std::process::exit(1); - } - } - } - eprintln!("no frame {want} decoded"); - std::process::exit(1); -} diff --git a/crates/ec-vp8/examples/throughput.rs b/crates/ec-vp8/examples/throughput.rs deleted file mode 100644 index dd7b72e4..00000000 --- a/crates/ec-vp8/examples/throughput.rs +++ /dev/null @@ -1,38 +0,0 @@ -//! Perf-lane probe: decode an IVF repeatedly, report MP/s and fps. -//! Dims come from the IVF header; usage: `throughput [rounds]`. -use ec_vp8::decode::Decoder; -use std::time::Instant; - -fn main() { - let args: Vec = std::env::args().collect(); - let bytes = std::fs::read(&args[1]).unwrap(); - let w = u16::from_le_bytes([bytes[12], bytes[13]]) as u64; - let h = u16::from_le_bytes([bytes[14], bytes[15]]) as u64; - let rounds: u64 = args.get(2).map(|s| s.parse().unwrap()).unwrap_or(20); - let mut frames = Vec::new(); - let mut pos = 32; - while pos + 12 <= bytes.len() { - let sz = u32::from_le_bytes(bytes[pos..pos + 4].try_into().unwrap()) as usize; - frames.push(bytes[pos + 12..pos + 12 + sz].to_vec()); - pos += 12 + sz; - } - let nframes = frames.len(); - let shown = frames.iter().filter(|f| (f[0] >> 4) & 1 == 1).count() as u64; - let t = Instant::now(); - for _ in 0..rounds { - let mut dec = Decoder::new(); - for f in &frames { - dec.decode(f).unwrap(); - } - } - let dt = t.elapsed().as_secs_f64(); - let dec_mpx = rounds as f64 * nframes as f64 * w as f64 * h as f64 / 1e6 / dt; - let out_mpx = rounds as f64 * shown as f64 * w as f64 * h as f64 / 1e6 / dt; - println!( - "{}x{rounds} frames ({shown} shown/round) in {dt:.3}s: \ - decode {dec_mpx:.1} MP/s, output {out_mpx:.1} MP/s \ - ({:.1} shown fps @ {w}x{h})", - nframes, - rounds as f64 * shown as f64 / dt - ); -}