From 5a5d083cc528f19322b29852e8a53c65733c0d00 Mon Sep 17 00:00:00 2001
From: ZHI ZHANG <zhizhang@qti.qualcomm.com>
Date: Tue, 25 Jan 2022 21:20:04 +0000
Subject: [PATCH] fix compilation problem when turn off LIC or MHP

---
 source/Lib/CommonLib/UnitTools.cpp    |  9 ++++++++-
 source/Lib/DecoderLib/DecCu.cpp       |  4 ++++
 source/Lib/EncoderLib/EncCu.cpp       | 14 +++++++++++++-
 source/Lib/EncoderLib/InterSearch.cpp |  2 ++
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp
index 3c4e4031e..cc9bbe8dc 100644
--- a/source/Lib/CommonLib/UnitTools.cpp
+++ b/source/Lib/CommonLib/UnitTools.cpp
@@ -2424,9 +2424,13 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
       }
       mrgCtx.interDirNeighbours [ mrgCtx.numValidMergeCand ] = 3;
       mrgCtx.BcwIdx             [ mrgCtx.numValidMergeCand ] = BCW_DEFAULT;
+#if INTER_LIC
       mrgCtx.LICFlags           [ mrgCtx.numValidMergeCand ] = false;
+#endif
       mrgCtx.useAltHpelIf       [ mrgCtx.numValidMergeCand ] = false;
+#if MULTI_HYP_PRED
       mrgCtx.addHypNeighbours   [ mrgCtx.numValidMergeCand ].clear();
+#endif
       mrgCtx.mvFieldNeighbours  [ mrgCtx.numValidMergeCand << 1].setMvField(Mv(0, 0), mergeRefIdx);
       mrgCtx.mvFieldNeighbours  [(mrgCtx.numValidMergeCand << 1) + 1].setMvField(Mv(0, 0), mergeRefIdx);
       mrgCtx.numValidMergeCand++;
