diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 08a16df6f079cf408d3aa04319f9e06cfdcef552..54ee586a369118a775a8ec6f601573a7cb99a409 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -86,6 +86,8 @@ #define JVET_P0667_QP_OFFSET_TABLE_SIGNALING_JCCR 1 // JVET-P0667: removing signaling of qp offset table for JCCR, at SPS and PPS, when JCCR is disabled. +#define JVET_P1000_REMOVE_TRANFORMSHIFT_IN_TS_MODE 1 // JVET-P1000: Remove Transformshift in TS mode + #define JVET_P0517_ADAPTIVE_COLOR_TRANSFORM 1 // JVET-P0517: adaptive color transform #define JVET_P0090_32BIT_MVD 1 // JVET-P0090: Limitation of abs_mvd_min2 binarization within 32-bit diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index d7afc5520d3f876a50c68b9b42bbff5a77ed0cb2..91112ebbec8994b38791f36c2858106274e93574 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -1887,6 +1887,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC if ((!validCandRet || (cu.ispMode && cu.firstTU->cbf[COMPONENT_Y] == 0))) #else validCandRet = m_pcIntraSearch->estIntraPredLumaQT( cu, partitioner, bestCostSoFar, mtsFlag, startMTSIdx[ trGrpIdx ], endMTSIdx[ trGrpIdx ], ( trGrpIdx > 0 ) ); + if (sps.getUseLFNST() && (!validCandRet || (cu.ispMode && cu.firstTU->cbf[COMPONENT_Y] == 0))) #endif { continue; diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 2d4720b8235cfd46eb6296b61bdb9c0d3beb8a9e..b08e80085a2221ed88aff492f2c65bd920d8d876 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -1145,68 +1145,21 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, { continue; } -#endif -#if JVET_P0517_ADAPTIVE_COLOR_TRANSFORM + if (mode < 0 || (isSecondColorSpace && m_savedBDPCMModeFirstColorSpace[m_savedRdModeIdx][mode])) { cu.bdpcmMode = mode < 0 ? -mode : m_savedBDPCMModeFirstColorSpace[m_savedRdModeIdx][mode]; -#if JVET_P0803_COMBINED_MIP_CLEANUP - uiOrgMode = ModeInfo(false, false, 0, NOT_INTRA_SUBPARTITIONS, cu.bdpcmMode == 2 ? VER_IDX : HOR_IDX); -#else - uiOrgMode = ModeInfo(false, 0, NOT_INTRA_SUBPARTITIONS, cu.bdpcmMode == 2 ? VER_IDX : HOR_IDX); -#endif - } - else - { - cu.bdpcmMode = 0; - uiOrgMode = uiRdModeList[mode]; - } - if (!cu.bdpcmMode && uiRdModeList[mode].ispMod == INTRA_SUBPARTITIONS_RESERVED) - { - if (mode == numNonISPModes) // the list needs to be sorted only once - { -#if JVET_P1026_ISP_LFNST_COMBINATION - if (m_pcEncCfg->getUseFastISP()) - { - m_modeCtrl->setBestPredModeDCT2(uiBestPUMode.modeId); - } - if (!xSortISPCandList(bestCurrentCost, csBest->cost, uiBestPUMode)) - break; -#else - xSortISPCandList(bestCurrentCost, csBest->cost); -#endif - } - xGetNextISPMode(uiRdModeList[mode], (mode > 0 ? &uiRdModeList[mode - 1] : nullptr), Size(width, height)); - if (uiRdModeList[mode].ispMod == INTRA_SUBPARTITIONS_RESERVED) - continue; -#if JVET_P1026_ISP_LFNST_COMBINATION - cu.lfnstIdx = m_curIspLfnstIdx; -#endif - uiOrgMode = uiRdModeList[mode]; - } - cu.mipFlag = uiOrgMode.mipFlg; -#if JVET_P0803_COMBINED_MIP_CLEANUP - pu.mipTransposedFlag = uiOrgMode.mipTrFlg; -#endif - cu.ispMode = uiOrgMode.ispMod; - pu.multiRefIdx = uiOrgMode.mRefId; - pu.intraDir[CHANNEL_TYPE_LUMA] = uiOrgMode.modeId; - - CHECK(cu.mipFlag&& pu.multiRefIdx, "Error: combination of MIP and MRL not supported"); - CHECK(pu.multiRefIdx && (pu.intraDir[0] == PLANAR_IDX), "Error: combination of MRL and Planar mode not supported"); - CHECK(cu.ispMode&& cu.mipFlag, "Error: combination of ISP and MIP not supported"); - CHECK(cu.ispMode&& pu.multiRefIdx, "Error: combination of ISP and MRL not supported"); - CHECK(cu.ispMode&& cu.colorTransform, "Error: combination of ISP and ACT not supported"); #else if ( mode < 0 ) { cu.bdpcmMode = -mode; - +#endif #if JVET_P0803_COMBINED_MIP_CLEANUP uiOrgMode = ModeInfo( false, false, 0, NOT_INTRA_SUBPARTITIONS, cu.bdpcmMode == 2 ? VER_IDX : HOR_IDX ); #else uiOrgMode = ModeInfo(false, 0, NOT_INTRA_SUBPARTITIONS, cu.bdpcmMode == 2 ? VER_IDX : HOR_IDX); #endif +#if !JVET_P0517_ADAPTIVE_COLOR_TRANSFORM cu.mipFlag = uiOrgMode.mipFlg; #if JVET_P0803_COMBINED_MIP_CLEANUP pu.mipTransposedFlag = uiOrgMode.mipTrFlg; @@ -1214,18 +1167,25 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, cu.ispMode = uiOrgMode.ispMod; pu.multiRefIdx = uiOrgMode.mRefId; pu.intraDir[CHANNEL_TYPE_LUMA] = uiOrgMode.modeId; +#endif } else { cu.bdpcmMode = 0; +#if JVET_P0517_ADAPTIVE_COLOR_TRANSFORM + uiOrgMode = uiRdModeList[mode]; + } + if (!cu.bdpcmMode && uiRdModeList[mode].ispMod == INTRA_SUBPARTITIONS_RESERVED) +#else if (uiRdModeList[mode].ispMod == INTRA_SUBPARTITIONS_RESERVED) +#endif { if (mode == numNonISPModes) // the list needs to be sorted only once { #if JVET_P1026_ISP_LFNST_COMBINATION if (m_pcEncCfg->getUseFastISP()) { - m_modeCtrl->setBestPredModeDCT2( uiBestPUMode.modeId ); + m_modeCtrl->setBestPredModeDCT2(uiBestPUMode.modeId); } if (!xSortISPCandList(bestCurrentCost, csBest->cost, uiBestPUMode)) break; @@ -1239,8 +1199,13 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, #if JVET_P1026_ISP_LFNST_COMBINATION cu.lfnstIdx = m_curIspLfnstIdx; #endif +#if JVET_P0517_ADAPTIVE_COLOR_TRANSFORM + uiOrgMode = uiRdModeList[mode]; + } +#else } uiOrgMode = uiRdModeList[mode]; +#endif cu.mipFlag = uiOrgMode.mipFlg; #if JVET_P0803_COMBINED_MIP_CLEANUP pu.mipTransposedFlag = uiOrgMode.mipTrFlg; @@ -1253,10 +1218,12 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, CHECK(pu.multiRefIdx && (pu.intraDir[0] == PLANAR_IDX), "Error: combination of MRL and Planar mode not supported"); CHECK(cu.ispMode && cu.mipFlag, "Error: combination of ISP and MIP not supported"); CHECK(cu.ispMode && pu.multiRefIdx, "Error: combination of ISP and MRL not supported"); - } -#endif #if JVET_P0517_ADAPTIVE_COLOR_TRANSFORM + CHECK(cu.ispMode&& cu.colorTransform, "Error: combination of ISP and ACT not supported"); + pu.intraDir[CHANNEL_TYPE_CHROMA] = cu.colorTransform ? DM_CHROMA_IDX : pu.intraDir[CHANNEL_TYPE_CHROMA]; +#else + } #endif // set context models