Exercise the two 10-bit refusals
Browse files at this commitb19cdc4877d1954a74f0556b71ec7bc6fd3a353dParent: ebea85e- test
- exercise the two 10-bit refusals
- bench 10-bit row off the black leader
2 changed files +21 -3
- crates/ec-hw/tests/gpu.rs +16 -0
- tools/ec-bench/src/main.rs +5 -3
crates/ec-hw/tests/gpu.rsmodified+16 -0
| @@ -1154,6 +1154,22 @@ fn av1_10bit_encode_agrees_between_two_decoders() { | ||
| 1154 | 1154 | "the coded stream's sequence header does not say 10-bit" |
| 1155 | 1155 | ); |
| 1156 | 1156 | |
| 1157 | + // The two refusals this depth added, exercised rather than asserted in | |
| 1158 | + // prose: 10-bit H.265 (High and Main are 8-bit profiles, so this crate | |
| 1159 | + // never asks the driver), and 8-bit pixels handed to a 10-bit encoder. | |
| 1160 | + let ten_bit_hevc = EncoderConfig::new(EncCodec::H265, width, height).ten_bit(); | |
| 1161 | + assert!( | |
| 1162 | + Encoder::new(&display, ten_bit_hevc).is_err(), | |
| 1163 | + "a 10-bit HEVC encoder was built out of an 8-bit profile" | |
| 1164 | + ); | |
| 1165 | + let mut config = EncoderConfig::new(EncCodec::Av1, width, height).ten_bit(); | |
| 1166 | + config.rate_control = RateControlMode::ConstantQp { qp: 90 }; | |
| 1167 | + let mut ten = Encoder::new(&display, config).expect("a 10-bit AV1 encoder"); | |
| 1168 | + assert!( | |
| 1169 | + ten.encode(&source_frame(width, height, 0), FrameMetadata::default()).is_err(), | |
| 1170 | + "8-bit pixels went into a 10-bit encoder" | |
| 1171 | + ); | |
| 1172 | + | |
| 1157 | 1173 | let ours = ec_av1::stream::decode_stream(&data) |
| 1158 | 1174 | .unwrap_or_else(|e| panic!("ec-av1 decodes the 10-bit hardware stream: {e}")); |
| 1159 | 1175 | assert_eq!(ours.len(), planes.len(), "ec-av1 decoded {} of {frames} frames", ours.len()); |
tools/ec-bench/src/main.rsmodified+5 -3
| @@ -465,17 +465,19 @@ fn bench_hw_av1_encode_10bit(rows: &mut Vec<Row>) { | ||
| 465 | 465 | rows.push(Row { |
| 466 | 466 | component: "ec-hw av1 10-bit", |
| 467 | 467 | direction: "encode", |
| 468 | - content: format!("{w}x{h} yuv420p10le, {n} frames, CQP 120, {} kB", coded / 1000), | |
| 468 | + content: format!("{w}x{h} yuv420p10le, {n} frames from 00:01:00, CQP 120, {} kB", coded / 1000), | |
| 469 | 469 | media: format!("{media_s:.1}s"), |
| 470 | 470 | wall_ms: wall * 1000.0, |
| 471 | 471 | rtf: (wall > 0.0).then_some(media_s / wall), |
| 472 | 472 | }); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | -/// `extract_yuv420p` at ten bits: P010-ordered planar 16-bit little endian. | |
| 475 | +/// `extract_yuv420p` at ten bits, planar 16-bit little endian, seeked a | |
| 476 | +/// minute in: frame 0 of a film is its black leader, and a black leader codes | |
| 477 | +/// to nothing and benchmarks nothing. | |
| 476 | 478 | fn extract_yuv420p10(src: &Path, w: u32, h: u32, n: u32) -> Vec<u8> { |
| 477 | 479 | let out = Command::new("ffmpeg") |
| 478 | - .args(["-v", "error", "-i"]) | |
| 480 | + .args(["-v", "error", "-ss", "60", "-i"]) | |
| 479 | 481 | .arg(src) |
| 480 | 482 | .args([ |
| 481 | 483 | "-vf", &format!("scale={w}:{h}"), |