forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

bench.rs19 lines, 790 bytesHistoryRawDownload
1//! Decode a raw .dv file repeatedly and print frames per second (optional 2nd arg: frame count).
2use ec_dv::DvVideoDecoder;
3fn main() {
4 let a: Vec<String> = std::env::args().collect();
5 let data = std::fs::read(&a[1]).unwrap();
6 let limit: Option<u32> = a.get(2).and_then(|s| s.parse().ok());
7 let fs = ec_dv::frame_profile(None, &data).unwrap().frame_size;
8 let frames: Vec<&[u8]> = data.chunks_exact(fs).collect();
9 let mut d = DvVideoDecoder::new();
10 let t = std::time::Instant::now();
11 let mut n = 0;
12 while limit.map_or(t.elapsed().as_secs_f64() < 3.0, |l| n < l) {
13 for f in &frames {
14 std::hint::black_box(d.decode(f).unwrap());
15 n += 1;
16 }
17 }
18 println!("{:.0} fps", f64::from(n) / t.elapsed().as_secs_f64());
19}