@@ -2548,7 +2552,10 @@ bool PU::addBMMergeHMVPCand(const CodingStructure &cs, MergeCtx &mrgCtx, const i
       int refIdx1 = miNeighbor.refIdx[1];
       if (refIdx0 >= 0 && refIdx1 >= 0 
         && miNeighbor.BcwIdx == BCW_DEFAULT
-        && miNeighbor.addHypData.empty())
+#if MULTI_HYP_PRED
+        && miNeighbor.addHypData.empty()
+#endif
+        )
       {
         if (cs.slice->getRefPic(REF_PIC_LIST_0, refIdx0)->longTerm
           || cs.slice->getRefPic(REF_PIC_LIST_1, refIdx1)->longTerm)
diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp
index 9f22f67b5..4ebde3a09 100644
--- a/source/Lib/DecoderLib/DecCu.cpp
+++ b/source/Lib/DecoderLib/DecCu.cpp
@@ -1350,7 +1350,9 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
 #if INTER_LIC
             m_geoTmMrgCtx0.LICFlags[pu.geoMergeIdx0] = false;
 #endif
+#if MULTI_HYP_PRED
             m_geoTmMrgCtx0.addHypNeighbours[pu.geoMergeIdx0] = m_geoMrgCtx.addHypNeighbours[pu.geoMergeIdx0];
+#endif
             m_geoTmMrgCtx0.interDirNeighbours[pu.geoMergeIdx0] = m_geoMrgCtx.interDirNeighbours[pu.geoMergeIdx0];
             m_geoTmMrgCtx0.mvFieldNeighbours[(pu.geoMergeIdx0 << 1)].mv = m_geoMrgCtx.mvFieldNeighbours[(pu.geoMergeIdx0 << 1)].mv;
             m_geoTmMrgCtx0.mvFieldNeighbours[(pu.geoMergeIdx0 << 1) + 1].mv = m_geoMrgCtx.mvFieldNeighbours[(pu.geoMergeIdx0 << 1) + 1].mv;
@@ -1371,7 +1373,9 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
 #if INTER_LIC
             m_geoTmMrgCtx1.LICFlags[pu.geoMergeIdx1] = false;
 #endif
+#if MULTI_HYP_PRED
             m_geoTmMrgCtx1.addHypNeighbours[pu.geoMergeIdx1] = m_geoMrgCtx.addHypNeighbours[pu.geoMergeIdx1];
+#endif
             m_geoTmMrgCtx1.interDirNeighbours[pu.geoMergeIdx1] = m_geoMrgCtx.interDirNeighbours[pu.geoMergeIdx1];
             m_geoTmMrgCtx1.mvFieldNeighbours[(pu.geoMergeIdx1 << 1)].mv = m_geoMrgCtx.mvFieldNeighbours[(pu.geoMergeIdx1 << 1)].mv;
             m_geoTmMrgCtx1.mvFieldNeighbours[(pu.geoMergeIdx1 << 1) + 1].mv = m_geoMrgCtx.mvFieldNeighbours[(pu.geoMergeIdx1 << 1) + 1].mv;
diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp
index d2c67cb0b..05fb8a929 100644
--- a/source/Lib/EncoderLib/EncCu.cpp
+++ b/source/Lib/EncoderLib/EncCu.cpp
@@ -2920,8 +2920,12 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
       memcpy(ciipTmMrgCtx.interDirNeighbours, mergeCtxtmp.interDirNeighbours, CIIP_TM_MRG_MAX_NUM_CANDS * sizeof(unsigned char));
       memcpy(ciipTmMrgCtx.mvFieldNeighbours, mergeCtxtmp.mvFieldNeighbours, (CIIP_TM_MRG_MAX_NUM_CANDS << 1) * sizeof(MvField));
       memcpy(ciipTmMrgCtx.useAltHpelIf, mergeCtxtmp.useAltHpelIf, CIIP_TM_MRG_MAX_NUM_CANDS * sizeof(bool));
+#if INTER_LIC
       memcpy(ciipTmMrgCtx.LICFlags, mergeCtxtmp.LICFlags, CIIP_TM_MRG_MAX_NUM_CANDS * sizeof(bool));
+#endif
+#if MULTI_HYP_PRED
       memcpy(ciipTmMrgCtx.addHypNeighbours, mergeCtxtmp.addHypNeighbours, CIIP_TM_MRG_MAX_NUM_CANDS * sizeof(MultiHypVec));
+#endif
 #else
       ciipTmMrgCtx = mergeCtx;
       ciipTmMrgCtx.numValidMergeCand = int(pu.cs->sps->getMaxNumCiipTMMergeCand());
@@ -2929,8 +2933,12 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
       memcpy(ciipTmMrgCtx.interDirNeighbours, mergeCtx.interDirNeighbours, CIIP_TM_MRG_MAX_NUM_CANDS * sizeof(unsigned char));
       memcpy(ciipTmMrgCtx.mvFieldNeighbours, mergeCtx.mvFieldNeighbours, (CIIP_TM_MRG_MAX_NUM_CANDS << 1) * sizeof(MvField));
       memcpy(ciipTmMrgCtx.useAltHpelIf, mergeCtx.useAltHpelIf, CIIP_TM_MRG_MAX_NUM_CANDS * sizeof(bool));
+#if INTER_LIC
       memcpy(ciipTmMrgCtx.LICFlags, mergeCtx.LICFlags, CIIP_TM_MRG_MAX_NUM_CANDS * sizeof(bool));
+#endif
+#if MULTI_HYP_PRED
       memcpy(ciipTmMrgCtx.addHypNeighbours, mergeCtx.addHypNeighbours, CIIP_TM_MRG_MAX_NUM_CANDS * sizeof(MultiHypVec));
+#endif
 #endif
 
       for (uint32_t uiMergeCand = 0; uiMergeCand < ciipTmMrgCtx.numValidMergeCand; uiMergeCand++)
@@ -8394,7 +8402,11 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC
 #if JVET_X0083_BM_AMVP_MERGE_MODE
   int maxBdmvrAmSearchLoop = 3;
   m_pcInterSearch->m_amvpOnlyCost = std::numeric_limits<Distortion>::max();
-  if ((tempCS->slice->getUseLIC() && (encTestMode.opts & ETO_LIC)) || !tempCS->slice->isInterB() || (tempCS->picHeader->getMvdL1ZeroFlag() == true))
+  if (!tempCS->slice->isInterB() || (tempCS->picHeader->getMvdL1ZeroFlag() == true)
+#if INTER_LIC
+      || (tempCS->slice->getUseLIC() && (encTestMode.opts & ETO_LIC))
+#endif
+      )
   {
     maxBdmvrAmSearchLoop = 1;
   }
diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp
index 7f70da0b7..5bd8b0394 100644
--- a/source/Lib/EncoderLib/InterSearch.cpp
+++ b/source/Lib/EncoderLib/InterSearch.cpp
@@ -2859,7 +2859,9 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
             {
               PelUnitBuf predBufTmp = m_tmpPredStorage[1 - iRefList].getBuf( UnitAreaRelative(cu, pu) );
               motionCompensation( pu, predBufTmp, RefPicList(1 - iRefList) );
+#if MULTI_HYP_PRED
               CHECK(pu.addHypData.empty() == false, "this is not possible");
+#endif
               xMotionEstimation ( pu, origBuf, eRefPicList, cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, amvp[eRefPicList], true );
             }
             else
-- 
GitLab