A long-GOP native BD arm -- 48 frames, gop 48, film rows only
Browse files at this commitc58bcaa0fdd235016d513f934d73a9483aecebe2Parent: 29892fb- test
- a long-GOP native BD arm -- 48 frames, gop 48, film rows only
1 changed file +46 -4
- crates/ec-av1/src/encode.rs +46 -4
crates/ec-av1/src/encode.rsmodified+46 -4
| @@ -14115,17 +14115,59 @@ mod tests { | |||
| 14115 | #[test] | 14115 | #[test] |
| 14116 | #[ignore = "the native-resolution BD arm: minutes per row, needs ffmpeg"] | 14116 | #[ignore = "the native-resolution BD arm: minutes per row, needs ffmpeg"] |
| 14117 | fn bd_rate_screen_native() { | 14117 | 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) { | ||
| 14118 | if !have_ffmpeg() { | 14158 | if !have_ffmpeg() { |
| 14119 | - eprintln!("SKIP bd_rate_screen_native: no ffmpeg"); | 14159 | + eprintln!("SKIP {label}: no ffmpeg"); |
| 14120 | return; | 14160 | return; |
| 14121 | } | 14161 | } |
| 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 | + } | ||
| 14123 | if clips.is_empty() { | 14166 | if clips.is_empty() { |
| 14124 | - eprintln!("SKIP bd_rate_screen_native: no clip"); | 14167 | + eprintln!("SKIP {label}: no clip"); |
| 14125 | return; | 14168 | return; |
| 14126 | } | 14169 | } |
| 14127 | 14170 | ||
| 14128 | - let frames = 12usize; | ||
| 14129 | let aom_points: Vec<Vec<String>> = [5, 20, 35, 45] | 14171 | let aom_points: Vec<Vec<String>> = [5, 20, 35, 45] |
| 14130 | .iter() | 14172 | .iter() |
| 14131 | .map(|q| { | 14173 | .map(|q| { |