diff --git a/source/Lib/CommonLib/Reshape.cpp b/source/Lib/CommonLib/Reshape.cpp index 4d6ac24644cca6d38c6a471c10d8c092ebb6a3fb..06b777cae51aef1ea0b24c50afe58c94919179f9 100644 --- a/source/Lib/CommonLib/Reshape.cpp +++ b/source/Lib/CommonLib/Reshape.cpp @@ -95,8 +95,12 @@ void Reshape::destroy() */ int Reshape::calculateChromaAdj(Pel avgLuma) { +#if JVET_R0330_CRS_CLIP_REM + int iAdj = m_chromaAdjHelpLUT[getPWLIdxInv(avgLuma)]; +#else int lumaIdx = Clip3<int>(0, (1<<m_lumaBD) - 1, avgLuma); int iAdj = m_chromaAdjHelpLUT[getPWLIdxInv(lumaIdx)]; +#endif return(iAdj); } @@ -181,16 +185,28 @@ int Reshape::calculateChromaAdjVpduNei(TransformUnit &tu, const CompArea &areaY } if (pelnum == numNeighbor) { +#if JVET_R0330_CRS_CLIP_REM + lumaValue = (recLuma + (1 << (numNeighborLog - 1))) >> numNeighborLog; +#else lumaValue = ClipPel((recLuma + (1 << (numNeighborLog - 1))) >> numNeighborLog, tu.cs->slice->clpRng(COMPONENT_Y)); +#endif } else if (pelnum == (numNeighbor << 1)) { +#if JVET_R0330_CRS_CLIP_REM + lumaValue = (recLuma + (1 << numNeighborLog)) >> (numNeighborLog + 1); +#else lumaValue = ClipPel((recLuma + (1 << numNeighborLog)) >> (numNeighborLog + 1), tu.cs->slice->clpRng(COMPONENT_Y)); +#endif } else { CHECK(pelnum != 0, ""); +#if JVET_R0330_CRS_CLIP_REM + lumaValue = valueDC; +#else lumaValue = ClipPel(valueDC, tu.cs->slice->clpRng(COMPONENT_Y)); +#endif } chromaScale = calculateChromaAdj(lumaValue); setChromaScale(chromaScale); diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index f1fe53cbb5146eba6532c7c5278a51200182f4a3..45d8bcfe2fdfcc4cd98aff86b2e3943c92b5c140 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -51,6 +51,8 @@ #include <cassert> //########### place macros to be removed in next cycle below this line ############### +#define JVET_R0330_CRS_CLIP_REM 1 // JVET-R0330: Remove redundant clipping in chroma residual scaling factor derivation + #define JVET_R0059_RPL_CLEANUP 1 // JVET-R0059 aspect 2: Condition the signalling of ltrp_in_header_flag[ listIdx ][ rplsIdx ]. #define JVET_R0202_WHEN_PH_IN_SH_INFO_FLAGS_EQUAL_0 1 // JVET-R0202 When sh_picture_header_in_slice_header_flag is equal to 1, rpl_info_in_ph_flag, dbf_info_in_ph_flag, sao_info_in_ph_flag, wp_info_in_ph_flag, qp_delta_info_in_ph_flag shall be be equal to 0