diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 72bfaaefd57232f603bd6a37c09aa58b478df5d4..aad7a48614aeebe5730ad67e7201d689547a654d 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -148,6 +148,8 @@ #define JVET_O0280_SIMD_TRIANGLE_WEIGHTING 1 // JVET-O0280: SIMD implementation for weighted sample prediction process of triangle prediction mode +#define JVET_O0379_SPEEDUP_TPM_ENCODER 1 // JVET_O0379: Speedup mode decision process for triangle prediction mode + #define JVET_O0364_PDPC_DC 1 // JVET-O0364 Part 4: align PDPC process for DC with the one for Planar #define JVET_O0364_PDPC_ANGULAR 1 // JVET-O0364 Part 5: simplify PDPC process for angular modes diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 24c4afb773dae4e82a9ca411c0bea329fc603852..b16f155702f2f65ff5ed3ef95e7e7a877bec2885 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -2463,12 +2463,16 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru trianglecandHasNoResidual[mergeCand] = false; } +#if JVET_O0379_SPEEDUP_TPM_ENCODER + bool bestIsSkip = false; +#else bool bestIsSkip; CodingUnit* cuTemp = bestCS->getCU(partitioner.chType); if (cuTemp) bestIsSkip = m_pcEncCfg->getUseFastDecisionForMerge() ? bestCS->getCU(partitioner.chType)->rootCbf == 0 : false; else bestIsSkip = false; +#endif uint8_t numTriangleCandidate = TRIANGLE_MAX_NUM_CANDS; uint8_t triangleNumMrgSATDCand = TRIANGLE_MAX_NUM_SATD_CANDS; PelUnitBuf triangleBuffer[TRIANGLE_MAX_NUM_UNI_CANDS]; @@ -2477,10 +2481,12 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru static_vector<double, TRIANGLE_MAX_NUM_CANDS> tianglecandCostList; uint8_t numTriangleCandComb = slice.getMaxNumTriangleCand() * (slice.getMaxNumTriangleCand() - 1) * 2; +#if !JVET_O0379_SPEEDUP_TPM_ENCODER if( auto blkCache = dynamic_cast< CacheBlkInfoCtrl* >( m_modeCtrl ) ) { bestIsSkip |= blkCache->isSkip( tempCS->area ); } +#endif DistParam distParam; const bool useHadamard = !encTestMode.lossless && !tempCS->slice->getDisableSATDForRD(); @@ -2524,6 +2530,9 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru } } +#if JVET_O0379_SPEEDUP_TPM_ENCODER + triangleNumMrgSATDCand = min(triangleNumMrgSATDCand, numTriangleCandComb); +#else bool tempBufSet = bestIsSkip ? false : true; triangleNumMrgSATDCand = bestIsSkip ? TRIANGLE_MAX_NUM_CANDS : TRIANGLE_MAX_NUM_SATD_CANDS; triangleNumMrgSATDCand = min(triangleNumMrgSATDCand, numTriangleCandComb); @@ -2535,6 +2544,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru } } else +#endif { CodingUnit &cu = tempCS->addCU( tempCS->area, partitioner.chType ); @@ -2678,6 +2688,9 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru tempCS->initStructData( encTestMode.qp, encTestMode.lossless ); return; } +#if JVET_O0379_SPEEDUP_TPM_ENCODER + tempCS->getPredBuf().copyFrom( triangleWeightedBuffer[mergeCand] ); +#else if( tempBufSet ) { tempCS->getPredBuf().copyFrom( triangleWeightedBuffer[mergeCand] ); @@ -2689,7 +2702,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru PelUnitBuf predBuf = tempCS->getPredBuf(); m_pcInterSearch->weightedTriangleBlk( pu, splitDir, MAX_NUM_CHANNEL_TYPE, predBuf, triangleBuffer[candIdx0], triangleBuffer[candIdx1] ); } - +#endif xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, noResidualPass, ( noResidualPass == 0 ? &trianglecandHasNoResidual[mergeCand] : NULL ) ); if (m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip)