if mvs.len() > 0 { self.skip = false; }
let mut mv_arr: [MV; 2] = [ZERO_MV, ZERO_MV];
for i in 0..mvs.len() { mv_arr[i] = mvs[i]; }
- self.mv2 = mv_arr;
+ self.mv2 = mv_arr;
+ self.num_mv2 = mvs.len();
}
pub fn is_b_fwd(&self) -> bool { self.fwd }
pub fn set_acpred(&mut self, acpred: ACPredMode) { self.acpred = acpred }
}
}
fn b_sub(pvec: MV, fwdvec: MV, bvec: MV, trb: u16, trd: u16) -> Self {
- let bscale = (trb as i16) - (trd as i16);
- let x = if bvec.x != 0 { fwdvec.x - pvec.x } else if trd != 0 { bscale * pvec.x / (trd as i16) } else { 0 };
- let y = if bvec.y != 0 { fwdvec.y - pvec.y } else if trd != 0 { bscale * pvec.y / (trd as i16) } else { 0 };
+ let bscale = (trb as i32) - (trd as i32);
+ let x = if bvec.x != 0 { fwdvec.x - pvec.x } else if trd != 0 { (bscale * (pvec.x as i32) / (trd as i32)) as i16 } else { 0 };
+ let y = if bvec.y != 0 { fwdvec.y - pvec.y } else if trd != 0 { (bscale * (pvec.y as i32) / (trd as i32)) as i16 } else { 0 };
MV { x: x, y: y }
}
}