The 64x64 root ships at every speed preset
Browse files at this commit7b4f91d155e0c9b999bb3cc8ca2fe376e67b20b5Parent: af02836- feat
- the 64x64 root ships at every speed preset
- re-pin
2 changed files +36 -26
- crates/ec-av1/src/encode.rs +17 -5
- crates/ec-av1/src/speed.rs +19 -21
crates/ec-av1/src/encode.rsmodified+17 -5
| @@ -386,10 +386,16 @@ fn split_inter_blocks() -> bool { | ||
| 386 | 386 | /// 32x32 or smaller, which put our mode+mv+partition+tx_size spend at 162,669 |
| 387 | 387 | /// bits against rav1e's 61,988, about 46% of the film B gap. |
| 388 | 388 | /// |
| 389 | -/// SKIP-only: a 64x64 residual needs a forward TX_64X64 the encoder does not | |
| 390 | -/// have (`transform.rs` tops out at 32x32), and the writer refuses any other | |
| 391 | -/// shape (`crate::tile::Quadrant::Whole64`). Switched off by `EC_AV1_B64=0` | |
| 392 | -/// in any build. | |
| 389 | +/// lane-tx64: no longer skip-only. The root also prices a REAL residual -- | |
| 390 | +/// one TX_64X64 luma transform (`transform.rs`'s forward network has always | |
| 391 | +/// reached 64 points; what was missing was the block coder and the writer | |
| 392 | +/// around it) and one TX_32X32 per chroma plane -- see [`b64_residual`], | |
| 393 | +/// which carries that arm's own gate table. Still refused at the 64 root: | |
| 394 | +/// compound references, a depth-1 4x32x32 var-tx tree, intra, and a | |
| 395 | +/// superblock the true frame edge cuts through. | |
| 396 | +/// | |
| 397 | +/// Switched off by `EC_AV1_B64=0` in any build; `EC_AV1_B64RES=0` keeps the | |
| 398 | +/// root and restores the skip-only shape lane-b64 shipped. | |
| 393 | 399 | pub(crate) const B64_ROOT: bool = true; |
| 394 | 400 | |
| 395 | 401 | /// How many superblocks took the 64x64 root since the last |
| @@ -13495,8 +13501,14 @@ mod tests { | ||
| 13495 | 13501 | // one mode/mv chain and no residual where four quadrants used to -- |
| 13496 | 13502 | // 8076 -> 7291 at q=150 and 27585 -> 27466 at q=60. `EC_AV1_B64=0` |
| 13497 | 13503 | // restores these. |
| 13504 | + // Re-taken on lane-tx64: that 64x64 root can code a REAL residual now | |
| 13505 | + // (one TX_64X64 luma transform and two TX_32X32 chroma ones), so a | |
| 13506 | + // superblock whose skip arm was too coarse codes coefficients where | |
| 13507 | + // it used to fall back to four quadrants -- 7291 -> 7355 at q=150 and | |
| 13508 | + // 27466 -> 27573 at q=60. `EC_AV1_B64RES=0` restores these; | |
| 13509 | + // `EC_AV1_B64=0` still gives lane-b64's own pre-root 8076 / 27585. | |
| 13498 | 13510 | let pins: [(u8, usize, u64); 2] = |
| 13499 | - [(150, 7291, 0xa411_97e8_8a80_2a1b), (60, 27466, 0xdc87_26a3_c625_46ce)]; | |
| 13511 | + [(150, 7355, 0xd074_3dc7_a231_8a20), (60, 27573, 0xd9fb_3c84_57cc_b86f)]; | |
| 13500 | 13512 | for (q, bytes, hash) in pins { |
| 13501 | 13513 | let encoded = encode_sequence(&source, q, 0.5).unwrap(); |
| 13502 | 13514 | assert_eq!( |
crates/ec-av1/src/speed.rsmodified+19 -21
| @@ -149,27 +149,25 @@ pub(crate) fn at<T: Copy>(table: &[T; 11]) -> T { | ||
| 149 | 149 | /// film B +70.5/+35.2 -> +64.7/+34.0, screen +48.2/-16.4 -> +33.4/-23.8) at |
| 150 | 150 | /// -4% to -20% wall on four of the five rows. |
| 151 | 151 | /// |
| 152 | -/// MEASURED OFF from preset 4 up (lane-b64, native gate at `EC_AV1_SPEED=6`, | |
| 153 | -/// two arms side by side): ON costs film A +55.1/+24.8 -> +64.5/+37.5 and | |
| 154 | -/// film B +91.5/+53.4 -> +114.6/+71.5 for -16%/-36% wall. The cause is the | |
| 155 | -/// trial's own early-out, which rides [`SPLIT_RD`]: at 0.5 (preset 6) a | |
| 156 | -/// superblock is taken whole without its quadrants ever being searched, and | |
| 157 | -/// film B's q150 point loses 1.2 dB. Presets 1..=3 keep it because they keep | |
| 158 | -/// `SPLIT_RD` at 0.125, i.e. the early-out they get is the measured one; | |
| 159 | -/// 4 and up switch it off with `SPLIT_RD`'s first step. | |
| 160 | -pub(crate) const B64_ROOT: [bool; 11] = [ | |
| 161 | - crate::encode::B64_ROOT, | |
| 162 | - true, | |
| 163 | - true, | |
| 164 | - true, | |
| 165 | - false, | |
| 166 | - false, | |
| 167 | - false, | |
| 168 | - false, | |
| 169 | - false, | |
| 170 | - false, | |
| 171 | - false, | |
| 172 | -]; | |
| 152 | +/// lane-b64 MEASURED it off from preset 4 up: at `EC_AV1_SPEED=6` ON cost | |
| 153 | +/// film A +55.1/+24.8 -> +64.5/+37.5 and film B +91.5/+53.4 -> +114.6/+71.5. | |
| 154 | +/// The cause was named there and FIXED in lane-tx64: the trial's early-out | |
| 155 | +/// rode [`SPLIT_RD`], so at 0.5 (preset 6) a superblock was taken whole with | |
| 156 | +/// its quadrants never searched. `encode::b64_breakout_threshold` clamps that | |
| 157 | +/// early-out at the shipped 0.125 whatever the preset, and the same gate at | |
| 158 | +/// `EC_AV1_SPEED=6` now reads, every row better on both columns: | |
| 159 | +/// | |
| 160 | +/// | row | B64 off | B64 on, clamped | | |
| 161 | +/// |---|---|---| | |
| 162 | +/// | bars 1080p | +88.9 / +54.8 | +79.5 / +47.2 | | |
| 163 | +/// | bars 2160p | +91.6 / +49.8 | +72.6 / +35.1 | | |
| 164 | +/// | film A | +55.1 / +24.8 | +51.0 / +21.7 | | |
| 165 | +/// | film B | +91.5 / +53.4 | +77.9 / +44.3 | | |
| 166 | +/// | screen | +57.7 / -11.7 | +40.3 / -20.0 | | |
| 167 | +/// | |
| 168 | +/// at 28.1s vs 30.8s (film A), 31.3s vs 28.0s (film B), 14.3s vs 15.2s | |
| 169 | +/// (screen). So it is on at every preset. | |
| 170 | +pub(crate) const B64_ROOT: [bool; 11] = [crate::encode::B64_ROOT; 11]; | |
| 173 | 171 | |
| 174 | 172 | /// `encode::SPLIT_RD_THRESHOLD`: how cheap a block has to be before its split |
| 175 | 173 | /// trial is withheld. The single biggest wall lever in the tile search. |