forge
Explore
Log in

Don't you dare go Hollow

NEAREST_NEWMV / NEW_NEARESTMV compound candidates on by default

Browse files at this commit

757ff823c400ae61046c141944e9a56732713033Ahmet Kaan GümüşParent: 9b0008b
  • feat
    • NEAREST_NEWMV / NEW_NEARESTMV compound candidates on by default
Show full message
feat(av1): NEAREST_NEWMV / NEW_NEARESTMV compound candidates on by default

Each half-new mode pairs the compound stack's derived NEAREST vector on one
side with the single-reference search this block already ran on the other, so
neither costs a joint search. Both mirror decode.rs assign_compound_mv: no DRL
index, residual against compound stack entry 0.

Measured alone on the BD gate against the grid fix's base (+101.7/+116.6/+73.3
vs libaom): half-new +100.7/+115.8/+73.3 keeps (two down, screen byte-identical
-- it codes NEAREST_NEAREST only) and ships on; NEAR_NEARMV +102.2/+116.4/+73.3
does not and stays behind EC_AV1_COMP_NEARNEAR, both arms together
+100.7/+116.1/+73.3. Compound share 12.1/13.0/31.9%; NEAREST_NEW 93/33/0,
NEW_NEAREST 39/13/0 blocks per gate run. Wall 6.6s/5.1s/5.6s.

Byte pins and the coefficient-price drift bound move with the streams (the
gate's own failure output); the drift widens to +29.6% because a compound
block's second reference tree, compound mode symbol and MV residual are all
outside the coefficient sum.
crates/ec-av1/src/encode.rsmodified+12 -7
@@ -4342,11 +4342,12 @@ fn search_inter_block(
43424342 // reference alone is right. Priced with the same static-CDF approximation
43434343 // the single-reference candidates use, plus the compound-only symbols
43444344 // (`comp_mode`, the reference-pair tree, `comp_group_idx`/`compound_idx`).
4345- // The two 2026-09-06 compound-mode arms, both measured on the BD gate
4346- // before either could default on (see the lane report): presence of the
4347- // flag arms the candidate.
4345+ // The two compound-mode arms, each measured alone on the BD gate before
4346+ // it could default on. `NEAREST_NEWMV`/`NEW_NEARESTMV` keep (-1.0/-0.8
4347+ // vs libaom, screen byte-identical) and ship on; `NEAR_NEARMV` does not
4348+ // (+0.5/-0.2/flat) and stays behind `EC_AV1_COMP_NEARNEAR`.
43484349 let near_near = crate::envflags::env_flag!("EC_AV1_COMP_NEARNEAR");
4349- let half_new = crate::envflags::env_flag!("EC_AV1_COMP_HALFNEW");
4350+ let half_new = true;
43504351 for (ref1, g, cstack) in compound {
43514352 let (ref1, g) = (*ref1, *g);
43524353 let uni = (crate::mvstack::BWDREF_FRAME..=crate::mvstack::ALTREF_FRAME)
@@ -7488,9 +7489,13 @@ mod tests {
74887489 );
74897490 // Measured 2026-09-06 with the extra-reference `NEWMV` in: +18.9% at
74907491 // the worst inter frame, where nearly every block now codes an MV
7491- // residual and a reference the coefficient sum never counts.
7492+ // residual and a reference the coefficient sum never counts. Re-measured
7493+ // at +29.6% once the encoder's grid published compound blocks properly
7494+ // (compound share 8.8% -> 11.5%): a compound block carries a second
7495+ // reference tree, a compound mode symbol and -- for the half-new modes
7496+ // -- an MV residual, none of which the coefficient sum counts.
74927497 assert!(
7493- worst_under <= 0.22,
7498+ worst_under <= 0.32,
74947499 "the writer spent {:.2}% more than the search priced -- more than \
74957500 the mode/mv syntax outside the coefficient sum explains",
74967501 worst_under * 100.0
@@ -8366,7 +8371,7 @@ mod tests {
83668371 })
83678372 };
83688373 let pins: [(u8, usize, u64); 2] =
8369- [(150, 7209, 0xacdd_6952_78c1_49f2), (60, 27353, 0x9be8_7898_f08d_3b77)];
8374+ [(150, 7166, 0xc608_4e2a_071e_1d72), (60, 26950, 0x019f_a19c_251b_f61d)];
83708375 for (q, bytes, hash) in pins {
83718376 let encoded = encode_sequence(&source, q, 0.5).unwrap();
83728377 assert_eq!(