forge
Explore
Log in

Don't you dare go Hollow

A long-GOP native BD arm -- 48 frames, gop 48, film rows only

Browse files at this commit

c58bcaa0fdd235016d513f934d73a9483aecebe2Ahmet Kaan GümüşParent: 29892fb
  • test
    • a long-GOP native BD arm -- 48 frames, gop 48, film rows only
Show full message
test(av1): a long-GOP native BD arm -- 48 frames, gop 48, film rows only

bd_rate_screen_native codes 12 frames with gop=12 and encode_frames cuts a
mini-GOP at every key frame, so any Pyramid::mini_gop over 12 codes the SAME
stream there: the shipped 16 was measured as one hidden ARF per 12-picture
GOP, never as a real 16-picture group (class instrument-at-bound).

bd_rate_film_long_gop reuses native_gate_clips and the three-way exact decode
through a shared driver native_bd_arm(label, frames, films_only); ffmpeg gets
-g 48, which both reference wrappers honour (measured: 96 frames at -g 48 code
2 key frames under librav1e and libaom-av1 alike).
crates/ec-av1/src/encode.rsmodified+46 -4
@@ -14115,17 +14115,59 @@ mod tests {
1411514115 #[test]
1411614116 #[ignore = "the native-resolution BD arm: minutes per row, needs ffmpeg"]
1411714117 fn bd_rate_screen_native() {
14118+ native_bd_arm("bd_rate_screen_native", 12, false);
14119+ }
14120+
14121+ /// The LONG-GOP arm of the native BD gate: the same recipe as
14122+ /// [`bd_rate_screen_native`] over the two real film rows only, but 48
14123+ /// pictures with `gop = 48` (`encode_sequence` sets `gop =
14124+ /// pictures.len()`, and `external_ladder` passes ffmpeg `-g 48`, which
14125+ /// reaches libaom as `--kf-max-dist=48` and rav1e as
14126+ /// `key_frame_interval=48`), so every encoder sees one key frame and 47
14127+ /// inter pictures.
14128+ ///
14129+ /// WHY IT EXISTS: `bd_rate_screen_native` codes 12 frames with `gop =
14130+ /// 12`, and `Av1Encoder::encode_frames` cuts a mini-GOP at every key
14131+ /// frame (`encoder.rs`), so ANY [`crate::encoder::Pyramid::mini_gop`]
14132+ /// above 12 codes the same stream there -- the shipped `16` was measured
14133+ /// as "one hidden ARF per 12-picture GOP", never as a real 16-picture
14134+ /// group (class `instrument at bound` / `gate blind to feature`). The
14135+ /// user's exports are long GOPs, so the pyramid shape is decided here.
14136+ ///
14137+ /// cargo test -p ec-av1 --release --lib -- --ignored \
14138+ /// bd_rate_film_long_gop --nocapture
14139+ ///
14140+ /// `EC_AV1_NATIVE_FILM=1` keeps only film A, `EC_AV1_NATIVE_FILM4K=1`
14141+ /// only film B; `EC_AV1_PYRAMID=<mini_gop>:<arf>:<leaf>` picks the shape.
14142+ /// Read every row off the log's own "pyramid requested/effective" print,
14143+ /// never off the argument order of the runs (lane-pyr3 misattributed
14144+ /// three rows that way).
14145+ ///
14146+ /// Table: `lanes/pyr4.sweep.txt`.
14147+ #[test]
14148+ #[ignore = "the long-GOP native BD arm: ~7 minutes per film row, needs ffmpeg"]
14149+ fn bd_rate_film_long_gop() {
14150+ native_bd_arm("bd_rate_film_long_gop", 48, true);
14151+ }
14152+
14153+ /// The shared driver of the two native BD arms above: `frames` pictures
14154+ /// per row (the sequence's `gop` is the same number, so one key frame),
14155+ /// four quantizers, `films_only` dropping every row but the two real
14156+ /// films.
14157+ fn native_bd_arm(label: &str, frames: usize, films_only: bool) {
1411814158 if !have_ffmpeg() {
14119- eprintln!("SKIP bd_rate_screen_native: no ffmpeg");
14159+ eprintln!("SKIP {label}: no ffmpeg");
1412014160 return;
1412114161 }
14122- let clips = native_gate_clips();
14162+ let mut clips = native_gate_clips();
14163+ if films_only {
14164+ clips.retain(|(name, _, _)| name.starts_with("film "));
14165+ }
1412314166 if clips.is_empty() {
14124- eprintln!("SKIP bd_rate_screen_native: no clip");
14167+ eprintln!("SKIP {label}: no clip");
1412514168 return;
1412614169 }
1412714170
14128- let frames = 12usize;
1412914171 let aom_points: Vec<Vec<String>> = [5, 20, 35, 45]
1413014172 .iter()
1413114173 .map(|q| {