From b3c1a8d879702a59fafd12de108954443d923265 Mon Sep 17 00:00:00 2001
From: Thierry Dumas <thierry.dumas@interdigital.com>
Date: Mon, 13 Feb 2023 07:54:31 +0000
Subject: [PATCH] Fix issue #16.

---
 source/Lib/EncoderLib/IntraSearch.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp
index ab6f6b1d2a..1af40d9e58 100644
--- a/source/Lib/EncoderLib/IntraSearch.cpp
+++ b/source/Lib/EncoderLib/IntraSearch.cpp
@@ -1876,11 +1876,11 @@ IntraSearch::estIntraPredChromaQT( CodingUnit &cu, Partitioner &partitioner, con
       std::vector<uint32_t> vector_indices;
       const int error_code = collect_indices_non_zeros(satdSortedCost,NUM_CHROMA_MODE,vector_indices);
       CHECK(error_code < 0, "Error in `collect_indices_non_zeros`.");
-      if (vector_indices.empty())
+      if (m_pcEncCfg->getUseNnIntraPred() && vector_indices.empty())
       {
         m_modeIsEnable[chromaCandModes[1]] = false;m_modeIsEnable[chromaCandModes[2]] = false;
       }
-      else if (vector_indices.size() == 1)
+      else if (m_pcEncCfg->getUseNnIntraPred() && vector_indices.size() == 1)
       {
         CHECK(vector_indices.at(0) != NUM_CHROMA_MODE - 1,"The index in `satdSortedCost` of the unique chrominance candidate intra prediction mode with non-zero SATD cost is not equal to `NUM_CHROMA_MODE - 1`.");
         m_modeIsEnable[satdModeList[NUM_CHROMA_MODE - 1]] = false;
@@ -1909,7 +1909,7 @@ IntraSearch::estIntraPredChromaQT( CodingUnit &cu, Partitioner &partitioner, con
       m_isModeIsEnableUpdated = true;
       }
       CHECK(!m_isModeIsEnableUpdated,"For the current call to `EncCu::xCheckRDCostIntra`, the fast search in chrominance was not run before starting the rate-distortion tests in chrominance.");
-      CHECK(!m_modeIsEnable[PLANAR_IDX] || !m_modeIsEnable[LM_CHROMA_IDX] || !m_modeIsEnable[DM_CHROMA_IDX],"PLANAR or LM or DM is rejected during the fast search in chrominance.");
+      CHECK(m_pcEncCfg->getUseNnIntraPred() && (!m_modeIsEnable[PLANAR_IDX] || !m_modeIsEnable[LM_CHROMA_IDX] || !m_modeIsEnable[DM_CHROMA_IDX]),"PLANAR or LM or DM is rejected during the fast search in chrominance.");
 #endif
       int32_t numModesForFullRD(NUM_CHROMA_MODE);
 #if JVET_AB0149_INTRA_PRED
-- 
GitLab