pub struct MotionVector {
pub dx: i32,
pub dy: i32,
}Expand description
A motion vector with sub-pixel precision.
Components are stored in 1/8 pixel (eighth-pel) precision internally. This allows conversion to any lower precision without loss.
Fields§
§dx: i32Horizontal displacement (dx) in 1/8 pixel units.
dy: i32Vertical displacement (dy) in 1/8 pixel units.
Implementations§
Source§impl MotionVector
impl MotionVector
Sourcepub const fn new(dx: i32, dy: i32) -> Self
pub const fn new(dx: i32, dy: i32) -> Self
Creates a motion vector with the given components (in 1/8 pel).
Sourcepub const fn from_full_pel(dx: i32, dy: i32) -> Self
pub const fn from_full_pel(dx: i32, dy: i32) -> Self
Creates a motion vector from full-pixel coordinates.
Sourcepub const fn from_precision(dx: i32, dy: i32, precision: MvPrecision) -> Self
pub const fn from_precision(dx: i32, dy: i32, precision: MvPrecision) -> Self
Creates a motion vector at the given precision.
Sourcepub const fn full_pel_x(&self) -> i32
pub const fn full_pel_x(&self) -> i32
Returns the full-pixel horizontal component.
Sourcepub const fn full_pel_y(&self) -> i32
pub const fn full_pel_y(&self) -> i32
Returns the full-pixel vertical component.
Sourcepub const fn half_pel_x(&self) -> i32
pub const fn half_pel_x(&self) -> i32
Returns the half-pel x component (0-1).
Sourcepub const fn half_pel_y(&self) -> i32
pub const fn half_pel_y(&self) -> i32
Returns the half-pel y component (0-1).
Sourcepub const fn quarter_pel_x(&self) -> i32
pub const fn quarter_pel_x(&self) -> i32
Returns the quarter-pel x component (0-3).
Sourcepub const fn quarter_pel_y(&self) -> i32
pub const fn quarter_pel_y(&self) -> i32
Returns the quarter-pel y component (0-3).
Sourcepub const fn to_precision(&self, precision: MvPrecision) -> Self
pub const fn to_precision(&self, precision: MvPrecision) -> Self
Converts to the specified precision (may lose fractional bits).
Sourcepub const fn round_to_precision(&self, precision: MvPrecision) -> Self
pub const fn round_to_precision(&self, precision: MvPrecision) -> Self
Rounds to the specified precision.
Sourcepub fn clamp_to_range(&self, range: &SearchRange) -> Self
pub fn clamp_to_range(&self, range: &SearchRange) -> Self
Clamps to the specified search range (in full pixels).
Sourcepub const fn magnitude_squared(&self) -> i64
pub const fn magnitude_squared(&self) -> i64
Returns the squared magnitude.
Trait Implementations§
Source§impl Add for MotionVector
impl Add for MotionVector
Source§impl Clone for MotionVector
impl Clone for MotionVector
Source§fn clone(&self) -> MotionVector
fn clone(&self) -> MotionVector
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MotionVector
impl Debug for MotionVector
Source§impl Default for MotionVector
impl Default for MotionVector
Source§fn default() -> MotionVector
fn default() -> MotionVector
Source§impl Hash for MotionVector
impl Hash for MotionVector
Source§impl Neg for MotionVector
impl Neg for MotionVector
Source§impl PartialEq for MotionVector
impl PartialEq for MotionVector
Source§impl Sub for MotionVector
impl Sub for MotionVector
impl Copy for MotionVector
impl Eq for MotionVector
impl StructuralPartialEq for MotionVector
Auto Trait Implementations§
impl Freeze for MotionVector
impl RefUnwindSafe for MotionVector
impl Send for MotionVector
impl Sync for MotionVector
impl Unpin for MotionVector
impl UnsafeUnpin for MotionVector
impl UnwindSafe for MotionVector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more