diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 04d6c935020b82afac1cdba4634135e6cdd7e3c3..fcee2e20483777433e3905c95dbeccca2352e1ee 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -2583,7 +2583,11 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( 0 < m_maxNumGeoCand && m_maxNumGeoCand < 2, "MaxNumGeoCand must be no less than 2 unless MaxNumGeoCand is 0." ); xConfirmPara( m_maxNumIBCMergeCand < 1, "MaxNumIBCMergeCand must be 1 or greater." ); xConfirmPara( m_maxNumIBCMergeCand > IBC_MRG_MAX_NUM_CANDS, "MaxNumIBCMergeCand must be no more than IBC_MRG_MAX_NUM_CANDS." ); +#if JVET_R0371_MAX_NUM_SUB_BLK_MRG_CAND + xConfirmPara( m_maxNumAffineMergeCand < (m_SubPuMvpMode ? 1 : 0), "MaxNumAffineMergeCand must be greater or equal to SubPuMvp." ); +#else xConfirmPara( m_maxNumAffineMergeCand < 1, "MaxNumAffineMergeCand must be 1 or greater." ); +#endif xConfirmPara( m_maxNumAffineMergeCand > AFFINE_MRG_MAX_NUM_CANDS, "MaxNumAffineMergeCand must be no more than AFFINE_MRG_MAX_NUM_CANDS." ); if ( m_Affine == 0 ) { diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 3fd12dd95b66b6073f3c737b3aa9bc6effbcbf01..fd000c8a194ef461eea437e405d56326914e014e 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -63,6 +63,7 @@ #define JVET_R0143_TSRCdisableLL 1 // JVET-R0143: disable TSRC for lossless coding +#define JVET_R0371_MAX_NUM_SUB_BLK_MRG_CAND 1 // JVET-R0371: set the range of max number of subblock based merge candidate to 0 to 5 – sps_sbtmvp_enabled_flag. #define JVET_R0233_CCALF_LINE_BUFFER_REDUCTION 1 // JVET-R0233 method 2: Line buffer reduction for CCALF diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 203157adbf138c5703363ca2070252eaa0954999..b056eb0a603ebb5a4549db50d1283ffe9281d4d4 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -1675,7 +1675,12 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) if ( pcSPS->getUseAffine() ) { READ_UVLC(uiCode, "five_minus_max_num_subblock_merge_cand"); +#if JVET_R0371_MAX_NUM_SUB_BLK_MRG_CAND + CHECK(uiCode > 5 - (pcSPS->getSBTMVPEnabledFlag() ? 1 : 0), "The value of five_minus_max_num_subblock_merge_cand shall be in the range of 0 to 5 – sps_sbtmvp_enabled_flag"); + CHECK(AFFINE_MRG_MAX_NUM_CANDS < uiCode, "The value of five_minus_max_num_subblock_merge_cand shall be in the range of 0 to 5 – sps_sbtmvp_enabled_flag"); +#else CHECK(AFFINE_MRG_MAX_NUM_CANDS < uiCode, "Incorrrect max number of affine merge candidates!"); +#endif pcSPS->setMaxNumAffineMergeCand(AFFINE_MRG_MAX_NUM_CANDS - uiCode); READ_FLAG( uiCode, "sps_affine_type_flag" ); pcSPS->setUseAffineType ( uiCode != 0 ); if( pcSPS->getAMVREnabledFlag()) diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 1a1e531c842baea93c9256686fdb1cec068dd00e..d54524587e1df9e7718f3e413658ffb7296bb9c2 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -3105,6 +3105,12 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct AffineMergeCtx affineMergeCtx; const SPS &sps = *tempCS->sps; +#if JVET_R0371_MAX_NUM_SUB_BLK_MRG_CAND + if (sps.getMaxNumAffineMergeCand() == 0) + { + return; + } +#endif setAFFBestSATDCost(MAX_DOUBLE);