diff --git a/crates/ec-hw/tests/gpu.rs b/crates/ec-hw/tests/gpu.rs index 43483bfb..c575496a 100644 --- a/crates/ec-hw/tests/gpu.rs +++ b/crates/ec-hw/tests/gpu.rs @@ -1154,6 +1154,22 @@ fn av1_10bit_encode_agrees_between_two_decoders() { "the coded stream's sequence header does not say 10-bit" ); + // The two refusals this depth added, exercised rather than asserted in + // prose: 10-bit H.265 (High and Main are 8-bit profiles, so this crate + // never asks the driver), and 8-bit pixels handed to a 10-bit encoder. + let ten_bit_hevc = EncoderConfig::new(EncCodec::H265, width, height).ten_bit(); + assert!( + Encoder::new(&display, ten_bit_hevc).is_err(), + "a 10-bit HEVC encoder was built out of an 8-bit profile" + ); + let mut config = EncoderConfig::new(EncCodec::Av1, width, height).ten_bit(); + config.rate_control = RateControlMode::ConstantQp { qp: 90 }; + let mut ten = Encoder::new(&display, config).expect("a 10-bit AV1 encoder"); + assert!( + ten.encode(&source_frame(width, height, 0), FrameMetadata::default()).is_err(), + "8-bit pixels went into a 10-bit encoder" + ); + let ours = ec_av1::stream::decode_stream(&data) .unwrap_or_else(|e| panic!("ec-av1 decodes the 10-bit hardware stream: {e}")); assert_eq!(ours.len(), planes.len(), "ec-av1 decoded {} of {frames} frames", ours.len()); diff --git a/tools/ec-bench/src/main.rs b/tools/ec-bench/src/main.rs index 7c44680d..9ca14014 100644 --- a/tools/ec-bench/src/main.rs +++ b/tools/ec-bench/src/main.rs @@ -465,17 +465,19 @@ fn bench_hw_av1_encode_10bit(rows: &mut Vec) { rows.push(Row { component: "ec-hw av1 10-bit", direction: "encode", - content: format!("{w}x{h} yuv420p10le, {n} frames, CQP 120, {} kB", coded / 1000), + content: format!("{w}x{h} yuv420p10le, {n} frames from 00:01:00, CQP 120, {} kB", coded / 1000), media: format!("{media_s:.1}s"), wall_ms: wall * 1000.0, rtf: (wall > 0.0).then_some(media_s / wall), }); } -/// `extract_yuv420p` at ten bits: P010-ordered planar 16-bit little endian. +/// `extract_yuv420p` at ten bits, planar 16-bit little endian, seeked a +/// minute in: frame 0 of a film is its black leader, and a black leader codes +/// to nothing and benchmarks nothing. fn extract_yuv420p10(src: &Path, w: u32, h: u32, n: u32) -> Vec { let out = Command::new("ffmpeg") - .args(["-v", "error", "-i"]) + .args(["-v", "error", "-ss", "60", "-i"]) .arg(src) .args([ "-vf", &format!("scale={w}:{h}"),