Merge branch 'lane-av1native2' (897fa938): the native-crop BD arm prints all three clips
Browse files at this commit1 changed file +44 -28
- crates/ec-av1/src/encode.rs +44 -28
crates/ec-av1/src/encode.rsmodified+44 -28
| @@ -10741,7 +10741,7 @@ mod tests { | |||
| 10741 | Some((f.next()?.trim().parse().ok()?, f.next()?.trim().parse().ok()?)) | 10741 | Some((f.next()?.trim().parse().ok()?, f.next()?.trim().parse().ok()?)) |
| 10742 | } | 10742 | } |
| 10743 | 10743 | ||
| 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 |
| 10745 | /// downscales the OBS capture to 640x384, which destroys exactly the | 10745 | /// downscales the OBS capture to 640x384, which destroys exactly the |
| 10746 | /// pixel-identical 16x16 repeats intrabc and (part of) the palette exist | 10746 | /// pixel-identical 16x16 repeats intrabc and (part of) the palette exist |
| 10747 | /// for (class `gate-recipe-confound`), so every screen-tool decision taken | 10747 | /// for (class `gate-recipe-confound`), so every screen-tool decision taken |
| @@ -10762,39 +10762,55 @@ mod tests { | |||
| 10762 | /// EC_AV1_INTRABC=1 ... same command # intra block copy | 10762 | /// EC_AV1_INTRABC=1 ... same command # intra block copy |
| 10763 | /// EC_AV1_PAL_MAXCOLORS=256 ... same command # palette bound | 10763 | /// EC_AV1_PAL_MAXCOLORS=256 ... same command # palette bound |
| 10764 | /// EC_AV1_TILES=1:1 EC_AV1_TILE_THREADS=4 ... # 2x2 tiles | 10764 | /// 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. | ||
| 10766 | #[test] | 10769 | #[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"] |
| 10768 | fn bd_rate_screen_native() { | 10771 | fn bd_rate_screen_native() { |
| 10769 | if !have_ffmpeg() { | 10772 | if !have_ffmpeg() { |
| 10770 | eprintln!("SKIP bd_rate_screen_native: no ffmpeg"); | 10773 | eprintln!("SKIP bd_rate_screen_native: no ffmpeg"); |
| 10771 | return; | 10774 | return; |
| 10772 | } | 10775 | } |
| 10773 | let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures"); | 10776 | 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); | ||
| 10774 | let mut clips: Vec<(String, String)> = Vec::new(); | 10785 | let mut clips: Vec<(String, String)> = Vec::new(); |
| 10775 | - match std::fs::read_to_string(fixtures.join("real-library-manifest.tsv")) { | 10786 | + for (want, label, file) in [ |
| 10776 | - Ok(manifest) => match manifest | 10787 | + (all || film, "film 1080p", "h264-1080p-23.976-8bit.mp4"), |
| 10777 | - .lines() | 10788 | + (all || film4k, "film 2160p", "h264-2160p-23.976-8bit.mp4"), |
| 10778 | - .skip(1) | 10789 | + ] { |
| 10779 | - .filter_map(|l| l.split('\t').next()) | 10790 | + if !want { |
| 10780 | - .find(|p| p.contains("/OBS/") && p.ends_with(".mkv") && std::path::Path::new(p).exists()) | 10791 | + continue; |
| 10781 | - { | 10792 | + } |
| 10782 | - Some(p) => clips.push(( | 10793 | + let path = fixtures.join("video").join(file); |
| 10783 | - format!("screen capture ({})", p.rsplit('/').next().unwrap_or(p)), | 10794 | + match path.exists() { |
| 10784 | - p.to_string(), | 10795 | + true => clips.push((label.to_string(), path.to_str().unwrap().to_string())), |
| 10785 | - )), | 10796 | + false => eprintln!("SKIP {label}: {file} missing"), |
| 10786 | - None => eprintln!("SKIP screen capture: no OBS recording in the manifest exists"), | 10797 | + } |
| 10787 | - }, | ||
| 10788 | - Err(e) => eprintln!("SKIP bd_rate_screen_native: no real-library manifest ({e})"), | ||
| 10789 | } | 10798 | } |
| 10790 | - // The film crop is an extra row, not a default-moving measurement. | 10799 | + if all || screen { |
| 10791 | - if std::env::var("EC_AV1_NATIVE_FILM").ok().as_deref() == Some("1") { | 10800 | + match std::fs::read_to_string(fixtures.join("real-library-manifest.tsv")) { |
| 10792 | - let path = fixtures.join("video").join("h264-1080p-23.976-8bit.mp4"); | 10801 | + Ok(manifest) => match manifest |
| 10793 | - if path.exists() { | 10802 | + .lines() |
| 10794 | - clips.push(( | 10803 | + .skip(1) |
| 10795 | - "film 1080p (native crop)".to_string(), | 10804 | + .filter_map(|l| l.split('\t').next()) |
| 10796 | - path.to_str().unwrap().to_string(), | 10805 | + .find(|p| p.contains("/OBS/") && p.ends_with(".mkv") && std::path::Path::new(p).exists()) |
| 10797 | - )); | 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})"), | ||
| 10798 | } | 10814 | } |
| 10799 | } | 10815 | } |
| 10800 | if clips.is_empty() { | 10816 | if clips.is_empty() { |
| @@ -10828,8 +10844,8 @@ mod tests { | |||
| 10828 | intrabc_enabled(), | 10844 | intrabc_enabled(), |
| 10829 | palette_max_colors(), | 10845 | palette_max_colors(), |
| 10830 | ); | 10846 | ); |
| 10831 | - println!("| clip | size | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e |"); | 10847 | + println!("| clip | ours PSNR/bytes per point | BD-rate vs libaom | BD-rate vs rav1e | wall ours:libaom:rav1e (noisy) |"); |
| 10832 | - println!("|---|---|---|---|---|---|"); | 10848 | + println!("|---|---|---|---|---|"); |
| 10833 | for (name, path) in &clips { | 10849 | for (name, path) in &clips { |
| 10834 | let fctx = &crate::decode::FrameCtx::new(); | 10850 | let fctx = &crate::decode::FrameCtx::new(); |
| 10835 | let Some((nw, nh)) = probe_dims(path) else { | 10851 | let Some((nw, nh)) = probe_dims(path) else { |
| @@ -10889,7 +10905,7 @@ mod tests { | |||
| 10889 | .collect::<Vec<_>>() | 10905 | .collect::<Vec<_>>() |
| 10890 | .join(", "); | 10906 | .join(", "); |
| 10891 | println!( | 10907 | 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 |", |
| 10893 | bd_rate(&aom, &ours) * 100.0, | 10909 | bd_rate(&aom, &ours) * 100.0, |
| 10894 | bd_rate(&rav1e, &ours) * 100.0, | 10910 | bd_rate(&rav1e, &ours) * 100.0, |
| 10895 | ); | 10911 | ); |