The native BD gate scores two real AV1 films, and the testsrc2 rows say bars
Browse files at this commit5aa054a6007c7ee51658972878f37bbe3538011cParent: 037459c- test
- the native BD gate scores two real AV1 films, and the testsrc2 rows say bars
1 changed file +69 -13
- crates/ec-av1/src/encode.rs +69 -13
crates/ec-av1/src/encode.rsmodified+69 -13
| @@ -12521,10 +12521,15 @@ mod tests { | |||
| 12521 | } | 12521 | } |
| 12522 | let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures"); | 12522 | let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures"); |
| 12523 | let mut clips: Vec<(String, std::path::PathBuf)> = Vec::new(); | 12523 | let mut clips: Vec<(String, std::path::PathBuf)> = Vec::new(); |
| 12524 | - for name in ["h264-1080p-23.976-8bit.mp4", "h264-2160p-23.976-8bit.mp4"] { | 12524 | + // testsrc2 COLOUR BARS, not film -- labelled so no reader takes these |
| 12525 | + // rows for real content (the real rows live in the native gate). | ||
| 12526 | + for (label, name) in [ | ||
| 12527 | + ("bars 1080p", "h264-1080p-23.976-8bit.mp4"), | ||
| 12528 | + ("bars 2160p", "h264-2160p-23.976-8bit.mp4"), | ||
| 12529 | + ] { | ||
| 12525 | let path = fixtures.join("video").join(name); | 12530 | let path = fixtures.join("video").join(name); |
| 12526 | if path.exists() { | 12531 | if path.exists() { |
| 12527 | - clips.push((name.to_string(), path)); | 12532 | + clips.push((label.to_string(), path)); |
| 12528 | } else { | 12533 | } else { |
| 12529 | eprintln!("SKIP clip {name}: missing"); | 12534 | eprintln!("SKIP clip {name}: missing"); |
| 12530 | } | 12535 | } |
| @@ -12915,9 +12920,20 @@ mod tests { | |||
| 12915 | /// decoder on all three planes in display order, and prints the per-level | 12920 | /// decoder on all three planes in display order, and prints the per-level |
| 12916 | /// frame and byte census. | 12921 | /// frame and byte census. |
| 12917 | /// | 12922 | /// |
| 12918 | - /// All three gate clips are rows by default. `EC_AV1_NATIVE_FILM=1`, | 12923 | + /// WHICH ROWS ARE REAL CONTENT: the `bars 1080p` / `bars 2160p` rows are |
| 12924 | + /// the repo fixtures `scripts/gen-fixtures.sh` builds with ffmpeg | ||
| 12925 | + /// `testsrc2` -- COLOUR BARS, ~90% of whose 16x16 cells have no intra | ||
| 12926 | + /// cost -- so every "film" column in the historical tables of this file | ||
| 12927 | + /// is that generator, not film. The real content is `film A`, `film B` | ||
| 12928 | + /// (native crops out of the two AV1 films the real-library manifest | ||
| 12929 | + /// names, at a pinned seek; added 2026-09-07) and the screen capture. A | ||
| 12930 | + /// decision only the bars rows support is not supported. | ||
| 12931 | + /// | ||
| 12932 | + /// All five gate clips are rows by default. `EC_AV1_NATIVE_FILM=1`, | ||
| 12919 | /// `EC_AV1_NATIVE_FILM4K=1` and `EC_AV1_NATIVE_SCREEN=1` select a subset: | 12933 | /// `EC_AV1_NATIVE_FILM4K=1` and `EC_AV1_NATIVE_SCREEN=1` select a subset: |
| 12920 | - /// setting any one of them keeps only the selected rows. | 12934 | + /// setting any one of them keeps only the selected rows (the two 1080p |
| 12935 | + /// rows, the two 2160p rows, the capture row respectively). A missing | ||
| 12936 | + /// real film SKIPs its row; it never fails the gate. | ||
| 12921 | #[test] | 12937 | #[test] |
| 12922 | #[ignore = "the native-resolution BD arm: minutes per row, needs ffmpeg"] | 12938 | #[ignore = "the native-resolution BD arm: minutes per row, needs ffmpeg"] |
| 12923 | fn bd_rate_screen_native() { | 12939 | fn bd_rate_screen_native() { |
| @@ -12934,22 +12950,61 @@ mod tests { | |||
| 12934 | ); | 12950 | ); |
| 12935 | // No selector at all means every clip; any selector means that subset. | 12951 | // No selector at all means every clip; any selector means that subset. |
| 12936 | let all = !(film || film4k || screen); | 12952 | let all = !(film || film4k || screen); |
| 12937 | - let mut clips: Vec<(String, String)> = Vec::new(); | 12953 | + // (label, path, seek). The two `testsrc2` fixtures are COLOUR BARS, |
| 12954 | + // not film -- they print as "bars" so no reader takes them for real | ||
| 12955 | + // content -- and the two rows below them are the real AV1 films. | ||
| 12956 | + let mut clips: Vec<(String, String, String)> = Vec::new(); | ||
| 12938 | for (want, label, file) in [ | 12957 | for (want, label, file) in [ |
| 12939 | - (all || film, "film 1080p", "h264-1080p-23.976-8bit.mp4"), | 12958 | + (all || film, "bars 1080p", "h264-1080p-23.976-8bit.mp4"), |
| 12940 | - (all || film4k, "film 2160p", "h264-2160p-23.976-8bit.mp4"), | 12959 | + (all || film4k, "bars 2160p", "h264-2160p-23.976-8bit.mp4"), |
| 12941 | ] { | 12960 | ] { |
| 12942 | if !want { | 12961 | if !want { |
| 12943 | continue; | 12962 | continue; |
| 12944 | } | 12963 | } |
| 12945 | let path = fixtures.join("video").join(file); | 12964 | let path = fixtures.join("video").join(file); |
| 12946 | match path.exists() { | 12965 | match path.exists() { |
| 12947 | - true => clips.push((label.to_string(), path.to_str().unwrap().to_string())), | 12966 | + true => { |
| 12967 | + clips.push((label.to_string(), path.to_str().unwrap().to_string(), "0".into())) | ||
| 12968 | + } | ||
| 12948 | false => eprintln!("SKIP {label}: {file} missing"), | 12969 | false => eprintln!("SKIP {label}: {file} missing"), |
| 12949 | } | 12970 | } |
| 12950 | } | 12971 | } |
| 12972 | + let manifest = std::fs::read_to_string(fixtures.join("real-library-manifest.tsv")); | ||
| 12973 | + // The real films, taken out of the real-library manifest by codec and | ||
| 12974 | + // coded width so no title and no home path lives in this file. Each | ||
| 12975 | + // seek is PINNED (class `seeded fixture not reproducible`) at a | ||
| 12976 | + // moving, non-black window -- a black leader would make every arm | ||
| 12977 | + // read +0.000 (class `flat sample window`). Both sources are 10-bit | ||
| 12978 | + // (one HDR10/PQ); the loader's plain `-pix_fmt yuv420p` conversion is | ||
| 12979 | + // what all three encoders see, so the comparison stays | ||
| 12980 | + // encoder-vs-encoder. | ||
| 12981 | + let pick = |width: &str| -> Option<String> { | ||
| 12982 | + let m = manifest.as_ref().ok()?; | ||
| 12983 | + m.lines() | ||
| 12984 | + .skip(1) | ||
| 12985 | + .map(|l| l.split('\t').collect::<Vec<_>>()) | ||
| 12986 | + .find(|f| { | ||
| 12987 | + f.len() > 4 | ||
| 12988 | + && f[2] == "av1" | ||
| 12989 | + && f[3] == width | ||
| 12990 | + && std::path::Path::new(f[0]).exists() | ||
| 12991 | + }) | ||
| 12992 | + .map(|f| f[0].to_string()) | ||
| 12993 | + }; | ||
| 12994 | + for (want, label, width, seek) in [ | ||
| 12995 | + (all || film, "film A (1080p source)", "1920", "00:35:00"), | ||
| 12996 | + (all || film4k, "film B (2160p HDR source)", "3840", "00:40:00"), | ||
| 12997 | + ] { | ||
| 12998 | + if !want { | ||
| 12999 | + continue; | ||
| 13000 | + } | ||
| 13001 | + match pick(width) { | ||
| 13002 | + Some(path) => clips.push((label.to_string(), path, seek.to_string())), | ||
| 13003 | + None => eprintln!("SKIP {label}: no {width}-wide AV1 source in the manifest"), | ||
| 13004 | + } | ||
| 13005 | + } | ||
| 12951 | if all || screen { | 13006 | if all || screen { |
| 12952 | - match std::fs::read_to_string(fixtures.join("real-library-manifest.tsv")) { | 13007 | + match &manifest { |
| 12953 | Ok(manifest) => match manifest | 13008 | Ok(manifest) => match manifest |
| 12954 | .lines() | 13009 | .lines() |
| 12955 | .skip(1) | 13010 | .skip(1) |
| @@ -12959,6 +13014,7 @@ mod tests { | |||
| 12959 | Some(p) => clips.push(( | 13014 | Some(p) => clips.push(( |
| 12960 | format!("screen capture ({})", p.rsplit('/').next().unwrap_or(p)), | 13015 | format!("screen capture ({})", p.rsplit('/').next().unwrap_or(p)), |
| 12961 | p.to_string(), | 13016 | p.to_string(), |
| 13017 | + "0".into(), | ||
| 12962 | )), | 13018 | )), |
| 12963 | None => eprintln!("SKIP screen capture: no OBS recording in the manifest exists"), | 13019 | None => eprintln!("SKIP screen capture: no OBS recording in the manifest exists"), |
| 12964 | }, | 13020 | }, |
| @@ -12998,7 +13054,7 @@ mod tests { | |||
| 12998 | ); | 13054 | ); |
| 12999 | println!("| clip | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e (noisy) |"); | 13055 | println!("| clip | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e (noisy) |"); |
| 13000 | println!("|---|---|---|---|---|"); | 13056 | println!("|---|---|---|---|---|"); |
| 13001 | - for (name, path) in &clips { | 13057 | + for (name, path, seek) in &clips { |
| 13002 | let fctx = &crate::decode::FrameCtx::new(); | 13058 | let fctx = &crate::decode::FrameCtx::new(); |
| 13003 | let Some((nw, nh)) = probe_dims(path) else { | 13059 | let Some((nw, nh)) = probe_dims(path) else { |
| 13004 | eprintln!("SKIP {name}: ffprobe gave no size"); | 13060 | eprintln!("SKIP {name}: ffprobe gave no size"); |
| @@ -13012,7 +13068,7 @@ mod tests { | |||
| 13012 | let (x, y) = ((nw - cw) / 2 & !1, (nh - ch) / 2 & !1); | 13068 | let (x, y) = ((nw - cw) / 2 & !1, (nh - ch) / 2 & !1); |
| 13013 | let source = clip_frames_vf( | 13069 | let source = clip_frames_vf( |
| 13014 | path, | 13070 | path, |
| 13015 | - "0", | 13071 | + seek, |
| 13016 | &format!("crop={cw}:{ch}:{x}:{y}"), | 13072 | &format!("crop={cw}:{ch}:{x}:{y}"), |
| 13017 | cw, | 13073 | cw, |
| 13018 | ch, | 13074 | ch, |
| @@ -13115,8 +13171,8 @@ mod tests { | |||
| 13115 | } | 13171 | } |
| 13116 | let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures"); | 13172 | let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures"); |
| 13117 | for (label, file) in [ | 13173 | for (label, file) in [ |
| 13118 | - ("film 1080p", "h264-1080p-23.976-8bit.mp4"), | 13174 | + ("bars 1080p", "h264-1080p-23.976-8bit.mp4"), |
| 13119 | - ("film 2160p", "h264-2160p-23.976-8bit.mp4"), | 13175 | + ("bars 2160p", "h264-2160p-23.976-8bit.mp4"), |
| 13120 | ] { | 13176 | ] { |
| 13121 | let path = fixtures.join("video").join(file); | 13177 | let path = fixtures.join("video").join(file); |
| 13122 | if !path.exists() { | 13178 | if !path.exists() { |