Let ffmpeg check the encoder's own picture hash
Browse files at this commit138d2a4d5573379b5dde93a79e5e80c858cfe23aParent: 4d59579- test
- let ffmpeg check the encoder's own picture hash
1 changed file +29 -0
crates/ec-h265/tests/conformance.rsmodified+29 -0
| @@ -131,6 +131,35 @@ fn ffmpeg_decodes_bit_exactly_at_every_shape() { | |||
| 131 | } | 131 | } |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | +#[test] | ||
| 135 | +fn ffmpeg_verifies_the_decoded_picture_hash() { | ||
| 136 | + // The MD5 SEI is the encoder's claim about its own reconstruction; ffmpeg's | ||
| 137 | + // decoder checks that claim against what it decoded when asked to. This is | ||
| 138 | + // the one oracle that does not depend on this crate being right about | ||
| 139 | + // anything except the hash itself. | ||
| 140 | + if !have_ffmpeg() { | ||
| 141 | + eprintln!("skipping: ffmpeg not installed"); | ||
| 142 | + return; | ||
| 143 | + } | ||
| 144 | + let (_, coded) = encode(352, 288, 30); | ||
| 145 | + let path = write_au("hash-352x288", &coded); | ||
| 146 | + let output = Command::new("ffmpeg") | ||
| 147 | + .args(["-v", "debug", "-err_detect", "crccheck", "-y", "-i"]) | ||
| 148 | + .arg(&path) | ||
| 149 | + .args(["-f", "null", "-"]) | ||
| 150 | + .output() | ||
| 151 | + .expect("run ffmpeg"); | ||
| 152 | + let log = String::from_utf8_lossy(&output.stderr).to_string(); | ||
| 153 | + let checks: Vec<&str> = log | ||
| 154 | + .lines() | ||
| 155 | + .filter(|line| line.contains("Verifying checksum")) | ||
| 156 | + .collect(); | ||
| 157 | + assert!(!checks.is_empty(), "ffmpeg checked no picture hash: {log}"); | ||
| 158 | + for line in checks { | ||
| 159 | + assert_eq!(line.matches("correct").count(), 3, "hash mismatch: {line}"); | ||
| 160 | + } | ||
| 161 | +} | ||
| 162 | + | ||
| 134 | #[test] | 163 | #[test] |
| 135 | fn vaapi_hardware_decodes_the_stream() { | 164 | fn vaapi_hardware_decodes_the_stream() { |
| 136 | // The other half of "it decodes": a GPU decoder is a different | 165 | // The other half of "it decodes": a GPU decoder is a different |