NEWMV against GOLDEN/ALTREF with a swept early-out, plus a motion-search census
Browse files at this commit242c4318a3df32ae7b2f5de957563d31bcd58a50Parent: 082d0dc- feat
- NEWMV against GOLDEN/ALTREF with a swept early-out, plus a motion-search census
1 changed file +16 -7
- crates/ec-av1/src/encode.rs +16 -7
crates/ec-av1/src/encode.rsmodified+16 -7
| @@ -165,15 +165,22 @@ fn split_inter_8() -> bool { | ||
| 165 | 165 | /// NEARESTMV candidate it always had. |
| 166 | 166 | const LEAF_NEW_MV: bool = true; |
| 167 | 167 | |
| 168 | -/// Whether GOLDEN/ALTREF get a `NEWMV` search of their own. Set from the | |
| 169 | -/// lane report's measurement. | |
| 170 | -const EXTRA_REF_NEW_MV: bool = false; | |
| 168 | +/// Whether GOLDEN/ALTREF get a `NEWMV` search of their own. Measured on the | |
| 169 | +/// BD gate: with the early-out below at its swept margin, -1.7/-2.5/-0.0 | |
| 170 | +/// points vs libaom and -1.6/-2.3/-0.0 vs rav1e for 4%/4%/0.3% more motion | |
| 171 | +/// searches (the census `bd_rate_vs_libaom_and_rav1e` prints). | |
| 172 | +const EXTRA_REF_NEW_MV: bool = true; | |
| 171 | 173 | |
| 172 | 174 | /// How much cheaper an extra reference's `NEARESTMV` has to be than LAST's |
| 173 | 175 | /// own best vector before that reference's `NEWMV` search is skipped: a |
| 174 | 176 | /// factor on the search cost scale, `1.0` meaning "as good or better". |
| 175 | -/// Swept on the BD gate (see the lane report) -- `0.0` never skips. | |
| 176 | -const EXTRA_NEW_SKIP_MARGIN: f64 = 0.0; | |
| 177 | +/// Swept on the BD gate over 0.15/0.25/0.35/0.5/0.8/1.0/1.5 and off (`0.0`, | |
| 178 | +/// never skip): the whole BD gain survives down to 0.35 (+124.8/+150.4/+80.9 | |
| 179 | +/// vs libaom, against +124.9/+150.3/+81.0 with no early-out at all) while the | |
| 180 | +/// extra searches drop from +27% to +4% of the base count -- and on screen | |
| 181 | +/// capture, where an extra reference's NEWMV wins nothing, it skips 99.7% of | |
| 182 | +/// them. Below 0.35 the gain starts eroding (0.15: +125.3/+151.7). | |
| 183 | +const EXTRA_NEW_SKIP_MARGIN: f64 = 0.35; | |
| 177 | 184 | |
| 178 | 185 | /// [`EXTRA_NEW_SKIP_MARGIN`], swept by `EC_AV1_MV_SKIP_MARGIN`. |
| 179 | 186 | fn extra_new_skip_margin() -> f64 { |
| @@ -7441,7 +7448,9 @@ mod tests { | ||
| 7441 | 7448 | /// hair without failing anything; this pins the streams themselves. |
| 7442 | 7449 | /// Every number below was measured 2026-09-06 (lane-av1fwd) and is |
| 7443 | 7450 | /// identical at `a6649c4e`, the merge before that lane's three exact |
| 7444 | - /// speed steps. | |
| 7451 | + /// speed steps; the q=150 pin moved with lane-av1mv's extra-reference | |
| 7452 | + /// `NEWMV` (a coded-bits change, not a speed step -- the BD gate is what | |
| 7453 | + /// judged it). | |
| 7445 | 7454 | #[test] |
| 7446 | 7455 | fn the_encoders_own_streams_are_byte_identical_to_their_pins() { |
| 7447 | 7456 | if !have_ffmpeg() { |
| @@ -7463,7 +7472,7 @@ mod tests { | ||
| 7463 | 7472 | }) |
| 7464 | 7473 | }; |
| 7465 | 7474 | let pins: [(u8, usize, u64); 2] = |
| 7466 | - [(150, 7416, 0x75632db72a63d5f1), (60, 27927, 0xb63a984f521b7341)]; | |
| 7475 | + [(150, 7397, 0xca56a6962842df67), (60, 27780, 0x584a5034ed4c3b27)]; | |
| 7467 | 7476 | for (q, bytes, hash) in pins { |
| 7468 | 7477 | let encoded = encode_sequence(&source, q, 0.5).unwrap(); |
| 7469 | 7478 | assert_eq!( |