Code motion_mode syntax only when the OBMC knob is on
Browse files at this commit0d0c9c4a3a3b600f3a7e3b35f8b140d230f85ffbParent: 84a1ea3- fix
- code motion_mode syntax only when the OBMC knob is on
1 changed file +16 -8
- crates/ec-av1/src/encode.rs +16 -8
crates/ec-av1/src/encode.rsmodified+16 -8
| @@ -1159,11 +1159,16 @@ pub fn inter_frame_headers_slots( | ||
| 1159 | 1159 | }, |
| 1160 | 1160 | allow_high_precision_mv: false, |
| 1161 | 1161 | interpolation_filter: ec_av1_syntax::InterpolationFilter::Eighttap, |
| 1162 | - // lane-av1obmc: every single-reference inter block libaom's | |
| 1163 | - // `motion_mode_allowed` accepts carries a `motion_mode` symbol | |
| 1164 | - // (`crate::tile::write_motion_mode`). `allow_warped_motion` stays | |
| 1165 | - // false, so the alphabet is the 2-symbol `obmc_cdf`. | |
| 1166 | - is_motion_mode_switchable: true, | |
| 1162 | + // lane-av1obmc: with this bit set every single-reference inter block | |
| 1163 | + // libaom's `motion_mode_allowed` accepts carries a `motion_mode` | |
| 1164 | + // symbol (`crate::tile::write_motion_mode`); `allow_warped_motion` | |
| 1165 | + // stays false, so the alphabet is the 2-symbol `obmc_cdf`. It is tied | |
| 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 | 1172 | use_ref_frame_mvs: false, |
| 1168 | 1173 | // Forces `get_tx_set` (spec 5.11.48) to the two-symbol |
| 1169 | 1174 | // `TX_SET_INTER_3` for every inter transform below 32x32 -- the only |
| @@ -9687,8 +9692,11 @@ mod tests { | ||
| 9687 | 9692 | // lane-av1obmc: every eligible single-reference inter block now also |
| 9688 | 9693 | // carries a `motion_mode` symbol the coefficient sum never counts, |
| 9689 | 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 path | |
| 9691 | - // (OBMC off, SIMPLE symbols only) reads +33.x. | |
| 9695 | + // re-measured at +35.0% here with `EC_AV1_OBMC=1`. Like | |
| 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 | 9700 | assert!( |
| 9693 | 9701 | worst_under <= 0.34, |
| 9694 | 9702 | "the writer spent {:.2}% more than the search priced -- more than \ |
| @@ -10744,7 +10752,7 @@ mod tests { | ||
| 10744 | 10752 | }) |
| 10745 | 10753 | }; |
| 10746 | 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 | 10756 | for (q, bytes, hash) in pins { |
| 10749 | 10757 | let encoded = encode_sequence(&source, q, 0.5).unwrap(); |
| 10750 | 10758 | assert_eq!( |