diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index 8b3740b345015e261bacc287e875a2919acad882..051f4b2495e9564e7311f5321b5028c1ab778735 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -214,7 +214,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) } #if JVET_M0427_INLOOP_RESHAPER const Slice &slice = *cs.slice; - bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag() ) || (slice.getSliceType() == P_SLICE && slice.getSPS()->getSpsNext().getIBCMode())); + bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); if (flag && slice.getReshapeInfo().getSliceReshapeChromaAdj() && (compID != COMPONENT_Y)) { @@ -274,7 +274,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) CompArea tmpArea(COMPONENT_Y, area.chromaFormat, Position(0, 0), area.size()); PelBuf tmpPred; #endif - if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra() || (slice.getSliceType() == P_SLICE && slice.getSPS()->getSpsNext().getIBCMode())) && compID == COMPONENT_Y) + if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) { #if REUSE_CU_RESULTS { @@ -293,7 +293,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) pReco.copyFrom( piPred ); #endif #if JVET_M0427_INLOOP_RESHAPER - if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra() || (slice.getSliceType() == P_SLICE && slice.getSPS()->getSpsNext().getIBCMode())) && compID == COMPONENT_Y) + if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) { #if REUSE_CU_RESULTS { diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index a936ef43438a08a7137c452bce15681ca6cef6fc..bf47465199ff7104e6e685ac94a2fec34dce6733 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -1277,7 +1277,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl { m_cReshaper.setReshapeFlag(false); } - if ((pcSlice->getSliceType() == I_SLICE|| (pcSlice->getSliceType() == P_SLICE && pcSlice->getSPS()->getSpsNext().getIBCMode()) ) && m_cReshaper.getSliceReshaperInfo().getUseSliceReshaper()) + if ((pcSlice->getSliceType() == I_SLICE) && m_cReshaper.getSliceReshaperInfo().getUseSliceReshaper()) { m_cReshaper.setCTUFlag(false); m_cReshaper.setRecReshaped(true); diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index b7c2fa6f8ba27af4547f066dddb00b1bddbdc83a..91d4dbd25f2e2bf3ece823f35add70ffdcc4b7a7 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -2205,18 +2205,18 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ) { - m_pcReshaper->preAnalyzerHDR(pcPic, pcSlice->getSliceType(), m_pcCfg->getReshapeCW(), m_pcCfg->getDualITree(), m_pcCfg->getIBCMode()); + m_pcReshaper->preAnalyzerHDR(pcPic, pcSlice->getSliceType(), m_pcCfg->getReshapeCW(), m_pcCfg->getDualITree()); } else if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_SDR) { - m_pcReshaper->preAnalyzerSDR(pcPic, pcSlice->getSliceType(), m_pcCfg->getReshapeCW(), m_pcCfg->getDualITree(), m_pcCfg->getIBCMode()); + m_pcReshaper->preAnalyzerSDR(pcPic, pcSlice->getSliceType(), m_pcCfg->getReshapeCW(), m_pcCfg->getDualITree()); } else { THROW("Reshaper for signal other than PQ and SDR currently not defined!"); } - if (pcSlice->getSliceType() == I_SLICE || (pcSlice->getSliceType()==P_SLICE && m_pcCfg->getIBCMode())) + if (pcSlice->getSliceType() == I_SLICE ) { if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ) { diff --git a/source/Lib/EncoderLib/EncReshape.cpp b/source/Lib/EncoderLib/EncReshape.cpp index df0ec3b4467efd5d97d2805d52952cd9687af1a8..e7c8dcd90bef92e3cb0c9c365f2100fefd8dcd85 100644 --- a/source/Lib/EncoderLib/EncReshape.cpp +++ b/source/Lib/EncoderLib/EncReshape.cpp @@ -107,7 +107,7 @@ void EncReshape::destroy() \param pcPic describe pointer of current coding picture \param sliceType describe the slice type */ -void EncReshape::preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT, bool isIBC) +void EncReshape::preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT) { if (m_lumaBD >= 10) { @@ -119,11 +119,11 @@ void EncReshape::preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const } else { - if (sliceType == I_SLICE || (sliceType==P_SLICE && isIBC) ) { m_sliceReshapeInfo.sliceReshaperModelPresentFlag = true; } + if (sliceType == I_SLICE ) { m_sliceReshapeInfo.sliceReshaperModelPresentFlag = true; } else { m_sliceReshapeInfo.sliceReshaperModelPresentFlag = false; } } - if ((sliceType == I_SLICE || (sliceType == P_SLICE && isIBC)) && isDualT) { m_sliceReshapeInfo.enableChromaAdj = 0; } - else { m_sliceReshapeInfo.enableChromaAdj = 1; } + if (sliceType == I_SLICE && isDualT) { m_sliceReshapeInfo.enableChromaAdj = 0; } + else { m_sliceReshapeInfo.enableChromaAdj = 1; } } else { @@ -138,14 +138,14 @@ void EncReshape::preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const \param sliceType describe the slice type \param reshapeCW describe some input info */ -void EncReshape::preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT, bool isIBC) +void EncReshape::preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT) { m_sliceReshapeInfo.sliceReshaperModelPresentFlag = true; m_sliceReshapeInfo.sliceReshaperEnableFlag = true; int modIP = pcPic->getPOC() - pcPic->getPOC() / reshapeCW.rspFpsToIp * reshapeCW.rspFpsToIp; - if (sliceType == I_SLICE || (reshapeCW.rspIntraPeriod == -1 && modIP == 0) || (sliceType== P_SLICE && isIBC)) + if (sliceType == I_SLICE || (reshapeCW.rspIntraPeriod == -1 && modIP == 0)) { if (m_sliceReshapeInfo.sliceReshaperModelPresentFlag == true) { @@ -460,7 +460,7 @@ void EncReshape::preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const } m_chromaAdj = m_sliceReshapeInfo.enableChromaAdj; - if ((sliceType == I_SLICE || (sliceType == P_SLICE && isIBC)) && isDualT) + if (sliceType == I_SLICE && isDualT) { m_sliceReshapeInfo.enableChromaAdj = 0; } @@ -1123,7 +1123,7 @@ void EncReshape::constructReshaperSDR() int16_t *tempFwdLUT = new int16_t[m_reshapeLUTSize + 1](); int i, j; int cwScaleBins1, cwScaleBins2; - int maxAllowedCW = totCW; + int maxAllowedCW = totCW-1; cwScaleBins1 = m_reshapeCW.binCW[0]; cwScaleBins2 = m_reshapeCW.binCW[1]; @@ -1252,7 +1252,7 @@ void EncReshape::constructReshaperSDR() int sumBins = 0; for (i = 0; i < PIC_CODE_CW_BINS; i++) { sumBins += m_binCW[i]; } - CHECK(sumBins > m_reshapeLUTSize, "SDR CW assignment is wrong!!"); + CHECK(sumBins >= m_reshapeLUTSize, "SDR CW assignment is wrong!!"); memset(tempFwdLUT, 0, (m_reshapeLUTSize + 1) * sizeof(int16_t)); tempFwdLUT[0] = 0; diff --git a/source/Lib/EncoderLib/EncReshape.h b/source/Lib/EncoderLib/EncReshape.h index ce273fea7e557f7aa85f2089ec8405c0f7718e5d..64c9540c9662effbfd00da413657b57fa08020fd 100644 --- a/source/Lib/EncoderLib/EncReshape.h +++ b/source/Lib/EncoderLib/EncReshape.h @@ -106,8 +106,8 @@ public: bool getSrcReshaped() { return m_srcReshaped; } void setSrcReshaped(bool b) { m_srcReshaped = b; } - void preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT, bool isIBC); - void preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT, bool isIBC); + void preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT); + void preAnalyzerHDR(Picture *pcPic, const SliceType sliceType, const ReshapeCW& reshapeCW, bool isDualT); void bubbleSortDsd(double *array, int * idx, int n); void swap(int *xp, int *yp) { int temp = *xp; *xp = *yp; *yp = temp; } void swap(double *xp, double *yp) { double temp = *xp; *xp = *yp; *yp = temp; } diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 6c82913cd89e7cab4d6ca706e3fb066d6ccc1b29..2bfc52a97d057b477f1c8154db1e4dc355b00005 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -1807,7 +1807,7 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp #if JVET_M0427_INLOOP_RESHAPER const Slice &slice = *cs.slice; - bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag()) || (slice.getSliceType() == P_SLICE && slice.getSPS()->getSpsNext().getIBCMode())); + bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); if (flag && slice.getReshapeInfo().getSliceReshapeChromaAdj() && isChroma(compID)) { const Area area = tu.Y().valid() ? tu.Y() : Area(recalcPosition(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].pos()), recalcSize(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].size()));