Commit 343461dc authored by Raphaël Zumer's avatar Raphaël Zumer
Browse files

Move MotionVector to mc.rs

parent 289afc7c
......@@ -17,6 +17,7 @@ use crate::ec::OD_BITRES;
use crate::encoder::FrameInvariants;
use crate::entropymode::*;
use crate::header::ReferenceMode;
use crate::mc::MotionVector;
use crate::partition::BlockSize::*;
use crate::partition::RefType::*;
use crate::partition::*;
......
......@@ -14,6 +14,7 @@ use crate::deblock::*;
use crate::frame::*;
use crate::ec::*;
use crate::lrf::*;
use crate::mc::MotionVector;
use crate::me::*;
use crate::partition::*;
use crate::predict::PredictionMode;
......
......@@ -15,6 +15,43 @@ pub use self::native::*;
use crate::tiling::*;
use crate::util::Pixel;
use std::ops;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct MotionVector {
pub row: i16,
pub col: i16
}
impl ops::Add<MotionVector> for MotionVector {
type Output = MotionVector;
fn add(self, _rhs: MotionVector) -> MotionVector {
MotionVector{row: self.row + _rhs.row, col: self.col + _rhs.col}
}
}
impl ops::Div<i16> for MotionVector {
type Output = MotionVector;
fn div(self, _rhs: i16) -> MotionVector {
MotionVector{row: self.row / _rhs, col: self.col / _rhs}
}
}
impl MotionVector {
pub fn quantize_to_fullpel(self) -> Self {
Self {
row: (self.row / 8) * 8,
col: (self.col / 8) * 8
}
}
pub fn is_zero(self) -> bool {
self.row == 0 && self.col == 0
}
}
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
#[allow(unused)]
pub enum FilterMode {
......
......@@ -14,6 +14,7 @@ pub use self::native::get_sad;
use crate::context::{BlockOffset, BLOCK_TO_PLANE_SHIFT, MI_SIZE};
use crate::encoder::ReferenceFrame;
use crate::FrameInvariants;
use crate::mc::MotionVector;
use crate::partition::*;
use crate::partition::RefType::*;
use crate::predict::PredictionMode;
......
......@@ -10,12 +10,9 @@
#![allow(non_camel_case_types)]
#![allow(dead_code)]
use std::ops;
use self::BlockSize::*;
use self::TxSize::*;
use crate::context::*;
use crate::encoder::FrameInvariants;
use crate::mc::*;
use crate::plane::*;
use crate::predict::*;
use crate::tiling::*;
......@@ -368,41 +365,6 @@ impl BlockSize {
}
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct MotionVector {
pub row: i16,
pub col: i16
}
impl ops::Add<MotionVector> for MotionVector {
type Output = MotionVector;
fn add(self, _rhs: MotionVector) -> MotionVector {
MotionVector{row: self.row + _rhs.row, col: self.col + _rhs.col}
}
}
impl ops::Div<i16> for MotionVector {
type Output = MotionVector;
fn div(self, _rhs: i16) -> MotionVector {
MotionVector{row: self.row / _rhs, col: self.col / _rhs}
}
}
impl MotionVector {
pub fn quantize_to_fullpel(self) -> Self {
Self {
row: (self.row / 8) * 8,
col: (self.col / 8) * 8
}
}
pub fn is_zero(self) -> bool {
self.row == 0 && self.col == 0
}
}
pub const NEWMV_MODE_CONTEXTS: usize = 7;
pub const GLOBALMV_MODE_CONTEXTS: usize = 2;
pub const REFMV_MODE_CONTEXTS: usize = 6;
......
......@@ -22,6 +22,7 @@ use crate::encode_block_with_modes;
use crate::encoder::FrameInvariants;
use crate::frame::Frame;
use crate::luma_ac;
use crate::mc::MotionVector;
use crate::me::*;
use crate::motion_compensate;
use crate::partition::*;
......
......@@ -8,6 +8,7 @@
// PATENTS file, you can obtain it at www.aomedia.org/license/patent.
use crate::context::*;
use crate::mc::MotionVector;
use crate::partition::*;
use crate::predict::PredictionMode;
use crate::transform::*;
......
......@@ -7,8 +7,8 @@
// Media Patent License 1.0 was not distributed with this source code in the
// PATENTS file, you can obtain it at www.aomedia.org/license/patent.
use crate::mc::MotionVector;
use crate::me::*;
use crate::partition::*;
use std::marker::PhantomData;
use std::ops::{Index, IndexMut};
......
......@@ -205,7 +205,7 @@ pub mod test {
use super::*;
use crate::api::*;
use crate::lrf::*;
use crate::partition::*;
use crate::mc::MotionVector;
use crate::predict::PredictionMode;
#[test]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment