From df6b9afade1ad70f3b5a7eb78b6196a9c690d0d7 Mon Sep 17 00:00:00 2001
From: "Zhang, Yan" <yzh@qti.qualcomm.com>
Date: Wed, 6 Mar 2024 09:22:18 -0800
Subject: [PATCH] fix issue 61

---
 source/Lib/DecoderLib/DecCu.cpp |  6 ++++++
 source/Lib/EncoderLib/EncCu.cpp | 12 ++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp
index fdb821d79..e6adc62f4 100644
--- a/source/Lib/DecoderLib/DecCu.cpp
+++ b/source/Lib/DecoderLib/DecCu.cpp
@@ -4375,6 +4375,12 @@ void DecCu::xDeriveCUMV(CodingUnit &cu)
             else
             {
               PU::getInterMergeCandidates(pu, mrgCtx, 0, pu.mergeIdx);
+#if JVET_AG0276_LIC_FLAG_SIGNALING
+              if (pu.mergeOppositeLic)
+              {
+                mrgCtx.licFlags[pu.mergeIdx] = !mrgCtx.licFlags[pu.mergeIdx];
+              }
+#endif
             }
 #else
             PU::getInterMergeCandidates(pu, mrgCtx, 0, pu.mergeIdx);
diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp
index 9587edc24..0465d340a 100644
--- a/source/Lib/EncoderLib/EncCu.cpp
+++ b/source/Lib/EncoderLib/EncCu.cpp
@@ -5239,13 +5239,13 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
           m_pcInterSearch->adjustAffineMergeCandidates(pu, affineBMMergeCtx);
         }
 #endif
-#if JVET_AG0276_LIC_FLAG_SIGNALING
-        if (hasOppositelicAff && pu.cs->sps->getUseAffMergeOppositeLic())
-        {
-          affineMergeCtxOppositeLic.numValidMergeCand = slice.getPicHeader()->getMaxNumAffineOppositeLicMergeCand();
-          affineMergeCtxOppositeLic.maxNumMergeCand = slice.getPicHeader()->getMaxNumAffineOppositeLicMergeCand();
-        }
+      }
 #endif
+#if JVET_AG0276_LIC_FLAG_SIGNALING
+      if (hasOppositelicAff && pu.cs->sps->getUseAffMergeOppositeLic())
+      {
+        affineMergeCtxOppositeLic.numValidMergeCand = slice.getPicHeader()->getMaxNumAffineOppositeLicMergeCand();
+        affineMergeCtxOppositeLic.maxNumMergeCand = slice.getPicHeader()->getMaxNumAffineOppositeLicMergeCand();
       }
 #endif
 #if JVET_AD0182_AFFINE_DMVR_PLUS_EXTENSIONS
-- 
GitLab