forge
Explore
Log in

Don't you dare go Hollow

The native BD arm covers all three gate clips in one table

Browse files at this commit

706758b4e1836307c847fddbdd4fd7d0a1b954d5Ahmet Kaan GümüşParent: 4a3f924
  • test
    • the native BD arm covers all three gate clips in one table
Show full message
test(av1): the native BD arm covers all three gate clips in one table

The native-crop arm only ever measured the screen capture, with the 1080p
film behind an opt-in and the 2160p film absent, so the two content classes
whose default-gate numbers are worst were never read at a resolution the
encoder's tools can serve. It now runs all three clips by default -- both
films and the capture, each a centred, superblock-aligned 1920x1024 crop of
its own source, never scaled -- printing the default gate's own columns with
the crop size folded into the clip cell. The three per-clip selectors survive
as a subset filter (EC_AV1_NATIVE_FILM / _FILM4K / _SCREEN): setting any one
keeps only those rows, setting none keeps all. The wall column is labelled
noisy; it is not a measurement on a loaded box.

No encoder change: the default gate reads +83.0 / +99.9 / +54.5 as before.
crates/ec-av1/src/encode.rsmodified+44 -28
@@ -10741,7 +10741,7 @@ mod tests {
1074110741 Some((f.next()?.trim().parse().ok()?, f.next()?.trim().parse().ok()?))
1074210742 }
1074310743
10744- /// The NATIVE-resolution screen arm of the BD gate. The default gate
10744+ /// The NATIVE-resolution arm of the BD gate (all three clips). The default gate
1074510745 /// downscales the OBS capture to 640x384, which destroys exactly the
1074610746 /// pixel-identical 16x16 repeats intrabc and (part of) the palette exist
1074710747 /// for (class `gate-recipe-confound`), so every screen-tool decision taken
@@ -10762,39 +10762,55 @@ mod tests {
1076210762 /// EC_AV1_INTRABC=1 ... same command # intra block copy
1076310763 /// EC_AV1_PAL_MAXCOLORS=256 ... same command # palette bound
1076410764 /// EC_AV1_TILES=1:1 EC_AV1_TILE_THREADS=4 ... # 2x2 tiles
10765- /// EC_AV1_NATIVE_FILM=1 ... same command # + a film crop row
10765+ ///
10766+ /// All three gate clips are rows by default. `EC_AV1_NATIVE_FILM=1`,
10767+ /// `EC_AV1_NATIVE_FILM4K=1` and `EC_AV1_NATIVE_SCREEN=1` select a subset:
10768+ /// setting any one of them keeps only the selected rows.
1076610769 #[test]
10767- #[ignore = "the native-resolution screen BD arm: minutes per row, needs ffmpeg"]
10770+ #[ignore = "the native-resolution BD arm: minutes per row, needs ffmpeg"]
1076810771 fn bd_rate_screen_native() {
1076910772 if !have_ffmpeg() {
1077010773 eprintln!("SKIP bd_rate_screen_native: no ffmpeg");
1077110774 return;
1077210775 }
1077310776 let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures");
10777+ let on = |k: &str| std::env::var(k).ok().as_deref() == Some("1");
10778+ let (film, film4k, screen) = (
10779+ on("EC_AV1_NATIVE_FILM"),
10780+ on("EC_AV1_NATIVE_FILM4K"),
10781+ on("EC_AV1_NATIVE_SCREEN"),
10782+ );
10783+ // No selector at all means every clip; any selector means that subset.
10784+ let all = !(film || film4k || screen);
1077410785 let mut clips: Vec<(String, String)> = Vec::new();
10775- match std::fs::read_to_string(fixtures.join("real-library-manifest.tsv")) {
10776- Ok(manifest) => match manifest
10777- .lines()
10778- .skip(1)
10779- .filter_map(|l| l.split('\t').next())
10780- .find(|p| p.contains("/OBS/") && p.ends_with(".mkv") && std::path::Path::new(p).exists())
10781- {
10782- Some(p) => clips.push((
10783- format!("screen capture ({})", p.rsplit('/').next().unwrap_or(p)),
10784- p.to_string(),
10785- )),
10786- None => eprintln!("SKIP screen capture: no OBS recording in the manifest exists"),
10787- },
10788- Err(e) => eprintln!("SKIP bd_rate_screen_native: no real-library manifest ({e})"),
10786+ for (want, label, file) in [
10787+ (all || film, "film 1080p", "h264-1080p-23.976-8bit.mp4"),
10788+ (all || film4k, "film 2160p", "h264-2160p-23.976-8bit.mp4"),
10789+ ] {
10790+ if !want {
10791+ continue;
10792+ }
10793+ let path = fixtures.join("video").join(file);
10794+ match path.exists() {
10795+ true => clips.push((label.to_string(), path.to_str().unwrap().to_string())),
10796+ false => eprintln!("SKIP {label}: {file} missing"),
10797+ }
1078910798 }
10790- // The film crop is an extra row, not a default-moving measurement.
10791- if std::env::var("EC_AV1_NATIVE_FILM").ok().as_deref() == Some("1") {
10792- let path = fixtures.join("video").join("h264-1080p-23.976-8bit.mp4");
10793- if path.exists() {
10794- clips.push((
10795- "film 1080p (native crop)".to_string(),
10796- path.to_str().unwrap().to_string(),
10797- ));
10799+ if all || screen {
10800+ match std::fs::read_to_string(fixtures.join("real-library-manifest.tsv")) {
10801+ Ok(manifest) => match manifest
10802+ .lines()
10803+ .skip(1)
10804+ .filter_map(|l| l.split('\t').next())
10805+ .find(|p| p.contains("/OBS/") && p.ends_with(".mkv") && std::path::Path::new(p).exists())
10806+ {
10807+ Some(p) => clips.push((
10808+ format!("screen capture ({})", p.rsplit('/').next().unwrap_or(p)),
10809+ p.to_string(),
10810+ )),
10811+ None => eprintln!("SKIP screen capture: no OBS recording in the manifest exists"),
10812+ },
10813+ Err(e) => eprintln!("SKIP screen capture: no real-library manifest ({e})"),
1079810814 }
1079910815 }
1080010816 if clips.is_empty() {
@@ -10828,8 +10844,8 @@ mod tests {
1082810844 intrabc_enabled(),
1082910845 palette_max_colors(),
1083010846 );
10831- println!("| clip | size | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e |");
10832- println!("|---|---|---|---|---|---|");
10847+ println!("| clip | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e (noisy) |");
10848+ println!("|---|---|---|---|---|");
1083310849 for (name, path) in &clips {
1083410850 let fctx = &crate::decode::FrameCtx::new();
1083510851 let Some((nw, nh)) = probe_dims(path) else {
@@ -10889,7 +10905,7 @@ mod tests {
1088910905 .collect::<Vec<_>>()
1089010906 .join(", ");
1089110907 println!(
10892- "| {name} | {cw}x{ch} | {points} | {:+.1}% | {:+.1}% | {ours_wall:.1}s:{aom_wall:.1}s:{rav1e_wall:.1}s |",
10908+ "| {name} {cw}x{ch} | {points} | {:+.1}% | {:+.1}% | {ours_wall:.1}s:{aom_wall:.1}s:{rav1e_wall:.1}s |",
1089310909 bd_rate(&aom, &ours) * 100.0,
1089410910 bd_rate(&rav1e, &ours) * 100.0,
1089510911 );