diff --git a/crates/ec-av1/src/encode.rs b/crates/ec-av1/src/encode.rs index 24f1c8d1..076331dd 100644 --- a/crates/ec-av1/src/encode.rs +++ b/crates/ec-av1/src/encode.rs @@ -2321,6 +2321,7 @@ fn code_square_inter( inter: Some(InterInfo { mode: InterMode::NewMv, mv: new_mv, + ref_mv_idx: 0, }), }, cost + dcost, @@ -2346,6 +2347,7 @@ fn code_square_inter( inter: Some(InterInfo { mode: InterMode::NearestMv, mv, + ref_mv_idx: 0, }), }, inter_cost + dcost) } else { @@ -3397,100 +3399,67 @@ fn search_inter_block( chroma[1].true_width, chroma[1].true_height, ); - let mode_bits_inter = symbol_bits(&cdf::NEW_MV[stack.new_mv_ctx], 1) // not NEWMV - + symbol_bits(&cdf::ZERO_MV[stack.zero_mv_ctx], 1) // not zero - + symbol_bits(&cdf::REF_MV[stack.ref_mv_ctx], 0); // NEARESTMV - - // The NEARESTMV candidate: `skip` is decided below from whether its - // trial actually found a nonzero level, once its residual is priced - // against the same CDFs the tile writer codes it with. - // - // lane-av1speed: its three trials are kept (rather than moved straight - // into the candidate) so that a NEWMV landing on the very same vector -- - // common on static content, where the stack's nearest vector is also - // what the search finds -- reuses them instead of running the same - // motion compensation, transform, quantize and reconstruct again. The - // reused trials are the same values, so the choice is bit-identical. - let nearest_trials; - { - let mv = stack.nearest_mv; - let luma_trial = mc_trial( - luma, - x, - y, - BLOCK, - mv, - true, - ref_luma.0, - ref_luma.1, - ref_luma.2, - ref_luma.3, - false, - search.base_q_idx, - search.deadzone, - TxbSet::Luma32Inter, fctx, - ); - let u = mc_trial( - &chroma[0], - x / 2, - y / 2, - BLOCK / 2, - mv, - false, - ref_u.0, - ref_u.1, - ref_u.2, - ref_u.3, - false, - search.base_q_idx, - search.deadzone, - chroma_set, fctx, - ); - let v = mc_trial( - &chroma[1], - x / 2, - y / 2, - BLOCK / 2, - mv, - false, - ref_v.0, - ref_v.1, - ref_v.2, - ref_v.3, - false, - search.base_q_idx, - search.deadzone, - chroma_set, fctx, - ); - let skip = luma_trial.levels.iter().all(|&l| l == 0) - && u.levels.iter().all(|&l| l == 0) - && v.levels.iter().all(|&l| l == 0); - let cost = luma_trial.sse - + u.sse - + v.sse - + search.lambda - * (skip_bits(skip) - + intra_inter_bits(true) - + single_ref_bits - + mode_bits_inter - + if skip { - 0.0 - } else { - luma_trial.bits + u.bits + v.bits - }); - nearest_trials = (luma_trial.clone(), u.clone(), v.clone()); - consider(Candidate { - cost, - luma: luma_trial, - u, - v, - mode: DC_PRED, - skip, - inter: Some(InterInfo { + // Every single-reference mode the writer can code (spec 5.11.24's symbol + // chain, mirrored by `tile::write_inter_mode`), priced with the static + // CDFs at this block's own stack contexts. A candidate is a motion + // vector plus the cheapest syntax that reaches it, so two modes landing + // on the same vector share one set of trials: the added modes cost + // mode-bit arithmetic, not another motion compensation. + let not_new = symbol_bits(&cdf::NEW_MV[stack.new_mv_ctx], 1); + let not_zero = symbol_bits(&cdf::ZERO_MV[stack.zero_mv_ctx], 1); + // `tile::write_drl_idx`'s cost: one `drl_mode` symbol per stack entry + // past `start`, `1` to advance and `0` to stop, at most two. A `target` + // the loop cannot reach is never offered below -- every candidate's + // index is one this same loop walks to. + let drl_bits = |start: usize, target: usize| { + let mut bits = 0.0; + let mut idx = start; + while idx < start + 2 && stack.entries.len() > idx + 1 { + let advance = idx < target; + bits += symbol_bits(&cdf::DRL_MODE[stack.drl_ctx[idx]], usize::from(advance)); + if !advance { + break; + } + idx += 1; + } + bits + }; + let mut cands: Vec<((i32, i32), f64, InterInfo)> = vec![ + ( + stack.nearest_mv, + not_new + not_zero + symbol_bits(&cdf::REF_MV[stack.ref_mv_ctx], 0), + InterInfo { mode: InterMode::NearestMv, - mv, - }), - }); + mv: stack.nearest_mv, + ref_mv_idx: 0, + }, + ), + // GLOBALMV is the identity model's zero vector -- this encoder writes + // no `gm_params` -- and the cheapest syntax of the four on the static + // content where that vector is also the right one. + ( + (0, 0), + not_new + symbol_bits(&cdf::ZERO_MV[stack.zero_mv_ctx], 0), + InterInfo { + mode: InterMode::GlobalMv, + mv: (0, 0), + ref_mv_idx: 0, + }, + ), + ]; + let near_bits = not_new + not_zero + symbol_bits(&cdf::REF_MV[stack.ref_mv_ctx], 1); + for idx in 1..=3usize { + if let Some(e) = stack.entries.get(idx) { + cands.push(( + e.mv, + near_bits + drl_bits(1, idx), + InterInfo { + mode: InterMode::NearMv, + mv: e.mv, + ref_mv_idx: idx as u8, + }, + )); + } } let source_block = luma.source_block(x, y, BLOCK); @@ -3512,96 +3481,114 @@ fn search_inter_block( #[cfg(test)] stage_add(0, t.elapsed()); let mv = round_to_valid_mv(found.mv, stack.pred_mv); - if let Some(mv_bits) = mv_residual_bits(mv, stack.pred_mv) { - let (luma_trial, u, v) = if mv == stack.nearest_mv { - nearest_trials - } else { - ( - mc_trial( - luma, - x, - y, - BLOCK, - mv, - true, - ref_luma.0, - ref_luma.1, - ref_luma.2, - ref_luma.3, - false, - search.base_q_idx, - search.deadzone, - TxbSet::Luma32Inter, fctx, - ), - mc_trial( - &chroma[0], - x / 2, - y / 2, - BLOCK / 2, - mv, - false, - ref_u.0, - ref_u.1, - ref_u.2, - ref_u.3, - false, - search.base_q_idx, - search.deadzone, - chroma_set, fctx, - ), - mc_trial( - &chroma[1], - x / 2, - y / 2, - BLOCK / 2, - mv, - false, - ref_v.0, - ref_v.1, - ref_v.2, - ref_v.3, - false, - search.base_q_idx, - search.deadzone, - chroma_set, fctx, - ), - ) - }; - let drl_bits = if stack.entries.len() > 1 { - symbol_bits(&cdf::DRL_MODE[stack.drl_ctx[0]], 0) - } else { - 0.0 - }; - let skip = luma_trial.levels.iter().all(|&l| l == 0) - && u.levels.iter().all(|&l| l == 0) - && v.levels.iter().all(|&l| l == 0); - let cost = luma_trial.sse - + u.sse - + v.sse - + search.lambda - * (skip_bits(skip) - + intra_inter_bits(true) - + single_ref_bits - + symbol_bits(&cdf::NEW_MV[stack.new_mv_ctx], 0) - + drl_bits - + mv_bits - + if skip { - 0.0 - } else { - luma_trial.bits + u.bits + v.bits - }); - consider(Candidate { - cost, - luma: luma_trial, - u, - v, - mode: DC_PRED, - skip, - inter: Some(InterInfo { + // Each DRL entry is a different `PredMv` (spec 7.10.2.10 `assign_mv`), so + // the same vector costs a different residual from each: take the index + // whose residual plus DRL bits is cheapest, not entry 0 by default. + let mut best_new: Option<(f64, u8)> = None; + for idx in 0..3usize { + if idx > 0 && stack.entries.len() <= idx { + break; + } + let base = stack.entries.get(idx).map_or(stack.pred_mv, |e| e.mv); + if let Some(b) = mv_residual_bits(mv, base) { + let total = b + drl_bits(0, idx); + if best_new.is_none_or(|(t, _)| total < t) { + best_new = Some((total, idx as u8)); + } + } + } + if let Some((bits, ref_mv_idx)) = best_new { + cands.push(( + mv, + symbol_bits(&cdf::NEW_MV[stack.new_mv_ctx], 0) + bits, + InterInfo { mode: InterMode::NewMv, mv, - }), - }); + ref_mv_idx, + }, + )); + } + + // One trial set per distinct vector: sort by vector, cheapest syntax + // first, and drop the rest of each vector's run. + cands.sort_by(|a, b| a.0.cmp(&b.0).then(a.1.total_cmp(&b.1))); + cands.dedup_by_key(|c| c.0); + { + for (mv, mode_bits_inter, info) in cands { + let luma_trial = mc_trial( + luma, + x, + y, + BLOCK, + mv, + true, + ref_luma.0, + ref_luma.1, + ref_luma.2, + ref_luma.3, + false, + search.base_q_idx, + search.deadzone, + TxbSet::Luma32Inter, fctx, + ); + let u = mc_trial( + &chroma[0], + x / 2, + y / 2, + BLOCK / 2, + mv, + false, + ref_u.0, + ref_u.1, + ref_u.2, + ref_u.3, + false, + search.base_q_idx, + search.deadzone, + chroma_set, fctx, + ); + let v = mc_trial( + &chroma[1], + x / 2, + y / 2, + BLOCK / 2, + mv, + false, + ref_v.0, + ref_v.1, + ref_v.2, + ref_v.3, + false, + search.base_q_idx, + search.deadzone, + chroma_set, fctx, + ); + let skip = luma_trial.levels.iter().all(|&l| l == 0) + && u.levels.iter().all(|&l| l == 0) + && v.levels.iter().all(|&l| l == 0); + let cost = luma_trial.sse + + u.sse + + v.sse + + search.lambda + * (skip_bits(skip) + + intra_inter_bits(true) + + single_ref_bits + + mode_bits_inter + + if skip { + 0.0 + } else { + luma_trial.bits + u.bits + v.bits + }); + consider(Candidate { + cost, + luma: luma_trial, + u, + v, + mode: DC_PRED, + skip, + inter: Some(info), + }); + } } let best = best.expect("the search offers at least the intra modes"); @@ -4574,6 +4561,7 @@ mod tests { inter: Some(InterInfo { mode: InterMode::NearestMv, mv: (0, 0), + ref_mv_idx: 0, }), }; let skipped_block = BlockCoeffs { @@ -4581,6 +4569,7 @@ mod tests { inter: Some(InterInfo { mode: InterMode::NearestMv, mv: (0, 0), + ref_mv_idx: 0, }), ..BlockCoeffs::default() }; @@ -6979,11 +6968,28 @@ mod tests { let source = clip_frames(path.to_str().unwrap(), "0", width, height, frames); let _ = take_partition_hits(); let _ = take_uv_mode_hits(); + let _ = crate::tile::take_inter_mode_hits(); + let _ = crate::tile::take_drl_hits(); let (ours, ours_wall) = our_ladder(&source, width, height, fctx); // How often the inter split actually fired over this clip's four // encodes, against the whole 32x32 that was the only outcome // before (gate-blind-to-feature). let [whole32, split32, whole16, split16] = take_partition_hits(); + // Which inter modes actually fired over this clip's four encodes, + // and at which DRL index -- a mode nobody picks is a mode the BD + // number cannot be crediting (gate-blind-to-feature). + let [nearest, near, global, new] = crate::tile::take_inter_mode_hits(); + let [drl0, drl1, drl2, drl3] = crate::tile::take_drl_hits(); + let modes_total = (nearest + near + global + new).max(1); + eprintln!( + "{name}: inter modes NEAREST {nearest} ({:.1}%) NEAR {near} ({:.1}%) \ + GLOBAL {global} ({:.1}%) NEW {new} ({:.1}%); drl idx 0/1/2/3+ \ + {drl0}/{drl1}/{drl2}/{drl3}", + 100.0 * nearest as f64 / modes_total as f64, + 100.0 * near as f64 / modes_total as f64, + 100.0 * global as f64 / modes_total as f64, + 100.0 * new as f64 / modes_total as f64, + ); eprintln!( "{name}: inter 32x32 split into 16s {split32} of {} blocks ({:.1}%); \ 16x16 leaves split into 8s {split16} of {} ({:.1}%)", diff --git a/crates/ec-av1/src/tile.rs b/crates/ec-av1/src/tile.rs index 8a495fd0..7bc694f1 100644 --- a/crates/ec-av1/src/tile.rs +++ b/crates/ec-av1/src/tile.rs @@ -487,16 +487,21 @@ pub struct BlockCoeffs { pub tx_depth: u8, } -/// One inter mode [`sb_coeff_inter_frame_tile`]'s blocks may take (spec -/// 5.11.24 `read_inter_mode`), reduced to the two branches its symbol chain -/// needs to prove out: the stack's own top candidate outright, or a coded -/// residual against it. `NEARMV`/`GLOBALMV` are never written. +/// One inter mode [`sb_coeff_inter_frame_tile`]'s blocks may take: the whole +/// single-reference set of spec 5.11.24 `read_inter_mode`, each written by +/// [`write_inter_mode`] with the decoder's own contexts. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum InterMode { /// `NEARESTMV`: takes `MvStack::nearest_mv` outright, no residual, no DRL. NearestMv, - /// `NEWMV`: codes `mv` as a residual against `MvStack::pred_mv`, through - /// a DRL index this writer always leaves at zero. + /// `NEARMV`: takes the stack entry [`InterInfo::ref_mv_idx`] names + /// (clamped to at least 1, the spec's own `RefMvIdx` base for this mode). + NearMv, + /// `GLOBALMV`: the identity global model's zero vector, two symbols and + /// no MV at all. + GlobalMv, + /// `NEWMV`: codes `mv` as a residual against the stack entry + /// [`InterInfo::ref_mv_idx`] names. NewMv, } @@ -510,6 +515,11 @@ pub struct InterInfo { pub mode: InterMode, /// The motion vector a [`InterMode::NewMv`] block's residual targets. pub mv: (i32, i32), + /// The block's `RefMvIdx` (spec 5.11.24 `read_drl_idx`): which + /// `MvStack::entries` slot `NEWMV` codes its residual against, or + /// `NEARMV` takes outright. Ignored by the two modes that code no DRL + /// index (`NEARESTMV`, `GLOBALMV`). + pub ref_mv_idx: u8, } impl From> for BlockCoeffs { @@ -2632,6 +2642,123 @@ fn write_mv( Ok(()) } +/// Per-mode fire counts of [`write_inter_mode`], indexed +/// `NEARESTMV`/`NEARMV`/`GLOBALMV`/`NEWMV`, and the DRL index each block +/// coded (bucket 3 collects any index past 2). Read by the BD gate, which +/// is the only thing that proves a newly added mode ever fires +/// (gate-blind-to-feature). +static INTER_MODE_HITS: [std::sync::atomic::AtomicUsize; 4] = [ + std::sync::atomic::AtomicUsize::new(0), + std::sync::atomic::AtomicUsize::new(0), + std::sync::atomic::AtomicUsize::new(0), + std::sync::atomic::AtomicUsize::new(0), +]; +static DRL_HITS: [std::sync::atomic::AtomicUsize; 4] = [ + std::sync::atomic::AtomicUsize::new(0), + std::sync::atomic::AtomicUsize::new(0), + std::sync::atomic::AtomicUsize::new(0), + std::sync::atomic::AtomicUsize::new(0), +]; + +/// Bumps the two histograms for one coded inter block. +fn note_inter_mode(mode: usize, drl: usize) { + INTER_MODE_HITS[mode].fetch_add(1, std::sync::atomic::Ordering::Relaxed); + DRL_HITS[drl.min(3)].fetch_add(1, std::sync::atomic::Ordering::Relaxed); +} + +/// Takes and clears the inter-mode histogram (NEAREST/NEAR/GLOBAL/NEW). +#[cfg(test)] +pub(crate) fn take_inter_mode_hits() -> [usize; 4] { + [0, 1, 2, 3].map(|i| INTER_MODE_HITS[i].swap(0, std::sync::atomic::Ordering::Relaxed)) +} + +/// Takes and clears the DRL-index histogram (0, 1, 2, 3+). +#[cfg(test)] +pub(crate) fn take_drl_hits() -> [usize; 4] { + [0, 1, 2, 3].map(|i| DRL_HITS[i].swap(0, std::sync::atomic::Ordering::Relaxed)) +} + +/// Writes the DRL index of one block: the loop the decoder runs (spec +/// 5.11.24 `read_drl_idx`, decode.rs' two copies at ~26655 and ~26695), one +/// `drl_mode` bit per stack entry past `start`, `1` to advance and `0` to +/// stop, at most two bits. `drl_ctx[idx]` is the context between +/// `entries[idx]` and `entries[idx + 1]`, exactly the pair the bit chooses +/// between. +fn write_drl_idx( + enc: &mut SymbolEncoder, + cdfs: &mut Cdfs, + stack: &crate::mvstack::MvStack, + start: usize, + target: usize, +) { + let mut idx = start; + while idx < start + 2 && stack.entries.len() > idx + 1 { + let advance = idx < target; + enc.symbol(usize::from(advance), &mut cdfs.drl_mode[stack.drl_ctx[idx]]); + if !advance { + return; + } + idx += 1; + } +} + +/// Writer-side counterpart of the decoder's single-reference +/// `read_inter_mode`/`assign_mv` chain (decode.rs ~26645): writes `info`'s +/// mode symbols against `stack`'s own contexts and, for `NEWMV`, the MV +/// residual against the DRL-selected predictor. Returns the motion vector +/// the decoder will derive for the block (what the MI grid must record) and +/// whether it is `NEWMV`. +/// +/// `GLOBALMV` resolves to `(0, 0)` because this encoder writes no global +/// motion parameters at all, so every `gm_get_motion_vector` the decoder +/// runs is the identity model's zero vector; a lane that starts writing +/// real `gm_params` has to feed the same vector in here. +/// +/// # Errors +/// As [`write_mv`]: a `NEWMV` residual needing eighth-pel precision. +fn write_inter_mode( + enc: &mut SymbolEncoder, + cdfs: &mut Cdfs, + info: InterInfo, + stack: &crate::mvstack::MvStack, +) -> Result<((i32, i32), bool)> { + let idx = usize::from(info.ref_mv_idx); + match info.mode { + InterMode::NewMv => { + enc.symbol(0, &mut cdfs.new_mv[stack.new_mv_ctx]); + write_drl_idx(enc, cdfs, stack, 0, idx); + let base = stack.entries.get(idx).map_or(stack.pred_mv, |e| e.mv); + write_mv(enc, &mut cdfs.mv_comp, &mut cdfs.mv_joint, info.mv, base)?; + note_inter_mode(3, idx); + Ok((info.mv, true)) + } + InterMode::GlobalMv => { + enc.symbol(1, &mut cdfs.new_mv[stack.new_mv_ctx]); // not NEWMV + enc.symbol(0, &mut cdfs.zero_mv[stack.zero_mv_ctx]); // GLOBALMV + note_inter_mode(2, 0); + Ok(((0, 0), false)) + } + InterMode::NearestMv => { + enc.symbol(1, &mut cdfs.new_mv[stack.new_mv_ctx]); // not NEWMV + enc.symbol(1, &mut cdfs.zero_mv[stack.zero_mv_ctx]); // not GLOBALMV + enc.symbol(0, &mut cdfs.ref_mv[stack.ref_mv_ctx]); // NEARESTMV + note_inter_mode(0, 0); + Ok((stack.nearest_mv, false)) + } + InterMode::NearMv => { + enc.symbol(1, &mut cdfs.new_mv[stack.new_mv_ctx]); // not NEWMV + enc.symbol(1, &mut cdfs.zero_mv[stack.zero_mv_ctx]); // not GLOBALMV + enc.symbol(1, &mut cdfs.ref_mv[stack.ref_mv_ctx]); // NEARMV + // `RefMvIdx` starts at 1 for NEARMV (spec 5.11.24). + let idx = idx.max(1); + write_drl_idx(enc, cdfs, stack, 1, idx); + let mv = stack.entries.get(idx).map_or(stack.near_mv, |e| e.mv); + note_inter_mode(1, idx); + Ok((mv, false)) + } + } +} + /// Writes the payload of a one-tile inter frame built from `blocks`, one /// 32x32 block per entry in raster order across the frame — every superblock /// is split into its four quadrants the way [`split_coeff_key_frame_tile`] @@ -3028,32 +3155,7 @@ pub fn sb_coeff_inter_frame_tile_tx( mi_rows as usize, ); - let is_new_mv = matches!(info.mode, InterMode::NewMv); - if is_new_mv { - enc.symbol(0, &mut cdfs.new_mv[stack.new_mv_ctx]); // NEWMV - } else { - enc.symbol(1, &mut cdfs.new_mv[stack.new_mv_ctx]); // not new - enc.symbol(1, &mut cdfs.zero_mv[stack.zero_mv_ctx]); // not zero - enc.symbol(0, &mut cdfs.ref_mv[stack.ref_mv_ctx]); // NEARESTMV - } - // This writer always keeps the first DRL candidate, so the - // loop (spec 5.11.24 `read_drl_idx`) only ever runs its - // first, breaking iteration. - if is_new_mv && stack.entries.len() > 1 { - enc.symbol(0, &mut cdfs.drl_mode[stack.drl_ctx[0]]); - } - let mv = if is_new_mv { - write_mv( - &mut enc, - &mut cdfs.mv_comp, - &mut cdfs.mv_joint, - info.mv, - stack.pred_mv, - )?; - info.mv - } else { - stack.nearest_mv - }; + let (mv, is_new_mv) = write_inter_mode(&mut enc, &mut cdfs, info, &stack)?; grid.set( mi_row, mi_col, @@ -3263,29 +3365,7 @@ fn write_inter_frame_leaf( mi_rows as usize, ); - let is_new_mv = matches!(info.mode, InterMode::NewMv); - if is_new_mv { - enc.symbol(0, &mut cdfs.new_mv[stack.new_mv_ctx]); // NEWMV - } else { - enc.symbol(1, &mut cdfs.new_mv[stack.new_mv_ctx]); // not new - enc.symbol(1, &mut cdfs.zero_mv[stack.zero_mv_ctx]); // not zero - enc.symbol(0, &mut cdfs.ref_mv[stack.ref_mv_ctx]); // NEARESTMV - } - if is_new_mv && stack.entries.len() > 1 { - enc.symbol(0, &mut cdfs.drl_mode[stack.drl_ctx[0]]); - } - let mv = if is_new_mv { - write_mv( - enc, - &mut cdfs.mv_comp, - &mut cdfs.mv_joint, - info.mv, - stack.pred_mv, - )?; - info.mv - } else { - stack.nearest_mv - }; + let (mv, is_new_mv) = write_inter_mode(enc, cdfs, info, &stack)?; for dr in 0..SUB_MI as usize { for dc in 0..SUB_MI as usize { grid.set( @@ -3483,29 +3563,7 @@ fn write_inter_frame_leaf8( mi_rows as usize, ); - let is_new_mv = matches!(info.mode, InterMode::NewMv); - if is_new_mv { - enc.symbol(0, &mut cdfs.new_mv[stack.new_mv_ctx]); // NEWMV - } else { - enc.symbol(1, &mut cdfs.new_mv[stack.new_mv_ctx]); // not new - enc.symbol(1, &mut cdfs.zero_mv[stack.zero_mv_ctx]); // not zero - enc.symbol(0, &mut cdfs.ref_mv[stack.ref_mv_ctx]); // NEARESTMV - } - if is_new_mv && stack.entries.len() > 1 { - enc.symbol(0, &mut cdfs.drl_mode[stack.drl_ctx[0]]); - } - let mv = if is_new_mv { - write_mv( - enc, - &mut cdfs.mv_comp, - &mut cdfs.mv_joint, - info.mv, - stack.pred_mv, - )?; - info.mv - } else { - stack.nearest_mv - }; + let (mv, is_new_mv) = write_inter_mode(enc, cdfs, info, &stack)?; for dr in 0..2 { for dc in 0..2 { grid.set( @@ -5898,6 +5956,7 @@ mod tests { inter: Some(InterInfo { mode: InterMode::NearestMv, mv: (0, 0), + ref_mv_idx: 0, }), skip: true, ..BlockCoeffs::default() @@ -5939,6 +5998,7 @@ mod tests { inter: Some(InterInfo { mode: InterMode::NearestMv, mv: (0, 0), + ref_mv_idx: 0, }), skip: true, ..BlockCoeffs::default() @@ -5947,6 +6007,7 @@ mod tests { inter: Some(InterInfo { mode: InterMode::NewMv, mv: (0, 2), + ref_mv_idx: 0, }), skip: true, ..BlockCoeffs::default()