From f2773da12f783ad975bfb3c4d41d44559e7eec3d Mon Sep 17 00:00:00 2001
From: HM Jang <hmj@qti.qualcomm.com>
Date: Tue, 22 Oct 2024 23:16:44 +0900
Subject: [PATCH] fix vtm to align with SPEC regarding pruning process of AMVP
 HMVP in case of multilayer

---
 source/Lib/CommonLib/UnitTools.cpp | 8 ++++----
 source/Lib/CommonLib/UnitTools.h   | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp
index 410d1bbc77..930a9053db 100644
--- a/source/Lib/CommonLib/UnitTools.cpp
+++ b/source/Lib/CommonLib/UnitTools.cpp
@@ -2201,8 +2201,8 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
 
   if (pInfo->numCand < AMVP_MAX_NUM_CANDS)
   {
-    const int currRefPOC = cs.slice->getRefPic(eRefPicList, refIdx)->getPOC();
-    addAMVPHMVPCand(pu, eRefPicList, currRefPOC, *pInfo);
+    Picture* currRefPic = cs.slice->getRefPic(eRefPicList, refIdx);
+    addAMVPHMVPCand(pu, eRefPicList, currRefPic, *pInfo);
   }
 
   if (pInfo->numCand > AMVP_MAX_NUM_CANDS)
@@ -2970,7 +2970,7 @@ bool PU::addMVPCandUnscaled(const PredictionUnit &pu, const RefPicList &eRefPicL
   return false;
 }
 
-void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const int currRefPOC, AMVPInfo &info)
+void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const Picture* currRefPic, AMVPInfo &info)
 {
   const Slice &slice = *(*pu.cs).slice;
 
@@ -3011,7 +3011,7 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList,
       const RefPicList eRefPicListIndex = (predictorSource == 0) ? eRefPicList : eRefPicList2nd;
       const int        neibRefIdx = neibMi.refIdx[eRefPicListIndex];
 
-      if (neibRefIdx >= 0 && (CU::isIBC(*pu.cu) || (currRefPOC == slice.getRefPOC(eRefPicListIndex, neibRefIdx))))
+      if (neibRefIdx >= 0 && (CU::isIBC(*pu.cu) || (currRefPic == slice.getRefPic(eRefPicListIndex, neibRefIdx))))
       {
         Mv pmv = neibMi.mv[eRefPicListIndex];
         pmv.roundTransPrecInternal2Amvr(pu.cu->imv);
diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h
index 2bb622bd0c..1db7377025 100644
--- a/source/Lib/CommonLib/UnitTools.h
+++ b/source/Lib/CommonLib/UnitTools.h
@@ -176,7 +176,7 @@ namespace PU
                         const PredictionUnit &pu, bool &allCandSolidInAbove
 #endif
   );
-  void addAMVPHMVPCand                (const PredictionUnit &pu, const RefPicList eRefPicList, const int currRefPOC, AMVPInfo &info);
+  void addAMVPHMVPCand                (const PredictionUnit &pu, const RefPicList eRefPicList, const Picture* currRefPic, AMVPInfo &info);
   bool addAffineMVPCandUnscaled       ( const PredictionUnit &pu, const RefPicList &refPicList, const int &refIdx, const Position &pos, const MvpDir &dir, AffineAMVPInfo &affiAmvpInfo );
   bool isBipredRestriction            (const PredictionUnit &pu);
   void spanMotionInfo                 (      PredictionUnit &pu, const MergeCtx &mrgCtx = MergeCtx() );
-- 
GitLab