Merge branch 'lane-split' (5e2874fd): split-trial lambda swept and refuted (single-peaked at 1.0), split census instrument; encoder bytes unchanged
Browse files at this commit3 changed files +328 -9
- crates/ec-av1/src/encode.rs +185 -9
- crates/ec-av1/src/encoder.rs +13 -0
- lanes/split.report.md +130 -0
crates/ec-av1/src/encode.rsmodified+185 -9
| @@ -4241,6 +4241,125 @@ fn tx_depth_bits(side: usize, depth: usize) -> f64 { | ||
| 4241 | 4241 | } |
| 4242 | 4242 | } |
| 4243 | 4243 | |
| 4244 | +/// lane-split: a multiplier on the RATE term of the transform-SPLIT trial | |
| 4245 | +/// only -- the intra `tx_depth` depth>0 candidates in [`code_square`] and the | |
| 4246 | +/// inter var-tx depth-1 trial in [`commit_inter_luma`]. `1.0` is the control | |
| 4247 | +/// (the mode search's own weight); below 1 the split trial is charged less | |
| 4248 | +/// for its bits and fires more often. | |
| 4249 | +/// | |
| 4250 | +/// The knob the class `rd-rate-term-calibration` asks for: lane-txd made the | |
| 4251 | +/// `tx_depth` SYMBOL price correct and every film row got worse, because the | |
| 4252 | +/// correct row is a one-sided push away from splitting (depth 0 up to 1.5 | |
| 4253 | +/// bits cheaper at ctx 2, which is 66% of an inter frame's intra blocks) -- | |
| 4254 | +/// so what is mis-calibrated is the weight the split's rate is judged under, | |
| 4255 | +/// not the price. `EC_AV1_SPLIT_LAMBDA`. | |
| 4256 | +pub(crate) fn split_lambda_mult() -> f64 { | |
| 4257 | + static M: std::sync::LazyLock<f64> = std::sync::LazyLock::new(|| { | |
| 4258 | + crate::envflags::var("EC_AV1_SPLIT_LAMBDA") | |
| 4259 | + .ok() | |
| 4260 | + .and_then(|v| v.parse().ok()) | |
| 4261 | + .unwrap_or(SPLIT_LAMBDA) | |
| 4262 | + }); | |
| 4263 | + *M | |
| 4264 | +} | |
| 4265 | + | |
| 4266 | +/// The shipped value of [`split_lambda_mult`]. See lanes/split.report.md for | |
| 4267 | +/// the sweep that chose it. | |
| 4268 | +const SPLIT_LAMBDA: f64 = 1.0; | |
| 4269 | + | |
| 4270 | +/// lane-split census (`EC_AV1_SPLIT_CENSUS=1`): the split decision itself, | |
| 4271 | +/// bucketed by site (0 = intra `tx_depth`, 1 = inter var-tx), frame type | |
| 4272 | +/// (0 = key, 1 = inter) and block side (8/16/32/64). Ten counters per bucket: | |
| 4273 | +/// trials offered, trials the split won, then the (rate, distortion) of the | |
| 4274 | +/// split and flat arms summed apart for the split-won and flat-won trials -- | |
| 4275 | +/// rate scaled by 64 into an integer counter, as [`TXRD_STATS`] is. | |
| 4276 | +static SPLIT_CENSUS: [std::sync::atomic::AtomicU64; 160] = | |
| 4277 | + [const { std::sync::atomic::AtomicU64::new(0) }; 160]; | |
| 4278 | + | |
| 4279 | +/// Whether [`SPLIT_CENSUS`] is armed, read once. | |
| 4280 | +pub(crate) fn split_census_on() -> bool { | |
| 4281 | + static ON: std::sync::LazyLock<bool> = | |
| 4282 | + std::sync::LazyLock::new(|| crate::envflags::env_flag!("EC_AV1_SPLIT_CENSUS")); | |
| 4283 | + *ON | |
| 4284 | +} | |
| 4285 | + | |
| 4286 | +/// Where one (site, frame type, block side) bucket starts in [`SPLIT_CENSUS`]. | |
| 4287 | +/// Sides below 8 and above 64 fold into the end rows, which no caller offers. | |
| 4288 | +fn split_census_base(site: usize, key: bool, side: usize) -> usize { | |
| 4289 | + let side_idx = (side.trailing_zeros() as usize).saturating_sub(3).min(3); | |
| 4290 | + ((site * 2 + usize::from(!key)) * 4 + side_idx) * 10 | |
| 4291 | +} | |
| 4292 | + | |
| 4293 | +/// Records one split trial into [`SPLIT_CENSUS`]. `split` and `flat` are each | |
| 4294 | +/// `(rate in bits, distortion as squared error)`. | |
| 4295 | +fn split_census( | |
| 4296 | + site: usize, | |
| 4297 | + key: bool, | |
| 4298 | + side: usize, | |
| 4299 | + split_won: bool, | |
| 4300 | + split: (f64, f64), | |
| 4301 | + flat: (f64, f64), | |
| 4302 | +) { | |
| 4303 | + use std::sync::atomic::Ordering::Relaxed; | |
| 4304 | + let base = split_census_base(site, key, side); | |
| 4305 | + let add = |i: usize, v: u64| { | |
| 4306 | + SPLIT_CENSUS[base + i].fetch_add(v, Relaxed); | |
| 4307 | + }; | |
| 4308 | + add(0, 1); | |
| 4309 | + let off = if split_won { | |
| 4310 | + add(1, 1); | |
| 4311 | + 2 | |
| 4312 | + } else { | |
| 4313 | + 6 | |
| 4314 | + }; | |
| 4315 | + let (win, lose) = if split_won { (split, flat) } else { (flat, split) }; | |
| 4316 | + add(off, (win.0 * 64.0).max(0.0) as u64); | |
| 4317 | + add(off + 1, win.1.max(0.0) as u64); | |
| 4318 | + add(off + 2, (lose.0 * 64.0).max(0.0) as u64); | |
| 4319 | + add(off + 3, lose.1.max(0.0) as u64); | |
| 4320 | +} | |
| 4321 | + | |
| 4322 | +/// Prints [`SPLIT_CENSUS`] to stderr when `EC_AV1_SPLIT_CENSUS=1`. Called at | |
| 4323 | +/// the end of every `Av1Encoder::encode_frames` call and NOT reset, so the | |
| 4324 | +/// last table a run prints is the whole encode's total (there is no flush | |
| 4325 | +/// hook the encoder API guarantees to reach). | |
| 4326 | +pub(crate) fn dump_split_census() { | |
| 4327 | + use std::sync::atomic::Ordering::Relaxed; | |
| 4328 | + eprintln!( | |
| 4329 | + "SPLITCENSUS site frame side offered split share% \ | |
| 4330 | + win_rate win_dist lose_rate lose_dist" | |
| 4331 | + ); | |
| 4332 | + for site in 0..2 { | |
| 4333 | + for key in [true, false] { | |
| 4334 | + for side_idx in 0..4 { | |
| 4335 | + let base = split_census_base(site, key, 8 << side_idx); | |
| 4336 | + let v: [u64; 10] = std::array::from_fn(|i| SPLIT_CENSUS[base + i].load(Relaxed)); | |
| 4337 | + if v[0] == 0 { | |
| 4338 | + continue; | |
| 4339 | + } | |
| 4340 | + let (n, s) = (v[0] as f64, v[1] as f64); | |
| 4341 | + // Winner terms live at 2,3 (split won) and 6,7 (flat won), | |
| 4342 | + // loser terms at 4,5 and 8,9 -- so each mean is one sum over | |
| 4343 | + // all `n` trials, not a mean of two means. | |
| 4344 | + eprintln!( | |
| 4345 | + "SPLITCENSUS {} {} {:>3} {:>7} {:>7} {:>5.1} \ | |
| 4346 | + {:>9.2} {:>9.0} {:>9.2} {:>9.0}", | |
| 4347 | + if site == 0 { "intra" } else { "inter" }, | |
| 4348 | + if key { "key " } else { "inter" }, | |
| 4349 | + 8 << side_idx, | |
| 4350 | + v[0], | |
| 4351 | + v[1], | |
| 4352 | + 100.0 * s / n, | |
| 4353 | + (v[2] + v[6]) as f64 / n / 64.0, | |
| 4354 | + (v[3] + v[7]) as f64 / n, | |
| 4355 | + (v[4] + v[8]) as f64 / n / 64.0, | |
| 4356 | + (v[5] + v[9]) as f64 / n, | |
| 4357 | + ); | |
| 4358 | + } | |
| 4359 | + } | |
| 4360 | + } | |
| 4361 | +} | |
| 4362 | + | |
| 4244 | 4363 | /// [`TX_TYPE_HITS`] for the INTER luma units (lane-txset2), counted apart so |
| 4245 | 4364 | /// the intra witness's fire count stays its own. |
| 4246 | 4365 | pub(crate) static INTER_TX_TYPE_HITS: [std::sync::atomic::AtomicUsize; 16] = |
| @@ -4647,8 +4766,13 @@ fn commit_inter_luma( | ||
| 4647 | 4766 | } |
| 4648 | 4767 | } |
| 4649 | 4768 | luma.ctx.tu_split = false; |
| 4650 | - let split_cost = sse + search.lambda * (bits + txfm_split_bits(side, 1)); | |
| 4651 | - let flat_cost = flat_ref.sse + search.lambda * (flat_ref.bits + txfm_split_bits(side, 0)); | |
| 4769 | + let split_rate = bits + txfm_split_bits(side, 1); | |
| 4770 | + let flat_rate = flat_ref.bits + txfm_split_bits(side, 0); | |
| 4771 | + let split_cost = sse + search.lambda * split_lambda_mult() * split_rate; | |
| 4772 | + let flat_cost = flat_ref.sse + search.lambda * flat_rate; | |
| 4773 | + if split_census_on() { | |
| 4774 | + split_census(1, false, side, split_cost < flat_cost, (split_rate, sse), (flat_rate, flat_ref.sse)); | |
| 4775 | + } | |
| 4652 | 4776 | let class = usize::from(side == BLOCK) * 4 + usize::from(second.is_some()) * 2; |
| 4653 | 4777 | // The depth census has a leaf row and a 32x32 row and no 64 one, so the |
| 4654 | 4778 | // 64x64 root counts itself ([`take_b64_var_tx_hits`]) instead of landing |
| @@ -5222,7 +5346,12 @@ fn code_square( | ||
| 5222 | 5346 | tx_select: bool, |
| 5223 | 5347 | // This tile's intra block-copy state ([`Ibc`]), `None` on a frame whose |
| 5224 | 5348 | // header did not set `allow_intrabc`. |
| 5225 | - ibc: Option<&mut Ibc>, fctx: &crate::decode::FrameCtx, | |
| 5349 | + ibc: Option<&mut Ibc>, | |
| 5350 | + // Whether this is a KEY frame's block, read only by the split census | |
| 5351 | + // ([`SPLIT_CENSUS`]): the two frame types split at very different rates, | |
| 5352 | + // which is this lane's whole finding. | |
| 5353 | + census_key: bool, | |
| 5354 | + fctx: &crate::decode::FrameCtx, | |
| 5226 | 5355 | ) -> (BlockCoeffs, f64) { |
| 5227 | 5356 | let (luma_set, chroma_set) = if side == SUPERBLOCK { |
| 5228 | 5357 | // A whole superblock coded as ONE intra block (lane-i64): one |
| @@ -5276,17 +5405,37 @@ fn code_square( | ||
| 5276 | 5405 | luma_coeffs, |
| 5277 | 5406 | ); |
| 5278 | 5407 | let mut best_types = std::mem::take(&mut luma_tx_types); |
| 5408 | + // The census wants the flat arm's own (rate, distortion), which | |
| 5409 | + // `search_block` only hands back folded into one cost -- so under the | |
| 5410 | + // env flag alone it is re-coded at depth 0 and the plane restored. | |
| 5411 | + let census_flat = split_census_on().then(|| { | |
| 5412 | + let kept = luma.snapshot(x, y, side); | |
| 5413 | + let (_, sse, bits, _) = | |
| 5414 | + luma.code_tx_depth(at, mode, angle_delta, 0, None, search, fctx); | |
| 5415 | + luma.restore(x, y, side, &kept); | |
| 5416 | + (bits + tx_depth_bits(side, 0), sse) | |
| 5417 | + }); | |
| 5418 | + let mut census_split: Option<(f64, f64)> = None; | |
| 5279 | 5419 | for depth in 1..=max_tx_depth(side) { |
| 5280 | 5420 | let (levels, sse, bits, types) = |
| 5281 | 5421 | luma.code_tx_depth(at, mode, angle_delta, depth, None, search, fctx); |
| 5282 | - let cost_d = sse | |
| 5283 | - + search.lambda | |
| 5284 | - * (bits + mode_bits[usize::from(mode)] + tx_depth_bits(side, depth)); | |
| 5422 | + let rate = bits + mode_bits[usize::from(mode)] + tx_depth_bits(side, depth); | |
| 5423 | + let cost_d = sse + search.lambda * split_lambda_mult() * rate; | |
| 5424 | + if census_flat.is_some() { | |
| 5425 | + let c = (bits + tx_depth_bits(side, depth), sse); | |
| 5426 | + if census_split.is_none_or(|b| sse + search.lambda * rate < b.1 + search.lambda * b.0) | |
| 5427 | + { | |
| 5428 | + census_split = Some(c); | |
| 5429 | + } | |
| 5430 | + } | |
| 5285 | 5431 | if cost_d < best.0 { |
| 5286 | 5432 | best = (cost_d, depth, luma.snapshot(x, y, side), coeffs(&levels, side)); |
| 5287 | 5433 | best_types = types; |
| 5288 | 5434 | } |
| 5289 | 5435 | } |
| 5436 | + if let (Some(flat), Some(split)) = (census_flat, census_split) { | |
| 5437 | + split_census(0, census_key, side, best.1 > 0, split, flat); | |
| 5438 | + } | |
| 5290 | 5439 | luma_tx_types = best_types; |
| 5291 | 5440 | luma.restore(x, y, side, &best.2); |
| 5292 | 5441 | cost = best.0; |
| @@ -6117,6 +6266,7 @@ fn code_square_inter( | ||
| 6117 | 6266 | mode_bits, |
| 6118 | 6267 | tx_select() && tx_select_inter(), |
| 6119 | 6268 | None, |
| 6269 | + false, | |
| 6120 | 6270 | fctx, |
| 6121 | 6271 | ); |
| 6122 | 6272 | let luma_set = if side == 8 { |
| @@ -7751,6 +7901,7 @@ pub(crate) fn encode_key_frame_inner( | ||
| 7751 | 7901 | &mode_bits(above_mode[c64], left_mode[r64]), |
| 7752 | 7902 | tx_select, |
| 7753 | 7903 | None, |
| 7904 | + true, | |
| 7754 | 7905 | fctx, |
| 7755 | 7906 | ); |
| 7756 | 7907 | let cost = cost + search.lambda * crate::tile::partition_bits(SUPERBLOCK, false); |
| @@ -7834,7 +7985,9 @@ pub(crate) fn encode_key_frame_inner( | ||
| 7834 | 7985 | &search, |
| 7835 | 7986 | &mode_bits(above_mode[c0], left_mode[r0]), |
| 7836 | 7987 | tx_select, |
| 7837 | - ibc.as_mut(), fctx, | |
| 7988 | + ibc.as_mut(), | |
| 7989 | + true, | |
| 7990 | + fctx, | |
| 7838 | 7991 | ); |
| 7839 | 7992 | cost_whole += search.lambda * partition_bits(BLOCK, false); |
| 7840 | 7993 | let after_whole = snapshot(&luma, &chroma, (x, y), BLOCK); |
| @@ -7869,7 +8022,9 @@ pub(crate) fn encode_key_frame_inner( | ||
| 7869 | 8022 | &search, |
| 7870 | 8023 | &mode_bits(above_mode[sc], left_mode[sr]), |
| 7871 | 8024 | tx_select, |
| 7872 | - ibc.as_mut(), fctx, | |
| 8025 | + ibc.as_mut(), | |
| 8026 | + true, | |
| 8027 | + fctx, | |
| 7873 | 8028 | ); |
| 7874 | 8029 | cost_split += cost; |
| 7875 | 8030 | split_modes.push(block.mode); |
| @@ -7902,7 +8057,9 @@ pub(crate) fn encode_key_frame_inner( | ||
| 7902 | 8057 | &search, |
| 7903 | 8058 | &leaf_mode_bits, |
| 7904 | 8059 | tx_select, |
| 7905 | - None, fctx, | |
| 8060 | + None, | |
| 8061 | + true, | |
| 8062 | + fctx, | |
| 7906 | 8063 | ); |
| 7907 | 8064 | cost_split += cost; |
| 7908 | 8065 | split_modes.push(leaf.mode); |
| @@ -12163,6 +12320,25 @@ pub(crate) fn encode_sequence_with_ctx( | ||
| 12163 | 12320 | #[cfg(test)] |
| 12164 | 12321 | mod tests { |
| 12165 | 12322 | |
| 12323 | + /// Every (site, frame type, block side) the census can be called with | |
| 12324 | + /// lands in its own ten-counter bucket, inside the array (class | |
| 12325 | + /// `enumerate-table-domain`: an off-by-one here would silently add two | |
| 12326 | + /// sites' trials together). | |
| 12327 | + #[test] | |
| 12328 | + fn the_split_census_buckets_are_distinct_and_in_bounds() { | |
| 12329 | + let mut seen = std::collections::BTreeSet::new(); | |
| 12330 | + for site in 0..2 { | |
| 12331 | + for key in [true, false] { | |
| 12332 | + for side in [8usize, 16, 32, 64] { | |
| 12333 | + let base = super::split_census_base(site, key, side); | |
| 12334 | + assert!(base + 10 <= super::SPLIT_CENSUS.len(), "{site} {key} {side}"); | |
| 12335 | + assert!(seen.insert(base), "{site} {key} {side} collides"); | |
| 12336 | + } | |
| 12337 | + } | |
| 12338 | + } | |
| 12339 | + assert_eq!(seen.len(), 16); | |
| 12340 | + } | |
| 12341 | + | |
| 12166 | 12342 | /// An [`crate::mvstack::MvStack`] with every context at zero and no |
| 12167 | 12343 | /// neighbours, for the pricer tests below to fill the one band each of |
| 12168 | 12344 | /// them is about. |
crates/ec-av1/src/encoder.rsmodified+13 -0
| @@ -1380,6 +1380,19 @@ impl Av1Encoder { | ||
| 1380 | 1380 | /// As [`Av1Encoder::encode`], minus the pyramid refusal. |
| 1381 | 1381 | pub fn encode_frames(&mut self, picture: &Picture) -> Result<Vec<Packet>> { |
| 1382 | 1382 | crate::encode::arm_tiles(self.config.tile_cols_log2, self.config.tile_rows_log2); |
| 1383 | + // lane-split: the split census prints on every exit of this call when | |
| 1384 | + // armed, so no `return` path loses it; the counters are cumulative, so | |
| 1385 | + // the last table a run prints is that run's total. | |
| 1386 | + struct SplitCensusDump; | |
| 1387 | + impl Drop for SplitCensusDump { | |
| 1388 | + fn drop(&mut self) { | |
| 1389 | + crate::encode::dump_split_census(); | |
| 1390 | + } | |
| 1391 | + } | |
| 1392 | + // `then_some` would CONSTRUCT the guard eagerly and drop it when the | |
| 1393 | + // flag is off, which runs `Drop` -- and printed the census header on | |
| 1394 | + // every unarmed encode. `then` builds it only when armed. | |
| 1395 | + let _census = crate::encode::split_census_on().then(|| SplitCensusDump); | |
| 1383 | 1396 | if (picture.width, picture.height) != (self.config.width, self.config.height) { |
| 1384 | 1397 | return Err(Error::unsupported( |
| 1385 | 1398 | "AV1 encode", |
lanes/split.report.mdadded+130 -0
| @@ -0,0 +1,130 @@ | ||
| 1 | +# lane-split — the split decision's own calibration: swept, and the control wins | |
| 2 | + | |
| 3 | +lane-txd left one live hypothesis behind its refuted arm (class | |
| 4 | +`rd-rate-term-calibration`): the correct `tx_depth` price is a one-sided push | |
| 5 | +AWAY from splitting, so maybe what is mis-calibrated is the weight the split | |
| 6 | +trial's rate is judged under, not the price. This lane restored the correct | |
| 7 | +pricing (`60c3cdf6` + its pins), built the knob and the census, and swept. | |
| 8 | +The sweep is single-peaked and its peak IS the control weight, and every | |
| 9 | +point on it is worse than the row-0-priced control. The pricing fix goes back | |
| 10 | +out again; the census and the swept knob stay. | |
| 11 | + | |
| 12 | +## The knob | |
| 13 | + | |
| 14 | +`EC_AV1_SPLIT_LAMBDA` (`encode::split_lambda_mult`, constant `SPLIT_LAMBDA = | |
| 15 | +1.0`) multiplies the RATE term of the transform-SPLIT trial only — the intra | |
| 16 | +`tx_depth` depth>0 candidates in `code_square` and the inter var-tx depth-1 | |
| 17 | +trial in `commit_inter_luma`. Below 1 the split is charged less for its bits | |
| 18 | +and fires more; above 1, less. The flat arm is untouched, so this is exactly | |
| 19 | +the depth-0-versus-split margin and nothing else. | |
| 20 | + | |
| 21 | +## Sweep — film B gate row, WITH the correct `tx_depth` pricing on | |
| 22 | + | |
| 23 | +Deciding gate, 12-frame native, BD-rate vs libaom cpu-used 6 / rav1e speed 6. | |
| 24 | + | |
| 25 | +| `EC_AV1_SPLIT_LAMBDA` | film B | bars 2160p | | |
| 26 | +|---|---|---| | |
| 27 | +| 0.6 | +28.4 / +0.5 | +10.5 / −11.8 | | |
| 28 | +| 0.8 | +26.1 / −0.9 | +10.0 / −12.2 | | |
| 29 | +| **1.0 (control weight)** | **+25.2 / −1.6** | **+8.7 / −13.4** | | |
| 30 | +| 1.25 | +25.9 / −1.1 | +8.9 / −13.2 | | |
| 31 | +| 1.5 | +26.2 / −0.9 | +9.3 / −13.0 | | |
| 32 | +| 2.0 | +26.3 / −0.8 | +11.7 / −11.4 | | |
| 33 | +| — control, row-0 pricing (`2caf213b`) | **+24.9 / −1.9** | +8.7 / −13.4 | | |
| 34 | + | |
| 35 | +The λ=1.0 row reproduces lane-txd's arm to the decimal, so the sweep is | |
| 36 | +against a reproduced control. The curve has ONE optimum, it sits at the | |
| 37 | +weight the encoder already uses, and it is still 0.3 worse on both columns | |
| 38 | +than the row-0-priced control. No re-weighting of the split's rate recovers | |
| 39 | +what correct pricing costs — so the split trial's λ was not the mis-calibrated | |
| 40 | +term either, and the class `rd-rate-term-calibration` reading of lane-txd's | |
| 41 | +result is refuted on its own terms. | |
| 42 | + | |
| 43 | +## Census 1 — the split DECISION (`EC_AV1_SPLIT_CENSUS=1`) | |
| 44 | + | |
| 45 | +Film B gate crop, 12 frames, q150, the shipped (row-0-priced) encoder. Rows | |
| 46 | +are TRIALS OFFERED by the RD search, which includes partition candidates that | |
| 47 | +later lose — not coded blocks; the coded-block view is census 2 below. | |
| 48 | + | |
| 49 | +``` | |
| 50 | +site frame side offered split share% win_rate win_dist lose_rate lose_dist | |
| 51 | +intra key 16 7504 1671 22.3 19.07 335 25.97 444 | |
| 52 | +intra key 32 1876 166 8.8 62.25 1381 78.58 1553 | |
| 53 | +intra inter 8 12424 4620 37.2 9.26 362 10.26 533 | |
| 54 | +intra inter 16 4704 942 20.0 23.29 1714 28.73 2109 | |
| 55 | +inter inter 16 1711 167 9.8 14.96 1480 21.14 1741 | |
| 56 | +inter inter 32 936 250 26.7 37.86 5869 38.32 6302 | |
| 57 | +inter inter 64 5280 483 9.1 15.77 8333 16.02 8461 | |
| 58 | +``` | |
| 59 | + | |
| 60 | +`win_rate`/`lose_rate` are bits (including the `tx_depth` / `txfm_split` | |
| 61 | +symbols), `win_dist`/`lose_dist` squared error. Read: the winner is cheaper on | |
| 62 | +BOTH terms in every row — the loser is never a rate-versus-distortion trade | |
| 63 | +the weight could tip, which is the same thing the sweep says from the outside. | |
| 64 | + | |
| 65 | +With the correct pricing ON the shares fall exactly where lane-txd's price | |
| 66 | +table predicts (intra key 16: 22.3% → 21.0%, intra inter 8: 37.2% → 32.9%, | |
| 67 | +inter var-tx 32: 26.7% → 27.9%) — a 4-point drop on the inter frame's intra | |
| 68 | +blocks, which are the 66% ctx-2 population. | |
| 69 | + | |
| 70 | +## Census 2 — ours vs libaom, coded blocks, same crop and rate | |
| 71 | + | |
| 72 | +Both streams read by OUR decoder (`EC_AV1_BITCENSUS=1 syntax_census`), film B | |
| 73 | +gate crop 1920x1024 @ 00:40:00, 12 frames, `-g 12`. Ours q150 = 27343 payload | |
| 74 | +bytes; libaom `-cpu-used 6 -crf 30` = 28590. Split share = the share of coded | |
| 75 | +blocks whose PUBLISHED luma transform is smaller than the block, read as the | |
| 76 | +mass the tx-size histogram moves down against the block-size histogram. | |
| 77 | + | |
| 78 | +| | key frame | whole stream | | |
| 79 | +|---|---|---| | |
| 80 | +| ours | 4.8% | 1.0% | | |
| 81 | +| libaom crf 30 | 7.6% | 2.1% | | |
| 82 | + | |
| 83 | +libaom splits about twice as often as we do at the same rate — so we are on | |
| 84 | +the LOW side of libaom's split rate, and the sweep says every step toward | |
| 85 | +libaom's rate (λ 0.8, 0.6) costs 1.2 and 3.5 BD points on film B. The split | |
| 86 | +rate is not where film B's +25% lives; a lane that goes after it by moving | |
| 87 | +this margin is measuring the wrong knob. | |
| 88 | + | |
| 89 | +## Gate — the shipped tree | |
| 90 | + | |
| 91 | +Encoder output is BYTE-IDENTICAL to `2caf213b` (both stream pins green and | |
| 92 | +UNMOVED at 8325 / 33014, at the default preset and at `EC_AV1_SPEED=6`), so | |
| 93 | +the rows are the control's, re-measured here: | |
| 94 | + | |
| 95 | +| row | shipped | | |
| 96 | +|---|---| | |
| 97 | +| film A | +21.0 / −4.8 | | |
| 98 | +| film B | +24.9 / −1.9 | | |
| 99 | +| screen | +14.5 / −33.2 | | |
| 100 | +| bars 1080p | −2.0 / −17.6 | | |
| 101 | +| bars 2160p | +8.7 / −13.4 | | |
| 102 | + | |
| 103 | +`bd_rate_film_long_gop` was not run: nothing ships that moves a byte. | |
| 104 | + | |
| 105 | +## Suite | |
| 106 | + | |
| 107 | +* `--skip stream::` 338 passed / 0 failed / 32 ignored; `stream:: --skip | |
| 108 | + 10bit` 200 / 0 / 15; `10bit` 42 / 0 / 1. All RC=0. | |
| 109 | +* `--ignored encoder::tests::every_speed_preset_decodes_sample_exact_through_both_decoders` | |
| 110 | + passed. | |
| 111 | +* `encode::tests::the_split_census_buckets_are_distinct_and_in_bounds` — the | |
| 112 | + census index enumerated over its whole domain (class | |
| 113 | + `enumerate-table-domain`). | |
| 114 | +* `timeout 900 cargo check --workspace --all-targets -j4`: 0 errors, 0 ec-av1 | |
| 115 | + warnings. | |
| 116 | + | |
| 117 | +## Disposition | |
| 118 | + | |
| 119 | +`deferred: the tx_depth context pricing — built twice (lane-ctx2, lane-txd), | |
| 120 | +now swept against its own split weight and still losing at every point. What | |
| 121 | +would unblock it is NOT another calibration knob on this margin: the census | |
| 122 | +says the losing arm is worse on rate AND distortion together, so the depth | |
| 123 | +trial is choosing between two arms the search already separates cleanly. | |
| 124 | +Whatever film B's +25% is, it is not the transform-split margin.` | |
| 125 | + | |
| 126 | +`deferred: a bug found while building the census — encoder.rs used | |
| 127 | +bool::then_some to build a Drop guard, which CONSTRUCTS and then DROPS the | |
| 128 | +guard when the flag is off. Fixed here (then_some -> then); swept the class: the crate's | |
| 129 | +other 9 `then_some` calls all pass a reference or a `Copy` scalar, none of | |
| 130 | +which has a `Drop` impl.` |