From b1e4c272e973d304f207c19cc1d6def01d96ffce Mon Sep 17 00:00:00 2001
From: Xiang Li <xlxiangli@tencent.com>
Date: Mon, 12 Nov 2018 12:31:20 -0800
Subject: [PATCH] Fix ticket #103 on MV rounding issue during AMVP candidates
 generation. Patch provided by ruoyang.yu@ericsson.com

---
 source/Lib/CommonLib/UnitTools.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp
index 4f4725d4..b7c70c66 100644
--- a/source/Lib/CommonLib/UnitTools.cpp
+++ b/source/Lib/CommonLib/UnitTools.cpp
@@ -2365,6 +2365,9 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
       if (pu.cu->imv != 0)
       {
         unsigned imvShift = pu.cu->imv << 1;
+#if REMOVE_MV_ADAPT_PREC
+        imvShift += VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
+#endif
         roundMV(cColMv, imvShift);
       }
       int i = 0;
@@ -3158,6 +3161,9 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList,
   MotionInfo neibMi;
   int i = 0;
   unsigned imvShift = imv << 1;
+#if REMOVE_MV_ADAPT_PREC
+  imvShift += VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
+#endif
 
   int num_avai_candInLUT = slice.getAvailableLUTMrgNum();
   int num_allowedCand = std::min(MAX_NUM_HMVP_AVMPCANDS, num_avai_candInLUT);
-- 
GitLab