+ #[allow(dead_code)]
+ fn get_b_fwdref(&mut self) -> Option<NAVideoBuffer<u8>> {
+ if let Some(ref frm) = self.nextframe {
+ Some(frm.clone())
+ } else {
+ None
+ }
+ }
+ #[allow(dead_code)]
+ fn get_b_bwdref(&mut self) -> Option<NAVideoBuffer<u8>> {
+ if let Some(ref frm) = self.lastframe {
+ Some(frm.clone())
+ } else {
+ None
+ }
+ }
+}
+
+#[derive(Debug,Clone,Copy)]
+pub struct MV {
+ pub x: i16,
+ pub y: i16,
+}
+
+impl MV {
+ pub fn new(x: i16, y: i16) -> Self { MV{ x: x, y: y } }
+ pub fn pred(a: MV, b: MV, c: MV) -> Self {
+ let x;
+ if a.x < b.x {
+ if b.x < c.x {
+ x = b.x;
+ } else {
+ if a.x < c.x { x = c.x; } else { x = a.x; }
+ }
+ } else {
+ if b.x < c.x {
+ if a.x < c.x { x = a.x; } else { x = c.x; }
+ } else {
+ x = b.x;
+ }
+ }
+ let y;
+ if a.y < b.y {
+ if b.y < c.y {
+ y = b.y;
+ } else {
+ if a.y < c.y { y = c.y; } else { y = a.y; }
+ }
+ } else {
+ if b.y < c.y {
+ if a.y < c.y { y = a.y; } else { y = c.y; }
+ } else {
+ y = b.y;
+ }
+ }
+ MV { x: x, y: y }
+ }
+}
+
+pub const ZERO_MV: MV = MV { x: 0, y: 0 };
+
+impl Add for MV {
+ type Output = MV;
+ fn add(self, other: MV) -> MV { MV { x: self.x + other.x, y: self.y + other.y } }
+}
+
+impl AddAssign for MV {
+ fn add_assign(&mut self, other: MV) { self.x += other.x; self.y += other.y; }