Inter frames code tx_mode Select by default
Browse files at this commit2fa64f7487bafb91cbbf396e5e7d163546880b3bParent: 710cb11- feat
- inter frames code tx_mode Select by default
1 changed file +29 -9
- crates/ec-av1/src/encode.rs +29 -9
crates/ec-av1/src/encode.rsmodified+29 -9
| @@ -124,19 +124,22 @@ const SPLIT_INTER_8: bool = true; | ||
| 124 | 124 | /// Whether a key frame codes `tx_mode == TxMode::Select` and searches each |
| 125 | 125 | /// block's transform depth (lane-av1tx). On by default; `EC_AV1_TX_SELECT=0` |
| 126 | 126 | /// turns it off for an A/B on one build. |
| 127 | -/// Whether an INTER frame also carries `TxMode::Select` (lane-av1tx step 2: | |
| 128 | -/// one `txfm_split` flag per inter block, a searched `tx_depth` on every | |
| 129 | -/// intra block inside the inter frame). OFF by default and opt-in through | |
| 130 | -/// `EC_AV1_TX_SELECT_INTER=1`: the syntax is written but a stream carrying it | |
| 131 | -/// is refused by dav1d and by this crate's own decoder, and the first | |
| 132 | -/// diverging symbol was not located inside the lane's budget. Key frames are | |
| 133 | -/// unaffected -- they are byte-exact with [`tx_select`] on. | |
| 127 | +/// Whether an INTER frame also carries `TxMode::Select`: an inter block's | |
| 128 | +/// residual as one transform over the whole block or as the four transforms | |
| 129 | +/// of half the side ([`commit_inter_luma`]), a searched `tx_depth` on every | |
| 130 | +/// intra block inside the inter frame. ON since lane-av1tx2, which found why | |
| 131 | +/// the streams desynced -- the writer counted the [`crate::decode:: | |
| 132 | +/// TXFM_CTX_INIT`] band value of a neighbour outside the tile, where the | |
| 133 | +/// reader drops the term -- and measured the split search: BD-rate vs libaom | |
| 134 | +/// 233.5 -> 226.1 and 170.9 -> 167.4 on two clips, 212.8 -> 213.2 on the | |
| 135 | +/// third, for 13% encode wall. `EC_AV1_TX_SELECT_INTER=0` turns it off for an | |
| 136 | +/// A/B on one build. | |
| 134 | 137 | fn tx_select_inter() -> bool { |
| 135 | 138 | static ON: std::sync::OnceLock<bool> = std::sync::OnceLock::new(); |
| 136 | 139 | *ON.get_or_init(|| { |
| 137 | - matches!( | |
| 140 | + !matches!( | |
| 138 | 141 | std::env::var("EC_AV1_TX_SELECT_INTER").as_deref(), |
| 139 | - Ok("1") | Ok("on") | |
| 142 | + Ok("0") | Ok("off") | |
| 140 | 143 | ) |
| 141 | 144 | }) |
| 142 | 145 | } |
| @@ -7014,6 +7017,23 @@ mod tests { | ||
| 7014 | 7017 | .collect::<Vec<_>>() |
| 7015 | 7018 | .join(" ") |
| 7016 | 7019 | ); |
| 7020 | + // And which var-tx depth this clip's INTER blocks resolved to | |
| 7021 | + // (lane-av1tx2): 0 is one transform over the whole block, 1 its | |
| 7022 | + // four halves. | |
| 7023 | + let splits = take_inter_tx_split_hits(); | |
| 7024 | + let split_total: usize = splits.iter().sum(); | |
| 7025 | + eprintln!( | |
| 7026 | + "{name}: inter var-tx depths {}", | |
| 7027 | + splits | |
| 7028 | + .iter() | |
| 7029 | + .enumerate() | |
| 7030 | + .map(|(d, &n)| format!( | |
| 7031 | + "{d}={n} ({:.1}%)", | |
| 7032 | + 100.0 * n as f64 / split_total.max(1) as f64 | |
| 7033 | + )) | |
| 7034 | + .collect::<Vec<_>>() | |
| 7035 | + .join(" ") | |
| 7036 | + ); | |
| 7017 | 7037 | let (aom, aom_wall) = |
| 7018 | 7038 | external_ladder(&source, width, height, "libaom-av1", &aom_points); |
| 7019 | 7039 | let (rav1e, rav1e_wall) = |