From 5219afd366bc8e73300f41beb20096f068ff19d9 Mon Sep 17 00:00:00 2001 From: LuhangXu <xuluhang@oppo.com> Date: Mon, 8 May 2023 12:02:56 +0800 Subject: [PATCH] fix for searching minimal SAD cost when TMRL is off --- source/Lib/EncoderLib/IntraSearch.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 8dbae2204..e05bf6ef1 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -1307,8 +1307,13 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c // Use the min between SAD and SATD as the cost criterion // SAD is scaled by 2 to align with the scaling of HAD +#if JVET_AD0208_IBC_ADAPT_FOR_CAM_CAPTURED_CONTENTS + Distortion sadCost = distParamSad.distFunc(distParamSad); + Distortion minSadHad = std::min(sadCost * 2, distParamHad.distFunc(distParamHad)); +#else Distortion minSadHad = std::min(distParamSad.distFunc(distParamSad) * 2, distParamHad.distFunc(distParamHad)); +#endif // NB xFracModeBitsIntra will not affect the mode for chroma that may have already been pre-estimated. #if JVET_V0130_INTRA_TMP @@ -1335,6 +1340,9 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c uint64_t fracModeBits = xFracModeBitsIntra(pu, mode, CHANNEL_TYPE_LUMA); double cost = (double) minSadHad + (double) fracModeBits * sqrtLambdaForFirstPass; +#if JVET_AD0208_IBC_ADAPT_FOR_CAM_CAPTURED_CONTENTS + m_bestIntraSADCost = std::min(m_bestIntraSADCost, cost - (double)minSadHad + (double)sadCost); +#endif updateCandList(ModeInfo(false, false, multiRefIdx, NOT_INTRA_SUBPARTITIONS, mode), cost, uiRdModeList, CandCostList, numModesForFullRD); updateCandList(ModeInfo(false, false, multiRefIdx, NOT_INTRA_SUBPARTITIONS, mode), double(minSadHad), -- GitLab