diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2021-10-12 15:41:59 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2021-10-14 16:38:21 +0200 |
commit | 473c2f76c1164db245d9de89034650be998d4d7d (patch) | |
tree | 245ae867d69ca2ab3690ae134ab27237de6606e5 /nihav-codec-support/src | |
parent | 0cc75664f579f511681ee7000741484a1d849061 (diff) | |
download | nihav-473c2f76c1164db245d9de89034650be998d4d7d.tar.gz |
codec_support/codecs: add negation for MV
Diffstat (limited to 'nihav-codec-support/src')
-rw-r--r-- | nihav-codec-support/src/codecs/mod.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nihav-codec-support/src/codecs/mod.rs b/nihav-codec-support/src/codecs/mod.rs index 389821e..92dee91 100644 --- a/nihav-codec-support/src/codecs/mod.rs +++ b/nihav-codec-support/src/codecs/mod.rs @@ -1,6 +1,6 @@ //! Decoder support functions and definitions. use std::fmt; -use std::ops::{Add, AddAssign, Sub, SubAssign}; +use std::ops::{Add, AddAssign, Sub, SubAssign, Neg}; pub use nihav_core::frame::*; use std::mem; @@ -288,6 +288,13 @@ impl SubAssign for MV { fn sub_assign(&mut self, other: MV) { self.x -= other.x; self.y -= other.y; } } +impl Neg for MV { + type Output = MV; + fn neg(self) -> Self::Output { + MV { x: -self.x, y: -self.y } + } +} + impl fmt::Display for MV { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{},{}", self.x, self.y) |