diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index d8f90b39fb8a4d420123a13b15be0a1ce7f5100b..300086069ed530ba808c673b3ba57558c56e036d 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -551,7 +551,7 @@ void DecApp::xCreateDecLib() m_cDecLib.initScalingList(); #if GDR_LEAK_TEST m_cDecLib.m_gdrPocRandomAccess = this->m_gdrPocRandomAccess; -#endif // GDR_LEAK_TEST +#endif } void DecApp::xDestroyDecLib() diff --git a/source/App/DecoderApp/DecAppCfg.cpp b/source/App/DecoderApp/DecAppCfg.cpp index 3df618eef2aba31f1dff75aa7c76361d4eb9f354..c75308fed16b605f03e2bcdb9e6dbd8e20c2875c 100644 --- a/source/App/DecoderApp/DecAppCfg.cpp +++ b/source/App/DecoderApp/DecAppCfg.cpp @@ -122,7 +122,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) ( "UpscaledOutput", m_upscaledOutput, 0, "Upscaled output for RPR" ) #if GDR_LEAK_TEST ("RandomAccessPos", m_gdrPocRandomAccess, 0, "POC of GDR Random access picture\n" ) -#endif // GDR_LEAK_TEST +#endif #if DUMP_BEFORE_INLOOP ( "DumpBeforeInloop", m_dumpBeforeInloop, false, "Dump YUV before inloop filters" ) #endif diff --git a/source/App/DecoderApp/DecAppCfg.h b/source/App/DecoderApp/DecAppCfg.h index ac32d1ea1b79ca5ae654e77aac5493b1277754c2..4c9670ee0b3caf24ce47f6007c2289b277e20ac8 100644 --- a/source/App/DecoderApp/DecAppCfg.h +++ b/source/App/DecoderApp/DecAppCfg.h @@ -87,7 +87,7 @@ protected: int m_targetSubPicIdx; ///< Specify which subpicture shall be write to output, using subpicture index #if GDR_LEAK_TEST int m_gdrPocRandomAccess; ///< -#endif // GDR_LEAK_TEST +#endif #if DUMP_BEFORE_INLOOP bool m_dumpBeforeInloop; diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 38261eb0dd5071cde19e1063d203ffc910092ef0..43b86339f56a831a584502626d33b7cfdefe0a77 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -121,8 +121,8 @@ CodingStructure::CodingStructure(CUCache& cuCache, PUCache& puCache, TUCache& tu m_ipmBuf1 = nullptr; #else m_ipmBuf = nullptr; -#endif // JVET_Z0118_GDR -#endif // JVET_W0123_TIMD_FUSION +#endif +#endif #if JVET_Z0136_OOB for (uint32_t i = 0; i < 2; i++) @@ -202,8 +202,8 @@ void CodingStructure::destroy() #else delete[] m_ipmBuf; m_ipmBuf = nullptr; -#endif // JVET_Z0118_GDR -#endif // JVET_W0123_TIMD_FUSION +#endif +#endif #if JVET_Z0136_OOB for (uint32_t i = 0; i < 2; i++) diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 91561e4328571cafba8c4d9631bb14e47b576977..c1b00cd6202ca7d3c0b706d63c80728b1e142b9a 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -3497,7 +3497,7 @@ void InterPrediction::xWeightedAverage( #if JVET_W0090_ARMC_TM || JVET_Z0056_GPM_SPLIT_MODE_REORDERING #if !INTER_LIC -template <bool TrueA_FalseL> +template <bool trueAfalseL> void InterPrediction::xGetPredBlkTpl(const CodingUnit& cu, const ComponentID compID, const CPelBuf& refBuf, const Mv& mv, const int posW, const int posH, const int tplSize, Pel* predBlkTpl #if JVET_Y0067_ENHANCED_MMVD_MVD_SIGN_PRED , bool AML @@ -3516,7 +3516,7 @@ void InterPrediction::xGetPredBlkTpl(const CodingUnit& cu, const ComponentID com const Pel* ref; Pel* dst; int refStride, dstStride, bw, bh; - if (TrueA_FalseL) + if (trueAfalseL) { ref = refBuf.bufAt(cu.blocks[compID].pos().offset(xInt + posW, yInt + posH - 1)); dst = predBlkTpl + posW; @@ -8653,7 +8653,7 @@ void InterPrediction::xGetLICParamGeneral(const CodingUnit& cu, offset = Clip3(minOffset, maxOffset, offset); } -template <bool TrueA_FalseL> +template <bool trueAfalseL> void InterPrediction::xGetPredBlkTpl(const CodingUnit& cu, const ComponentID compID, const CPelBuf& refBuf, const Mv& mv, const int posW, const int posH, const int tplSize, Pel* predBlkTpl #if JVET_Y0067_ENHANCED_MMVD_MVD_SIGN_PRED , bool AML @@ -8672,7 +8672,7 @@ void InterPrediction::xGetPredBlkTpl(const CodingUnit& cu, const ComponentID com const Pel* ref; Pel* dst; int refStride, dstStride, bw, bh; - if( TrueA_FalseL ) + if( trueAfalseL ) { ref = refBuf.bufAt(cu.blocks[compID].pos().offset(xInt + posW, yInt + posH - 1)); dst = predBlkTpl + posW; @@ -8951,10 +8951,10 @@ void TplMatchingCtrl::removeHighFreq(const Picture& otherRefPic, const Mv& other xRemoveHighFreq<tplSize, false>(otherRefPic, otherRefMv, curRefBcwWeight); } -template <int tplSize, bool TrueA_FalseL> +template <int tplSize, bool trueAfalseL> bool TplMatchingCtrl::xFillCurTemplate(Pel* tpl) { - const Position posOffset = TrueA_FalseL ? Position(0, -tplSize) : Position(-tplSize, 0); + const Position posOffset = trueAfalseL ? Position(0, -tplSize) : Position(-tplSize, 0); const CodingUnit* const cuNeigh = m_cu.cs->getCU(m_pu.blocks[m_compID].pos().offset(posOffset), toChannelType(m_compID)); if (cuNeigh == nullptr) @@ -8973,12 +8973,12 @@ bool TplMatchingCtrl::xFillCurTemplate(Pel* tpl) { const int cuPelX = m_pu.lx(); const int cuPelY = m_pu.ly(); - const int roiWidth = TrueA_FalseL ? m_pu.lwidth() : tplSize; - const int roiHeight = TrueA_FalseL ? tplSize : m_pu.lheight(); + const int roiWidth = trueAfalseL ? m_pu.lwidth() : tplSize; + const int roiHeight = trueAfalseL ? tplSize : m_pu.lheight(); const int picWidth = m_pu.cs->slice->getPPS()->getPicWidthInLumaSamples(); const int picHeight = m_pu.cs->slice->getPPS()->getPicHeightInLumaSamples(); const uint32_t ctuSize = m_pu.cs->slice->getSPS()->getMaxCUWidth(); - const Mv tempBv = TrueA_FalseL ? Mv(0, -tplSize) : Mv(-tplSize, 0); + const Mv tempBv = trueAfalseL ? Mv(0, -tplSize) : Mv(-tplSize, 0); if (!PU::searchBv(m_pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, tempBv.getHor(), tempBv.getVer(), ctuSize)) { @@ -8997,24 +8997,24 @@ bool TplMatchingCtrl::xFillCurTemplate(Pel* tpl) CHECK(m_pu.geoTmType == GEO_TM_OFF, "invalid geo template type value"); if (m_pu.geoTmType == GEO_TM_SHAPE_A) { - if (TrueA_FalseL == 0) + if (trueAfalseL == 0) { return false; } } if (m_pu.geoTmType == GEO_TM_SHAPE_L) { - if (TrueA_FalseL == 1) + if (trueAfalseL == 1) { return false; } } } #endif - const Size dstSize = (TrueA_FalseL ? Size(m_pu.lwidth(), tplSize) : Size(tplSize, m_pu.lheight())); + const Size dstSize = (trueAfalseL ? Size(m_pu.lwidth(), tplSize) : Size(tplSize, m_pu.lheight())); for (int h = 0; h < (int)dstSize.height; h++) { - const Position recPos = TrueA_FalseL ? Position(0, -tplSize + h) : Position(-tplSize, h); + const Position recPos = trueAfalseL ? Position(0, -tplSize + h) : Position(-tplSize, h); const Pel* rec = recBuf.bufAt(m_pu.blocks[m_compID].pos().offset(recPos)); Pel* dst = tpl + h * dstSize.width; @@ -9028,7 +9028,7 @@ bool TplMatchingCtrl::xFillCurTemplate(Pel* tpl) return true; } -template <int tplSize, bool TrueA_FalseL, int sr> +template <int tplSize, bool trueAfalseL, int sr> PelBuf TplMatchingCtrl::xGetRefTemplate(const PredictionUnit& curPu, const Picture& refPic, const Mv& _mv, PelBuf& dstBuf) { #if JVET_Z0084_IBC_TM @@ -9037,15 +9037,15 @@ PelBuf TplMatchingCtrl::xGetRefTemplate(const PredictionUnit& curPu, const Pictu { const int cuPelX = m_pu.lx(); const int cuPelY = m_pu.ly(); - const int roiWidth = TrueA_FalseL ? m_pu.lwidth() : tplSize; - const int roiHeight = TrueA_FalseL ? tplSize : m_pu.lheight(); + const int roiWidth = trueAfalseL ? m_pu.lwidth() : tplSize; + const int roiHeight = trueAfalseL ? tplSize : m_pu.lheight(); const int picWidth = m_pu.cs->slice->getPPS()->getPicWidthInLumaSamples(); const int picHeight = m_pu.cs->slice->getPPS()->getPicHeightInLumaSamples(); const uint32_t ctuSize = m_pu.cs->slice->getSPS()->getMaxCUWidth(); Mv tempBv = _mv; tempBv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); - tempBv += TrueA_FalseL ? Mv(0, -tplSize) : Mv(-tplSize, 0); + tempBv += trueAfalseL ? Mv(0, -tplSize) : Mv(-tplSize, 0); if (!PU::searchBv(m_pu, cuPelX, cuPelY, roiWidth, roiHeight, picWidth, picHeight, tempBv.getHor(), tempBv.getVer(), ctuSize)) { @@ -9055,7 +9055,7 @@ PelBuf TplMatchingCtrl::xGetRefTemplate(const PredictionUnit& curPu, const Pictu #endif // read from pre-interpolated buffer - PelBuf& refSrBuf = TrueA_FalseL ? m_refSrAbove : m_refSrLeft; + PelBuf& refSrBuf = trueAfalseL ? m_refSrAbove : m_refSrLeft; #if JVET_Z0084_IBC_TM if (!CU::isIBC(m_cu) && sr == 0 && refPic.getPOC() == m_refPic.getPOC() && refSrBuf.buf != nullptr) #else @@ -9074,7 +9074,7 @@ PelBuf TplMatchingCtrl::xGetRefTemplate(const PredictionUnit& curPu, const Pictu } // Do interpolation on the fly - Position blkPos = ( TrueA_FalseL ? Position(curPu.lx(), curPu.ly() - tplSize) : Position(curPu.lx() - tplSize, curPu.ly()) ); + Position blkPos = ( trueAfalseL ? Position(curPu.lx(), curPu.ly() - tplSize) : Position(curPu.lx() - tplSize, curPu.ly()) ); Size blkSize = Size(dstBuf.width, dstBuf.height); Mv mv = _mv - Mv(sr << MV_FRACTIONAL_BITS_INTERNAL, sr << MV_FRACTIONAL_BITS_INTERNAL); #if JVET_Z0084_IBC_TM @@ -9125,15 +9125,15 @@ PelBuf TplMatchingCtrl::xGetRefTemplate(const PredictionUnit& curPu, const Pictu return dstBuf; } -template <int tplSize, bool TrueA_FalseL> +template <int tplSize, bool trueAfalseL> void TplMatchingCtrl::xRemoveHighFreq(const Picture& otherRefPic, const Mv& otherRefMv, const uint8_t curRefBcwWeight) { - PelBuf& curTplBuf = TrueA_FalseL ? m_curTplAbove : m_curTplLeft; - PelBuf refTplBuf = TrueA_FalseL ? m_refTplAbove : m_refTplLeft; + PelBuf& curTplBuf = trueAfalseL ? m_curTplAbove : m_curTplLeft; + PelBuf refTplBuf = trueAfalseL ? m_refTplAbove : m_refTplLeft; if (curTplBuf.buf != nullptr) { - refTplBuf = xGetRefTemplate<tplSize, TrueA_FalseL, 0>(m_pu, otherRefPic, otherRefMv, refTplBuf); + refTplBuf = xGetRefTemplate<tplSize, trueAfalseL, 0>(m_pu, otherRefPic, otherRefMv, refTplBuf); if (curRefBcwWeight != g_BcwWeights[BCW_DEFAULT]) { curTplBuf.removeWeightHighFreq(refTplBuf, false, m_cu.slice->clpRng(m_compID), curRefBcwWeight); @@ -9417,11 +9417,11 @@ Distortion TplMatchingCtrl::xGetTempMatchError(const Mv& mv) return sum; } -template <int tplSize, bool TrueA_FalseL> +template <int tplSize, bool trueAfalseL> Distortion TplMatchingCtrl::xGetTempMatchError(const Mv& mv) { - PelBuf& curTplBuf = TrueA_FalseL ? m_curTplAbove : m_curTplLeft; - PelBuf refTplBuf = TrueA_FalseL ? m_refTplAbove : m_refTplLeft; + PelBuf& curTplBuf = trueAfalseL ? m_curTplAbove : m_curTplLeft; + PelBuf refTplBuf = trueAfalseL ? m_refTplAbove : m_refTplLeft; if (curTplBuf.buf == nullptr) { @@ -9432,7 +9432,7 @@ Distortion TplMatchingCtrl::xGetTempMatchError(const Mv& mv) const int bitDepth = m_cu.slice->clpRng(m_compID).bd; // fetch reference template block - refTplBuf = xGetRefTemplate<tplSize, TrueA_FalseL, 0>(m_pu, m_refPic, mv, refTplBuf); + refTplBuf = xGetRefTemplate<tplSize, trueAfalseL, 0>(m_pu, m_refPic, mv, refTplBuf); #if JVET_Z0084_IBC_TM if (refTplBuf.buf == nullptr) { @@ -9450,7 +9450,7 @@ Distortion TplMatchingCtrl::xGetTempMatchError(const Mv& mv) cDistParam.useMR = m_cu.LICFlag; #endif int tmWeightIdx = (m_pu.lwidth() >= TM_MIN_CU_SIZE_FOR_ALT_WEIGHTED_COST && m_pu.lheight() >= TM_MIN_CU_SIZE_FOR_ALT_WEIGHTED_COST ? 1 : 0); - m_interRes.m_pcRdCost->setDistParam( cDistParam, curTplBuf, refTplBuf, bitDepth, TrueA_FalseL, tmWeightIdx, rowSubShift, m_compID ); + m_interRes.m_pcRdCost->setDistParam( cDistParam, curTplBuf, refTplBuf, bitDepth, trueAfalseL, tmWeightIdx, rowSubShift, m_compID ); CHECK(TM_TPL_SIZE != 4, "The distortion function of template matching is implemetned currently only for size=4."); partSum = cDistParam.distFunc( cDistParam ); } diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h index 02dcd8e736f4d037d7156adb1adc6b0f8a43f49c..22fe6b8dfc5f34b6e7b881ad1822988892f55e50 100644 --- a/source/Lib/CommonLib/InterPrediction.h +++ b/source/Lib/CommonLib/InterPrediction.h @@ -288,7 +288,7 @@ protected: #endif #if JVET_W0090_ARMC_TM || JVET_Z0056_GPM_SPLIT_MODE_REORDERING #if !INTER_LIC - template <bool TrueA_FalseL> + template <bool trueAfalseL> void xGetPredBlkTpl(const CodingUnit& cu, const ComponentID compID, const CPelBuf& refBuf, const Mv& mv, const int posW, const int posH, const int tplSize, Pel* predBlkTpl #if JVET_Y0067_ENHANCED_MMVD_MVD_SIGN_PRED , bool AML = false @@ -638,7 +638,7 @@ public: void xGetSublkTemplate (const CodingUnit& cu, const ComponentID compID, const Picture& refPic, const Mv& mv, const int sublkWidth, const int sublkHeight, const int posW, const int posH, int* numTemplate, Pel* refLeftTemplate, Pel* refAboveTemplate, Pel* recLeftTemplate, Pel* recAboveTemplate); void xLocalIlluComp (const PredictionUnit& pu, const ComponentID compID, const Picture& refPic, const Mv& mv, const bool biPred, PelBuf& dstBuf); - template <bool TrueA_FalseL> + template <bool trueAfalseL> void xGetPredBlkTpl(const CodingUnit& cu, const ComponentID compID, const CPelBuf& refBuf, const Mv& mv, const int posW, const int posH, const int tplSize, Pel* predBlkTpl #if JVET_Y0067_ENHANCED_MMVD_MVD_SIGN_PRED , bool AML = false @@ -828,9 +828,9 @@ public: template <int tplSize> void removeHighFreq (const Picture& otherRefPic, const Mv& otherRefMv, const uint8_t curRefBcwWeight); private: - template <int tplSize, bool TrueA_FalseL> bool xFillCurTemplate (Pel* tpl); - template <int tplSize, bool TrueA_FalseL, int sr> PelBuf xGetRefTemplate (const PredictionUnit& curPu, const Picture& refPic, const Mv& _mv, PelBuf& dstBuf); - template <int tplSize, bool TrueA_FalseL> void xRemoveHighFreq (const Picture& otherRefPic, const Mv& otherRefMv, const uint8_t curRefBcwWeight); + template <int tplSize, bool trueAfalseL> bool xFillCurTemplate (Pel* tpl); + template <int tplSize, bool trueAfalseL, int sr> PelBuf xGetRefTemplate (const PredictionUnit& curPu, const Picture& refPic, const Mv& _mv, PelBuf& dstBuf); + template <int tplSize, bool trueAfalseL> void xRemoveHighFreq (const Picture& otherRefPic, const Mv& otherRefMv, const uint8_t curRefBcwWeight); template <int tplSize, int searchPattern> void xRefineMvSearch (int maxSearchRounds, int searchStepShift); #if MULTI_PASS_DMVR template <int searchPattern> void xNextTmCostAarray (int bestDirect); @@ -842,7 +842,7 @@ private: public: #endif template <int tplSize> Distortion xGetTempMatchError (const Mv& mv); - template <int tplSize, bool TrueA_FalseL> Distortion xGetTempMatchError (const Mv& mv); + template <int tplSize, bool trueAfalseL> Distortion xGetTempMatchError (const Mv& mv); }; #endif // TM_AMVP || TM_MRG diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp index 75a59e7103e20b27c996f59f8887a2246ecdd7eb..361c94782f78186b67fa50278d0b738873a203cf 100644 --- a/source/Lib/CommonLib/IntraPrediction.cpp +++ b/source/Lib/CommonLib/IntraPrediction.cpp @@ -241,16 +241,10 @@ void IntraPrediction::init(ChromaFormat chromaFormatIDC, const unsigned bitDepth buffer.create( chromaFormatIDC, Area( 0, 0, MAX_CU_SIZE, MAX_CU_SIZE ) ); } #if ENABLE_DIMD && INTRA_TRANS_ENC_OPT - m_dimdBlending = xDimdBlending; -#ifdef TARGET_SIMD_X86 - m_dimdBlending = xDimdBlending_SIMD; -#endif + m_dimdBlending = dimdBlending; #endif #if JVET_W0123_TIMD_FUSION && INTRA_TRANS_ENC_OPT - m_timdBlending = xTimdBlending; -#ifdef TARGET_SIMD_X86 - m_timdBlending = xTimdBlending_SIMD; -#endif + m_timdBlending = timdBlending; #endif #if JVET_V0130_INTRA_TMP unsigned int blkSize; @@ -845,7 +839,7 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co #endif #if ENABLE_DIMD - if (pu.cu->dimd && pu.cu->dimd_is_blend && isLuma(compID)) + if (pu.cu->dimd && pu.cu->dimdBlending && isLuma(compID)) { int width = piPred.width; int height = piPred.height; @@ -1162,7 +1156,7 @@ void IntraPrediction::predIntraChromaLM(const ComponentID compID, PelBuf &piPred if ( createModel ) { #if LMS_LINEAR_MODEL - xGetLMParameters_LMS(pu, compID, chromaArea, cclmModel); + xGetLMParametersLMS(pu, compID, chromaArea, cclmModel); #else xGetLMParameters (pu, compID, chromaArea, cclmModel); #endif @@ -4181,7 +4175,7 @@ int IntraPrediction::deriveTimdMode( const CPelBuf &recoBuf, const CompArea &are } } #if INTRA_TRANS_ENC_OPT -void xTimdBlending(Pel *pDst, int strideDst, Pel *pSrc, int strideSrc, int w0, int w1, int width, int height) +void IntraPrediction::timdBlending(Pel *pDst, int strideDst, Pel *pSrc, int strideSrc, int w0, int w1, int width, int height) { const int log2WeightSum = 6; Pel *pelPred = pDst; @@ -4200,35 +4194,9 @@ void xTimdBlending(Pel *pDst, int strideDst, Pel *pSrc, int strideSrc, int w0, i pelPredFusion += strideSrc; } } -#ifdef TARGET_SIMD_X86 -void xTimdBlending_SIMD(Pel *pDst, int strideDst, Pel *pSrc, int strideSrc, int w0, int w1, int width, int height) -{ - CHECK((width % 4) != 0, "width should be multiple of 4"); - __m128i vw0 = _mm_set1_epi32(w0); - __m128i vw1 = _mm_set1_epi32(w1); - int shift = 6; - - for (int i = 0; i < height; i++) - { - for (int j = 0; j < width; j += 4) - { - __m128i vdst = _mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i*)(pDst + j))); - __m128i vsrc = _mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i*)(pSrc + j))); - - vdst = _mm_mullo_epi32(vdst, vw0); - vdst = _mm_add_epi32(vdst, _mm_mullo_epi32(vsrc, vw1)); - - vdst = _mm_srai_epi32(vdst, shift); - vdst = _mm_packs_epi32(vdst, vdst); - _mm_storel_epi64((__m128i*)(pDst + j), vdst); - } - pDst += strideDst; - pSrc += strideSrc; - } -} -#endif #endif #endif + #if ENABLE_DIMD void IntraPrediction::deriveDimdMode(const CPelBuf &recoBuf, const CompArea &area, CodingUnit &cu) { @@ -4274,111 +4242,113 @@ void IntraPrediction::deriveDimdMode(const CPelBuf &recoBuf, const CompArea &are int numIntraLeft = isLeftAvailable(cu, chType, posLT, numLeftUnits, unitHeight, (neighborFlags + totalLeftUnits - 1)); // ----- Step 2: build histogram of gradients ----- - int piHistogram_clean[NUM_LUMA_MODE] = { 0 }; + int histogram[NUM_LUMA_MODE] = { 0 }; if (numIntraLeft) { uint32_t uiHeightLeft = numIntraLeft * unitHeight - 1 - (!numIntraAbove ? 1 : 0); const Pel *pRecoLeft = pReco - 2 + iStride * (!numIntraAbove ? 1 : 0); - sigcnt += buildHistogram(pRecoLeft, iStride, uiHeightLeft, 1, piHistogram_clean, 1, uiWidth, uiHeight); + sigcnt += buildHistogram(pRecoLeft, iStride, uiHeightLeft, 1, histogram, 1, uiWidth, uiHeight); } if (numIntraAbove) { uint32_t uiWidthAbove = numIntraAbove * unitWidth - 1 - (!numIntraLeft ? 1 : 0); const Pel *pRecoAbove = pReco - iStride * 2 + (!numIntraLeft ? 1 : 0); - sigcnt += buildHistogram(pRecoAbove, iStride, 1, uiWidthAbove, piHistogram_clean, 2, uiWidth, uiHeight); + sigcnt += buildHistogram(pRecoAbove, iStride, 1, uiWidthAbove, histogram, 2, uiWidth, uiHeight); } if (numIntraLeft && numIntraAbove) { const Pel *pRecoAboveLeft = pReco - 2 - iStride * 2; - sigcnt += buildHistogram(pRecoAboveLeft, iStride, 2, 2, piHistogram_clean, 3, uiWidth, uiHeight); + sigcnt += buildHistogram(pRecoAboveLeft, iStride, 2, 2, histogram, 3, uiWidth, uiHeight); } - int first_amp = 0, second_amp = 0, cur_amp = 0; - int first_mode = 0, second_mode = 0, cur_mode = 0; + int firstAmp = 0, secondAmp = 0, curAmp = 0; + int firstMode = 0, secondMode = 0, curMode = 0; + for (int i = 0; i < NUM_LUMA_MODE; i++) { - cur_amp = piHistogram_clean[i]; - cur_mode = i; - if (cur_amp > first_amp) + curAmp = histogram[i]; + curMode = i; + if (curAmp > firstAmp) { - second_amp = first_amp; - second_mode = first_mode; - first_amp = cur_amp; - first_mode = cur_mode; + secondAmp = firstAmp; + secondMode = firstMode; + firstAmp = curAmp; + firstMode = curMode; } else { - if (cur_amp > second_amp) + if (curAmp > secondAmp) { - second_amp = cur_amp; - second_mode = cur_mode; + secondAmp = curAmp; + secondMode = curMode; } } } // ----- Step 3: derive best mode from histogram of gradients ----- - cu.dimdMode = first_mode; + cu.dimdMode = firstMode; - cu.dimd_is_blend = true; - cu.dimd_is_blend &= second_amp > 0; - cu.dimd_is_blend &= second_mode > DC_IDX; - cu.dimd_is_blend &= first_mode > DC_IDX; + cu.dimdBlending = true; + cu.dimdBlending &= secondAmp > 0; + cu.dimdBlending &= secondMode > DC_IDX; + cu.dimdBlending &= firstMode > DC_IDX; - if( cu.dimd_is_blend ) + if( cu.dimdBlending ) { - cu.dimdBlendMode[0] = second_mode; + cu.dimdBlendMode[0] = secondMode; } #if JVET_X0149_TIMD_DIMD_LUT - int log2BlendWeight = 6; - int dimd_planar_weight = 21; - int sum_weight = (1 << log2BlendWeight); + const int log2BlendWeight = 6; + const int planarWeight = 21; + int sumWeight = 1 << log2BlendWeight; #else - const int blend_sum_weight = 6; - int sum_weight = 1 << blend_sum_weight; + const int blendSumWeight = 6; + int sumWeight = 1 << blend_sum_weight; #endif - if (cu.dimd_is_blend) + if (cu.dimdBlending) { #if JVET_X0149_TIMD_DIMD_LUT - int g_gradDivTable[16] = { 0, 7, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 0 }; - sum_weight = sum_weight - dimd_planar_weight; - int s0 = first_amp; - int s1 = first_amp + second_amp; + sumWeight = sumWeight - planarWeight; + int s0 = firstAmp; + int s1 = firstAmp + secondAmp; int x = floorLog2(s1); + CHECK(x < 0, "floor log2 value should be no negative"); - int norm_s1 = (s1 << 4 >> x) & 15; - int v = g_gradDivTable[norm_s1] | 8; - x += (norm_s1 != 0); + + int norm = (s1 << 4 >> x) & 15; + int v = g_gradDivTable[norm] | 8; + x += (norm != 0); int shift = x + 3; int add = (1 << (shift - 1)); - int iRatio = (s0 * v * sum_weight + add) >> shift; + int ratio = (s0 * v * sumWeight + add) >> shift; - if( iRatio > sum_weight ) + if( ratio > sumWeight ) { - iRatio = sum_weight; + ratio = sumWeight; } - CHECK( iRatio > sum_weight, "Wrong DIMD ratio" ); + CHECK( ratio > sumWeight, "Wrong DIMD ratio" ); #else double dRatio = 0.0; - sum_weight -= static_cast<int>((double)sum_weight / 3); // ~ 1/3 of the weight to be reserved for planar - dRatio = (double)first_amp / (double)(first_amp + second_amp); - int iRatio = static_cast<int>(dRatio * sum_weight); + sum_weight -= static_cast<int>((double)sumWeight / 3); // ~ 1/3 of the weight to be reserved for planar + dRatio = (double)firstAmp / (double)(firstAmp + secondAmp); + int ratio = static_cast<int>(dRatio * sumWeight); #endif - cu.dimdRelWeight[0] = iRatio; - cu.dimdRelWeight[2] = sum_weight - iRatio; + cu.dimdRelWeight[0] = ratio; + cu.dimdRelWeight[2] = sumWeight - ratio; #if JVET_X0149_TIMD_DIMD_LUT - cu.dimdRelWeight[1] = dimd_planar_weight; + cu.dimdRelWeight[1] = planarWeight; #else - cu.dimdRelWeight[1] = (1 << blend_sum_weight) - sum_weight; + cu.dimdRelWeight[1] = (1 << blendSumWeight) - sumWeight; #endif } else { - cu.dimdRelWeight[0] = sum_weight; + cu.dimdRelWeight[0] = sumWeight; cu.dimdRelWeight[1] = 0; cu.dimdRelWeight[2] = 0; } @@ -4513,35 +4483,36 @@ void IntraPrediction::deriveDimdChromaMode(const CPelBuf &recoBufY, const CPelBu } #endif -int buildHistogram(const Pel *pReco, int iStride, uint32_t uiHeight, uint32_t uiWidth, int* piHistogram, int direction, int bw, int bh) +int IntraPrediction::buildHistogram(const Pel *pReco, int iStride, uint32_t uiHeight, uint32_t uiWidth, int* piHistogram, int direction, int bw, int bh) { - int w_step = 1, h_step = 1; + const int wStep = 1, hStep = 1; int angTable[17] = { 0, 2048, 4096, 6144, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 40960, 47104, 53248, 59392, 65536 }; int offsets[4] = { HOR_IDX, HOR_IDX, VER_IDX, VER_IDX }; int dirs[4] = { -1, 1, -1, 1 }; - int map_x_gr_y_1[2][2] = { { 1, 0 },{ 0, 1 } }; - int map_x_gr_y_0[2][2] = { { 2, 3 },{ 3, 2 } }; -#if JVET_X0149_TIMD_DIMD_LUT - int g_gradDivTable[16] = { 0, 7, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 0 }; -#endif + int mapXgrY1[2][2] = { { 1, 0 },{ 0, 1 } }; + int mapXgrY0[2][2] = { { 2, 3 },{ 3, 2 } }; - for (uint32_t y = 0; y < uiHeight; y += h_step) + for (uint32_t y = 0; y < uiHeight; y += hStep) { - for (uint32_t x = 0; x < uiWidth; x += w_step) + for (uint32_t x = 0; x < uiWidth; x += wStep) { - if ((direction == 3) && x == (uiWidth - 1) && y == (uiHeight - 1)) + if( (direction == 3) && x == (uiWidth - 1) && y == (uiHeight - 1) ) + { continue; + } const Pel *pRec = pReco + y * iStride + x; int iDy = pRec[-iStride - 1] + 2 * pRec[-1] + pRec[iStride - 1] - pRec[-iStride + 1] - 2 * pRec[+1] - pRec[iStride + 1]; int iDx = pRec[iStride - 1] + 2 * pRec[iStride] + pRec[iStride + 1] - pRec[-iStride - 1] - 2 * pRec[-iStride] - pRec[-iStride + 1]; - if (iDy == 0 && iDx == 0) + if( iDy == 0 && iDx == 0 ) + { continue; + } int iAmp = (int)(abs(iDx) + abs(iDy)); - int iAng_uneven = -1; + int iAngUneven = -1; // for determining region if (iDx != 0 && iDy != 0) // pure angles are not concerned { @@ -4550,64 +4521,64 @@ int buildHistogram(const Pel *pReco, int iStride, uint32_t uiHeight, uint32_t ui int signy = iDy < 0 ? 1 : 0; int absx = iDx < 0 ? -iDx : iDx; int absy = iDy < 0 ? -iDy : iDy; - int x_gr_y = absx > absy ? 1 : 0; - int region = x_gr_y ? map_x_gr_y_1[signy][signx] : map_x_gr_y_0[signy][signx]; + int gtY = absx > absy ? 1 : 0; + int region = gtY ? mapXgrY1[signy][signx] : mapXgrY0[signy][signx]; //region = (region == 1 ? 2 : (region == 2 ? 1 : (region == 3 ? 4 : 3))); #if JVET_X0149_TIMD_DIMD_LUT - int s0 = x_gr_y ? absy : absx; - int s1 = x_gr_y ? absx : absy; + int s0 = gtY ? absy : absx; + int s1 = gtY ? absx : absy; int x = floorLog2(s1); - int norm_s1 = (s1 << 4 >> x) & 15; - int v = g_gradDivTable[norm_s1] | 8; - x += (norm_s1 != 0); + int norm = (s1 << 4 >> x) & 15; + int v = g_gradDivTable[norm] | 8; + x += (norm != 0); int shift = 13 - x; - int iRatio; + int ratio; if (shift < 0) { shift = -shift; int add = (1 << (shift - 1)); - iRatio = (s0 * v + add) >> shift; + ratio = (s0 * v + add) >> shift; } else { - iRatio = (s0 * v) << shift; + ratio = (s0 * v) << shift; } // iRatio after integerization can go beyond 2^16 #else - float fRatio = x_gr_y ? static_cast<float>(absy) / static_cast<float>(absx) : static_cast<float>(absx) / static_cast<float>(absy); - float fRatio_scaled = fRatio * (1 << 16); - int iRatio = static_cast<int>(fRatio_scaled); + float fRatio = gtY ? static_cast<float>(absy) / static_cast<float>(absx) : static_cast<float>(absx) / static_cast<float>(absy); + float fRatioScaled = fRatio * (1 << 16); + int ratio = static_cast<int>(fRatioScaled); #endif // get ang_idx int idx = 16; for( int i = 1; i < 17; i++ ) { - if( iRatio <= angTable[i] ) + if( ratio <= angTable[i] ) { - idx = iRatio - angTable[i - 1] < angTable[i] - iRatio ? i - 1 : i; + idx = ratio - angTable[i - 1] < angTable[i] - ratio ? i - 1 : i; break; } } - iAng_uneven = offsets[region] + dirs[region] * idx; - //iAng_uneven = offsets[region - 1] + dirs[region - 1] * idx; + iAngUneven = offsets[region] + dirs[region] * idx; + //iAngUneven = offsets[region - 1] + dirs[region - 1] * idx; } else { - iAng_uneven = iDx == 0 ? VER_IDX : HOR_IDX; + iAngUneven = iDx == 0 ? VER_IDX : HOR_IDX; } - CHECK( iAng_uneven < 0, "Wrong mode in DIMD histogram" ); - CHECK( iAng_uneven >= NUM_LUMA_MODE, "Wrong mode in DIMD histogram" ); + CHECK( iAngUneven < 0, "Wrong mode in DIMD histogram" ); + CHECK( iAngUneven >= NUM_LUMA_MODE, "Wrong mode in DIMD histogram" ); - piHistogram[iAng_uneven] += iAmp; + piHistogram[iAngUneven] += iAmp; } } return 0; } #if INTRA_TRANS_ENC_OPT -void xDimdBlending(Pel *pDst, int strideDst, Pel *pSrc0, int strideSrc0, Pel *pSrc1, int strideSrc1, int w0, int w1, int w2, int width, int height) +void IntraPrediction::dimdBlending(Pel *pDst, int strideDst, Pel *pSrc0, int strideSrc0, Pel *pSrc1, int strideSrc1, int w0, int w1, int w2, int width, int height) { Pel *pelPred = pDst; Pel *pelPlanar = pSrc0; @@ -4628,37 +4599,6 @@ void xDimdBlending(Pel *pDst, int strideDst, Pel *pSrc0, int strideSrc0, Pel *pS pelPredAng += strideSrc1; } } -#ifdef TARGET_SIMD_X86 -void xDimdBlending_SIMD(Pel *pDst, int strideDst, Pel *pSrc0, int strideSrc0, Pel *pSrc1, int strideSrc1, int w0, int w1, int w2, int width, int height) -{ - CHECK((width % 4) != 0, "width should be multiple of 4"); - __m128i vw0 = _mm_set1_epi32(w0); - __m128i vw1 = _mm_set1_epi32(w1); - __m128i vw2 = _mm_set1_epi32(w2); - int shift = 6; - - for (int i = 0; i < height; i++) - { - for (int j = 0; j < width; j += 4) - { - __m128i vdst = _mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i*)(pDst + j))); - __m128i vsrc0 = _mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i*)(pSrc0 + j))); - __m128i vsrc1 = _mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i*)(pSrc1 + j))); - - vdst = _mm_mullo_epi32(vdst, vw0); - vdst = _mm_add_epi32(vdst, _mm_mullo_epi32(vsrc0, vw1)); - vdst = _mm_add_epi32(vdst, _mm_mullo_epi32(vsrc1, vw2)); - - vdst = _mm_srai_epi32(vdst, shift); - vdst = _mm_packs_epi32(vdst, vdst); - _mm_storel_epi64((__m128i*)(pDst + j), vdst); - } - pDst += strideDst; - pSrc0 += strideSrc0; - pSrc1 += strideSrc1; - } -} -#endif #endif #endif bool isAboveLeftAvailable(const CodingUnit &cu, const ChannelType &chType, const Position &posLT) @@ -5920,7 +5860,7 @@ void IntraPrediction::xPadMdlmTemplateSample(Pel*pSrc, Pel*pCur, int cWidth, int pTempCur[i] = pCur[i * step]; } } -void IntraPrediction::xGetLMParameters_LMS(const PredictionUnit &pu, const ComponentID compID, const CompArea& chromaArea, CclmModel &cclmModel) +void IntraPrediction::xGetLMParametersLMS(const PredictionUnit &pu, const ComponentID compID, const CompArea& chromaArea, CclmModel &cclmModel) { CHECK(compID == COMPONENT_Y, ""); const SizeType cWidth = chromaArea.width; diff --git a/source/Lib/CommonLib/IntraPrediction.h b/source/Lib/CommonLib/IntraPrediction.h index 0b8d9034bf8d485ccf9fd8397f356134d4af22a6..6be53e1da73bc1ed74e805282dfe19989b52d371 100644 --- a/source/Lib/CommonLib/IntraPrediction.h +++ b/source/Lib/CommonLib/IntraPrediction.h @@ -67,37 +67,25 @@ enum PredBuf static const uint32_t MAX_INTRA_FILTER_DEPTHS=8; #if JVET_V0130_INTRA_TMP -extern unsigned int g_uiDepth2Width[5]; -extern unsigned int g_uiDepth2MaxCandiNum[5]; - class TempLibFast { public: - int m_pX; //offset X - int m_pY; //offset Y - int m_pXInteger; //offset X for integer pixel search - int m_pYInteger; //offset Y for integer pixel search - int m_pDiffInteger; - int getXInteger() { return m_pXInteger; } - int getYInteger() { return m_pYInteger; } - int getDiffInteger() { return m_pDiffInteger; } - short m_pIdInteger; //frame id - short getIdInteger() { return m_pIdInteger; } - int m_pDiff; //mse - short m_pId; //frame id + int m_pX; //offset X + int m_pY; //offset Y + int m_pDiff; //mse + short m_pId; //frame id + int m_diffMax; TempLibFast(); ~TempLibFast(); - //void init(); - int getX() { return m_pX; } - int getY() { return m_pY; } - int getDiff() { return m_pDiff; } - short getId() { return m_pId; } - /*void initDiff(unsigned int uiPatchSize, int bitDepth); - void initDiff(unsigned int uiPatchSize, int bitDepth, int iCandiNumber);*/ - void initTemplateDiff( unsigned int uiPatchWidth, unsigned int uiPatchHeight, unsigned int uiBlkWidth, unsigned int uiBlkHeight, int bitDepth ); - int m_diffMax; - int getDiffMax() { return m_diffMax; } + + void initTemplateDiff ( unsigned int uiPatchWidth, unsigned int uiPatchHeight, unsigned int uiBlkWidth, unsigned int uiBlkHeight, int bitDepth ); + + int getX () { return m_pX; } + int getY () { return m_pY; } + int getDiff () { return m_pDiff; } + short getId () { return m_pId; } + int getDiffMax () { return m_diffMax; } }; typedef short TrainDataType; @@ -222,10 +210,10 @@ protected: void destroy (); #if LMS_LINEAR_MODEL - void xPadMdlmTemplateSample(Pel*pSrc, Pel*pCur, int cWidth, int cHeight, int existSampNum, int targetSampNum); - void xGetLMParameters_LMS(const PredictionUnit &pu, const ComponentID compID, const CompArea& chromaArea, CclmModel &cclmModel); + void xPadMdlmTemplateSample (Pel*pSrc, Pel*pCur, int cWidth, int cHeight, int existSampNum, int targetSampNum); + void xGetLMParametersLMS (const PredictionUnit &pu, const ComponentID compID, const CompArea& chromaArea, CclmModel &cclmModel); #else - void xGetLMParameters (const PredictionUnit &pu, const ComponentID compID, const CompArea& chromaArea, CclmModel &cclmModel); + void xGetLMParameters (const PredictionUnit &pu, const ComponentID compID, const CompArea& chromaArea, CclmModel &cclmModel); #endif #if LMS_LINEAR_MODEL && MMLM struct MMLM_parameter @@ -235,26 +223,23 @@ protected: int shift; }; int xCalcLMParametersGeneralized(int x, int y, int xx, int xy, int count, int bitDepth, int &a, int &b, int &iShift); - int xLMSampleClassifiedTraining(int count, int mean, int meanC, int LumaSamples[], int ChrmSamples[], int bitDepth, MMLM_parameter parameters[]); + int xLMSampleClassifiedTraining (int count, int mean, int meanC, int LumaSamples[], int ChrmSamples[], int bitDepth, MMLM_parameter parameters[]); #endif #if JVET_Z0050_CCLM_SLOPE - void xUpdateCclmModel(int &a, int &b, int &iShift, int midLuma, int delta); + void xUpdateCclmModel (int &a, int &b, int &iShift, int midLuma, int delta); #endif public: IntraPrediction(); virtual ~IntraPrediction(); -#if JVET_W0069_TMP_BOUNDARY - RefTemplateType getRefTemplateType(CodingUnit& cu, CompArea& area); -#endif - void init (ChromaFormat chromaFormatIDC, const unsigned bitDepthY); #if ENABLE_DIMD static void deriveDimdMode (const CPelBuf &recoBuf, const CompArea &area, CodingUnit &cu); #if JVET_Z0050_DIMD_CHROMA_FUSION && ENABLE_DIMD static void deriveDimdChromaMode(const CPelBuf &recoBufY, const CPelBuf &recoBufCb, const CPelBuf &recoBufCr, const CompArea &areaY, const CompArea &areaCb, const CompArea &areaCr, CodingUnit &cu); #endif + static int buildHistogram ( const Pel *pReco, int iStride, uint32_t uiHeight, uint32_t uiWidth, int* piHistogram, int direction, int bw, int bh ); #endif #if JVET_W0123_TIMD_FUSION void xIntraPredTimdHorVerPdpc (Pel* pDsty,const int dstStride, Pel* refSide, const int width, const int height, int xOffset, int yOffset, int scale, const Pel* refMain, const ClpRng& clpRng); @@ -268,7 +253,7 @@ public: Pel xGetPredTimdValDc ( const CPelBuf &pSrc, const Size &dstSize, TEMPLATE_TYPE eTempType, int iTempHeight, int iTempWidth ); void initPredTimdIntraParams (const PredictionUnit & pu, const CompArea area, int dirMode); void predTimdIntraAng ( const ComponentID compId, const PredictionUnit &pu, uint32_t uiDirMode, Pel* pPred, uint32_t uiStride, uint32_t iWidth, uint32_t iHeight, TEMPLATE_TYPE eTempType, int32_t iTemplateWidth, int32_t iTemplateHeight); - int deriveTimdMode ( const CPelBuf &recoBuf, const CompArea &area, CodingUnit &cu ); + int deriveTimdMode ( const CPelBuf &recoBuf, const CompArea &area, CodingUnit &cu ); void initTimdIntraPatternLuma (const CodingUnit &cu, const CompArea &area, int iTemplateWidth, int iTemplateHeight, uint32_t uiRefWidth, uint32_t uiRefHeight); #if GRAD_PDPC void xIntraPredTimdAngGradPdpc (Pel* pDsty, const int dstStride, Pel* refMain, Pel* refSide, const int width, const int height, int xOffset, int yOffset, int scale, int deltaPos, int intraPredAngle, const ClpRng& clpRng); @@ -331,64 +316,50 @@ public: void switchBuffer (const PredictionUnit &pu, ComponentID compID, PelBuf srcBuff, Pel *dst); #endif #if ENABLE_DIMD && INTRA_TRANS_ENC_OPT - void(*m_dimdBlending)(Pel *pDst, int strideDst, Pel *pSrc0, int strideSrc0, Pel *pSrc1, int strideSrc1, int w0, int w1, int w2, int width, int height); + void(*m_dimdBlending) ( Pel *pDst, int strideDst, Pel *pSrc0, int strideSrc0, Pel *pSrc1, int strideSrc1, int w0, int w1, int w2, int width, int height ); + static void dimdBlending ( Pel *pDst, int strideDst, Pel *pSrc0, int strideSrc0, Pel *pSrc1, int strideSrc1, int w0, int w1, int w2, int width, int height ); #endif #if JVET_W0123_TIMD_FUSION && INTRA_TRANS_ENC_OPT - void(*m_timdBlending)(Pel *pDst, int strideDst, Pel *pSrc, int strideSrc, int w0, int w1, int width, int height); + void(*m_timdBlending) ( Pel *pDst, int strideDst, Pel *pSrc, int strideSrc, int w0, int w1, int width, int height ); + static void timdBlending ( Pel *pDst, int strideDst, Pel *pSrc, int strideSrc, int w0, int w1, int width, int height ); #endif #if JVET_V0130_INTRA_TMP #if JVET_W0069_TMP_BOUNDARY - int( *m_calcTemplateDiff )(Pel* ref, unsigned int uiStride, Pel** tarPatch, unsigned int uiPatchWidth, unsigned int uiPatchHeight, int iMax, RefTemplateType TempType); - static int calcTemplateDiff( Pel* ref, unsigned int uiStride, Pel** tarPatch, unsigned int uiPatchWidth, unsigned int uiPatchHeight, int iMax, RefTemplateType TempType ); + int( *m_calcTemplateDiff ) ( Pel* ref, unsigned int uiStride, Pel** tarPatch, unsigned int uiPatchWidth, unsigned int uiPatchHeight, int iMax, RefTemplateType TempType ); + static int calcTemplateDiff ( Pel* ref, unsigned int uiStride, Pel** tarPatch, unsigned int uiPatchWidth, unsigned int uiPatchHeight, int iMax, RefTemplateType TempType ); #else - int( *m_calcTemplateDiff )(Pel* ref, unsigned int uiStride, Pel** tarPatch, unsigned int uiPatchWidth, unsigned int uiPatchHeight, int iMax); - static int calcTemplateDiff( Pel* ref, unsigned int uiStride, Pel** tarPatch, unsigned int uiPatchWidth, unsigned int uiPatchHeight, int iMax ); + int( *m_calcTemplateDiff ) (Pel* ref, unsigned int uiStride, Pel** tarPatch, unsigned int uiPatchWidth, unsigned int uiPatchHeight, int iMax); + static int calcTemplateDiff ( Pel* ref, unsigned int uiStride, Pel** tarPatch, unsigned int uiPatchWidth, unsigned int uiPatchHeight, int iMax ); #endif - Pel** getTargetPatch( unsigned int uiDepth ) { return m_pppTarPatch[uiDepth]; } - Pel* getRefPicUsed() { return m_refPicUsed; } - void setRefPicUsed( Pel* ref ) { m_refPicUsed = ref; } - unsigned int getStride() { return m_uiPicStride; } - void setStride( unsigned int uiPicStride ) { m_uiPicStride = uiPicStride; } + Pel** getTargetPatch ( unsigned int uiDepth ) { return m_pppTarPatch[uiDepth]; } + Pel* getRefPicUsed () { return m_refPicUsed; } + void setRefPicUsed ( Pel* ref ) { m_refPicUsed = ref; } + unsigned int getStride () { return m_uiPicStride; } + void setStride ( unsigned int uiPicStride ) { m_uiPicStride = uiPicStride; } #if JVET_W0069_TMP_BOUNDARY + RefTemplateType getRefTemplateType ( CodingUnit& cu, CompArea& area ); void searchCandidateFromOnePicIntra( CodingUnit* pcCU, Pel** tarPatch, unsigned int uiPatchWidth, unsigned int uiPatchHeight, unsigned int setId, RefTemplateType tempType ); - void candidateSearchIntra( CodingUnit* pcCU, unsigned int uiBlkWidth, unsigned int uiBlkHeight, RefTemplateType tempType ); + void candidateSearchIntra ( CodingUnit* pcCU, unsigned int uiBlkWidth, unsigned int uiBlkHeight, RefTemplateType tempType ); #else void searchCandidateFromOnePicIntra( CodingUnit* pcCU, Pel** tarPatch, unsigned int uiPatchWidth, unsigned int uiPatchHeight, unsigned int setId ); - void candidateSearchIntra( CodingUnit* pcCU, unsigned int uiBlkWidth, unsigned int uiBlkHeight ); + void candidateSearchIntra ( CodingUnit* pcCU, unsigned int uiBlkWidth, unsigned int uiBlkHeight ); #endif - bool generateTMPrediction( Pel* piPred, unsigned int uiStride, unsigned int uiBlkWidth, unsigned int uiBlkHeight, int& foundCandiNum ); + bool generateTMPrediction ( Pel* piPred, unsigned int uiStride, unsigned int uiBlkWidth, unsigned int uiBlkHeight, int& foundCandiNum ); #if JVET_W0069_TMP_BOUNDARY - bool generateTmDcPrediction( Pel* piPred, unsigned int uiStride, unsigned int uiBlkWidth, unsigned int uiBlkHeight, int DC_Val ); - void getTargetTemplate( CodingUnit* pcCU, unsigned int uiBlkWidth, unsigned int uiBlkHeight, RefTemplateType tempType ); + bool generateTmDcPrediction ( Pel* piPred, unsigned int uiStride, unsigned int uiBlkWidth, unsigned int uiBlkHeight, int DC_Val ); + void getTargetTemplate ( CodingUnit* pcCU, unsigned int uiBlkWidth, unsigned int uiBlkHeight, RefTemplateType tempType ); #else - void getTargetTemplate( CodingUnit* pcCU, unsigned int uiBlkWidth, unsigned int uiBlkHeight ); + void getTargetTemplate ( CodingUnit* pcCU, unsigned int uiBlkWidth, unsigned int uiBlkHeight ); #endif #endif -#if ENABLE_SIMD_TMP #ifdef TARGET_SIMD_X86 void initIntraX86(); template <X86_VEXT vext> void _initIntraX86(); #endif -#endif }; -#if ENABLE_DIMD -int buildHistogram(const Pel *pReco, int iStride, uint32_t uiHeight, uint32_t uiWidth, int* piHistogram, int direction, int bw, int bh); -#if INTRA_TRANS_ENC_OPT -void xDimdBlending(Pel *pDst, int strideDst, Pel *pSrc0, int strideSrc0, Pel *pSrc1, int strideSrc1, int w0, int w1, int w2, int wdith, int height); -#ifdef TARGET_SIMD_X86 -void xDimdBlending_SIMD(Pel *pDst, int strideDst, Pel *pSrc0, int strideSrc0, Pel *pSrc1, int strideSrc1, int w0, int w1, int w2, int wdith, int height); -#endif -#endif -#endif -#if JVET_W0123_TIMD_FUSION && INTRA_TRANS_ENC_OPT -void xTimdBlending(Pel *pDst, int strideDst, Pel *pSrc, int strideSrc, int w0, int w1, int width, int height); -#ifdef TARGET_SIMD_X86 -void xTimdBlending_SIMD(Pel *pDst, int strideDst, Pel *pSrc, int strideSrc, int w0, int w1, int width, int height); -#endif -#endif //! \} #endif // __INTRAPREDICTION__ diff --git a/source/Lib/CommonLib/MotionInfo.h b/source/Lib/CommonLib/MotionInfo.h index 7b089ff9d061f1eade77b077757418231eb612b2..699d6f1c541fde574de8c5fbc0ad988db74249c1 100644 --- a/source/Lib/CommonLib/MotionInfo.h +++ b/source/Lib/CommonLib/MotionInfo.h @@ -377,7 +377,7 @@ struct LutMotionCand static_vector<AffineInheritInfo, MAX_NUM_AFF_INHERIT_HMVP_CANDS> lutAffInherit0; static_vector<AffineInheritInfo, MAX_NUM_AFF_INHERIT_HMVP_CANDS> lutAffInherit1; #endif -#else // JVET_Z0118_GDR +#else static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> lut; #if JVET_Z0075_IBC_HMVP_ENLARGE static_vector<MotionInfo, MAX_NUM_HMVP_IBC_CANDS> lutIbc; @@ -389,7 +389,7 @@ struct LutMotionCand static_vector<AffineMotionInfo, MAX_NUM_AFF_HMVP_CANDS> lutAff[2 * MAX_NUM_AFFHMVP_ENTRIES_ONELIST]; static_vector<AffineInheritInfo, MAX_NUM_AFF_INHERIT_HMVP_CANDS> lutAffInherit; #endif -#endif // JVET_Z0118_GDR +#endif }; struct PatentBvCand { diff --git a/source/Lib/CommonLib/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp index cad0da41cc7a65a51c8519ee50a24c50a0032b52..4a4a4a9eb5c380b9a0601832fbf8a00a3aa79725 100644 --- a/source/Lib/CommonLib/RdCost.cpp +++ b/source/Lib/CommonLib/RdCost.cpp @@ -504,7 +504,7 @@ void RdCost::setTimdDistParam( DistParam &rcDP, const Pel* pOrg, const Pel* piRe #endif #if TM_AMVP || TM_MRG -void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const CPelBuf &cur, int bitDepth, bool TrueA_FalseL, int wIdx, int subShift, ComponentID compID ) +void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const CPelBuf &cur, int bitDepth, bool trueAfalseL, int wIdx, int subShift, ComponentID compID ) { rcDP.org = org; rcDP.cur = cur; @@ -514,7 +514,7 @@ void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const CPelBuf &c rcDP.compID = compID; rcDP.tmWeightIdx = wIdx; - if (TrueA_FalseL) + if (trueAfalseL) { rcDP.distFunc = m_afpDistortFunc[ rcDP.useMR ? DF_TM_A_WMRSAD_FULL_NBIT : DF_TM_A_WSAD_FULL_NBIT ]; } @@ -3667,17 +3667,17 @@ Distortion RdCost::xGetSADwMask( const DistParam& rcDtParam ) } #if TM_AMVP || TM_MRG -template <int tplSize, bool TrueA_FalseL, bool MR> +template <int tplSize, bool trueAfalseL, bool mr> Distortion RdCost::xGetTMErrorFull( const DistParam& rcDtParam ) { const CPelBuf& curTplBuf = rcDtParam.org; const CPelBuf& refTplBuf = rcDtParam.cur; // get delta mean value - const int64_t deltaSum = !MR ? 0 : g_pelBufOP.getSumOfDifference(curTplBuf.buf, curTplBuf.stride, refTplBuf.buf, refTplBuf.stride, curTplBuf.width, curTplBuf.height, rcDtParam.subShift, rcDtParam.bitDepth); - if (MR && deltaSum == 0) + const int64_t deltaSum = !mr ? 0 : g_pelBufOP.getSumOfDifference(curTplBuf.buf, curTplBuf.stride, refTplBuf.buf, refTplBuf.stride, curTplBuf.width, curTplBuf.height, rcDtParam.subShift, rcDtParam.bitDepth); + if (mr && deltaSum == 0) { - return xGetTMErrorFull<tplSize, TrueA_FalseL, false>(rcDtParam); + return xGetTMErrorFull<tplSize, trueAfalseL, false>(rcDtParam); } // weight configuration @@ -3732,15 +3732,15 @@ Distortion RdCost::xGetTMErrorFull( const DistParam& rcDtParam ) const int iStrideRef = refTplBuf.stride << iSubShift; Distortion partSum = 0; - const int deltaMean = !MR ? 0 : int(deltaSum / (int64_t)curTplBuf.area()); - if (MR) + const int deltaMean = !mr ? 0 : int(deltaSum / (int64_t)curTplBuf.area()); + if (mr) { - if (TrueA_FalseL) { X_GET_TM_TEMP_MATCH_ERROR_LOOPER_FOR_ABOVE_TPL(X_GET_TM_ERR_MRSAD_OP); } + if (trueAfalseL) { X_GET_TM_TEMP_MATCH_ERROR_LOOPER_FOR_ABOVE_TPL(X_GET_TM_ERR_MRSAD_OP); } else { X_GET_TM_TEMP_MATCH_ERROR_LOOPER_FOR__LEFT_TPL(X_GET_TM_ERR_MRSAD_OP); } } else { - if (TrueA_FalseL) { X_GET_TM_TEMP_MATCH_ERROR_LOOPER_FOR_ABOVE_TPL(X_GET_TM_ERR___SAD_OP); } + if (trueAfalseL) { X_GET_TM_TEMP_MATCH_ERROR_LOOPER_FOR_ABOVE_TPL(X_GET_TM_ERR___SAD_OP); } else { X_GET_TM_TEMP_MATCH_ERROR_LOOPER_FOR__LEFT_TPL(X_GET_TM_ERR___SAD_OP); } } diff --git a/source/Lib/CommonLib/RdCost.h b/source/Lib/CommonLib/RdCost.h index a5106bc5cb40911ab2bcd63899f8ad4aad11efb0..d5325ff578a032e26d03f01880b548f8394ba8d5 100644 --- a/source/Lib/CommonLib/RdCost.h +++ b/source/Lib/CommonLib/RdCost.h @@ -207,7 +207,7 @@ public: #endif void setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRefY, int iRefStride, const Pel* mask01, int iMaskStride, int stepX, int iMaskStride2, int bitDepth, ComponentID compID); #if TM_AMVP || TM_MRG - void setDistParam( DistParam &rcDP, const CPelBuf &org, const CPelBuf &cur, int bitDepth, bool TrueA_FalseL, int wIdx, int subShift, ComponentID compID ); + void setDistParam( DistParam &rcDP, const CPelBuf &org, const CPelBuf &cur, int bitDepth, bool trueAfalseL, int wIdx, int subShift, ComponentID compID ); #endif double getMotionLambda ( ) { return m_dLambdaMotionSAD; } @@ -561,7 +561,7 @@ private: static Distortion xCalcHADs8x4 ( const Pel *piOrg, const Pel *piCur, int iStrideOrg, int iStrideCur ); #if TM_AMVP || TM_MRG - template < int tplSize, bool TrueA_FalseL, bool MR > + template < int tplSize, bool trueAfalseL, bool mr > static Distortion xGetTMErrorFull ( const DistParam& rcDtParam ); #endif @@ -590,7 +590,7 @@ private: static Distortion xGetMRSAD_SIMD(const DistParam &rcDtParam); #endif #if TM_AMVP || TM_MRG - template < X86_VEXT vext, int tplSize, bool TrueA_FalseL, bool MR > + template < X86_VEXT vext, int tplSize, bool trueAfalseL, bool mr > static Distortion xGetTMErrorFull_SIMD(const DistParam& rcDtParam); #endif diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp index 58b1b8d5096a563416a9aec23c99e7c8525cf2a5..7e6120dc5c6b270eaff93c53cd13a9d00a8830d6 100644 --- a/source/Lib/CommonLib/Rom.cpp +++ b/source/Lib/CommonLib/Rom.cpp @@ -5118,4 +5118,10 @@ const int8_t g_ccSaoEdgeTypeX[CCSAO_EDGE_TYPE][2] = { { -1, 1 }, { 0, 0 }, { -1, const int8_t g_ccSaoEdgeTypeY[CCSAO_EDGE_TYPE][2] = { { 0, 0 }, { -1, 1 }, { -1, 1 }, { -1, 1 } }; const short g_ccSaoQuanValue[CCSAO_QUAN_NUM] = { 2, 4, 6, 8, 10, 14, 18, 22, 30, 38, 54, 70, 86, 118, 150, 182 }; #endif +#if JVET_V0130_INTRA_TMP +unsigned int g_uiDepth2Width[5] = { 4, 8, 16, 32, 64 }; +#endif +#if JVET_X0149_TIMD_DIMD_LUT +int g_gradDivTable[16] = { 0, 7, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 0 }; +#endif //! \} diff --git a/source/Lib/CommonLib/Rom.h b/source/Lib/CommonLib/Rom.h index 9a15ced4aec8ccd54cd5a50c517919570db817a9..46de2b67c611023ebd021122efad6930ef98a380 100644 --- a/source/Lib/CommonLib/Rom.h +++ b/source/Lib/CommonLib/Rom.h @@ -369,5 +369,11 @@ extern const int8_t g_ccSaoEdgeTypeX[CCSAO_EDGE_TYPE][2]; extern const int8_t g_ccSaoEdgeTypeY[CCSAO_EDGE_TYPE][2]; extern const short g_ccSaoQuanValue[CCSAO_QUAN_NUM]; #endif +#if JVET_V0130_INTRA_TMP +extern unsigned int g_uiDepth2Width[5]; +#endif +#if JVET_X0149_TIMD_DIMD_LUT +extern int g_gradDivTable[16]; +#endif #endif //__TCOMROM__ diff --git a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp index 28e69d7e756fc73a7a53e8c04b920c58a7c0d351..4e3346659b60016baa844b26fef1a1437cf0ec4e 100644 --- a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp +++ b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp @@ -1878,7 +1878,7 @@ void SampleAdaptiveOffset::offsetCTUCcSaoNoClip(CodingStructure& cs, const UnitA isLeftAvail, isRightAvail, isAboveAvail, isBelowAvail, isAboveLeftAvail, isAboveRightAvail, isBelowLeftAvail, isBelowRightAvail #if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY - , isCtuCrossedByVirtualBoundaries, horVirBndryPosComp, verVirBndryPosComp, numHorVirBndry, numVerVirBndry + , isCtuCrossedByVirtualBoundaries, horVirBndryPosComp, verVirBndryPosComp, numHorVirBndry, numVerVirBndry #endif ); } @@ -2091,8 +2091,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -2153,8 +2153,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -2210,8 +2210,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -2259,8 +2259,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -2309,8 +2309,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -2360,8 +2360,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -2409,8 +2409,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -2459,8 +2459,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -2533,7 +2533,7 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else if (bandNumY > 4 && bandNumY <= 6) { int bandc = bandNumY - 4; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; band = (*colC * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; const int classIdx = band; @@ -2542,8 +2542,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else { const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remaining third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remaining third component for bandIdx calc.*/ int bandc = bandNumY - 6; band = (*colCT * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; @@ -2596,7 +2596,7 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else if (bandNumY > 4 && bandNumY <= 6) { int bandc = bandNumY - 4; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; band = (*colC * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; const int classIdx = band; @@ -2605,8 +2605,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else { const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remaining third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remaining third component for bandIdx calc.*/ int bandc = bandNumY - 6; band = (*colCT * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; @@ -2654,7 +2654,7 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else if (bandNumY > 4 && bandNumY <= 6) { int bandc = bandNumY - 4; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; band = (*colC * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; const int classIdx = band; @@ -2663,8 +2663,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else { const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remaining third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remaining third component for bandIdx calc.*/ int bandc = bandNumY - 6; band = (*colCT * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; @@ -2704,7 +2704,7 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else if (bandNumY > 4 && bandNumY <= 6) { int bandc = bandNumY - 4; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; band = (*colC * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; const int classIdx = band; @@ -2713,8 +2713,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else { const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remaining third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remaining third component for bandIdx calc.*/ int bandc = bandNumY - 6; band = (*colCT * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; @@ -2755,7 +2755,7 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else if (bandNumY > 4 && bandNumY <= 6) { int bandc = bandNumY - 4; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; band = (*colC * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; const int classIdx = band; @@ -2764,8 +2764,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else { const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remaining third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remaining third component for bandIdx calc.*/ int bandc = bandNumY - 6; band = (*colCT * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; @@ -2807,7 +2807,7 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else if (bandNumY > 4 && bandNumY <= 6) { int bandc = bandNumY - 4; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; band = (*colC * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; const int classIdx = band; @@ -2816,8 +2816,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else { const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remaining third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remaining third component for bandIdx calc.*/ int bandc = bandNumY - 6; band = (*colCT * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; @@ -2857,7 +2857,7 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else if (bandNumY > 4 && bandNumY <= 6) { int bandc = bandNumY - 4; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; band = (*colC * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; const int classIdx = band; @@ -2866,8 +2866,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else { const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remaining third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remaining third component for bandIdx calc.*/ int bandc = bandNumY - 6; band = (*colCT * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; @@ -2908,7 +2908,7 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else if (bandNumY > 4 && bandNumY <= 6) { int bandc = bandNumY - 4; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; band = (*colC * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; const int classIdx = band; @@ -2917,8 +2917,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else { const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remaining third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remaining third component for bandIdx calc.*/ int bandc = bandNumY - 6; band = (*colCT * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; @@ -2947,8 +2947,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( for (int x = 0; x < width; x++) { const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -3011,7 +3011,7 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else if (bandNumY > 4 && bandNumY <= 6) { int bandc = bandNumY - 4; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; band = (*colC * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; const int classIdx = band; @@ -3020,8 +3020,8 @@ void SampleAdaptiveOffset::offsetBlockCcSaoNoClipEdge( else { const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remaining third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remaining third component for bandIdx calc.*/ int bandc = bandNumY - 6; band = (*colCT * bandc) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 740827f5b8ae3a6e7990828136a2f5e6e6151e6f..da3b0798fd3e507b0a9019821fe870bd4bc3aa17 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -1701,7 +1701,7 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic, const PPS& pps) } } } -#else // JVET_Z0118_GDR +#else #if JVET_S0193_NO_OUTPUT_PRIOR_PIC if (pcSlice->getPicHeader()->getPicOutputFlag() == 1 && !this->getNoOutputOfPriorPicsFlag() && pcPic->layerId == this->m_nuhLayerId) #else @@ -1739,7 +1739,7 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic, const PPS& pps) "nuh_layer_id equal to layerId in decoding order shall precede the recovery point picture in output order."); } } -#endif // JVET_Z0118_GDR +#endif if ((nalUnitType == NAL_UNIT_CODED_SLICE_RASL || nalUnitType == NAL_UNIT_CODED_SLICE_RADL) && (pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RASL && pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RADL) && !pps.getMixedNaluTypesInPicFlag()) diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index 0e8162c7ca0f5a0d6f59cfab3658671bd9e696ce..05bb11fabb968624fa6073d7bd39ee3d49486e8b 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -55,10 +55,6 @@ #include "CommonLib/CodingStatistics.h" #endif -#if JVET_V0130_INTRA_TMP -unsigned int g_uiDepth2Width[5] = { 4, 8, 16, 32, 64 }; -#endif - struct coeffGroupRDStats { int iNNZbeforePos0; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index b1b8d015a5577dd4c35f2cc520498affe2aa9f8f..ef7f014bded36b33e9d56099e4e13c8ee25692b2 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -57,21 +57,18 @@ #if BASE_ENCODER - -#define JVET_Y0240_BIM 1 // JVET_Y0240: Block Importance Mapping - -#define JVET_X0144_MAX_MTT_DEPTH_TID 1 // JVET-X0144: max MTT hierarchy depth set by temporal ID // Lossy encoder speedups #define AFFINE_ENC_OPT 1 // Affine encoder optimization #define AMVR_ENC_OPT 1 // Encoder optimization for AMVR #define MERGE_ENC_OPT 1 // Encoder optimization for merge modes. Regular merge, subblock based merge, CIIP and MMVD share the same full RD pool #define ALF_SAO_TRUE_ORG 1 // using true original samples for SAO and ALF optimization - #define REMOVE_PCM 1 // Remove PCM related code for memory reduction and speedup +#define JVET_Y0152_TT_ENC_SPEEDUP 1 // TT encoding speedup +// Software optimization +#define JVET_X0144_MAX_MTT_DEPTH_TID 1 // JVET-X0144: max MTT hierarchy depth set by temporal ID #define JVET_X0049_BDMVR_SW_OPT 1 // JVET-X0049: software optimization for BDMVR (lossless) - -#define JVET_Y0152_TT_ENC_SPEEDUP 1 // TT encoding speedup +#define INTRA_TRANS_ENC_OPT 1 // JVET-Y0141: Software optimization, including TIMD/DIMD/MTS/LFNS encoder fast algorithm, SIMD implementation and CM initial value retraining // SIMD optimizations #define MCIF_SIMD_NEW 1 // SIMD for interpolation @@ -102,7 +99,7 @@ #define AFFINE_RM_CONSTRAINTS_AND_OPT 1 // Remove affine constraints and optimization // Loop filters -#define DB_PARAM_TID 1 // adjust DB parameters based on temporal ID +#define DB_PARAM_TID 1 // Adjust DB parameters based on temporal ID #define CONVERT_NUM_TU_SPLITS_TO_CFG 1 // Convert number of TU splits to config parameter to lower memory #define DUMP_BEFORE_INLOOP 1 // Dump reconstructed YUV before inloop filters, controlled by config parameter @@ -113,15 +110,15 @@ #if TOOLS // Intra #define MMLM 1 // Add three MMLM modes -#define GRAD_PDPC 1 // gradient PDPC extension for angular-intra modes for luma. +#define GRAD_PDPC 1 // Gradient PDPC extension for angular-intra modes for luma. #define INTRA_6TAP 1 // 6TapCubic + 6 TapGaussian + left side 4 tap weak filtering for intra. -#define SECONDARY_MPM 1 // Primary MPM and Secondary MPM: Add neighbouring modes into MPMs from positions AR, BL, AL, derived modes +#define SECONDARY_MPM 1 // Primary MPM and secondary MPM: Add neighbouring modes into MPMs from positions AR, BL, AL, derived modes #define ENABLE_DIMD 1 // Decoder side intra mode derivation #if ENABLE_DIMD -#define JVET_V0087_DIMD_NO_ISP 1 // JVET-V0087: disallow combination of DIMD and ISP -#define JVET_X0124_TMP_SIGNAL 1 // JVET-X0124: cleanup on signalling of intra template matching +#define JVET_V0087_DIMD_NO_ISP 1 // JVET-V0087: Disallow combination of DIMD and ISP +#define JVET_X0124_TMP_SIGNAL 1 // JVET-X0124: Cleanup on signalling of intra template matching #endif -#define JVET_V0130_INTRA_TMP 1 // JVET-V0130: template matching prediction +#define JVET_V0130_INTRA_TMP 1 // JVET-V0130: Template matching prediction #define JVET_W0069_TMP_BOUNDARY 1 // JVET-W0069: boundary handling for TMP #define JVET_W0123_TIMD_FUSION 1 // JVET-W0123: Template based intra mode derivation and fusion #if JVET_W0123_TIMD_FUSION @@ -137,15 +134,15 @@ //IBC -#define JVET_Y0058_IBC_LIST_MODIFY 1 // JVET-Y0058:Modifications of IBC merge/AMVP list construction, ARMC-TM-IBC part is included under JVET_W0090_ARMC_TM -#define JVET_Z0075_IBC_HMVP_ENLARGE 1 // JVET-Z0075:Enlarged HMVP table for IBC -#define JVET_Z0084_IBC_TM 1 // JVET-Z0084: add template matching in IBC modes (controlled by TM_MRG or TM_AMVP) -#define JVET_Z0131_IBC_BVD_BINARIZATION 1 // JVET-Z0131: Block Vector Difference Binarization -#define JVET_Z0153_IBC_EXT_REF 1 // JVET-Z0153: extend reference area for IBC +#define JVET_Y0058_IBC_LIST_MODIFY 1 // JVET-Y0058: Modifications of IBC merge/AMVP list construction, ARMC-TM-IBC part is included under JVET_W0090_ARMC_TM +#define JVET_Z0075_IBC_HMVP_ENLARGE 1 // JVET-Z0075: Enlarged HMVP table for IBC +#define JVET_Z0084_IBC_TM 1 // JVET-Z0084: Add template matching in IBC modes (controlled by TM_MRG or TM_AMVP) +#define JVET_Z0131_IBC_BVD_BINARIZATION 1 // JVET-Z0131: Block vector difference binarization +#define JVET_Z0153_IBC_EXT_REF 1 // JVET-Z0153: Extend reference area for IBC #define JVET_Z0160_IBC_ZERO_PADDING 1 // JVET-Z0160: Replacement of zero-padding candidates // Inter -#define CIIP_PDPC 1 // apply pdpc to megre prediction as a new CIIP mode (CIIP_PDPC) additional to CIIP mode +#define CIIP_PDPC 1 // Apply pdpc to megre prediction as a new CIIP mode (CIIP_PDPC) additional to CIIP mode #define JVET_X0090_CIIP_FIX 1 // JVET-X0090: combination of CIIP, OBMC and LMCS #define SAMPLE_BASED_BDOF 1 // Sample based BDOF #define MULTI_PASS_DMVR 1 // Multi-pass DMVR @@ -154,10 +151,10 @@ #define NON_ADJACENT_MRG_CAND 1 // Add non-adjacent merge candidates #define MULTI_HYP_PRED 1 // Multiple hypothesis prediction #if MULTI_HYP_PRED -#define JVET_Z0127_SPS_MHP_MAX_MRG_CAND 1 +#define JVET_Z0127_SPS_MHP_MAX_MRG_CAND 1 // JVET-Z0127: Signal number of MHP candidates #endif #define IF_12TAP 1 // 12-tap IF -#define JVET_Z0117_CHROMA_IF 1 //JVET_Z0117: 6-tap interpolation filter for chroma MC +#define JVET_Z0117_CHROMA_IF 1 // JVET-Z0117: 6-tap interpolation filter for chroma MC #define ENABLE_OBMC 1 // Enable Overlapped Block Motion Compensation #if JVET_X0049_BDMVR_SW_OPT @@ -171,10 +168,10 @@ #endif #define JVET_Y0089_DMVR_BCW 1 // JVET-Y0089: DMVR with BCW enabled #define JVET_Y0065_GPM_INTRA 1 // JVET-Y0065: Intra prediction for GPM -#define JVET_Z0136_OOB 1 // JVET-Z0136 test2.2a: enhanced bi-prediction with out-of-boundary prediction samples +#define JVET_Z0136_OOB 1 // JVET-Z0136 test2.2a: Enhanced bi-prediction with out-of-boundary prediction samples #define JVET_Z0083_PARSINGERROR_FIX 1 // JVET-Z0083: Fix on MHP parsing condition #define JVET_Z0139_HIST_AFF 1 // JVET-Z0139: Affine HMVP -#define JVET_Z0139_NA_AFF 1 // JVET-Z0139: Constructed Non-adjacent spatial neighbors for affine mode +#define JVET_Z0139_NA_AFF 1 // JVET-Z0139: Constructed non-adjacent spatial neighbors for affine mode // Inter template matching tools #define ENABLE_INTER_TEMPLATE_MATCHING 1 // It controls whether template matching is enabled for inter prediction @@ -192,21 +189,21 @@ #define JVET_Y0134_TMVP_NAMVP_CAND_REORDERING 1 // JVET-Y0134: MV candidate reordering for TMVP and NAMVP types (controlled by JVET_W0090_ARMC_TM), and reference picture selection for TMVP #if JVET_W0090_ARMC_TM #define JVET_Y0067_ENHANCED_MMVD_MVD_SIGN_PRED 1 // JVET-Y0067: TM based reordering for MMVD and affine MMVD and MVD sign prediction -#define JVET_Z0102_NO_ARMC_FOR_ZERO_CAND 1 // JVET-Z0102: No ARMC for the Zero candidates of Regular, TM and BM merge modes +#define JVET_Z0102_NO_ARMC_FOR_ZERO_CAND 1 // JVET-Z0102: No ARMC for the zero candidates of regular, TM and BM merge modes #define JVET_Z0054_BLK_REF_PIC_REORDER 1 // JVET-Z0054: Block level TM based reordering of reference pictures #endif // Transform and coefficient coding #define TCQ_8STATES 1 -#define JVET_W0119_LFNST_EXTENSION 1 +#define JVET_W0119_LFNST_EXTENSION 1 // JVET-W0119: LFNST extension with large kernel #if JVET_W0119_LFNST_EXTENSION #define EXTENDED_LFNST 0 #else #define EXTENDED_LFNST 1 // Extended LFNST #endif -#define SIGN_PREDICTION 1 // transform coefficients sign prediction +#define SIGN_PREDICTION 1 // Transform coefficients sign prediction #if SIGN_PREDICTION -#define JVET_Y0141_SIGN_PRED_IMPROVE 1 //JVET-Y0141 test3: sign prediction improvement +#define JVET_Y0141_SIGN_PRED_IMPROVE 1 // JVET-Y0141 test3: Sign prediction improvement #endif #define JVET_W0103_INTRA_MTS 1 // JVET-W0103: Extended Intra MTS #if JVET_W0103_INTRA_MTS @@ -230,17 +227,14 @@ #define JVET_X0071_LONGER_CCALF 1 // JVET-X0071/JVET-X0045: Longer filter for CCALF #define JVET_X0071_ALF_BAND_CLASSIFIER 1 // JVET-X0071/JVET-X0070: Alternative band classifier for ALF #define JVET_Y0106_CCSAO_EDGE_CLASSIFIER 1 // JVET-Y0106: Edge based classifier for CCSAO -#define JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY 1 // JVET-Z0105: Enable Virtual Boundary Processing for new In-loop filer tools of ECM +#define JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY 1 // JVET-Z0105: Enable virtual boundary processing for in-loop filters -//encoder optimization -#define INTRA_TRANS_ENC_OPT 1 //software optimization introduced by JVET-Y0141,including TIMD/DIMD/MTS/LFNS encoder fast algorithm, SIMD implementation and CM initial value retraining - // SIMD optimizations #if IF_12TAP -#define IF_12TAP_SIMD 1 // enable SIMD for 12-tap filter +#define IF_12TAP_SIMD 1 // Enable SIMD for 12-tap filter #if IF_12TAP_SIMD -#define SIMD_4x4_12 1 //enable 4x4-block combined passes for 12-tap filters +#define SIMD_4x4_12 1 // Enable 4x4-block combined passes for 12-tap filters #endif #endif #if SIGN_PREDICTION @@ -259,16 +253,17 @@ // Software extensions #define RPR_ENABLE 1 // JVET-X0121: Fixes for RRP -#define JVET_Y0128_NON_CTC 1 // JVET-Y0128: Fixing issues for RPR enabling and non-CTC configuration in ECM -#define JVET_Z0067_RPR_ENABLE 1 // JVET_Z0067: Fixes for RPR -#define JVET_Z0118_GDR 1 // JVET_Z0118: GDR for ECM -#define JVET_Z0150_MEMORY_USAGE_PRINT 1 // JVET-Z0150: print memory usage +#define JVET_Y0128_NON_CTC 1 // JVET-Y0128: Fixing issues for RPR enabling and non-CTC configuration +#define JVET_Y0240_BIM 1 // JVET-Y0240: Block importance mapping +#define JVET_Z0067_RPR_ENABLE 1 // JVET-Z0067: Fixes for RPR +#define JVET_Z0150_MEMORY_USAGE_PRINT 1 // JVET-Z0150: Print memory usage +#define JVET_Z0118_GDR 1 // JVET-Z0118: GDR #if JVET_Z0118_GDR -#define GDR_LEAK_TEST 1 -#define GDR_ENC_TRACE 0 -#define GDR_DEC_TRACE 0 -#endif // JVET_Z0118_GDR +#define GDR_LEAK_TEST 1 +#define GDR_ENC_TRACE 0 +#define GDR_DEC_TRACE 0 +#endif diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index 20b75e8b80a634d9fd7dd5d75d267c851a40745a..960b06cda648dba1627e3d9a9c07f3bcba243ea9 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -278,7 +278,7 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) tileIdx = other.tileIdx; #if ENABLE_DIMD dimd = other.dimd; - dimd_is_blend = other.dimd_is_blend; + dimdBlending = other.dimdBlending; dimdMode = other.dimdMode; #if JVET_Z0050_DIMD_CHROMA_FUSION && ENABLE_DIMD dimdChromaMode = other.dimdChromaMode; @@ -374,7 +374,7 @@ void CodingUnit::initData() tileIdx = 0; #if ENABLE_DIMD dimd = false; - dimd_is_blend = false; + dimdBlending = false; dimdMode = -1; #if JVET_Z0050_DIMD_CHROMA_FUSION && ENABLE_DIMD dimdChromaMode = -1; diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index d246f8ce7b5a52fb3149c7cba6255e1094dd3a83..845518926c7f1e8ee07b7a8fa128c55ef72c921e 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -320,7 +320,7 @@ struct CodingUnit : public UnitArea uint32_t tileIdx; #if ENABLE_DIMD bool dimd; - bool dimd_is_blend; + bool dimdBlending; int8_t dimdMode; #if JVET_Z0050_DIMD_CHROMA_FUSION && ENABLE_DIMD int8_t dimdChromaMode; diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 2e91c8dd0af9146e35cdb39197190667b9278ecf..80d3d60e3392f3296fa32dcfb6af35813408c8a5 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -411,7 +411,7 @@ void CU::saveMotionInHMVP( const CodingUnit& cu, const bool isToBeDone ) cu.cs->addAffMiToLut((isClean) ? cu.cs->motionLut.lutAff1 : cu.cs->motionLut.lutAff0, addMi, addRefIdx); #else cu.cs->addAffMiToLut(cu.cs->motionLut.lutAff, addMi, addRefIdx); -#endif // JVET_Z0118_GDR +#endif AffineInheritInfo addAffInherit; addAffInherit.basePos = cu.lumaPos(); @@ -433,11 +433,12 @@ void CU::saveMotionInHMVP( const CodingUnit& cu, const bool isToBeDone ) cu.cs->addAffInheritToLut((isClean) ? cu.cs->motionLut.lutAffInherit1 : cu.cs->motionLut.lutAffInherit0, addAffInherit); #else cu.cs->addAffInheritToLut(cu.cs->motionLut.lutAffInherit, addAffInherit); -#endif // JVET_Z0118_GDR +#endif } return; } -#endif // JVET_Z0139_HIST_AFF +#endif + if (!cu.geoFlag && !cu.affine && !isToBeDone) { MotionInfo mi = pu.getMotionInfo(); @@ -487,9 +488,9 @@ void CU::saveMotionInHMVP( const CodingUnit& cu, const bool isToBeDone ) { cu.cs->addMiToLut(cu.cs->motionLut.lut, mi); } -#endif // JVET_Z0118_GDR +#endif } -#else // JVET_Z0075_IBC_HMVP_ENLARGE +#else #if JVET_Z0118_GDR bool isClean = pu.cs->isClean(pu.cu->Y().bottomRight(), CHANNEL_TYPE_LUMA); @@ -500,8 +501,8 @@ void CU::saveMotionInHMVP( const CodingUnit& cu, const bool isToBeDone ) cu.cs->addMiToLut(CU::isIBC(cu) ? cu.cs->motionLut.lutIbc0 : cu.cs->motionLut.lut0, mi); #else cu.cs->addMiToLut(CU::isIBC(cu) ? cu.cs->motionLut.lutIbc : cu.cs->motionLut.lut, mi); -#endif // JVET_Z0118_GDR -#endif // JVET_Z0075_IBC_HMVP_ENLARGE +#endif +#endif } } @@ -1798,22 +1799,22 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx &mrgCtx, const int #if JVET_Z0075_IBC_HMVP_ENLARGE #if JVET_Z0118_GDR bool isClean = cs.isClean(pu.cu->Y().bottomRight(), CHANNEL_TYPE_LUMA); -#endif // JVET_Z0118_GDR +#endif #if JVET_Z0118_GDR auto &lut = (isClean) ? cs.motionLut.lut1 : cs.motionLut.lut0; #else auto &lut = cs.motionLut.lut; -#endif // JVET_Z0118_GDR +#endif #else - #if JVET_Z0118_GDR auto &lut = ibcFlag ? (isClean ? cs.motionLut.lutIbc1 : cs.motionLut.lutIbc0) : (isClean ? cs.motionLut.lut1 : cs.motionLut.lut0); #else auto &lut = ibcFlag ? cs.motionLut.lutIbc : cs.motionLut.lut; -#endif // JVET_Z0118_GDR +#endif + +#endif -#endif // JVET_Z0075_IBC_HMVP_ENLARGE int num_avai_candInLUT = (int)lut.size(); for (int mrgIdx = 1; mrgIdx <= num_avai_candInLUT; mrgIdx++) @@ -3909,21 +3910,22 @@ bool PU::addBMMergeHMVPCand(const CodingStructure &cs, MergeCtx &mrgCtx, const i MotionInfo miNeighbor; #if JVET_Z0118_GDR bool isClean = cs.isClean(cs.area.Y().bottomRight(), CHANNEL_TYPE_LUMA); -#endif // JVET_Z0118_GDR +#endif #if JVET_Z0075_IBC_HMVP_ENLARGE #if JVET_Z0118_GDR auto &lut = (isClean) ? cs.motionLut.lut1 : cs.motionLut.lut0; #else auto &lut = cs.motionLut.lut; -#endif // JVET_Z0118_GDR +#endif #else #if JVET_Z0118_GDR auto &lut = ibcFlag ? (isClean ? cs.motionLut.lutIbc1 : cs.motionLut.lutIbc0) : (isClean ? cs.motionLut.lut1 : cs.motionLut.lut0); #else auto &lut = ibcFlag ? cs.motionLut.lutIbc : cs.motionLut.lut; -#endif // JVET_Z0118_GDR -#endif // JVET_Z0075_IBC_HMVP_ENLARGE +#endif +#endif + int num_avai_candInLUT = (int)lut.size(); for (int mrgIdx = 1; mrgIdx <= num_avai_candInLUT; mrgIdx++) @@ -7883,21 +7885,22 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, MotionInfo neibMi; #if JVET_Z0118_GDR bool isClean = pu.cs->isClean(pu.cu->Y().bottomRight(), CHANNEL_TYPE_LUMA); -#endif // JVET_Z0118_GDR +#endif #if JVET_Z0075_IBC_HMVP_ENLARGE #if JVET_Z0118_GDR auto &lut = (isClean) ? pu.cs->motionLut.lut1 : pu.cs->motionLut.lut0; #else auto &lut = pu.cs->motionLut.lut; -#endif // JVET_Z0118_GDR +#endif #else #if JVET_Z0118_GDR auto &lut = CU::isIBC(*pu.cu) ? (isClean ? pu.cs->motionLut.lutIbc1 : pu.cs->motionLut.lutIbc0) : (isClean ? pu.cs->motionLut.lut1 : pu.cs->motionLut.lut0); #else auto &lut = CU::isIBC(*pu.cu) ? pu.cs->motionLut.lutIbc : pu.cs->motionLut.lut; -#endif // JVET_Z0118_GDR -#endif // JVET_Z0075_IBC_HMVP_ENLARGE +#endif +#endif + int num_avai_candInLUT = (int) lut.size(); int num_allowedCand = std::min(MAX_NUM_HMVP_AVMPCANDS, num_avai_candInLUT); const RefPicList eRefPicList2nd = (eRefPicList == REF_PIC_LIST_0) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; diff --git a/source/Lib/CommonLib/x86/IntraX86.h b/source/Lib/CommonLib/x86/IntraX86.h index e4f5617d45650e6fe303f53860358711ab3eaf05..faba4e217ceffe34c12dcc0d901b02246e6f2f79 100644 --- a/source/Lib/CommonLib/x86/IntraX86.h +++ b/source/Lib/CommonLib/x86/IntraX86.h @@ -305,6 +305,69 @@ int calcTemplateDiffSIMD( Pel* ref, unsigned int uiStride, Pel** tarPatch, unsig return diffSum; } +#endif + +#if ENABLE_DIMD && INTRA_TRANS_ENC_OPT +template< X86_VEXT vext > +void dimdBlendingSIMD( Pel *pDst, int strideDst, Pel *pSrc0, int strideSrc0, Pel *pSrc1, int strideSrc1, int w0, int w1, int w2, int width, int height ) +{ + CHECK( (width % 4) != 0, "width should be multiple of 4" ); + __m128i vw0 = _mm_set1_epi32( w0 ); + __m128i vw1 = _mm_set1_epi32( w1 ); + __m128i vw2 = _mm_set1_epi32( w2 ); + const int shift = 6; + + for( int i = 0; i < height; i++ ) + { + for( int j = 0; j < width; j += 4 ) + { + __m128i vdst = _mm_cvtepi16_epi32( _mm_loadl_epi64( (__m128i*)(pDst + j) ) ); + __m128i vsrc0 = _mm_cvtepi16_epi32( _mm_loadl_epi64( (__m128i*)(pSrc0 + j) ) ); + __m128i vsrc1 = _mm_cvtepi16_epi32( _mm_loadl_epi64( (__m128i*)(pSrc1 + j) ) ); + + vdst = _mm_mullo_epi32( vdst, vw0 ); + vdst = _mm_add_epi32( vdst, _mm_mullo_epi32( vsrc0, vw1 ) ); + vdst = _mm_add_epi32( vdst, _mm_mullo_epi32( vsrc1, vw2 ) ); + + vdst = _mm_srai_epi32( vdst, shift ); + vdst = _mm_packs_epi32( vdst, vdst ); + _mm_storel_epi64( (__m128i*)(pDst + j), vdst ); + } + pDst += strideDst; + pSrc0 += strideSrc0; + pSrc1 += strideSrc1; + } +} +#endif + +#if JVET_W0123_TIMD_FUSION && INTRA_TRANS_ENC_OPT +template< X86_VEXT vext > +void timdBlendingSIMD( Pel *pDst, int strideDst, Pel *pSrc, int strideSrc, int w0, int w1, int width, int height ) +{ + CHECK( (width % 4) != 0, "width should be multiple of 4" ); + __m128i vw0 = _mm_set1_epi32( w0 ); + __m128i vw1 = _mm_set1_epi32( w1 ); + const int shift = 6; + + for( int i = 0; i < height; i++ ) + { + for( int j = 0; j < width; j += 4 ) + { + __m128i vdst = _mm_cvtepi16_epi32( _mm_loadl_epi64( (__m128i*)(pDst + j) ) ); + __m128i vsrc = _mm_cvtepi16_epi32( _mm_loadl_epi64( (__m128i*)(pSrc + j) ) ); + + vdst = _mm_mullo_epi32( vdst, vw0 ); + vdst = _mm_add_epi32( vdst, _mm_mullo_epi32( vsrc, vw1 ) ); + + vdst = _mm_srai_epi32( vdst, shift ); + vdst = _mm_packs_epi32( vdst, vdst ); + _mm_storel_epi64( (__m128i*)(pDst + j), vdst ); + } + pDst += strideDst; + pSrc += strideSrc; + } +} +#endif template <X86_VEXT vext> void IntraPrediction::_initIntraX86() @@ -312,10 +375,15 @@ void IntraPrediction::_initIntraX86() #if ENABLE_SIMD_TMP m_calcTemplateDiff = calcTemplateDiffSIMD<vext>; #endif +#if ENABLE_DIMD && INTRA_TRANS_ENC_OPT + m_dimdBlending = dimdBlendingSIMD<vext>; +#endif +#if JVET_W0123_TIMD_FUSION && INTRA_TRANS_ENC_OPT + m_timdBlending = timdBlendingSIMD<vext>; +#endif } template void IntraPrediction::_initIntraX86<SIMDX86>(); -#endif #endif //#ifdef TARGET_SIMD_X86 //! \} diff --git a/source/Lib/CommonLib/x86/RdCostX86.h b/source/Lib/CommonLib/x86/RdCostX86.h index 2d42c74c0de080eb7ddd43569204c46827ebf69e..7dd4aae78198e0764c5f161d2a4990b045bb2ca6 100644 --- a/source/Lib/CommonLib/x86/RdCostX86.h +++ b/source/Lib/CommonLib/x86/RdCostX86.h @@ -2864,28 +2864,28 @@ Distortion RdCost::xGetMRSAD_SIMD(const DistParam &rcDtParam) #endif #if TM_AMVP || TM_MRG -template < X86_VEXT vext, int tplSize, bool TrueA_FalseL, bool MR > +template < X86_VEXT vext, int tplSize, bool trueAfalseL, bool mr > Distortion RdCost::xGetTMErrorFull_SIMD(const DistParam& rcDtParam) { if ( rcDtParam.org.width < 4 - || ( TrueA_FalseL && (rcDtParam.org.width & 15) ) // (Above template) multiple of 16 + || ( trueAfalseL && (rcDtParam.org.width & 15) ) // (Above template) multiple of 16 || rcDtParam.bitDepth > 10 || rcDtParam.applyWeight ) { - return RdCost::xGetTMErrorFull<tplSize, TrueA_FalseL, MR>(rcDtParam); + return RdCost::xGetTMErrorFull<tplSize, trueAfalseL, mr>(rcDtParam); } const CPelBuf& curTplBuf = rcDtParam.org; const CPelBuf& refTplBuf = rcDtParam.cur; // get delta sum value - const int64_t deltaSum = !MR ? 0 : g_pelBufOP.getSumOfDifference(curTplBuf.buf, curTplBuf.stride, refTplBuf.buf, refTplBuf.stride, curTplBuf.width, curTplBuf.height, rcDtParam.subShift, rcDtParam.bitDepth); - if (MR && deltaSum == 0) + const int64_t deltaSum = !mr ? 0 : g_pelBufOP.getSumOfDifference(curTplBuf.buf, curTplBuf.stride, refTplBuf.buf, refTplBuf.stride, curTplBuf.width, curTplBuf.height, rcDtParam.subShift, rcDtParam.bitDepth); + if (mr && deltaSum == 0) { - return xGetTMErrorFull_SIMD<vext, tplSize, TrueA_FalseL, false>(rcDtParam); + return xGetTMErrorFull_SIMD<vext, tplSize, trueAfalseL, false>(rcDtParam); } - const int deltaMean = !MR ? 0 : int(deltaSum / (int64_t)curTplBuf.area()); + const int deltaMean = !mr ? 0 : int(deltaSum / (int64_t)curTplBuf.area()); // weight configuration const int* tplWeightD = TM_DISTANCE_WEIGHTS[rcDtParam.tmWeightIdx]; // uiWeight @@ -2902,7 +2902,7 @@ Distortion RdCost::xGetTMErrorFull_SIMD(const DistParam& rcDtParam) // compute matching cost Distortion partSum = 0; - if (TrueA_FalseL) + if (trueAfalseL) { const int subblkWidth = iCols >> 2; @@ -2910,7 +2910,7 @@ Distortion RdCost::xGetTMErrorFull_SIMD(const DistParam& rcDtParam) { __m128i vzero = _mm_setzero_si128(); __m128i vsum32 = vzero; - __m128i delta = MR ? _mm_set1_epi16(deltaMean) : vzero; + __m128i delta = mr ? _mm_set1_epi16(deltaMean) : vzero; for (uint32_t j = 0; j < iRows; j += iSubStep) { @@ -2925,7 +2925,7 @@ Distortion RdCost::xGetTMErrorFull_SIMD(const DistParam& rcDtParam) { __m128i cur = _mm_loadl_epi64((__m128i*)(piCur + i)); __m128i ref = _mm_loadl_epi64((__m128i*)(piRef + i)); - vsum16 = MR ? _mm_abs_epi16(_mm_sub_epi16(_mm_sub_epi16(cur, ref), delta)) : _mm_abs_epi16(_mm_sub_epi16(cur, ref)); + vsum16 = mr ? _mm_abs_epi16(_mm_sub_epi16(_mm_sub_epi16(cur, ref), delta)) : _mm_abs_epi16(_mm_sub_epi16(cur, ref)); } vsum32subblk = _mm_add_epi32(vsum32subblk, _mm_unpacklo_epi16(vsum16, vzero)); @@ -2949,7 +2949,7 @@ Distortion RdCost::xGetTMErrorFull_SIMD(const DistParam& rcDtParam) { __m256i vzero = _mm256_setzero_si256(); __m256i vsum32 = vzero; - __m256i delta = MR ? _mm256_set1_epi16(deltaMean) : vzero; + __m256i delta = mr ? _mm256_set1_epi16(deltaMean) : vzero; for (uint32_t j = 0; j < iRows; j += iSubStep) { @@ -2964,7 +2964,7 @@ Distortion RdCost::xGetTMErrorFull_SIMD(const DistParam& rcDtParam) { __m256i cur = _mm256_lddqu_si256((__m256i*)(piCur + i)); __m256i ref = _mm256_lddqu_si256((__m256i*)(piRef + i)); - vsum16 = MR ? _mm256_abs_epi16(_mm256_sub_epi16(_mm256_sub_epi16(cur, ref), delta)) : _mm256_abs_epi16(_mm256_sub_epi16(cur, ref)); + vsum16 = mr ? _mm256_abs_epi16(_mm256_sub_epi16(_mm256_sub_epi16(cur, ref), delta)) : _mm256_abs_epi16(_mm256_sub_epi16(cur, ref)); } __m256i vsumtemp = _mm256_add_epi32(_mm256_unpacklo_epi16(vsum16, vzero), _mm256_unpackhi_epi16(vsum16, vzero)); @@ -2989,7 +2989,7 @@ Distortion RdCost::xGetTMErrorFull_SIMD(const DistParam& rcDtParam) { __m128i vzero = _mm_setzero_si128(); __m128i vsum32 = vzero; - __m128i delta = MR ? _mm_set1_epi16(deltaMean) : vzero; + __m128i delta = mr ? _mm_set1_epi16(deltaMean) : vzero; for (uint32_t j = 0; j < iRows; j += iSubStep) { @@ -3004,7 +3004,7 @@ Distortion RdCost::xGetTMErrorFull_SIMD(const DistParam& rcDtParam) { __m128i cur = _mm_lddqu_si128((__m128i*)(piCur + i)); __m128i ref = _mm_lddqu_si128((__m128i*)(piRef + i)); - vsum16 = MR ? _mm_abs_epi16(_mm_sub_epi16(_mm_sub_epi16(cur, ref), delta)) : _mm_abs_epi16(_mm_sub_epi16(cur, ref)); + vsum16 = mr ? _mm_abs_epi16(_mm_sub_epi16(_mm_sub_epi16(cur, ref), delta)) : _mm_abs_epi16(_mm_sub_epi16(cur, ref)); } __m128i vsumtemp = _mm_add_epi32(_mm_unpacklo_epi16(vsum16, vzero), _mm_unpackhi_epi16(vsum16, vzero)); @@ -3029,7 +3029,7 @@ Distortion RdCost::xGetTMErrorFull_SIMD(const DistParam& rcDtParam) { __m128i vzero = _mm_setzero_si128(); __m128i vsum32 = vzero; - __m128i delta = MR ? _mm_set1_epi16(deltaMean) : vzero; + __m128i delta = mr ? _mm_set1_epi16(deltaMean) : vzero; for (uint32_t m = 0, n = 0; m < iRows; m += (iRows >> 2), n++) { @@ -3041,7 +3041,7 @@ Distortion RdCost::xGetTMErrorFull_SIMD(const DistParam& rcDtParam) { __m128i cur = _mm_loadl_epi64((__m128i*)piCur); __m128i ref = _mm_loadl_epi64((__m128i*)piRef); - __m128i abs = MR ? _mm_abs_epi16(_mm_sub_epi16(_mm_sub_epi16(cur, ref), delta)) : _mm_abs_epi16(_mm_sub_epi16(cur, ref)); + __m128i abs = mr ? _mm_abs_epi16(_mm_sub_epi16(_mm_sub_epi16(cur, ref), delta)) : _mm_abs_epi16(_mm_sub_epi16(cur, ref)); vsum16 = _mm_adds_epu16(abs, vsum16); } diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index 844dbbcfae6f15be1b855c8c56d80670bbccac7e..f4288b04b7c3bcd92b62f78fc865af4692fbeee4 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -2425,8 +2425,10 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) #if JVET_Z0118_GDR if (cu.cs->slice->getSPS()->getGDREnabledFlag()) { - if (cu.cs->isClean(cu)) - CHECK(!m_pcInterPred->isLumaBvValid(lcuWidth, cuPelX, cuPelY, roiWidth, roiHeight, xPred, yPred), "invalid block vector for IBC detected."); + if( cu.cs->isClean( cu ) ) + { + CHECK( !m_pcInterPred->isLumaBvValid( lcuWidth, cuPelX, cuPelY, roiWidth, roiHeight, xPred, yPred ), "invalid block vector for IBC detected." ); + } } else { diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index c1c726dd4e2861ebc496df7d562bf7cf3f5388ce..157df26e1967c7092a688ba8c8ff00829bc7b14b 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -3120,7 +3120,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } } } -#endif // GDR_LEAK_TEST +#endif #if JVET_Z0118_GDR m_pcPic->initCleanCurPicture(); diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index 5907289aad0c1017aa3c99e618b1605a9bac010f..a244fb5014303f68da7fc9a8301290050bbf664a 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -217,7 +217,7 @@ public: #if GDR_LEAK_TEST public: int m_gdrPocRandomAccess; -#endif // GDR_LEAK_TEST +#endif public: DecLib(); diff --git a/source/Lib/DecoderLib/DecSlice.cpp b/source/Lib/DecoderLib/DecSlice.cpp index 6846ec79f3e3867931764fdbd839335ab2691949..21384d7cd3ce1685de823dce95d21f6153926d82 100644 --- a/source/Lib/DecoderLib/DecSlice.cpp +++ b/source/Lib/DecoderLib/DecSlice.cpp @@ -309,7 +309,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb #else cs.motionLut.lut.resize(0); cs.motionLut.lutIbc.resize(0); -#endif // JVET_Z0118_GDR +#endif #if JVET_Z0139_HIST_AFF for (int i = 0; i < 2 * MAX_NUM_AFFHMVP_ENTRIES_ONELIST; i++) @@ -319,14 +319,14 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb cs.motionLut.lutAff1[i].resize(0); #else cs.motionLut.lutAff[i].resize(0); -#endif // JVET_Z0118_GDR +#endif } #if JVET_Z0118_GDR cs.motionLut.lutAffInherit0.resize(0); cs.motionLut.lutAffInherit1.resize(0); #else cs.motionLut.lutAffInherit.resize(0); -#endif // JVET_Z0118_GDR +#endif #endif #if !JVET_Z0153_IBC_EXT_REF cs.resetIBCBuffer = true; diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index a40be7f1b4b51007297b35b5dc5835345d407065..f9f8bab25f44237e6041b8668920eac827fd2955 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -2244,7 +2244,7 @@ bool EncCu::xCheckRDCostIntra(CodingStructure *&tempCS, CodingStructure *&bestCS } #endif #if ENABLE_DIMD - bool dimd_is_blend = false; + bool dimdBlending = false; int dimdMode = 0; int dimdBlendMode[2] = { 0 }; int dimdRelWeight[3] = { 0 }; @@ -2266,7 +2266,7 @@ bool EncCu::xCheckRDCostIntra(CodingStructure *&tempCS, CodingStructure *&bestCS IntraPrediction::deriveDimdMode(bestCS->picture->getRecoBuf(area), area, cu); dimdDerived = true; - dimd_is_blend = cu.dimd_is_blend; + dimdBlending = cu.dimdBlending; dimdMode = cu.dimdMode; dimdBlendMode[0] = cu.dimdBlendMode[0]; dimdBlendMode[1] = cu.dimdBlendMode[1]; @@ -2342,7 +2342,7 @@ bool EncCu::xCheckRDCostIntra(CodingStructure *&tempCS, CodingStructure *&bestCS cu.dimd = false; if( dimdDerived ) { - cu.dimd_is_blend = dimd_is_blend; + cu.dimdBlending = dimdBlending; cu.dimdMode = dimdMode; cu.dimdBlendMode[0] = dimdBlendMode[0]; cu.dimdBlendMode[1] = dimdBlendMode[1]; @@ -10662,8 +10662,8 @@ void EncCu::xCalDebCost( CodingStructure &cs, Partitioner &partitioner, bool cal CompArea &compArea = currTU.block(COMPONENT_Y); PelBuf recBuf = picDbBuf.getBuf(compArea); PelBuf recIPredBuf = recBuf; - std::vector<Pel> my_invLUT; - m_bilateralFilter->bilateralFilterRDOdiamond5x5(recBuf, recBuf, recBuf, currTU.cu->qp, recIPredBuf, cs.slice->clpRng(COMPONENT_Y), currTU, true, false, my_invLUT); + std::vector<Pel> invLUT; + m_bilateralFilter->bilateralFilterRDOdiamond5x5(recBuf, recBuf, recBuf, currTU.cu->qp, recIPredBuf, cs.slice->clpRng(COMPONENT_Y), currTU, true, false, invLUT); } } } @@ -11335,8 +11335,8 @@ void EncCu::xReuseCachedResult( CodingStructure *&tempCS, CodingStructure *&best } else { - std::vector<Pel> dummy_invLUT; - m_bilateralFilter->bilateralFilterRDOdiamond5x5(tmpSubBuf, tmpSubBuf, tmpSubBuf, currTU.cu->qp, recIPredBuf, tempCS->slice->clpRng(compID), currTU, true, false, dummy_invLUT); + std::vector<Pel> invLUT; + m_bilateralFilter->bilateralFilterRDOdiamond5x5(tmpSubBuf, tmpSubBuf, tmpSubBuf, currTU.cu->qp, recIPredBuf, tempCS->slice->clpRng(compID), currTU, true, false, invLUT); } } } diff --git a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp index 3283f33e58950ab8e70a21e3d26f924135e2d6b9..f3116ddd11ee5a8d0325aac57806ac77933d4249 100644 --- a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp +++ b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp @@ -3572,8 +3572,8 @@ int calcDiffRangeEnc(Pel a, Pel b, int th) int EncSampleAdaptiveOffset::calcEdgeStatIndex(const int ctuRsAddr, const int mode, const int type, const int th) { int index = 0; - index = (ctuRsAddr * ((CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C) * CCSAO_EDGE_TYPE * CCSAO_QUAN_NUM)) - + (mode * (CCSAO_EDGE_TYPE * CCSAO_QUAN_NUM)) + (type * CCSAO_QUAN_NUM) + th; + index = ctuRsAddr * (CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C) * CCSAO_EDGE_TYPE * CCSAO_QUAN_NUM + + mode * CCSAO_EDGE_TYPE * CCSAO_QUAN_NUM + type * CCSAO_QUAN_NUM + th; return index; } @@ -3635,8 +3635,8 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -3649,20 +3649,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colU * band_num) >> bitDepth; + band = (*colU * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colV * (band_num - 2)) >> bitDepth; + band = (*colV * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -3704,8 +3704,8 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -3718,20 +3718,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colU * band_num) >> bitDepth; + band = (*colU * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colV * (band_num - 2)) >> bitDepth; + band = (*colV * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -3766,8 +3766,8 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -3780,20 +3780,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colU * band_num) >> bitDepth; + band = (*colU * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colV * (band_num - 2)) >> bitDepth; + band = (*colV * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -3822,8 +3822,8 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -3836,20 +3836,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colU * band_num) >> bitDepth; + band = (*colU * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colV * (band_num - 2)) >> bitDepth; + band = (*colV * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -3885,8 +3885,8 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -3899,20 +3899,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colU * band_num) >> bitDepth; + band = (*colU * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colV * (band_num - 2)) >> bitDepth; + band = (*colV * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -3940,8 +3940,8 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( continue; } const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -3954,20 +3954,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colU * band_num) >> bitDepth; + band = (*colU * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colV * (band_num - 2)) >> bitDepth; + band = (*colV * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -4025,10 +4025,10 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( const Pel *colA = srcY + (x << chromaScaleX) + srcStrideY * candPosYYA + candPosYXA; const Pel *colB = srcY + (x << chromaScaleX) + srcStrideY * candPosYYB + candPosYXB; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remainig third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remainig third component for bandIdx calc.*/ signa = 0; signb = 0; @@ -4040,20 +4040,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( signa = signa * 4 + signb; for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colC * band_num) >> bitDepth; + band = (*colC * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colCT * (band_num - 2)) >> bitDepth; + band = (*colCT * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -4098,10 +4098,10 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( const Pel *colA = srcY + (x << chromaScaleX) + srcStrideY * candPosYYA + candPosYXA; const Pel *colB = srcY + (x << chromaScaleX) + srcStrideY * candPosYYB + candPosYXB; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remainig third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remainig third component for bandIdx calc.*/ signa = 0; signb = 0; @@ -4112,20 +4112,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( signa = signa * 4 + signb; for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colC * band_num) >> bitDepth; + band = (*colC * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colCT * (band_num - 2)) >> bitDepth; + band = (*colCT * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -4163,10 +4163,10 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( const Pel *colA = srcY + (x << chromaScaleX) + srcStrideY * candPosYYA + candPosYXA; const Pel *colB = srcY + (x << chromaScaleX) + srcStrideY * candPosYYB + candPosYXB; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remainig third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remainig third component for bandIdx calc.*/ signa = 0; signb = 0; @@ -4177,20 +4177,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( signa = signa * 4 + signb; for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colC * band_num) >> bitDepth; + band = (*colC * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colCT * (band_num - 2)) >> bitDepth; + band = (*colCT * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -4222,10 +4222,10 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( const Pel *colA = srcY + (x << chromaScaleX) + srcStrideY * candPosYYA + candPosYXA; const Pel *colB = srcY + (x << chromaScaleX) + srcStrideY * candPosYYB + candPosYXB; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remainig third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remainig third component for bandIdx calc.*/ signa = 0; signb = 0; @@ -4236,20 +4236,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( signa = signa * 4 + signb; for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colC * band_num) >> bitDepth; + band = (*colC * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colCT * (band_num - 2)) >> bitDepth; + band = (*colCT * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -4288,10 +4288,10 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( const Pel *colA = srcY + (x << chromaScaleX) + srcStrideY * candPosYYA + candPosYXA; const Pel *colB = srcY + (x << chromaScaleX) + srcStrideY * candPosYYB + candPosYXB; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remainig third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remainig third component for bandIdx calc.*/ signa = 0; signb = 0; @@ -4302,20 +4302,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( signa = signa * 4 + signb; for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colC * band_num) >> bitDepth; + band = (*colC * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colCT * (band_num - 2)) >> bitDepth; + band = (*colCT * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -4346,10 +4346,10 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( const Pel *colA = srcY + (x << chromaScaleX) + srcStrideY * candPosYYA + candPosYXA; const Pel *colB = srcY + (x << chromaScaleX) + srcStrideY * candPosYYB + candPosYXB; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remainig third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remainig third component for bandIdx calc.*/ signa = 0; signb = 0; @@ -4360,20 +4360,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( signa = signa * 4 + signb; for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colC * band_num) >> bitDepth; + band = (*colC * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colCT * (band_num - 2)) >> bitDepth; + band = (*colCT * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -4421,8 +4421,8 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( int candPosYYB = g_ccSaoEdgeTypeY[type][1]; const Pel *colY = srcY + x; - const Pel *colA = srcY + (x) + srcStrideY * candPosYYA + candPosYXA; - const Pel *colB = srcY + (x) + srcStrideY * candPosYYB + candPosYXB; + const Pel *colA = srcY + x + srcStrideY * candPosYYA + candPosYXA; + const Pel *colB = srcY + x + srcStrideY * candPosYYB + candPosYXB; const Pel *colU = srcU + (x >> chromaScaleX); const Pel *colV = srcV + (x >> chromaScaleX); @@ -4435,20 +4435,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colU * band_num) >> bitDepth; + band = (*colU * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colV * (band_num - 2)) >> bitDepth; + band = (*colV * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } @@ -4488,10 +4488,10 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( const Pel *colA = srcY + (x << chromaScaleX) + srcStrideY * candPosYYA + candPosYXA; const Pel *colB = srcY + (x << chromaScaleX) + srcStrideY * candPosYYB + candPosYXB; - const Pel *colC = (compID == COMPONENT_Cb) ? srcU + (x) : srcV + (x); + const Pel *colC = (compID == COMPONENT_Cb) ? srcU + x : srcV + x; const Pel *colCT = (compID == COMPONENT_Cb) - ? srcV + (x) - : srcU + (x); /* also use the remainig third component for bandIdx calc.*/ + ? srcV + x + : srcU + x; /* also use the remainig third component for bandIdx calc.*/ signa = 0; signb = 0; @@ -4502,20 +4502,20 @@ void EncSampleAdaptiveOffset::getCcSaoBlkStatsEdgeNew( signa = signa * 4 + signb; for (int modeY = 0; modeY < CCSAO_EDGE_BAND_NUM_Y + CCSAO_EDGE_BAND_NUM_C; modeY++) { - int band_num = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; + int bandNum = (modeY <= 3) ? modeY + 1 : modeY - 4 + 1; if (modeY <= 3) { - band = (*colY * band_num) >> bitDepth; + band = (*colY * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else if (modeY > 3 && modeY <= 5) { - band = (*colC * band_num) >> bitDepth; + band = (*colC * bandNum) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } else { - band = (*colCT * (band_num - 2)) >> bitDepth; + band = (*colCT * (bandNum - 2)) >> bitDepth; band = band * CCSAO_EDGE_NUM + signa; } diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index c749dd52fbb50ea8962c13efbecafd7f7c36798c..48e5c242f7914aea0dc5e56f546bc6b8db1320ec 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -9097,8 +9097,8 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par const CPelBuf predBuf = csFull->getPredBuf(compArea); PelBuf recIPredBuf = csFull->slice->getPic()->getRecoBuf(compArea); - std::vector<Pel> my_invLUT; - m_bilateralFilter->bilateralFilterRDOdiamond5x5(tmpRecLuma, predBuf, tmpRecLuma, tu.cu->qp, recIPredBuf, cs.slice->clpRng(compID), tu, false, false, my_invLUT); + std::vector<Pel> invLUT; + m_bilateralFilter->bilateralFilterRDOdiamond5x5(tmpRecLuma, predBuf, tmpRecLuma, tu.cu->qp, recIPredBuf, cs.slice->clpRng(compID), tu, false, false, invLUT); currCompDist = m_pcRdCost->getDistPart(orgResiBuf, tmpRecLuma, channelBitDepth, compID, DF_SSE); } @@ -9547,7 +9547,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par bool lmcsEnable = cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && isLuma( comp ) && !tu.cu->firstPU->ciipFlag && !CU::isIBC( *tu.cu ); #endif cs.reconstructPicture(tu.blocks[comp], m_pcReshape->getFwdLUT(), csFull, lmcsEnable); -#else // JVET_Z0118_GDR +#else PelBuf picRecoBuff = tu.cs->picture->getRecoBuf( tu.blocks[comp] ); #if JVET_Y0065_GPM_INTRA @@ -9563,7 +9563,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { picRecoBuff.reconstruct( cs.getPredBuf( tu.blocks[comp] ), csFull->getResiBuf( tu.blocks[comp] ), tu.cu->cs->slice->clpRng( comp ) ); } -#endif // JVET_Z0118_GDR +#endif } if ( sps.getNumPredSigns() > 0) @@ -10208,8 +10208,8 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa } else { - std::vector<Pel> dummy_invLUT; - m_bilateralFilter->bilateralFilterRDOdiamond5x5(tmpSubBuf, tmpSubBuf, tmpSubBuf, currTU.cu->qp, recIPredBuf, cs.slice->clpRng(compID), currTU, true, false, dummy_invLUT); + std::vector<Pel> invLUT; + m_bilateralFilter->bilateralFilterRDOdiamond5x5(tmpSubBuf, tmpSubBuf, tmpSubBuf, currTU.cu->qp, recIPredBuf, cs.slice->clpRng(compID), currTU, true, false, invLUT); } } } diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 92e7413dcaab44c2ecd4a6d303d8e1b47793d5a6..e4bcd52c9fec239836b7696b0a4c125c52322085 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -1445,7 +1445,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c uiOrgMode = uiRdModeList[mode]; } #if ENABLE_DIMD && INTRA_TRANS_ENC_OPT - if ((m_pcEncCfg->getIntraPeriod() == 1) && cu.slice->getSPS()->getUseDimd() && mode >= 0 && !cu.dimd_is_blend && uiOrgMode.ispMod == 0 && uiOrgMode.mRefId == 0 && uiOrgMode.modeId != TIMD_IDX && uiOrgMode.modeId != DIMD_IDX) + if ((m_pcEncCfg->getIntraPeriod() == 1) && cu.slice->getSPS()->getUseDimd() && mode >= 0 && !cu.dimdBlending && uiOrgMode.ispMod == 0 && uiOrgMode.mRefId == 0 && uiOrgMode.modeId != TIMD_IDX && uiOrgMode.modeId != DIMD_IDX) { bool modeDuplicated = (uiOrgMode.modeId == cu.dimdMode); if (modeDuplicated) @@ -4610,8 +4610,8 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp } else { - std::vector<Pel> dummy_invLUT; - m_bilateralFilter->bilateralFilterRDOdiamond5x5(tmpRecLuma, tmpRecLuma, tmpRecLuma, tu.cu->qp, recIPredBuf, cs.slice->clpRng(compID), tu, true, false, dummy_invLUT); + std::vector<Pel> invLUT; + m_bilateralFilter->bilateralFilterRDOdiamond5x5(tmpRecLuma, tmpRecLuma, tmpRecLuma, tu.cu->qp, recIPredBuf, cs.slice->clpRng(compID), tu, true, false, invLUT); } } @@ -4657,8 +4657,8 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp { CompArea compArea = tu.blocks[compID]; PelBuf recIPredBuf = cs.slice->getPic()->getRecoBuf(compArea); - std::vector<Pel> my_invLUT; - m_bilateralFilter->bilateralFilterRDOdiamond5x5(tmpRecLuma, tmpRecLuma, tmpRecLuma, tu.cu->qp, recIPredBuf, cs.slice->clpRng(compID), tu, true, false, my_invLUT); + std::vector<Pel> invLUT; + m_bilateralFilter->bilateralFilterRDOdiamond5x5(tmpRecLuma, tmpRecLuma, tmpRecLuma, tu.cu->qp, recIPredBuf, cs.slice->clpRng(compID), tu, true, false, invLUT); } ruiDist += m_pcRdCost->getDistPart( piOrg, tmpRecLuma, bitDepth, compID, DF_SSE );