Merge branch 'lane-txset2' (4b758da8): the inter luma tx_type search (IDTX vs DCT), screen-gated; unconditional it loses 2 dB on the bars rows at equal bytes, which points at the type search's pricing
Browse files at this commit6 changed files +603 -43
- crates/ec-av1/src/encode.rs +294 -39
- crates/ec-av1/src/encoder.rs +84 -0
- crates/ec-av1/src/speed.rs +12 -0
- crates/ec-av1/src/tile.rs +4 -1
- crates/ec-av1/src/transform.rs +11 -3
- lanes/txset2.report.md +198 -0
crates/ec-av1/src/encode.rsmodified+294 -39
| @@ -41,10 +41,11 @@ use crate::tile::{ | |||
| 41 | BlockCoeffs, Coeff, INTRA_MODE_CTX, InterInfo, InterMode, Quadrant, Superblock, partition_bits, | 41 | BlockCoeffs, Coeff, INTRA_MODE_CTX, InterInfo, InterMode, Quadrant, Superblock, partition_bits, |
| 42 | }; | 42 | }; |
| 43 | use crate::transform::{ | 43 | use crate::transform::{ |
| 44 | - TxType, dequant_and_inverse_typed_wh, forward_and_quantize, | 44 | + TxType, dequant_and_inverse_typed_wh, forward_and_quantize_typed, |
| 45 | - forward_and_quantize_scaled, forward_and_quantize_typed, | ||
| 46 | forward_and_quantize_typed_scaled, | 45 | forward_and_quantize_typed_scaled, |
| 47 | }; | 46 | }; |
| 47 | +#[cfg(test)] | ||
| 48 | +use crate::transform::forward_and_quantize; | ||
| 48 | 49 | ||
| 49 | /// The side of the larger of the two luma blocks this encoder codes, in | 50 | /// The side of the larger of the two luma blocks this encoder codes, in |
| 50 | /// samples. | 51 | /// samples. |
| @@ -285,6 +286,102 @@ pub(crate) fn tx_type_candidates(set: TxbSet, screen: bool) -> &'static [TxType] | |||
| 285 | } | 286 | } |
| 286 | } | 287 | } |
| 287 | 288 | ||
| 289 | +/// The transform types an INTER luma transform unit of `set` may be coded | ||
| 290 | +/// with (lane-txset2). Under this encoder's `reduced_tx_set` header bit every | ||
| 291 | +/// inter luma set at 16x16 and below is the two-type `TX_SET_INTER_3` | ||
| 292 | +/// (`IDTX`, `DCT_DCT`) and 32x32 is `EXT_TX_SET_DCT_IDTX` -- the same two | ||
| 293 | +/// types, a symbol the writer already codes and never varied. 64x64 codes no | ||
| 294 | +/// `tx_type` symbol at all, so it is not offered one. | ||
| 295 | +/// SCREEN CONTENT ONLY, measured (12-frame `bd_rate_screen_native`): the | ||
| 296 | +/// capture row goes +20.8/-30.1 -> +20.1/-30.4 while the two synthetic bars | ||
| 297 | +/// rows lose TWENTY points (-1.0/-16.8 -> +23.1/+3.3 and +9.4/-12.7 -> | ||
| 298 | +/// +31.2/+3.7) and film B 0.3 -- the `local-rd-on-references` class at its | ||
| 299 | +/// loudest, and restricting the offer to 16x16 and below does not soften it | ||
| 300 | +/// (`le16`: +22.9/+3.1, +31.6/+4.0). So this takes the same content gate the | ||
| 301 | +/// intra search, palette and intrabc stand behind: a non-screen frame is | ||
| 302 | +/// byte-identical to the encoder before the lane. | ||
| 303 | +/// | ||
| 304 | +/// `EC_AV1_TXSET_INTER`: `0`/`off`, `screen` (screen frames only), `le16` | ||
| 305 | +/// (16x16 and below, the sizes libaom's own census picks a non-`DCT_DCT` | ||
| 306 | +/// inter type on -- it never takes `IDTX` at 32x32 on film B), anything else | ||
| 307 | +/// on for every frame at every size. | ||
| 308 | +pub(crate) fn inter_tx_type_candidates(set: TxbSet, screen: bool) -> &'static [TxType] { | ||
| 309 | + const DCT: [TxType; 1] = [TxType::DctDct]; | ||
| 310 | + const INTER3: [TxType; 2] = [TxType::DctDct, TxType::Idtx]; | ||
| 311 | + let mode = inter_tx_type_search(); | ||
| 312 | + let on = match mode { | ||
| 313 | + InterTxSearch::Off => false, | ||
| 314 | + InterTxSearch::Screen => screen, | ||
| 315 | + InterTxSearch::All | InterTxSearch::Le16 => true, | ||
| 316 | + }; | ||
| 317 | + match set { | ||
| 318 | + TxbSet::Luma32Inter if on && mode != InterTxSearch::Le16 => &INTER3, | ||
| 319 | + TxbSet::Luma16Inter | TxbSet::Luma8Inter | TxbSet::Luma4Inter if on => &INTER3, | ||
| 320 | + _ => &DCT, | ||
| 321 | + } | ||
| 322 | +} | ||
| 323 | + | ||
| 324 | +#[derive(Clone, Copy, PartialEq)] | ||
| 325 | +pub(crate) enum InterTxSearch { | ||
| 326 | + Off, | ||
| 327 | + Screen, | ||
| 328 | + /// 16x16 and below only. | ||
| 329 | + Le16, | ||
| 330 | + All, | ||
| 331 | +} | ||
| 332 | + | ||
| 333 | +/// A PROCESS-GLOBAL [`inter_tx_type_search`] override that wins over both the | ||
| 334 | +/// environment and the preset (`u8::MAX` = unset), the shape | ||
| 335 | +/// [`set_deltaq_res`] has: the lever is OFF at every preset, so the witness | ||
| 336 | +/// that has to see a non-`DCT_DCT` inter unit turns it on through this while | ||
| 337 | +/// holding [`crate::speed::knob_write`]. | ||
| 338 | +static INTER_TX_OVERRIDE: std::sync::atomic::AtomicU8 = | ||
| 339 | + std::sync::atomic::AtomicU8::new(u8::MAX); | ||
| 340 | + | ||
| 341 | +/// Sets [`INTER_TX_OVERRIDE`]; `None` clears it. | ||
| 342 | +#[allow(dead_code)] // set only from the `#[cfg(test)]` gates | ||
| 343 | +pub(crate) fn set_inter_tx_search(on: Option<bool>) { | ||
| 344 | + INTER_TX_OVERRIDE.store( | ||
| 345 | + on.map_or(u8::MAX, u8::from), | ||
| 346 | + std::sync::atomic::Ordering::Relaxed, | ||
| 347 | + ); | ||
| 348 | +} | ||
| 349 | + | ||
| 350 | +fn inter_tx_type_search() -> InterTxSearch { | ||
| 351 | + match INTER_TX_OVERRIDE.load(std::sync::atomic::Ordering::Relaxed) { | ||
| 352 | + 0 => return InterTxSearch::Off, | ||
| 353 | + 1 => return InterTxSearch::All, | ||
| 354 | + _ => {} | ||
| 355 | + } | ||
| 356 | + static ENV: std::sync::LazyLock<Option<InterTxSearch>> = std::sync::LazyLock::new(|| { | ||
| 357 | + crate::envflags::var("EC_AV1_TXSET_INTER").ok().map(|v| match v.as_str() { | ||
| 358 | + "0" | "off" => InterTxSearch::Off, | ||
| 359 | + "screen" => InterTxSearch::Screen, | ||
| 360 | + "le16" => InterTxSearch::Le16, | ||
| 361 | + _ => InterTxSearch::All, | ||
| 362 | + }) | ||
| 363 | + }); | ||
| 364 | + ENV.unwrap_or_else(|| { | ||
| 365 | + if crate::speed::at(&crate::speed::TX_TYPE_SEARCH_INTER) { | ||
| 366 | + InterTxSearch::Screen | ||
| 367 | + } else { | ||
| 368 | + InterTxSearch::Off | ||
| 369 | + } | ||
| 370 | + }) | ||
| 371 | +} | ||
| 372 | + | ||
| 373 | +/// The inter luma [`TxbSet`] a `tx`-sided transform unit reads, `None` for the | ||
| 374 | +/// 64-point one (it codes no `tx_type` symbol). | ||
| 375 | +fn inter_luma_set(tx: usize) -> Option<TxbSet> { | ||
| 376 | + Some(match tx { | ||
| 377 | + 4 => TxbSet::Luma4Inter, | ||
| 378 | + 8 => TxbSet::Luma8Inter, | ||
| 379 | + 16 => TxbSet::Luma16Inter, | ||
| 380 | + 32 => TxbSet::Luma32Inter, | ||
| 381 | + _ => return None, | ||
| 382 | + }) | ||
| 383 | +} | ||
| 384 | + | ||
| 288 | fn tx_type_search() -> bool { | 385 | fn tx_type_search() -> bool { |
| 289 | static ENV: std::sync::LazyLock<Option<bool>> = std::sync::LazyLock::new(|| { | 386 | static ENV: std::sync::LazyLock<Option<bool>> = std::sync::LazyLock::new(|| { |
| 290 | crate::envflags::var("EC_AV1_TXSET") | 387 | crate::envflags::var("EC_AV1_TXSET") |
| @@ -2262,6 +2359,28 @@ impl Plane<'_> { | |||
| 2262 | base_q_idx: u8, | 2359 | base_q_idx: u8, |
| 2263 | deadzone: f64, | 2360 | deadzone: f64, |
| 2264 | set: TxbSet, | 2361 | set: TxbSet, |
| 2362 | + ) -> Trial { | ||
| 2363 | + self.code_from_prediction_typed( | ||
| 2364 | + x, y, side, prediction, skip, base_q_idx, deadzone, set, TxType::DctDct, | ||
| 2365 | + ) | ||
| 2366 | + } | ||
| 2367 | + | ||
| 2368 | + /// [`Self::code_from_prediction`] coding the residual with a NAMED | ||
| 2369 | + /// transform type (lane-txset2): the inter luma sets carry a two-type | ||
| 2370 | + /// alphabet (`TX_SET_INTER_3`, `IDTX`/`DCT_DCT`) the writer already codes | ||
| 2371 | + /// a symbol for, and [`commit_inter_luma`] prices both through this. | ||
| 2372 | + #[allow(clippy::too_many_arguments)] | ||
| 2373 | + fn code_from_prediction_typed( | ||
| 2374 | + &self, | ||
| 2375 | + x: usize, | ||
| 2376 | + y: usize, | ||
| 2377 | + side: usize, | ||
| 2378 | + prediction: &[u8], | ||
| 2379 | + skip: bool, | ||
| 2380 | + base_q_idx: u8, | ||
| 2381 | + deadzone: f64, | ||
| 2382 | + set: TxbSet, | ||
| 2383 | + tx_type: TxType, | ||
| 2265 | ) -> Trial { | 2384 | ) -> Trial { |
| 2266 | if skip { | 2385 | if skip { |
| 2267 | let sse = self.block_sse(x, y, side, prediction); | 2386 | let sse = self.block_sse(x, y, side, prediction); |
| @@ -2298,16 +2417,20 @@ impl Plane<'_> { | |||
| 2298 | // lane-rdoq, as in [`Self::trial_typed`]. | 2417 | // lane-rdoq, as in [`Self::trial_typed`]. |
| 2299 | let (levels, rdoq_bits) = if rdoq_on() { | 2418 | let (levels, rdoq_bits) = if rdoq_on() { |
| 2300 | let (mut levels, scaled) = | 2419 | let (mut levels, scaled) = |
| 2301 | - forward_and_quantize_scaled(residual, side, 8, i32::from(base_q_idx), deadzone); | 2420 | + forward_and_quantize_typed_scaled( |
| 2421 | + residual, side, 8, i32::from(base_q_idx), deadzone, tx_type, | ||
| 2422 | + ); | ||
| 2302 | let (skip_ctx, sign_ctx) = self.coef_ctx(x, y, side, set); | 2423 | let (skip_ctx, sign_ctx) = self.coef_ctx(x, y, side, set); |
| 2303 | let bits = crate::tile::rdoq( | 2424 | let bits = crate::tile::rdoq( |
| 2304 | &mut levels, &scaled, side, base_q_idx, set, skip_ctx, sign_ctx, rdoq_lambda(), | 2425 | &mut levels, &scaled, side, base_q_idx, set, skip_ctx, sign_ctx, rdoq_lambda(), |
| 2305 | - TxType::DctDct, | 2426 | + tx_type, |
| 2306 | ); | 2427 | ); |
| 2307 | (levels, Some(bits)) | 2428 | (levels, Some(bits)) |
| 2308 | } else { | 2429 | } else { |
| 2309 | ( | 2430 | ( |
| 2310 | - forward_and_quantize(residual, side, 8, i32::from(base_q_idx), deadzone), | 2431 | + forward_and_quantize_typed( |
| 2432 | + residual, side, 8, i32::from(base_q_idx), deadzone, tx_type, | ||
| 2433 | + ), | ||
| 2311 | None, | 2434 | None, |
| 2312 | ) | 2435 | ) |
| 2313 | }; | 2436 | }; |
| @@ -2320,7 +2443,7 @@ impl Plane<'_> { | |||
| 2320 | i32::from(base_q_idx), | 2443 | i32::from(base_q_idx), |
| 2321 | 0, | 2444 | 0, |
| 2322 | 0, | 2445 | 0, |
| 2323 | - TxType::DctDct, | 2446 | + tx_type, |
| 2324 | ); | 2447 | ); |
| 2325 | #[cfg(test)] | 2448 | #[cfg(test)] |
| 2326 | stage_since(2, t); | 2449 | stage_since(2, t); |
| @@ -2357,12 +2480,13 @@ impl Plane<'_> { | |||
| 2357 | } else { | 2480 | } else { |
| 2358 | { | 2481 | { |
| 2359 | let (skip_ctx, sign_ctx) = self.coef_ctx(x, y, side, set); | 2482 | let (skip_ctx, sign_ctx) = self.coef_ctx(x, y, side, set); |
| 2360 | - crate::tile::coeff_bits( | 2483 | + crate::tile::coeff_bits_typed( |
| 2361 | &levels, | 2484 | &levels, |
| 2362 | set, | 2485 | set, |
| 2363 | crate::decode::q_ctx_of(base_q_idx), | 2486 | crate::decode::q_ctx_of(base_q_idx), |
| 2364 | skip_ctx, | 2487 | skip_ctx, |
| 2365 | sign_ctx, | 2488 | sign_ctx, |
| 2489 | + tx_type, | ||
| 2366 | ) | 2490 | ) |
| 2367 | } | 2491 | } |
| 2368 | }; | 2492 | }; |
| @@ -3673,6 +3797,17 @@ fn tx_depth_bits(side: usize, depth: usize) -> f64 { | |||
| 3673 | } | 3797 | } |
| 3674 | } | 3798 | } |
| 3675 | 3799 | ||
| 3800 | +/// [`TX_TYPE_HITS`] for the INTER luma units (lane-txset2), counted apart so | ||
| 3801 | +/// the intra witness's fire count stays its own. | ||
| 3802 | +pub(crate) static INTER_TX_TYPE_HITS: [std::sync::atomic::AtomicUsize; 16] = | ||
| 3803 | + [const { std::sync::atomic::AtomicUsize::new(0) }; 16]; | ||
| 3804 | + | ||
| 3805 | +/// Reads [`INTER_TX_TYPE_HITS`] and zeroes it. | ||
| 3806 | +#[cfg(test)] | ||
| 3807 | +pub(crate) fn take_inter_tx_type_hits() -> [usize; 16] { | ||
| 3808 | + std::array::from_fn(|t| INTER_TX_TYPE_HITS[t].swap(0, std::sync::atomic::Ordering::Relaxed)) | ||
| 3809 | +} | ||
| 3810 | + | ||
| 3676 | /// How many luma transform units resolved to each [`TxType`], indexed by the | 3811 | /// How many luma transform units resolved to each [`TxType`], indexed by the |
| 3677 | /// enum's own discriminant (lane-txset): the fire count a witness asserts on, | 3812 | /// enum's own discriminant (lane-txset): the fire count a witness asserts on, |
| 3678 | /// and the instrument that says which types the search actually reaches. | 3813 | /// and the instrument that says which types the search actually reaches. |
| @@ -3821,7 +3956,52 @@ fn commit_inter_luma( | |||
| 3821 | // `comp_group_idx == 0` average). `None` is the single-reference block. | 3956 | // `comp_group_idx == 0` average). `None` is the single-reference block. |
| 3822 | second: Option<((i32, i32), (&[u16], usize, usize, usize))>, | 3957 | second: Option<((i32, i32), (&[u16], usize, usize, usize))>, |
| 3823 | fctx: &crate::decode::FrameCtx, | 3958 | fctx: &crate::decode::FrameCtx, |
| 3824 | -) -> (Vec<i32>, u8, f64) { | 3959 | +) -> (Vec<i32>, u8, f64, Vec<TxType>) { |
| 3960 | + // lane-txset2 step 1: the whole-block (depth 0) residual picks its own | ||
| 3961 | + // type out of the two-type inter set the writer already codes a symbol | ||
| 3962 | + // for, priced the same way the intra search is (sse + lambda * bits, the | ||
| 3963 | + // bits carrying the `tx_type` symbol itself through RDOQ). A skipped | ||
| 3964 | + // block codes no residual and the 64-point transform names no type. | ||
| 3965 | + let mut flat_typed: Option<Trial> = None; | ||
| 3966 | + let mut flat_type = TxType::DctDct; | ||
| 3967 | + if !skip { | ||
| 3968 | + if let Some(fset) = inter_luma_set(side) { | ||
| 3969 | + let cost = |t: &Trial| t.sse + search.lambda * t.bits; | ||
| 3970 | + for &tx_type in inter_tx_type_candidates(fset, search.screen) { | ||
| 3971 | + if tx_type == TxType::DctDct { | ||
| 3972 | + continue; | ||
| 3973 | + } | ||
| 3974 | + let candidate = match second { | ||
| 3975 | + Some((mv1, ref1)) => mc_trial_compound_typed( | ||
| 3976 | + luma, x, y, side, (mv, mv1), true, reference, ref1, search.base_q_idx, | ||
| 3977 | + search.deadzone, fset, tx_type, fctx, | ||
| 3978 | + ), | ||
| 3979 | + None => mc_trial_typed( | ||
| 3980 | + luma, x, y, side, mv, true, reference.0, reference.1, reference.2, | ||
| 3981 | + reference.3, false, search.base_q_idx, search.deadzone, fset, tx_type, | ||
| 3982 | + fctx, | ||
| 3983 | + ), | ||
| 3984 | + }; | ||
| 3985 | + if cost(&candidate) < cost(flat_typed.as_ref().unwrap_or(flat)) { | ||
| 3986 | + flat_type = tx_type; | ||
| 3987 | + flat_typed = Some(candidate); | ||
| 3988 | + } | ||
| 3989 | + } | ||
| 3990 | + } | ||
| 3991 | + } | ||
| 3992 | + // Counted at the return points, so the census names the types the block | ||
| 3993 | + // really CODES -- a split unit's winner that the flat cost then beats was | ||
| 3994 | + // never written (class `counter from refused stream`). | ||
| 3995 | + let count = |types: &[TxType]| { | ||
| 3996 | + for &t in types { | ||
| 3997 | + INTER_TX_TYPE_HITS[t as usize].fetch_add(1, std::sync::atomic::Ordering::Relaxed); | ||
| 3998 | + } | ||
| 3999 | + }; | ||
| 4000 | + let flat_ref: &Trial = flat_typed.as_ref().unwrap_or(flat); | ||
| 4001 | + // What the caller's already-counted `flat` cost has to be corrected by | ||
| 4002 | + // when a non-`DCT_DCT` type won it, the same way the split delta below is. | ||
| 4003 | + let flat_gain = (flat_ref.sse + search.lambda * flat_ref.bits) | ||
| 4004 | + - (flat.sse + search.lambda * flat.bits); | ||
| 3825 | let eligible = tx_select() | 4005 | let eligible = tx_select() |
| 3826 | && tx_select_inter() | 4006 | && tx_select_inter() |
| 3827 | && !skip | 4007 | && !skip |
| @@ -3831,8 +4011,9 @@ fn commit_inter_luma( | |||
| 3831 | && x + side <= luma.true_width | 4011 | && x + side <= luma.true_width |
| 3832 | && y + side <= luma.true_height; | 4012 | && y + side <= luma.true_height; |
| 3833 | if !eligible { | 4013 | if !eligible { |
| 3834 | - luma.commit(x, y, side, flat); | 4014 | + luma.commit(x, y, side, flat_ref); |
| 3835 | - return (flat.levels.clone(), 0, 0.0); | 4015 | + count(&[flat_type]); |
| 4016 | + return (flat_ref.levels.clone(), 0, flat_gain, vec![flat_type]); | ||
| 3836 | } | 4017 | } |
| 3837 | let tx = side / 2; | 4018 | let tx = side / 2; |
| 3838 | let set = if tx >= 32 { | 4019 | let set = if tx >= 32 { |
| @@ -3850,19 +4031,32 @@ fn commit_inter_luma( | |||
| 3850 | // context is the neighbour magnitude table ([`Plane::coef_ctx`]) -- and | 4031 | // context is the neighbour magnitude table ([`Plane::coef_ctx`]) -- and |
| 3851 | // each unit's own commit publishes what the next one reads, coding order. | 4032 | // each unit's own commit publishes what the next one reads, coding order. |
| 3852 | luma.ctx.tu_split = true; | 4033 | luma.ctx.tu_split = true; |
| 4034 | + // One type per unit in the writer's own raster order (tile.rs | ||
| 4035 | + // `write_luma_tus`), all `DCT_DCT` when nothing else is offered. | ||
| 4036 | + let mut split_types = vec![TxType::DctDct; 4]; | ||
| 3853 | for tu_row in 0..2 { | 4037 | for tu_row in 0..2 { |
| 3854 | for tu_col in 0..2 { | 4038 | for tu_col in 0..2 { |
| 3855 | let (tu_x, tu_y) = (x + tu_col * tx, y + tu_row * tx); | 4039 | let (tu_x, tu_y) = (x + tu_col * tx, y + tu_row * tx); |
| 3856 | - let trial = match second { | 4040 | + let unit = |tx_type: TxType| match second { |
| 3857 | - Some((mv1, ref1)) => mc_trial_compound( | 4041 | + Some((mv1, ref1)) => mc_trial_compound_typed( |
| 3858 | luma, tu_x, tu_y, tx, (mv, mv1), true, reference, ref1, | 4042 | luma, tu_x, tu_y, tx, (mv, mv1), true, reference, ref1, |
| 3859 | - search.base_q_idx, search.deadzone, set, fctx, | 4043 | + search.base_q_idx, search.deadzone, set, tx_type, fctx, |
| 3860 | ), | 4044 | ), |
| 3861 | - None => mc_trial( | 4045 | + None => mc_trial_typed( |
| 3862 | luma, tu_x, tu_y, tx, mv, true, reference.0, reference.1, reference.2, | 4046 | luma, tu_x, tu_y, tx, mv, true, reference.0, reference.1, reference.2, |
| 3863 | - reference.3, false, search.base_q_idx, search.deadzone, set, fctx, | 4047 | + reference.3, false, search.base_q_idx, search.deadzone, set, tx_type, fctx, |
| 3864 | ), | 4048 | ), |
| 3865 | }; | 4049 | }; |
| 4050 | + let mut best: Option<(f64, TxType, Trial)> = None; | ||
| 4051 | + for &tx_type in inter_tx_type_candidates(set, search.screen) { | ||
| 4052 | + let candidate = unit(tx_type); | ||
| 4053 | + let cost = candidate.sse + search.lambda * candidate.bits; | ||
| 4054 | + if best.as_ref().is_none_or(|(b, _, _)| cost < *b) { | ||
| 4055 | + best = Some((cost, tx_type, candidate)); | ||
| 4056 | + } | ||
| 4057 | + } | ||
| 4058 | + let (_, tx_type, trial) = best.expect("the candidate list is never empty"); | ||
| 4059 | + split_types[tu_row * 2 + tu_col] = tx_type; | ||
| 3866 | sse += trial.sse; | 4060 | sse += trial.sse; |
| 3867 | bits += trial.bits; | 4061 | bits += trial.bits; |
| 3868 | for row in 0..tx { | 4062 | for row in 0..tx { |
| @@ -3874,7 +4068,7 @@ fn commit_inter_luma( | |||
| 3874 | } | 4068 | } |
| 3875 | luma.ctx.tu_split = false; | 4069 | luma.ctx.tu_split = false; |
| 3876 | let split_cost = sse + search.lambda * (bits + txfm_split_bits(side, 1)); | 4070 | let split_cost = sse + search.lambda * (bits + txfm_split_bits(side, 1)); |
| 3877 | - let flat_cost = flat.sse + search.lambda * (flat.bits + txfm_split_bits(side, 0)); | 4071 | + let flat_cost = flat_ref.sse + search.lambda * (flat_ref.bits + txfm_split_bits(side, 0)); |
| 3878 | let class = usize::from(side == BLOCK) * 4 + usize::from(second.is_some()) * 2; | 4072 | let class = usize::from(side == BLOCK) * 4 + usize::from(second.is_some()) * 2; |
| 3879 | // The depth census has a leaf row and a 32x32 row and no 64 one, so the | 4073 | // The depth census has a leaf row and a 32x32 row and no 64 one, so the |
| 3880 | // 64x64 root counts itself ([`take_b64_var_tx_hits`]) instead of landing | 4074 | // 64x64 root counts itself ([`take_b64_var_tx_hits`]) instead of landing |
| @@ -3887,13 +4081,15 @@ fn commit_inter_luma( | |||
| 3887 | if counted { | 4081 | if counted { |
| 3888 | INTER_TX_SPLIT_HITS[class + 1].fetch_add(1, std::sync::atomic::Ordering::Relaxed); | 4082 | INTER_TX_SPLIT_HITS[class + 1].fetch_add(1, std::sync::atomic::Ordering::Relaxed); |
| 3889 | } | 4083 | } |
| 3890 | - return (levels, 1, split_cost - flat_cost); | 4084 | + count(&split_types); |
| 4085 | + return (levels, 1, flat_gain + split_cost - flat_cost, split_types); | ||
| 3891 | } | 4086 | } |
| 3892 | if counted { | 4087 | if counted { |
| 3893 | INTER_TX_SPLIT_HITS[class].fetch_add(1, std::sync::atomic::Ordering::Relaxed); | 4088 | INTER_TX_SPLIT_HITS[class].fetch_add(1, std::sync::atomic::Ordering::Relaxed); |
| 3894 | } | 4089 | } |
| 3895 | - luma.commit(x, y, side, flat); | 4090 | + luma.commit(x, y, side, flat_ref); |
| 3896 | - (flat.levels.clone(), 0, 0.0) | 4091 | + count(&[flat_type]); |
| 4092 | + (flat_ref.levels.clone(), 0, flat_gain, vec![flat_type]) | ||
| 3897 | } | 4093 | } |
| 3898 | 4094 | ||
| 3899 | /// The largest distinct-colour count a block may hold and still be offered a | 4095 | /// The largest distinct-colour count a block may hold and still be offered a |
| @@ -5932,11 +6128,11 @@ fn code_square_inter( | |||
| 5932 | ) | 6128 | ) |
| 5933 | }) | 6129 | }) |
| 5934 | }); | 6130 | }); |
| 5935 | - let (levels, tx_depth, dcost) = if motion_won != 0 | 6131 | + let (levels, tx_depth, dcost, luma_tx_types) = if motion_won != 0 |
| 5936 | || (info.ref1.is_some() && second.is_none()) | 6132 | || (info.ref1.is_some() && second.is_none()) |
| 5937 | { | 6133 | { |
| 5938 | luma.commit(x, y, side, &luma_new); | 6134 | luma.commit(x, y, side, &luma_new); |
| 5939 | - (luma_new.levels.clone(), 0, 0.0) | 6135 | + (luma_new.levels.clone(), 0, 0.0, Vec::new()) |
| 5940 | } else { | 6136 | } else { |
| 5941 | commit_inter_luma( | 6137 | commit_inter_luma( |
| 5942 | luma, (x, y), side, info.mv, | 6138 | luma, (x, y), side, info.mv, |
| @@ -5962,7 +6158,7 @@ fn code_square_inter( | |||
| 5962 | palette: None, | 6158 | palette: None, |
| 5963 | palette_uv: None, | 6159 | palette_uv: None, |
| 5964 | tx_depth, | 6160 | tx_depth, |
| 5965 | - luma_tx_types: Vec::new(), | 6161 | + luma_tx_types, |
| 5966 | inter: Some(info), | 6162 | inter: Some(info), |
| 5967 | motion_mode: motion_won, | 6163 | motion_mode: motion_won, |
| 5968 | }, | 6164 | }, |
| @@ -5979,13 +6175,13 @@ fn code_square_inter( | |||
| 5979 | census_add(9, 1); | 6175 | census_add(9, 1); |
| 5980 | } | 6176 | } |
| 5981 | if inter_cost < intra_cost { | 6177 | if inter_cost < intra_cost { |
| 5982 | - let (levels, tx_depth, dcost) = commit_inter_luma( | 6178 | + let (levels, tx_depth, dcost, luma_tx_types) = commit_inter_luma( |
| 5983 | luma, (x, y), side, mv, (ref_luma.0.as_slice(), ref_luma.1, ref_luma.2, ref_luma.3), search, &luma_trial, skip, None, fctx, | 6179 | luma, (x, y), side, mv, (ref_luma.0.as_slice(), ref_luma.1, ref_luma.2, ref_luma.3), search, &luma_trial, skip, None, fctx, |
| 5984 | ); | 6180 | ); |
| 5985 | chroma[0].commit(x / 2, y / 2, side / 2, &u); | 6181 | chroma[0].commit(x / 2, y / 2, side / 2, &u); |
| 5986 | chroma[1].commit(x / 2, y / 2, side / 2, &v); | 6182 | chroma[1].commit(x / 2, y / 2, side / 2, &v); |
| 5987 | (BlockCoeffs { | 6183 | (BlockCoeffs { |
| 5988 | - luma_tx_types: Vec::new(), | 6184 | + luma_tx_types, |
| 5989 | angle_delta_y: 0, | 6185 | angle_delta_y: 0, |
| 5990 | cfl_alphas: None, | 6186 | cfl_alphas: None, |
| 5991 | filter_intra: None, | 6187 | filter_intra: None, |
| @@ -7817,7 +8013,34 @@ fn mc_trial( | |||
| 7817 | skip: bool, | 8013 | skip: bool, |
| 7818 | base_q_idx: u8, | 8014 | base_q_idx: u8, |
| 7819 | deadzone: f64, | 8015 | deadzone: f64, |
| 7820 | - set: TxbSet, fctx: &crate::decode::FrameCtx, | 8016 | + set: TxbSet, |
| 8017 | + fctx: &crate::decode::FrameCtx, | ||
| 8018 | +) -> Trial { | ||
| 8019 | + mc_trial_typed( | ||
| 8020 | + plane, x, y, side, mv, luma, reference, stride, ref_width, ref_height, skip, base_q_idx, | ||
| 8021 | + deadzone, set, TxType::DctDct, fctx, | ||
| 8022 | + ) | ||
| 8023 | +} | ||
| 8024 | + | ||
| 8025 | +/// [`mc_trial`] coding its residual with a named transform type (lane-txset2). | ||
| 8026 | +#[allow(clippy::too_many_arguments)] | ||
| 8027 | +fn mc_trial_typed( | ||
| 8028 | + plane: &Plane, | ||
| 8029 | + x: usize, | ||
| 8030 | + y: usize, | ||
| 8031 | + side: usize, | ||
| 8032 | + mv: (i32, i32), | ||
| 8033 | + luma: bool, | ||
| 8034 | + reference: &[u16], | ||
| 8035 | + stride: usize, | ||
| 8036 | + ref_width: usize, | ||
| 8037 | + ref_height: usize, | ||
| 8038 | + skip: bool, | ||
| 8039 | + base_q_idx: u8, | ||
| 8040 | + deadzone: f64, | ||
| 8041 | + set: TxbSet, | ||
| 8042 | + tx_type: TxType, | ||
| 8043 | + fctx: &crate::decode::FrameCtx, | ||
| 7821 | ) -> Trial { | 8044 | ) -> Trial { |
| 7822 | let x_q4 = mv_to_q4(x, mv.1, luma); | 8045 | let x_q4 = mv_to_q4(x, mv.1, luma); |
| 7823 | let y_q4 = mv_to_q4(y, mv.0, luma); | 8046 | let y_q4 = mv_to_q4(y, mv.0, luma); |
| @@ -7846,7 +8069,9 @@ fn mc_trial( | |||
| 7846 | for (dst, &src) in prediction.iter_mut().zip(prediction16.iter()) { | 8069 | for (dst, &src) in prediction.iter_mut().zip(prediction16.iter()) { |
| 7847 | *dst = src as u8; | 8070 | *dst = src as u8; |
| 7848 | } | 8071 | } |
| 7849 | - plane.code_from_prediction(x, y, side, prediction, skip, base_q_idx, deadzone, set) | 8072 | + plane.code_from_prediction_typed( |
| 8073 | + x, y, side, prediction, skip, base_q_idx, deadzone, set, tx_type, | ||
| 8074 | + ) | ||
| 7850 | } | 8075 | } |
| 7851 | 8076 | ||
| 7852 | /// [`mc_trial`]'s compound counterpart (spec 7.11.3.1's compound path): both | 8077 | /// [`mc_trial`]'s compound counterpart (spec 7.11.3.1's compound path): both |
| @@ -7857,6 +8082,28 @@ fn mc_trial( | |||
| 7857 | /// block, so the encoder's reconstruction is the decoder's. | 8082 | /// block, so the encoder's reconstruction is the decoder's. |
| 7858 | #[allow(clippy::too_many_arguments)] | 8083 | #[allow(clippy::too_many_arguments)] |
| 7859 | fn mc_trial_compound( | 8084 | fn mc_trial_compound( |
| 8085 | + plane: &Plane, | ||
| 8086 | + x: usize, | ||
| 8087 | + y: usize, | ||
| 8088 | + side: usize, | ||
| 8089 | + mvs: ((i32, i32), (i32, i32)), | ||
| 8090 | + luma: bool, | ||
| 8091 | + ref0: (&[u16], usize, usize, usize), | ||
| 8092 | + ref1: (&[u16], usize, usize, usize), | ||
| 8093 | + base_q_idx: u8, | ||
| 8094 | + deadzone: f64, | ||
| 8095 | + set: TxbSet, | ||
| 8096 | + fctx: &crate::decode::FrameCtx, | ||
| 8097 | +) -> Trial { | ||
| 8098 | + mc_trial_compound_typed( | ||
| 8099 | + plane, x, y, side, mvs, luma, ref0, ref1, base_q_idx, deadzone, set, TxType::DctDct, fctx, | ||
| 8100 | + ) | ||
| 8101 | +} | ||
| 8102 | + | ||
| 8103 | +/// [`mc_trial_compound`] coding its residual with a named transform type | ||
| 8104 | +/// (lane-txset2). | ||
| 8105 | +#[allow(clippy::too_many_arguments)] | ||
| 8106 | +fn mc_trial_compound_typed( | ||
| 7860 | plane: &Plane, | 8107 | plane: &Plane, |
| 7861 | x: usize, | 8108 | x: usize, |
| 7862 | y: usize, | 8109 | y: usize, |
| @@ -7867,7 +8114,9 @@ fn mc_trial_compound( | |||
| 7867 | ref1: (&[u16], usize, usize, usize), | 8114 | ref1: (&[u16], usize, usize, usize), |
| 7868 | base_q_idx: u8, | 8115 | base_q_idx: u8, |
| 7869 | deadzone: f64, | 8116 | deadzone: f64, |
| 7870 | - set: TxbSet, fctx: &crate::decode::FrameCtx, | 8117 | + set: TxbSet, |
| 8118 | + tx_type: TxType, | ||
| 8119 | + fctx: &crate::decode::FrameCtx, | ||
| 7871 | ) -> Trial { | 8120 | ) -> Trial { |
| 7872 | let mut inter0 = [0i32; BLOCK * BLOCK]; | 8121 | let mut inter0 = [0i32; BLOCK * BLOCK]; |
| 7873 | let mut inter1 = [0i32; BLOCK * BLOCK]; | 8122 | let mut inter1 = [0i32; BLOCK * BLOCK]; |
| @@ -7896,7 +8145,9 @@ fn mc_trial_compound( | |||
| 7896 | for (dst, &src) in prediction.iter_mut().zip(blended16.iter()) { | 8145 | for (dst, &src) in prediction.iter_mut().zip(blended16.iter()) { |
| 7897 | *dst = src as u8; | 8146 | *dst = src as u8; |
| 7898 | } | 8147 | } |
| 7899 | - plane.code_from_prediction(x, y, side, prediction, false, base_q_idx, deadzone, set) | 8148 | + plane.code_from_prediction_typed( |
| 8149 | + x, y, side, prediction, false, base_q_idx, deadzone, set, tx_type, | ||
| 8150 | + ) | ||
| 7900 | } | 8151 | } |
| 7901 | 8152 | ||
| 7902 | /// Codes one 32x32 block of an inter frame as whichever costs least of: each | 8153 | /// Codes one 32x32 block of an inter frame as whichever costs least of: each |
| @@ -8262,7 +8513,7 @@ fn search_skip_64( | |||
| 8262 | // The residual arm's luma levels and the `txfm_split` depth the writer | 8513 | // The residual arm's luma levels and the `txfm_split` depth the writer |
| 8263 | // codes: depth 0 is the TX_64X64 corner in 32x32 coordinates, depth 1 is | 8514 | // codes: depth 0 is the TX_64X64 corner in 32x32 coordinates, depth 1 is |
| 8264 | // four TX_32X32 units in 64x64 ones. | 8515 | // four TX_32X32 units in 64x64 ones. |
| 8265 | - let mut luma_levels: Option<(Vec<i32>, u8)> = None; | 8516 | + let mut luma_levels: Option<(Vec<i32>, u8, Vec<TxType>)> = None; |
| 8266 | if residual { | 8517 | if residual { |
| 8267 | let sets = [TxbSet::Luma64, TxbSet::Chroma32, TxbSet::Chroma32]; | 8518 | let sets = [TxbSet::Luma64, TxbSet::Chroma32, TxbSet::Chroma32]; |
| 8268 | let residual_trials = [0usize, 1, 2].map(|plane| { | 8519 | let residual_trials = [0usize, 1, 2].map(|plane| { |
| @@ -8288,7 +8539,7 @@ fn search_skip_64( | |||
| 8288 | // four TX_32X32 units of `txfm_split = 1`, taken by the same | 8539 | // four TX_32X32 units of `txfm_split = 1`, taken by the same |
| 8289 | // `commit_inter_luma` every other inter block's is (it commits the | 8540 | // `commit_inter_luma` every other inter block's is (it commits the |
| 8290 | // winner and hands back the cost it took off the flat arm). | 8541 | // winner and hands back the cost it took off the flat arm). |
| 8291 | - let (levels, depth, gain) = if b64_var_tx() { | 8542 | + let (levels, depth, gain, tx_types) = if b64_var_tx() { |
| 8292 | let second = info.ref1.and_then(|r1| { | 8543 | let second = info.ref1.and_then(|r1| { |
| 8293 | compound.iter().find(|(r, _, _)| *r == r1).map(|&(_, g, _)| { | 8544 | compound.iter().find(|(r, _, _)| *r == r1).map(|&(_, g, _)| { |
| 8294 | ( | 8545 | ( |
| @@ -8311,7 +8562,7 @@ fn search_skip_64( | |||
| 8311 | fctx, | 8562 | fctx, |
| 8312 | ) | 8563 | ) |
| 8313 | } else { | 8564 | } else { |
| 8314 | - (residual_trials[0].levels.clone(), 0, 0.0) | 8565 | + (residual_trials[0].levels.clone(), 0, 0.0, Vec::new()) |
| 8315 | }; | 8566 | }; |
| 8316 | let cost = residual_trials.iter().map(|t| t.sse).sum::<f64>() | 8567 | let cost = residual_trials.iter().map(|t| t.sse).sum::<f64>() |
| 8317 | + search.lambda * (syntax + unskip + coeff_bits) | 8568 | + search.lambda * (syntax + unskip + coeff_bits) |
| @@ -8321,7 +8572,7 @@ fn search_skip_64( | |||
| 8321 | if depth == 1 { | 8572 | if depth == 1 { |
| 8322 | B64_VAR_TX_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); | 8573 | B64_VAR_TX_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); |
| 8323 | } | 8574 | } |
| 8324 | - luma_levels = Some((levels, depth)); | 8575 | + luma_levels = Some((levels, depth, tx_types)); |
| 8325 | chosen = (cost, false, residual_trials); | 8576 | chosen = (cost, false, residual_trials); |
| 8326 | } | 8577 | } |
| 8327 | } | 8578 | } |
| @@ -8342,11 +8593,15 @@ fn search_skip_64( | |||
| 8342 | // The chroma grids are whole TX_32X32; the luma one is the | 8593 | // The chroma grids are whole TX_32X32; the luma one is the |
| 8343 | // 64-point transform's coded 32x32 corner at depth 0 and the | 8594 | // 64-point transform's coded 32x32 corner at depth 0 and the |
| 8344 | // whole 64-sided block at depth 1 (lane-b64b). | 8595 | // whole 64-sided block at depth 1 (lane-b64b). |
| 8345 | - tx_depth: luma_levels.as_ref().map_or(0, |&(_, d)| d), | 8596 | + tx_depth: luma_levels.as_ref().map_or(0, |(_, d, _)| *d), |
| 8597 | + luma_tx_types: match (skip, &luma_levels) { | ||
| 8598 | + (false, Some((_, _, types))) => types.clone(), | ||
| 8599 | + _ => Vec::new(), | ||
| 8600 | + }, | ||
| 8346 | luma: match (skip, &luma_levels) { | 8601 | luma: match (skip, &luma_levels) { |
| 8347 | (true, _) => Vec::new(), | 8602 | (true, _) => Vec::new(), |
| 8348 | - (false, Some((levels, 1))) => coeffs(levels, SUPERBLOCK), | 8603 | + (false, Some((levels, 1, _))) => coeffs(levels, SUPERBLOCK), |
| 8349 | - (false, Some((levels, _))) => coeffs(levels, BLOCK), | 8604 | + (false, Some((levels, _, _))) => coeffs(levels, BLOCK), |
| 8350 | (false, None) => coeffs(&trials[0].levels, BLOCK), | 8605 | (false, None) => coeffs(&trials[0].levels, BLOCK), |
| 8351 | }, | 8606 | }, |
| 8352 | u: if skip { Vec::new() } else { coeffs(&trials[1].levels, side / 2) }, | 8607 | u: if skip { Vec::new() } else { coeffs(&trials[1].levels, side / 2) }, |
| @@ -9200,7 +9455,7 @@ fn search_inter_block( | |||
| 9200 | // compound winner the same offer behind `EC_AV1_COMP_VARTX`. An OBMC/warp | 9455 | // compound winner the same offer behind `EC_AV1_COMP_VARTX`. An OBMC/warp |
| 9201 | // winner still commits flat: `commit_inter_luma` re-predicts each unit by | 9456 | // winner still commits flat: `commit_inter_luma` re-predicts each unit by |
| 9202 | // plain translation, which is not the prediction it was priced from. | 9457 | // plain translation, which is not the prediction it was priced from. |
| 9203 | - let (levels, tx_depth, dcost) = match best.inter.filter(|_| motion_won == 0) { | 9458 | + let (levels, tx_depth, dcost, luma_tx_types) = match best.inter.filter(|_| motion_won == 0) { |
| 9204 | Some(info) => { | 9459 | Some(info) => { |
| 9205 | let own = match extra.iter().find(|(r, _, _)| *r == info.ref_frame) { | 9460 | let own = match extra.iter().find(|(r, _, _)| *r == info.ref_frame) { |
| 9206 | Some(&(_, g, _)) => (g.y.as_slice(), g.width, luma.true_width, luma.true_height), | 9461 | Some(&(_, g, _)) => (g.y.as_slice(), g.width, luma.true_width, luma.true_height), |
| @@ -9217,7 +9472,7 @@ fn search_inter_block( | |||
| 9217 | match info.ref1.is_some() && second.is_none() { | 9472 | match info.ref1.is_some() && second.is_none() { |
| 9218 | true => { | 9473 | true => { |
| 9219 | luma.commit(x, y, BLOCK, &best.luma); | 9474 | luma.commit(x, y, BLOCK, &best.luma); |
| 9220 | - (best.luma.levels.clone(), 0, 0.0) | 9475 | + (best.luma.levels.clone(), 0, 0.0, Vec::new()) |
| 9221 | } | 9476 | } |
| 9222 | false => commit_inter_luma( | 9477 | false => commit_inter_luma( |
| 9223 | luma, (x, y), BLOCK, info.mv, own, search, &best.luma, best.skip, second, | 9478 | luma, (x, y), BLOCK, info.mv, own, search, &best.luma, best.skip, second, |
| @@ -9227,14 +9482,14 @@ fn search_inter_block( | |||
| 9227 | } | 9482 | } |
| 9228 | None => { | 9483 | None => { |
| 9229 | luma.commit(x, y, BLOCK, &best.luma); | 9484 | luma.commit(x, y, BLOCK, &best.luma); |
| 9230 | - (best.luma.levels.clone(), 0, 0.0) | 9485 | + (best.luma.levels.clone(), 0, 0.0, Vec::new()) |
| 9231 | } | 9486 | } |
| 9232 | }; | 9487 | }; |
| 9233 | chroma[0].commit(x / 2, y / 2, BLOCK / 2, &best.u); | 9488 | chroma[0].commit(x / 2, y / 2, BLOCK / 2, &best.u); |
| 9234 | chroma[1].commit(x / 2, y / 2, BLOCK / 2, &best.v); | 9489 | chroma[1].commit(x / 2, y / 2, BLOCK / 2, &best.v); |
| 9235 | ( | 9490 | ( |
| 9236 | BlockCoeffs { | 9491 | BlockCoeffs { |
| 9237 | - luma_tx_types: Vec::new(), | 9492 | + luma_tx_types, |
| 9238 | angle_delta_y: 0, | 9493 | angle_delta_y: 0, |
| 9239 | cfl_alphas: None, | 9494 | cfl_alphas: None, |
| 9240 | filter_intra: None, | 9495 | filter_intra: None, |
crates/ec-av1/src/encoder.rsmodified+84 -0
| @@ -3727,6 +3727,90 @@ mod tests { | |||
| 3727 | eprintln!("tx_type witness: hits {hits:?}, {} bytes", stream.len()); | 3727 | eprintln!("tx_type witness: hits {hits:?}, {} bytes", stream.len()); |
| 3728 | } | 3728 | } |
| 3729 | 3729 | ||
| 3730 | + /// lane-txset2's witness: an INTER frame's luma transform units take BOTH | ||
| 3731 | + /// types of the two-type inter set the writer already codes a symbol for | ||
| 3732 | + /// (`TX_SET_INTER_3`: `IDTX` and `DCT_DCT`) at least once -- the fire | ||
| 3733 | + /// count, class `gate-blind-to-feature` -- and both decoders reconstruct | ||
| 3734 | + /// every frame sample-exact from the `tx_type` symbols that name them. | ||
| 3735 | + /// Before this lane every inter luma unit was coded `DCT_DCT`. | ||
| 3736 | + #[test] | ||
| 3737 | + fn an_inter_clip_codes_both_inter_set_tx_types_both_decoders_read_exactly() { | ||
| 3738 | + // The lever is OFF at every preset (`speed::TX_TYPE_SEARCH_INTER`), so | ||
| 3739 | + // this turns it on process-globally under the same exclusive lock the | ||
| 3740 | + // presets take. | ||
| 3741 | + let _knobs = crate::speed::knob_write(); | ||
| 3742 | + let _gate_lock = crate::stream::tests::lock_gate_counters(); | ||
| 3743 | + crate::encode::set_inter_tx_search(Some(true)); | ||
| 3744 | + let (width, height) = (320usize, 192usize); | ||
| 3745 | + // Sharp steps that MOVE: the motion-compensated residual along a | ||
| 3746 | + // moving edge is exactly where the identity transform beats a DCT, | ||
| 3747 | + // and the flat plateaus between them predict to nothing at all. | ||
| 3748 | + let sources: Vec<Picture> = (0..4) | ||
| 3749 | + .map(|t| { | ||
| 3750 | + let mut p = test_card(width, height, t * 3); | ||
| 3751 | + for y in 0..height { | ||
| 3752 | + for x in 0..width { | ||
| 3753 | + let v = match ((x + t * 5) / 16 % 2, (y + t * 3) / 16 % 2) { | ||
| 3754 | + (0, 0) => 16u16, | ||
| 3755 | + (1, 0) => 235, | ||
| 3756 | + (0, 1) => ((x + t) % 64 * 3) as u16, | ||
| 3757 | + _ => ((y + t) % 64 * 3) as u16, | ||
| 3758 | + }; | ||
| 3759 | + p.y[y * width + x] = v; | ||
| 3760 | + } | ||
| 3761 | + } | ||
| 3762 | + p | ||
| 3763 | + }) | ||
| 3764 | + .collect(); | ||
| 3765 | + let config = EncoderConfig { | ||
| 3766 | + width, | ||
| 3767 | + height, | ||
| 3768 | + base_q_idx: 90, | ||
| 3769 | + gop: 4, | ||
| 3770 | + colour: Colour::Bt709Limited, | ||
| 3771 | + tile_cols_log2: 0, | ||
| 3772 | + tile_rows_log2: 0, | ||
| 3773 | + }; | ||
| 3774 | + let mut enc = Av1Encoder::new(config).unwrap(); | ||
| 3775 | + let _ = crate::encode::take_inter_tx_type_hits(); | ||
| 3776 | + let mut stream = Vec::new(); | ||
| 3777 | + for packet in encode_all(&mut enc, &sources) { | ||
| 3778 | + stream.extend_from_slice(&packet.data); | ||
| 3779 | + } | ||
| 3780 | + let hits = crate::encode::take_inter_tx_type_hits(); | ||
| 3781 | + crate::encode::set_inter_tx_search(None); | ||
| 3782 | + for (name, ty) in [ | ||
| 3783 | + ("DCT_DCT", crate::transform::TxType::DctDct), | ||
| 3784 | + ("IDTX", crate::transform::TxType::Idtx), | ||
| 3785 | + ] { | ||
| 3786 | + assert!( | ||
| 3787 | + hits[ty as usize] > 0, | ||
| 3788 | + "no inter luma transform unit was CODED {name}: {hits:?}" | ||
| 3789 | + ); | ||
| 3790 | + } | ||
| 3791 | + let ours = crate::stream::decode_stream(&stream).expect("our decoder"); | ||
| 3792 | + assert_eq!(ours.len(), sources.len(), "our decoder's frames"); | ||
| 3793 | + if have_ffmpeg() { | ||
| 3794 | + let theirs = ffmpeg_decode_luma(&stream, width, height); | ||
| 3795 | + assert_eq!(theirs.len(), sources.len(), "ffmpeg's frames"); | ||
| 3796 | + for (i, (a, b)) in ours.iter().zip(&theirs).enumerate() { | ||
| 3797 | + let got: Vec<u8> = a.y.iter().map(|&v| v as u8).collect(); | ||
| 3798 | + if let Some(at) = got.iter().zip(b).position(|(x, y)| x != y) { | ||
| 3799 | + panic!( | ||
| 3800 | + "frame {i}: luma differs first at ({}, {}): ours {} vs ffmpeg {}", | ||
| 3801 | + at % width, | ||
| 3802 | + at / width, | ||
| 3803 | + got[at], | ||
| 3804 | + b[at], | ||
| 3805 | + ); | ||
| 3806 | + } | ||
| 3807 | + } | ||
| 3808 | + } else { | ||
| 3809 | + eprintln!("SKIP the ffmpeg half: no ffmpeg"); | ||
| 3810 | + } | ||
| 3811 | + eprintln!("inter tx_type witness: hits {hits:?}, {} bytes", stream.len()); | ||
| 3812 | + } | ||
| 3813 | + | ||
| 3730 | /// Every SHIPPED SPEED PRESET codes a stream both decoders reconstruct | 3814 | /// Every SHIPPED SPEED PRESET codes a stream both decoders reconstruct |
| 3731 | /// sample-exact -- ours and ffmpeg's -- and codes a DIFFERENT stream from | 3815 | /// sample-exact -- ours and ffmpeg's -- and codes a DIFFERENT stream from |
| 3732 | /// its neighbour (a preset that changes no byte is a preset that buys no | 3816 | /// its neighbour (a preset that changes no byte is a preset that buys no |
crates/ec-av1/src/speed.rsmodified+12 -0
| @@ -491,6 +491,18 @@ pub(crate) const TX_TYPE_SEARCH: [bool; 11] = [ | |||
| 491 | true, true, true, true, true, true, true, false, false, false, false, | 491 | true, true, true, true, true, true, true, false, false, false, false, |
| 492 | ]; | 492 | ]; |
| 493 | 493 | ||
| 494 | +/// `tx_type_candidates`: whether an INTER luma transform unit searches the | ||
| 495 | +/// two-type `TX_SET_INTER_3` (`IDTX` vs `DCT_DCT`) the writer already codes a | ||
| 496 | +/// symbol for, instead of always coding `DCT_DCT` (lane-txset2). On at the | ||
| 497 | +/// presets that carry the intra search, and SCREEN CONTENT ONLY on top of it | ||
| 498 | +/// (measured, 12-frame `bd_rate_screen_native`: the capture goes | ||
| 499 | +/// +20.8/-30.1 -> +20.1/-30.4 while both synthetic bars rows lose twenty | ||
| 500 | +/// points and film B 0.3 -- see `encode::inter_tx_type_candidates`). | ||
| 501 | +/// `EC_AV1_TXSET_INTER` overrides. | ||
| 502 | +pub(crate) const TX_TYPE_SEARCH_INTER: [bool; 11] = [ | ||
| 503 | + true, true, true, true, true, true, true, false, false, false, false, | ||
| 504 | +]; | ||
| 505 | + | ||
| 494 | /// `filter_search`: whether the deblock ladder's +-1/+-2 refinement stage runs. | 506 | /// `filter_search`: whether the deblock ladder's +-1/+-2 refinement stage runs. |
| 495 | pub(crate) const DEBLOCK_REFINE: [bool; 11] = [ | 507 | pub(crate) const DEBLOCK_REFINE: [bool; 11] = [ |
| 496 | true, true, true, true, true, true, true, false, false, false, false, | 508 | true, true, true, true, true, true, true, false, false, false, false, |
crates/ec-av1/src/tile.rsmodified+4 -1
| @@ -4724,6 +4724,9 @@ fn scan_of(side: usize) -> &'static Vec<u16> { | |||
| 4724 | } | 4724 | } |
| 4725 | } | 4725 | } |
| 4726 | 4726 | ||
| 4727 | +/// [`coeff_bits_typed`] at `DCT_DCT`, the only type the test-only pricers | ||
| 4728 | +/// ([`predicted_coeff_bits`]) model. | ||
| 4729 | +#[cfg(test)] | ||
| 4727 | pub(crate) fn coeff_bits( | 4730 | pub(crate) fn coeff_bits( |
| 4728 | grid: &[i32], | 4731 | grid: &[i32], |
| 4729 | set: TxbSet, | 4732 | set: TxbSet, |
| @@ -4734,7 +4737,7 @@ pub(crate) fn coeff_bits( | |||
| 4734 | coeff_bits_typed(grid, set, q_ctx, skip_ctx, sign_ctx, TxType::DctDct) | 4737 | coeff_bits_typed(grid, set, q_ctx, skip_ctx, sign_ctx, TxType::DctDct) |
| 4735 | } | 4738 | } |
| 4736 | 4739 | ||
| 4737 | -/// [`coeff_bits`] for levels a named transform type produced: the `tx_type` | 4740 | +/// What levels a named transform type produced cost: the `tx_type` |
| 4738 | /// symbol is part of what the block spends, so a search comparing types has | 4741 | /// symbol is part of what the block spends, so a search comparing types has |
| 4739 | /// to see each one's own symbol priced (lane-txset). | 4742 | /// to see each one's own symbol priced (lane-txset). |
| 4740 | pub(crate) fn coeff_bits_typed( | 4743 | pub(crate) fn coeff_bits_typed( |
crates/ec-av1/src/transform.rsmodified+11 -3
| @@ -2160,7 +2160,10 @@ mod tests { | |||
| 2160 | /// and the mode search would read as a loss. | 2160 | /// and the mode search would read as a loss. |
| 2161 | #[test] | 2161 | #[test] |
| 2162 | fn a_typed_forward_round_trips_like_the_dct_one() { | 2162 | fn a_typed_forward_round_trips_like_the_dct_one() { |
| 2163 | - for side in [4usize, 8, 16] { | 2163 | + // lane-txset2: 32 too -- the INTER search offers `IDTX` at 32x32 |
| 2164 | + // (`TxbSet::Luma32Inter`'s `EXT_TX_SET_DCT_IDTX`), a size the intra | ||
| 2165 | + // sets never name and this round trip never covered. | ||
| 2166 | + for side in [4usize, 8, 16, 32] { | ||
| 2164 | let residual: Vec<i32> = noise(side * side, 7 + side as u64) | 2167 | let residual: Vec<i32> = noise(side * side, 7 + side as u64) |
| 2165 | .iter() | 2168 | .iter() |
| 2166 | .map(|&v| v / 4) | 2169 | .map(|&v| v / 4) |
| @@ -2180,7 +2183,10 @@ mod tests { | |||
| 2180 | // the reduced set names -- the FLIPADST and 1D-ADST/DCT families | 2183 | // the reduced set names -- the FLIPADST and 1D-ADST/DCT families |
| 2181 | // reach the forward side through the mirrored residual, and a | 2184 | // reach the forward side through the mirrored residual, and a |
| 2182 | // mirror on the wrong axis reads exactly as a blown-up rmse here. | 2185 | // mirror on the wrong axis reads exactly as a blown-up rmse here. |
| 2183 | - for tx in [ | 2186 | + // At 32x32 the only types any set names are `DCT_DCT` and |
| 2187 | + // `IDTX` (`EXT_TX_SET_DCT_IDTX`; ADST is undefined above 16), and | ||
| 2188 | + // the inter search offers exactly those. | ||
| 2189 | + let all = [ | ||
| 2184 | TxType::AdstDct, | 2190 | TxType::AdstDct, |
| 2185 | TxType::DctAdst, | 2191 | TxType::DctAdst, |
| 2186 | TxType::AdstAdst, | 2192 | TxType::AdstAdst, |
| @@ -2196,7 +2202,9 @@ mod tests { | |||
| 2196 | TxType::FlipAdstFlipAdst, | 2202 | TxType::FlipAdstFlipAdst, |
| 2197 | TxType::AdstFlipAdst, | 2203 | TxType::AdstFlipAdst, |
| 2198 | TxType::FlipAdstAdst, | 2204 | TxType::FlipAdstAdst, |
| 2199 | - ] { | 2205 | + ]; |
| 2206 | + let types: &[TxType] = if side > 16 { &[TxType::Idtx] } else { &all }; | ||
| 2207 | + for &tx in types { | ||
| 2200 | let e = rmse(tx); | 2208 | let e = rmse(tx); |
| 2201 | assert!( | 2209 | assert!( |
| 2202 | e < 2.0 * dct, | 2210 | e < 2.0 * dct, |
lanes/txset2.report.mdadded+198 -0
| @@ -0,0 +1,198 @@ | |||
| 1 | +# lane-txset2 -- the inter transform-type search, and reduced_tx_set=0 | ||
| 2 | + | ||
| 3 | +Branch `lane-txset2` off main `5e923074`. Predecessor: `lanes/txset.report.md` | ||
| 4 | +(intra 5-type reduced set, screen-gated). | ||
| 5 | + | ||
| 6 | +## Step 1 -- inter luma IDTX vs DCT_DCT (`TX_SET_INTER_3`) | ||
| 7 | + | ||
| 8 | +The writer already codes a two-symbol `tx_type` for every inter luma unit at | ||
| 9 | +32x32 and below (`TxbSet::Luma{4,8,16,32}Inter`) and always named `DCT_DCT`. | ||
| 10 | + | ||
| 11 | +* `encode::inter_tx_type_candidates(set, screen)` -- `[DCT_DCT, IDTX]` for | ||
| 12 | + those four sets, `[DCT_DCT]` for the 64-point transform (no symbol) and for | ||
| 13 | + chroma. | ||
| 14 | +* `Plane::code_from_prediction_typed` / `mc_trial_typed` / | ||
| 15 | + `mc_trial_compound_typed`: the untyped entries are now `DCT_DCT` wrappers, | ||
| 16 | + so no call site outside the search moved. | ||
| 17 | +* `commit_inter_luma` prices the candidates twice: once for the whole-block | ||
| 18 | + (depth 0) residual, once per var-tx split unit, both by `sse + lambda * | ||
| 19 | + bits` with the bits carrying the `tx_type` symbol through RDOQ -- the same | ||
| 20 | + rule the intra search uses. The chosen types leave through the new fourth | ||
| 21 | + element of its return and reach the writer as `BlockCoeffs::luma_tx_types` | ||
| 22 | + (flat = one entry, split = four in the writer's raster order). | ||
| 23 | +* Levers: `speed::TX_TYPE_SEARCH_INTER` (OFF at every preset until the gate | ||
| 24 | + says otherwise), `EC_AV1_TXSET_INTER=0|screen|1`, plus a test-only | ||
| 25 | + process-global override (`encode::set_inter_tx_search`). | ||
| 26 | +* Census: `encode::INTER_TX_TYPE_HITS`, counted at the COMMIT points only, so | ||
| 27 | + a split unit's winner the flat cost then beats is not counted. | ||
| 28 | + | ||
| 29 | +Witness: `encoder::tests::an_inter_clip_codes_both_inter_set_tx_types_both_decoders_read_exactly` | ||
| 30 | +-- PASS, hits `[DCT_DCT 154 .., IDTX 1368 ..]`, ours == ffmpeg every sample. | ||
| 31 | + | ||
| 32 | +Gate rows: see below (arms running). | ||
| 33 | + | ||
| 34 | +### The 12-frame gate (`encode::tests::bd_rate_screen_native`, 12 frames, gop 12) | ||
| 35 | + | ||
| 36 | +Control re-run on this head (`EC_AV1_TXSET_INTER=0`, which is also the | ||
| 37 | +default): it REPRODUCES the charter's numbers to the digit, byte counts | ||
| 38 | +included. | ||
| 39 | + | ||
| 40 | +| clip | control | arm: every frame, every size | delta | wall ctl -> arm | | ||
| 41 | +|---|---|---|---|---| | ||
| 42 | +| bars 1080p | -1.0% / -16.8% | **+23.1% / +3.3%** | +24.1 / +20.1 | 177.2s -> 182.0s | | ||
| 43 | +| bars 2160p | +9.4% / -12.7% | **+31.2% / +3.7%** | +21.8 / +16.4 | 155.9s -> 160.7s | | ||
| 44 | +| film A | +21.7% / -4.4% | +21.5% / -4.5% | -0.2 / -0.1 | 154.9s -> 167.7s | | ||
| 45 | +| film B | +26.9% / -0.6% | +27.2% / -0.3% | +0.3 / +0.3 | 161.5s -> 167.6s | | ||
| 46 | +| screen capture | +20.8% / -30.1% | +20.1% / -30.4% | -0.7 / -0.3 | 112.2s -> 109.5s | | ||
| 47 | + | ||
| 48 | +KEEP RULE on the unconditional arm: FAIL, and not marginally -- the two | ||
| 49 | +synthetic bars rows lose TWENTY points (2 dB of luma PSNR at the same byte | ||
| 50 | +count). Film A is 0.2/0.1 down, film B 0.3/0.3 up, the capture 0.7/0.3 down. | ||
| 51 | + | ||
| 52 | +The identity transform is not mis-scaled at 32x32: the typed round trip now | ||
| 53 | +covers `side = 32` for the two types any set names there (`DCT_DCT`, `IDTX`; | ||
| 54 | +ADST is undefined above 16) and `IDTX`'s rmse stays inside the DCT's 2x bound. | ||
| 55 | +The bars collapse is the `local-rd-on-references` class again, at its loudest: | ||
| 56 | +a flat synthetic frame is all 32x32 inter blocks whose residual `IDTX` prices | ||
| 57 | +cheapest locally, and every later frame predicts from that reconstruction. | ||
| 58 | + | ||
| 59 | +## Step 3 -- what libaom actually picks (instrument, read off lane-libcen's census) | ||
| 60 | + | ||
| 61 | +`lanes/libcen.report.md`'s census files (`~/.cache/lc-libcen/cen-*.txt`, | ||
| 62 | +`crates/ec-av1/examples/syntax_census.rs`) already carry the per-frame | ||
| 63 | +`tx_type` histogram keyed by CDF row length, so no new run was needed. Film B, | ||
| 64 | +libaom cpu-used 6 crf41 (48 pictures), row length -> set: 3 = the 2-symbol | ||
| 65 | +inter `DCT_IDTX` (32x32), 6 = the 5-symbol `TX_SET_INTRA_2` (intra 16x16 and, | ||
| 66 | +under `reduced_tx_set`, all intra), 8 = the 7-symbol `TX_SET_INTRA_1` (intra | ||
| 67 | +8x8/4x4), 13 = the 12-symbol `TX_SET_INTER_2` (inter 16x16), 17 = ALL16 | ||
| 68 | +(inter 8x8/4x4). | ||
| 69 | + | ||
| 70 | +| frame | set3 (inter 32) | set6 (intra 16) | set8 (intra 8/4) | set13 (inter 16) | set17 (inter <=8) | | ||
| 71 | +|---|---|---|---|---|---| | ||
| 72 | +| key (718 symbols) | -- | 85.3% | 14.7% | -- | -- | | ||
| 73 | +| arf hint 30 (1058) | 27.5% | 6.8% | 4.5% | 51.7% | 9.7% | | ||
| 74 | +| arf hint 15 (364) | 34.1% | 1.7% | 1.6% | 46.8% | 15.7% | | ||
| 75 | +| arf hint 7 (61) | 67.2% | 1.6% | -- | 19.7% | 11.5% | | ||
| 76 | +| arf hint 3 (41) | 78.0% | -- | -- | 9.7% | 12.3% | | ||
| 77 | + | ||
| 78 | +Two readings, both decisions: | ||
| 79 | + | ||
| 80 | +1. **libaom never codes `IDTX` at 32x32 on film B.** Every one of its set3 | ||
| 81 | + symbols is symbol 1 (`DCT_DCT`); symbol 0 does not appear in any frame of | ||
| 82 | + the stream. That is exactly the size our unconditional arm loses its twenty | ||
| 83 | + points on -- hence the `le16` arm below. | ||
| 84 | +2. **41% of its inter `tx_type` symbols are in sets 13/17**, i.e. the alphabets | ||
| 85 | + `reduced_tx_set = 0` unlocks, and they are spread across nine or more | ||
| 86 | + distinct types (set13 symbols 3..11 at 1.5-14% each). Our own stream codes | ||
| 87 | + `set3/1` and `set6/1` only, 100% `DCT_DCT` in inter frames -- the gap step 2 | ||
| 88 | + is aimed at. | ||
| 89 | + | ||
| 90 | +### Step 1, second round: `le16` (the census's own prune) and the screen gate | ||
| 91 | + | ||
| 92 | +| clip | control | `le16` (16x16 and below) | screen-gated (SHIPPED) | | ||
| 93 | +|---|---|---|---| | ||
| 94 | +| bars 1080p | -1.0% / -16.8% | +22.9% / +3.1% | -1.0% / -16.8% (byte-identical) | | ||
| 95 | +| bars 2160p | +9.4% / -12.7% | +31.6% / +4.0% | +9.4% / -12.7% (byte-identical) | | ||
| 96 | +| film A | +21.7% / -4.4% | +21.6% / -4.5% | +21.7% / -4.4% (byte-identical) | | ||
| 97 | +| film B | +26.9% / -0.6% | +27.4% / -0.1% | +26.9% / -0.6% (byte-identical) | | ||
| 98 | +| screen capture | +20.8% / -30.1% | +19.9% / -30.4% | **+20.1% / -30.4%** | | ||
| 99 | + | ||
| 100 | +`le16` does NOT recover the bars rows (+22.9/+31.6 against the unconditional | ||
| 101 | +arm's +23.1/+31.2), so the size restriction the libaom census suggested is | ||
| 102 | +refuted as a fix: the damage is in the 16x16-and-below inter units, not the | ||
| 103 | +32x32 ones. It also drifts film B further up (+27.4/-0.1). | ||
| 104 | + | ||
| 105 | +DECISION: ship SCREEN-GATED, the same shape the intra half of lane-txset | ||
| 106 | +ships behind. The four non-screen rows land on the control's own byte counts | ||
| 107 | +to the digit (194497/299067/419042/567789, 205409/321883/435765/564573, | ||
| 108 | +64392/102508/170169/413430, 27442/50374/105485/296813 -- the clips classify | ||
| 109 | +0 screen frames of 4, the capture 48 of 48), so nothing outside screen | ||
| 110 | +content moves, pins included. The capture is 0.7 down against libaom and 0.3 | ||
| 111 | +against rav1e, at no wall cost (112.2s -> 109.4s, inside the noise). | ||
| 112 | + | ||
| 113 | +Levers as shipped: `speed::TX_TYPE_SEARCH_INTER` true at presets 0-6 (the row | ||
| 114 | +the intra search carries), `inter_tx_type_search()` defaulting to | ||
| 115 | +`Screen` on top of it. `EC_AV1_TXSET_INTER=1` is the unconditional arm, | ||
| 116 | +`le16` the pruned one, `0` off. | ||
| 117 | + | ||
| 118 | +## Step 2 -- `reduced_tx_set = 0` and the 13/17 alphabets: NOT ATTEMPTED, scoped | ||
| 119 | + | ||
| 120 | +`deferred: reduced_tx_set = 0 (sets 13/17, and the 7-symbol intra set at | ||
| 121 | +8x8/4x4) -- not started; the two gate slots and the budget went to step 1's | ||
| 122 | +three arms. What it needs, from this lane's reading:` | ||
| 123 | + | ||
| 124 | +* The DECODER half is complete and needs nothing: `decode::txbset_for` / | ||
| 125 | + `txbset_for_inter` already pick `Luma{8,4}Set1`, `Luma{16,8,4}InterSet1`, | ||
| 126 | + `LumaRect16x8Set1`, `LumaRect{4x8,16x4}Set1`, `LumaRect8x4InterSet1` off the | ||
| 127 | + frame's own bit, and `decode::tx_type_symbol` answers for the 7/12/16-symbol | ||
| 128 | + alphabets. Note the spec shape the charter's table simplifies: intra 16x16 | ||
| 129 | + stays the FIVE-type `TX_SET_INTRA_2` even with the bit off (there is no | ||
| 130 | + `Luma16Set1` and none is needed), only intra 8x8/4x4 widen to seven; inter | ||
| 131 | + 32x32 stays the two-type `DCT_IDTX`, inter 16x16 becomes the 12-symbol set | ||
| 132 | + and inter 8x8/4x4 ALL16. | ||
| 133 | +* The WRITER half is the cross-cutting part (class `tx-class-cross-cutting`): | ||
| 134 | + the frame-header bit (`encode.rs:1660`, `:1760`) plus EVERY luma `TxbSet` | ||
| 135 | + the writer and the pricer pick, which is `tile.rs` 2844, 4087, 4231-4238 | ||
| 136 | + (`write_luma_tus`), 4611-4616, 6078, 7004/7006, 7217/7219 and `encode.rs` | ||
| 137 | + `code_tx_depth` / `commit_inter_luma` / `inter_luma_set` / the trial set | ||
| 138 | + arguments. A site that misses the bit codes the right value against the | ||
| 139 | + wrong CDF -- the `wrong-alphabet-same-value` class -- so the bit belongs in | ||
| 140 | + one accessor both sides read, not in nine `match` arms. | ||
| 141 | +* The gate shape this lane measured says what to expect: a wider set is worth | ||
| 142 | + BD only where the reference chain is short or intra-heavy. Both halves of | ||
| 143 | + the search now measured (intra 5-type, inter 2-type) win on the capture and | ||
| 144 | + lose on film, so a 13/17 lane should be armed screen-gated from the start | ||
| 145 | + and spend its slots on the FILM question separately (the rate term, class | ||
| 146 | + `rd-rate-term-calibration`, is the suspect: at equal bytes the bars rows | ||
| 147 | + lose 2 dB of PSNR, which is a pricer that under-charges the cheap type, not | ||
| 148 | + a decoder or kernel defect -- the typed round trip at 32 is inside its | ||
| 149 | + bound). | ||
| 150 | + | ||
| 151 | +## Invariants, the long-GOP gate and the suite (at the shipped state) | ||
| 152 | + | ||
| 153 | +| invariant | preset 0 | preset 6 | | ||
| 154 | +|---|---|---| | ||
| 155 | +| `an_inter_clip_codes_both_inter_set_tx_types_both_decoders_read_exactly` (new) | PASS | PASS | | ||
| 156 | +| `an_edge_clip_codes_every_reduced_set_tx_type_both_decoders_read_exactly` | PASS | PASS | | ||
| 157 | +| `tile_bytes_do_not_depend_on_the_thread_count --include-ignored` | PASS | PASS | | ||
| 158 | +| `the_facade_codes_the_same_bytes_as_encode_sequence` | PASS | PASS | | ||
| 159 | +| `predicted_coeff_bits_track_the_tile_the_writer_wrote` | PASS | PASS | | ||
| 160 | +| all five above with `EC_COMP_MISMATCH=1` | 0 mismatches | 0 mismatches | | ||
| 161 | + | ||
| 162 | +`transform::tests::a_typed_forward_round_trips_like_the_dct_one` now covers | ||
| 163 | +`side = 32` for `IDTX` (the size the inter search newly offers): PASS. | ||
| 164 | +`every_speed_preset_decodes_sample_exact_through_both_decoders --ignored` | ||
| 165 | +with `EC_COMP_MISMATCH=1`: PASS. | ||
| 166 | +`the_encoders_own_streams_are_byte_identical_to_their_pins`: PASS at the | ||
| 167 | +UNCHANGED 8562 / 33357 -- no re-pin, the pin clip is not screen content | ||
| 168 | +(`EC_AV1_TXSET=0` therefore also restores them unchanged). | ||
| 169 | + | ||
| 170 | +`encode::tests::bd_rate_film_long_gop` at the shipped state (both rows are | ||
| 171 | +non-screen, so byte-identical to the encoder before the lane, which the | ||
| 172 | +12-frame confirm run proves clip by clip): | ||
| 173 | + | ||
| 174 | +| clip | shipped | wall ours:libaom:rav1e | | ||
| 175 | +|---|---|---| | ||
| 176 | +| film A | +26.4% / -6.6% | 726.9s:52.9s:73.5s | | ||
| 177 | +| film B | +89.8% / +9.1% | 489.9s:78.8s:52.2s | | ||
| 178 | + | ||
| 179 | +Full `ec-av1` suite, detached: **569 passed / 0 failed / 45 ignored** | ||
| 180 | +(1327.8s). `timeout 890 cargo check --workspace --all-targets -j4`: 0 errors, | ||
| 181 | +0 `ec-av1` warnings (the 22 warnings the workspace prints are `ec-opus` / | ||
| 182 | +`ec-vorbis`, untouched by this lane). | ||
| 183 | + | ||
| 184 | +## Deferred | ||
| 185 | + | ||
| 186 | +* `deferred: reduced_tx_set = 0 and the 13/17 alphabets -- see the scoped | ||
| 187 | + section above; unblocked by a lane of its own with two gate slots. Arm it | ||
| 188 | + screen-gated from the start.` | ||
| 189 | +* `deferred: the FILM question behind both halves of this search -- at equal | ||
| 190 | + bytes the bars rows lose 2 dB, i.e. the pricer under-charges the cheap type | ||
| 191 | + rather than any kernel or decoder being wrong (round trip at 32 is inside | ||
| 192 | + its bound, the witness decodes sample-exact through ffmpeg). The upgrade | ||
| 193 | + path is the rate term / lambda the type search compares with (class | ||
| 194 | + rd-rate-term-calibration), not a wider set -- unblocked by a sweep of that | ||
| 195 | + term against the bars and film rows.` | ||
| 196 | +* `deferred: offering the inter search on a warp/OBMC winner -- commit_inter_luma | ||
| 197 | + is skipped entirely for those blocks (motion_won != 0), so they still code | ||
| 198 | + DCT_DCT; unblocked by pricing the type on the motion-mode prediction.` | ||