forge
Explore
Log in

Don't you dare go Hollow

Code motion_mode syntax only when the OBMC knob is on

Browse files at this commit

0d0c9c4a3a3b600f3a7e3b35f8b140d230f85ffbAhmet Kaan GümüşParent: 84a1ea3
  • fix
    • code motion_mode syntax only when the OBMC knob is on
Show full message
fix(av1): code motion_mode syntax only when the OBMC knob is on

With OBMC default-off every eligible block coded a SIMPLE_TRANSLATION
symbol for no gain (+0.07% at q=150, +0.02% at q=60), so
is_motion_mode_switchable now follows EC_AV1_OBMC: the default path writes
no motion_mode syntax at all and is byte-identical to the streams before
this lane (pins back to 7106 / 25963). The arming, the writer, the
Encoded/decoder threading and the OBMC candidate are unchanged -- a future
warp knob joins the same disjunction.

Under EC_AV1_OBMC=1 the byte pins and the pricer drift bound fail BY DESIGN
(the knob changes encoder decisions), the same contract
EC_AV1_PRICE_FRAME_CDFS=1 already has; every decode round trip stays
sample-exact with 0 EC_COMP_MISMATCH lines.
crates/ec-av1/src/encode.rsmodified+16 -8
@@ -1159,11 +1159,16 @@ pub fn inter_frame_headers_slots(
1159 },1159 },
1160 allow_high_precision_mv: false,1160 allow_high_precision_mv: false,
1161 interpolation_filter: ec_av1_syntax::InterpolationFilter::Eighttap,1161 interpolation_filter: ec_av1_syntax::InterpolationFilter::Eighttap,
1162- // lane-av1obmc: every single-reference inter block libaom's1162+ // lane-av1obmc: with this bit set every single-reference inter block
1163- // `motion_mode_allowed` accepts carries a `motion_mode` symbol1163+ // libaom's `motion_mode_allowed` accepts carries a `motion_mode`
1164- // (`crate::tile::write_motion_mode`). `allow_warped_motion` stays1164+ // symbol (`crate::tile::write_motion_mode`); `allow_warped_motion`
1165- // false, so the alphabet is the 2-symbol `obmc_cdf`.1165+ // stays false, so the alphabet is the 2-symbol `obmc_cdf`. It is tied
1166- is_motion_mode_switchable: true,1166+ // to the OBMC knob rather than always on: with every block choosing
1167+ // SIMPLE_TRANSLATION the symbol is pure cost (+0.07% / +0.02% on the
1168+ // gate clip), so the DEFAULT path writes no motion_mode syntax at all
1169+ // and stays byte-identical to the streams before this lane. A future
1170+ // warp knob joins this disjunction.
1171+ is_motion_mode_switchable: crate::envflags::env_flag!("EC_AV1_OBMC"),
1167 use_ref_frame_mvs: false,1172 use_ref_frame_mvs: false,
1168 // Forces `get_tx_set` (spec 5.11.48) to the two-symbol1173 // Forces `get_tx_set` (spec 5.11.48) to the two-symbol
1169 // `TX_SET_INTER_3` for every inter transform below 32x32 -- the only1174 // `TX_SET_INTER_3` for every inter transform below 32x32 -- the only
@@ -9687,8 +9692,11 @@ mod tests {
9687 // lane-av1obmc: every eligible single-reference inter block now also9692 // lane-av1obmc: every eligible single-reference inter block now also
9688 // carries a `motion_mode` symbol the coefficient sum never counts,9693 // carries a `motion_mode` symbol the coefficient sum never counts,
9689 // and an OBMC block carries the more expensive of the two values --9694 // and an OBMC block carries the more expensive of the two values --
9690- // re-measured at +35.0% here with `EC_AV1_OBMC=1`; the default path9695+ // re-measured at +35.0% here with `EC_AV1_OBMC=1`. Like
9691- // (OBMC off, SIMPLE symbols only) reads +33.x.9696+ // `EC_AV1_PRICE_FRAME_CDFS=1` before it, that knob changes encoder
9697+ // decisions, so this bound and the byte pins above FAIL BY DESIGN
9698+ // under it; the default path (no motion_mode syntax at all) is the
9699+ // one they are measured on.
9692 assert!(9700 assert!(
9693 worst_under <= 0.34,9701 worst_under <= 0.34,
9694 "the writer spent {:.2}% more than the search priced -- more than \9702 "the writer spent {:.2}% more than the search priced -- more than \
@@ -10744,7 +10752,7 @@ mod tests {
10744 })10752 })
10745 };10753 };
10746 let pins: [(u8, usize, u64); 2] =10754 let pins: [(u8, usize, u64); 2] =
10747- [(150, 7111, 0xd375_2e36_13c4_9fc4), (60, 25969, 0x83b2_8522_cec6_38d4)];10755+ [(150, 7106, 0x1da4_9acd_a892_68e3), (60, 25963, 0x94df_8f46_174e_1a5e)];
10748 for (q, bytes, hash) in pins {10756 for (q, bytes, hash) in pins {
10749 let encoded = encode_sequence(&source, q, 0.5).unwrap();10757 let encoded = encode_sequence(&source, q, 0.5).unwrap();
10750 assert_eq!(10758 assert_eq!(