X-Git-Url: https://git.piment-noir.org/?p=deb_x265.git;a=blobdiff_plain;f=source%2Fcommon%2Fmv.h;fp=source%2Fcommon%2Fmv.h;h=dad3729165d2d4883645378c60d93f671ef4a91e;hp=22a70734c828062bf856de814c1cea29717f288a;hb=b53f7c52d8280ab63876efd6eb292c21430ac607;hpb=5c9b45285dd64723ad1dac380b98a7b1f3095674 diff --git a/source/common/mv.h b/source/common/mv.h index 22a7073..dad3729 100644 --- a/source/common/mv.h +++ b/source/common/mv.h @@ -44,19 +44,19 @@ public: int32_t word; }; - MV() : word(0) {} - + MV() {} + MV(int32_t w) : word(w) {} MV(int16_t _x, int16_t _y) : x(_x), y(_y) {} - const MV& operator =(uint32_t w) { word = w; return *this; } + MV& operator =(uint32_t w) { word = w; return *this; } - const MV& operator +=(const MV& other) { x += other.x; y += other.y; return *this; } + MV& operator +=(const MV& other) { x += other.x; y += other.y; return *this; } - const MV& operator -=(const MV& other) { x -= other.x; y -= other.y; return *this; } + MV& operator -=(const MV& other) { x -= other.x; y -= other.y; return *this; } - const MV& operator >>=(int i) { x >>= i; y >>= i; return *this; } + MV& operator >>=(int i) { x >>= i; y >>= i; return *this; } - const MV& operator <<=(int i) { x <<= i; y <<= i; return *this; } + MV& operator <<=(int i) { x <<= i; y <<= i; return *this; } MV operator >>(int i) const { return MV(x >> i, y >> i); } @@ -64,16 +64,18 @@ public: MV operator *(int16_t i) const { return MV(x * i, y * i); } - const MV operator -(const MV& other) const { return MV(x - other.x, y - other.y); } + MV operator -(const MV& other) const { return MV(x - other.x, y - other.y); } - const MV operator +(const MV& other) const { return MV(x + other.x, y + other.y); } + MV operator +(const MV& other) const { return MV(x + other.x, y + other.y); } bool operator ==(const MV& other) const { return word == other.word; } bool operator !=(const MV& other) const { return word != other.word; } + bool operator !() const { return !word; } + // Scale down a QPEL mv to FPEL mv, rounding up by one HPEL offset - MV roundToFPel() const { return MV(x + 2, y + 2) >> 2; } + MV roundToFPel() const { return MV((x + 2) >> 2, (y + 2) >> 2); } // Scale up an FPEL mv to QPEL by shifting up two bits MV toQPel() const { return *this << 2; }