From 8d6299c33dbae815176d4e58a2ed0ba5b40e7b94 Mon Sep 17 00:00:00 2001
From: Taoran Lu <tlu@dolby.com>
Date: Fri, 8 Feb 2019 12:33:48 -0800
Subject: [PATCH] more fix

---
 source/Lib/EncoderLib/EncCu.cpp       | 2 +-
 source/Lib/EncoderLib/EncGOP.cpp      | 1 +
 source/Lib/EncoderLib/InterSearch.cpp | 4 ++--
 source/Lib/EncoderLib/IntraSearch.cpp | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp
index dfd415cbd..96d6c0fe8 100644
--- a/source/Lib/EncoderLib/EncCu.cpp
+++ b/source/Lib/EncoderLib/EncCu.cpp
@@ -4702,7 +4702,7 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best
       {
         const CPelBuf orgLuma = tempCS->getOrgBuf(tempCS->area.blocks[COMPONENT_Y]);
 #if JVET_M0427_INLOOP_RESHAPER
-        if (compID == COMPONENT_Y && (tempCS->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag()))
+        if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled()))
         {
           const CompArea &area = cu.blocks[COMPONENT_Y];
           CompArea    tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size());
diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp
index fbd550f3b..8bd3a86ba 100644
--- a/source/Lib/EncoderLib/EncGOP.cpp
+++ b/source/Lib/EncoderLib/EncGOP.cpp
@@ -186,6 +186,7 @@ void EncGOP::init ( EncLib* pcEncLib )
   }
   else if (m_pcCfg->getLumaLevelToDeltaQPMapping().mode)
   {
+    pcEncLib->getRdCost()->setReshapeInfo(RESHAPE_SIGNAL_PQ, m_pcCfg->getBitDepth(CHANNEL_TYPE_LUMA));
     pcEncLib->getRdCost()->initLumaLevelToWeightTableReshape();
 #else
   pcEncLib->getRdCost()->initLumaLevelToWeightTable();
diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp
index 5d4d48624..501be48d1 100644
--- a/source/Lib/EncoderLib/InterSearch.cpp
+++ b/source/Lib/EncoderLib/InterSearch.cpp
@@ -6959,7 +6959,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa
       {
         const CPelBuf orgLuma = cs.getOrgBuf( cs.area.blocks[COMPONENT_Y] );
 #if JVET_M0427_INLOOP_RESHAPER
-        if (compID == COMPONENT_Y)
+        if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled()))
         {
           const CompArea &areaY = cu.Y();
           CompArea      tmpArea1(COMPONENT_Y, areaY.chromaFormat, Position(0, 0), areaY.size());
@@ -7190,7 +7190,7 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa
     {
       const CPelBuf orgLuma = cs.getOrgBuf( cs.area.blocks[COMPONENT_Y] );
 #if JVET_M0427_INLOOP_RESHAPER
-      if (compID == COMPONENT_Y)
+      if (compID == COMPONENT_Y && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled()) )
       {
         const CompArea &areaY = cu.Y();
         CompArea      tmpArea1(COMPONENT_Y, areaY.chromaFormat, Position(0, 0), areaY.size());
diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp
index 7f1d97ba3..68489fe25 100644
--- a/source/Lib/EncoderLib/IntraSearch.cpp
+++ b/source/Lib/EncoderLib/IntraSearch.cpp
@@ -1964,7 +1964,7 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp
   {
     const CPelBuf orgLuma = cs.getOrgBuf( cs.area.blocks[COMPONENT_Y] );
 #if JVET_M0427_INLOOP_RESHAPER
-    if (compID == COMPONENT_Y  && slice.getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag())
+    if (compID == COMPONENT_Y  && !(m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled()))
     {
       CompArea      tmpArea1(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size());
       PelBuf tmpRecLuma = m_tmpStorageLCU.getBuf(tmpArea1);
-- 
GitLab