From 5501afbfb1050e688228f6031e1d61cd3aa69bab Mon Sep 17 00:00:00 2001 From: Taoran Lu <tlu@dolby.com> Date: Thu, 7 Feb 2019 11:44:01 -0800 Subject: [PATCH] fix of reshaper implementation when lumaDQP is on for HDR --- source/App/EncoderApp/EncAppCfg.cpp | 5 +++++ source/Lib/EncoderLib/EncCu.cpp | 2 +- source/Lib/EncoderLib/EncGOP.cpp | 4 +++- source/Lib/EncoderLib/IntraSearch.cpp | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 5ca2c6bdf..1a450a0a2 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -2257,6 +2257,11 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_lumaLevelToDeltaQPMapping.mode && m_uiDeltaQpRD > 0, "Luma-level-based Delta QP cannot be used together with slice level multiple-QP optimization\n" ); #endif #if JVET_M0427_INLOOP_RESHAPER + if (m_lumaLevelToDeltaQPMapping.mode && m_lumaReshapeEnable) + { + msg(WARNING, "For HDR-PQ, reshaper should be used mutual-exclusively with Luma-level-based Delta QP. If use luma DQP, turn reshaper off.\n"); + m_lumaReshapeEnable = false; + } if (!m_lumaReshapeEnable) { m_reshapeSignalType = RESHAPE_SIGNAL_NULL; diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 17314f06b..dfd415cbd 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) + if (compID == COMPONENT_Y && (tempCS->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag())) { 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 78c21c8c0..fbd550f3b 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -186,8 +186,10 @@ void EncGOP::init ( EncLib* pcEncLib ) } else if (m_pcCfg->getLumaLevelToDeltaQPMapping().mode) { + pcEncLib->getRdCost()->initLumaLevelToWeightTableReshape(); +#else + pcEncLib->getRdCost()->initLumaLevelToWeightTable(); #endif - pcEncLib->getRdCost()->initLumaLevelToWeightTable(); #if JVET_M0427_INLOOP_RESHAPER } pcEncLib->getALF()->getLumaLevelWeightTable() = pcEncLib->getRdCost()->getLumaLevelWeightTable(); diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index e91b75652..cf21bad6a 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) + if (compID == COMPONENT_Y && slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || (isChroma(compID) && m_pcEncCfg->getReshapeIntraCMD()))) { CompArea tmpArea1(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); PelBuf tmpRecLuma = m_tmpStorageLCU.getBuf(tmpArea1); -- GitLab