Merge branch 'lane-av1realfilm' (b9e1cb62): the native BD gate scores two real films from the user's library; the testsrc2 rows are labelled "bars"
Browse files at this commit1 changed file +69 -13
- crates/ec-av1/src/encode.rs +69 -13
crates/ec-av1/src/encode.rsmodified+69 -13
| @@ -12562,10 +12562,15 @@ mod tests { | |||
| 12562 | } | 12562 | } |
| 12563 | let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures"); | 12563 | let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures"); |
| 12564 | let mut clips: Vec<(String, std::path::PathBuf)> = Vec::new(); | 12564 | let mut clips: Vec<(String, std::path::PathBuf)> = Vec::new(); |
| 12565 | - for name in ["h264-1080p-23.976-8bit.mp4", "h264-2160p-23.976-8bit.mp4"] { | 12565 | + // testsrc2 COLOUR BARS, not film -- labelled so no reader takes these |
| 12566 | + // rows for real content (the real rows live in the native gate). | ||
| 12567 | + for (label, name) in [ | ||
| 12568 | + ("bars 1080p", "h264-1080p-23.976-8bit.mp4"), | ||
| 12569 | + ("bars 2160p", "h264-2160p-23.976-8bit.mp4"), | ||
| 12570 | + ] { | ||
| 12566 | let path = fixtures.join("video").join(name); | 12571 | let path = fixtures.join("video").join(name); |
| 12567 | if path.exists() { | 12572 | if path.exists() { |
| 12568 | - clips.push((name.to_string(), path)); | 12573 | + clips.push((label.to_string(), path)); |
| 12569 | } else { | 12574 | } else { |
| 12570 | eprintln!("SKIP clip {name}: missing"); | 12575 | eprintln!("SKIP clip {name}: missing"); |
| 12571 | } | 12576 | } |
| @@ -12956,9 +12961,20 @@ mod tests { | |||
| 12956 | /// decoder on all three planes in display order, and prints the per-level | 12961 | /// decoder on all three planes in display order, and prints the per-level |
| 12957 | /// frame and byte census. | 12962 | /// frame and byte census. |
| 12958 | /// | 12963 | /// |
| 12959 | - /// All three gate clips are rows by default. `EC_AV1_NATIVE_FILM=1`, | 12964 | + /// WHICH ROWS ARE REAL CONTENT: the `bars 1080p` / `bars 2160p` rows are |
| 12965 | + /// the repo fixtures `scripts/gen-fixtures.sh` builds with ffmpeg | ||
| 12966 | + /// `testsrc2` -- COLOUR BARS, ~90% of whose 16x16 cells have no intra | ||
| 12967 | + /// cost -- so every "film" column in the historical tables of this file | ||
| 12968 | + /// is that generator, not film. The real content is `film A`, `film B` | ||
| 12969 | + /// (native crops out of the two AV1 films the real-library manifest | ||
| 12970 | + /// names, at a pinned seek; added 2026-09-07) and the screen capture. A | ||
| 12971 | + /// decision only the bars rows support is not supported. | ||
| 12972 | + /// | ||
| 12973 | + /// All five gate clips are rows by default. `EC_AV1_NATIVE_FILM=1`, | ||
| 12960 | /// `EC_AV1_NATIVE_FILM4K=1` and `EC_AV1_NATIVE_SCREEN=1` select a subset: | 12974 | /// `EC_AV1_NATIVE_FILM4K=1` and `EC_AV1_NATIVE_SCREEN=1` select a subset: |
| 12961 | - /// setting any one of them keeps only the selected rows. | 12975 | + /// setting any one of them keeps only the selected rows (the two 1080p |
| 12976 | + /// rows, the two 2160p rows, the capture row respectively). A missing | ||
| 12977 | + /// real film SKIPs its row; it never fails the gate. | ||
| 12962 | #[test] | 12978 | #[test] |
| 12963 | #[ignore = "the native-resolution BD arm: minutes per row, needs ffmpeg"] | 12979 | #[ignore = "the native-resolution BD arm: minutes per row, needs ffmpeg"] |
| 12964 | fn bd_rate_screen_native() { | 12980 | fn bd_rate_screen_native() { |
| @@ -12975,22 +12991,61 @@ mod tests { | |||
| 12975 | ); | 12991 | ); |
| 12976 | // No selector at all means every clip; any selector means that subset. | 12992 | // No selector at all means every clip; any selector means that subset. |
| 12977 | let all = !(film || film4k || screen); | 12993 | let all = !(film || film4k || screen); |
| 12978 | - let mut clips: Vec<(String, String)> = Vec::new(); | 12994 | + // (label, path, seek). The two `testsrc2` fixtures are COLOUR BARS, |
| 12995 | + // not film -- they print as "bars" so no reader takes them for real | ||
| 12996 | + // content -- and the two rows below them are the real AV1 films. | ||
| 12997 | + let mut clips: Vec<(String, String, String)> = Vec::new(); | ||
| 12979 | for (want, label, file) in [ | 12998 | for (want, label, file) in [ |
| 12980 | - (all || film, "film 1080p", "h264-1080p-23.976-8bit.mp4"), | 12999 | + (all || film, "bars 1080p", "h264-1080p-23.976-8bit.mp4"), |
| 12981 | - (all || film4k, "film 2160p", "h264-2160p-23.976-8bit.mp4"), | 13000 | + (all || film4k, "bars 2160p", "h264-2160p-23.976-8bit.mp4"), |
| 12982 | ] { | 13001 | ] { |
| 12983 | if !want { | 13002 | if !want { |
| 12984 | continue; | 13003 | continue; |
| 12985 | } | 13004 | } |
| 12986 | let path = fixtures.join("video").join(file); | 13005 | let path = fixtures.join("video").join(file); |
| 12987 | match path.exists() { | 13006 | match path.exists() { |
| 12988 | - true => clips.push((label.to_string(), path.to_str().unwrap().to_string())), | 13007 | + true => { |
| 13008 | + clips.push((label.to_string(), path.to_str().unwrap().to_string(), "0".into())) | ||
| 13009 | + } | ||
| 12989 | false => eprintln!("SKIP {label}: {file} missing"), | 13010 | false => eprintln!("SKIP {label}: {file} missing"), |
| 12990 | } | 13011 | } |
| 12991 | } | 13012 | } |
| 13013 | + let manifest = std::fs::read_to_string(fixtures.join("real-library-manifest.tsv")); | ||
| 13014 | + // The real films, taken out of the real-library manifest by codec and | ||
| 13015 | + // coded width so no title and no home path lives in this file. Each | ||
| 13016 | + // seek is PINNED (class `seeded fixture not reproducible`) at a | ||
| 13017 | + // moving, non-black window -- a black leader would make every arm | ||
| 13018 | + // read +0.000 (class `flat sample window`). Both sources are 10-bit | ||
| 13019 | + // (one HDR10/PQ); the loader's plain `-pix_fmt yuv420p` conversion is | ||
| 13020 | + // what all three encoders see, so the comparison stays | ||
| 13021 | + // encoder-vs-encoder. | ||
| 13022 | + let pick = |width: &str| -> Option<String> { | ||
| 13023 | + let m = manifest.as_ref().ok()?; | ||
| 13024 | + m.lines() | ||
| 13025 | + .skip(1) | ||
| 13026 | + .map(|l| l.split('\t').collect::<Vec<_>>()) | ||
| 13027 | + .find(|f| { | ||
| 13028 | + f.len() > 4 | ||
| 13029 | + && f[2] == "av1" | ||
| 13030 | + && f[3] == width | ||
| 13031 | + && std::path::Path::new(f[0]).exists() | ||
| 13032 | + }) | ||
| 13033 | + .map(|f| f[0].to_string()) | ||
| 13034 | + }; | ||
| 13035 | + for (want, label, width, seek) in [ | ||
| 13036 | + (all || film, "film A (1080p source)", "1920", "00:35:00"), | ||
| 13037 | + (all || film4k, "film B (2160p HDR source)", "3840", "00:40:00"), | ||
| 13038 | + ] { | ||
| 13039 | + if !want { | ||
| 13040 | + continue; | ||
| 13041 | + } | ||
| 13042 | + match pick(width) { | ||
| 13043 | + Some(path) => clips.push((label.to_string(), path, seek.to_string())), | ||
| 13044 | + None => eprintln!("SKIP {label}: no {width}-wide AV1 source in the manifest"), | ||
| 13045 | + } | ||
| 13046 | + } | ||
| 12992 | if all || screen { | 13047 | if all || screen { |
| 12993 | - match std::fs::read_to_string(fixtures.join("real-library-manifest.tsv")) { | 13048 | + match &manifest { |
| 12994 | Ok(manifest) => match manifest | 13049 | Ok(manifest) => match manifest |
| 12995 | .lines() | 13050 | .lines() |
| 12996 | .skip(1) | 13051 | .skip(1) |
| @@ -13000,6 +13055,7 @@ mod tests { | |||
| 13000 | Some(p) => clips.push(( | 13055 | Some(p) => clips.push(( |
| 13001 | format!("screen capture ({})", p.rsplit('/').next().unwrap_or(p)), | 13056 | format!("screen capture ({})", p.rsplit('/').next().unwrap_or(p)), |
| 13002 | p.to_string(), | 13057 | p.to_string(), |
| 13058 | + "0".into(), | ||
| 13003 | )), | 13059 | )), |
| 13004 | None => eprintln!("SKIP screen capture: no OBS recording in the manifest exists"), | 13060 | None => eprintln!("SKIP screen capture: no OBS recording in the manifest exists"), |
| 13005 | }, | 13061 | }, |
| @@ -13039,7 +13095,7 @@ mod tests { | |||
| 13039 | ); | 13095 | ); |
| 13040 | println!("| clip | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e (noisy) |"); | 13096 | println!("| clip | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e (noisy) |"); |
| 13041 | println!("|---|---|---|---|---|"); | 13097 | println!("|---|---|---|---|---|"); |
| 13042 | - for (name, path) in &clips { | 13098 | + for (name, path, seek) in &clips { |
| 13043 | let fctx = &crate::decode::FrameCtx::new(); | 13099 | let fctx = &crate::decode::FrameCtx::new(); |
| 13044 | let Some((nw, nh)) = probe_dims(path) else { | 13100 | let Some((nw, nh)) = probe_dims(path) else { |
| 13045 | eprintln!("SKIP {name}: ffprobe gave no size"); | 13101 | eprintln!("SKIP {name}: ffprobe gave no size"); |
| @@ -13053,7 +13109,7 @@ mod tests { | |||
| 13053 | let (x, y) = ((nw - cw) / 2 & !1, (nh - ch) / 2 & !1); | 13109 | let (x, y) = ((nw - cw) / 2 & !1, (nh - ch) / 2 & !1); |
| 13054 | let source = clip_frames_vf( | 13110 | let source = clip_frames_vf( |
| 13055 | path, | 13111 | path, |
| 13056 | - "0", | 13112 | + seek, |
| 13057 | &format!("crop={cw}:{ch}:{x}:{y}"), | 13113 | &format!("crop={cw}:{ch}:{x}:{y}"), |
| 13058 | cw, | 13114 | cw, |
| 13059 | ch, | 13115 | ch, |
| @@ -13156,8 +13212,8 @@ mod tests { | |||
| 13156 | } | 13212 | } |
| 13157 | let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures"); | 13213 | let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures"); |
| 13158 | for (label, file) in [ | 13214 | for (label, file) in [ |
| 13159 | - ("film 1080p", "h264-1080p-23.976-8bit.mp4"), | 13215 | + ("bars 1080p", "h264-1080p-23.976-8bit.mp4"), |
| 13160 | - ("film 2160p", "h264-2160p-23.976-8bit.mp4"), | 13216 | + ("bars 2160p", "h264-2160p-23.976-8bit.mp4"), |
| 13161 | ] { | 13217 | ] { |
| 13162 | let path = fixtures.join("video").join(file); | 13218 | let path = fixtures.join("video").join(file); |
| 13163 | if !path.exists() { | 13219 | if !path.exists() { |