diff --git a/doc/software-manual.tex b/doc/software-manual.tex index cc49354032b16d8cd732183549aa5fb07beeace8..f56c28e6091f04c13cdc4a8b187d8a0efe3b9a79 100755 --- a/doc/software-manual.tex +++ b/doc/software-manual.tex @@ -2117,10 +2117,22 @@ is satisfied, the stronger intra smoothing filter is applied. If disabled, the intra smoothing filter when applied is the 1:2:1 smoothing filter. \\ +\Option{TMVPMode} & +%\ShortOption{\None} & +\Default{1} & +Controls the temporal motion vector prediction mode. +\par +\begin{tabular}{cp{0.45\textwidth}} + 0 & Disabled for all slices. \\ + 1 & Enabled for all slices. \\ + 2 & Disabled only for the first picture of each GOPSize. \\ +\end{tabular} +\\ + \Option{PPSorSliceMode} & %\ShortOption{\None} & \Default{0} & -Enables signaling the below parameters either in PPS or per slice according to the following presets: +Enables signaling the below parameters either in PPS or for each slice according to the following preset modes: \par \begin{tabular}{cp{0.45\textwidth}} 0 & Always signaled per slice. \\ @@ -2130,17 +2142,18 @@ Enables signaling the below parameters either in PPS or per slice according to t \end{tabular} \par \begin{tabular}{p{5cm}llll} + & & & & \\ Parameter & \multicolumn{3}{l}{Mode} \\ & 0 & 1 & 2 & 3 \\ - dep_quant_enabled_flag & s & p & p & p \\ - ref_pic_list_sps_flag0 & s & s & p & p \\ - ref_pic_list_sps_flag1 & s & s & p & p \\ - temporal_mvp_enabled_flag & s & s & p & p \\ - mvd_l1_zero_flag & s & s & p & s \\ - collocated_from_l0_flag & s & s & p & s \\ - six_minus_max_num_merge_cand & s & p & p & p \\ - five_minus_max_num_subblock_merge_cand & s & p & p & p \\ - max_num_merge_cand_minus_max_num_triangle_cand & s & p & p & s \\ + dep_quant_enabled_flag & s & p(1) & p(1) & p(1) \\ + ref_pic_list_sps_flag0 & s & s & p(1) & p(1) \\ + ref_pic_list_sps_flag1 & s & s & p(1) & p(1) \\ + temporal_mvp_enabled_flag & s & s & p(1) & p(1) \\ + mvd_l1_zero_flag & s & s & p(1) & s \\ + collocated_from_l0_flag & s & s & p(0) & s \\ + six_minus_max_num_merge_cand & s & p(0) & p(0) & p(0) \\ + five_minus_max_num_subblock_merge_cand & s & p(0) & p(0) & p(0) \\ + max_num_merge_cand_minus_max_num_triangle_cand & s & p(1) & p(1) & s \\ \end{tabular} \\ diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index d55f2e82adac69878483aa3f1f987e20693338fb..f27dd7ac9d8648803dbf8d76220743e39ccd81cc 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -130,11 +130,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setNoPcmConstraintFlag ( !m_usePCM ); #endif m_cEncLib.setNoRefWraparoundConstraintFlag ( m_bNoRefWraparoundConstraintFlag ); -#if JVET_O0238_PPS_OR_SLICE - m_cEncLib.setNoTemporalMvpConstraintFlag ( m_PPSTemporalMVPEnabledIdc != 1 ? false : true ); -#else m_cEncLib.setNoTemporalMvpConstraintFlag ( m_TMVPModeId ? false : true ); -#endif m_cEncLib.setNoSbtmvpConstraintFlag ( m_SubPuMvpMode ? false : true ); m_cEncLib.setNoAmvrConstraintFlag ( m_bNoAmvrConstraintFlag ); m_cEncLib.setNoBdofConstraintFlag ( !m_BIO ); @@ -564,6 +560,7 @@ void EncApp::xInitLibCfg() } m_cEncLib.setLFCrossTileBoundaryFlag ( m_bLFCrossTileBoundaryFlag ); m_cEncLib.setEntropyCodingSyncEnabledFlag ( m_entropyCodingSyncEnabledFlag ); + m_cEncLib.setTMVPModeId ( m_TMVPModeId ); #if JVET_O0238_PPS_OR_SLICE m_cEncLib.setConstantSliceHeaderParamsEnabledFlag ( m_constantSliceHeaderParamsEnabledFlag ); m_cEncLib.setPPSDepQuantEnabledIdc ( m_PPSDepQuantEnabledIdc ); @@ -575,8 +572,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setPPSSixMinusMaxNumMergeCandPlus1 ( m_PPSSixMinusMaxNumMergeCandPlus1 ); m_cEncLib.setPPSFiveMinusMaxNumSubblockMergeCandPlus1 ( m_PPSFiveMinusMaxNumSubblockMergeCandPlus1 ); m_cEncLib.setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 ( m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 ); -#else - m_cEncLib.setTMVPModeId ( m_TMVPModeId ); #endif m_cEncLib.setUseScalingListId ( m_useScalingListId ); m_cEncLib.setScalingListFileName ( m_scalingListFileName ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index f81bdc910efb91763dd282acc8eca00db17bf423..531fe5cb76c51cfa406cf576fae21b4778b8ae7b 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1201,11 +1201,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) "\t2: CRC\n" "\t1: use MD5\n" "\t0: disable") + ("TMVPMode", m_TMVPModeId, 1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only") #if JVET_O0238_PPS_OR_SLICE ("PPSorSliceMode", m_PPSorSliceMode, 0, "Enable signalling certain parameters either in PPS or per slice\n" - "\tmode 0: Always per slice, 1: RA settings, 2: LDB settings, 3: LDP settings") -#else - ("TMVPMode", m_TMVPModeId, 1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only") + "\tmode 0: Always per slice (default), 1: RA settings, 2: LDB settings, 3: LDP settings") #endif ("FEN", tmpFastInterSearchMode, int(FASTINTERSEARCH_DISABLED), "fast encoder setting") ("ECU", m_bUseEarlyCU, false, "Early CU setting") @@ -3215,7 +3214,29 @@ bool EncAppCfg::xCheckParameter() } } -#if JVET_O0238_PPS_OR_SLICE + if ((m_MCTSEncConstraint) && (m_bLFCrossTileBoundaryFlag)) + { + printf("Warning: Constrained Encoding for Motion Constrained Tile Sets (MCTS) is enabled. Disabling filtering across tile boundaries!\n"); + m_bLFCrossTileBoundaryFlag = false; + } + if ((m_MCTSEncConstraint) && (m_TMVPModeId)) + { + printf("Warning: Constrained Encoding for Motion Constrained Tile Sets (MCTS) is enabled. Disabling TMVP!\n"); + m_TMVPModeId = 0; + } + + if ((m_MCTSEncConstraint) && ( m_alf )) + { + printf("Warning: Constrained Encoding for Motion Constrained Tile Sets (MCTS) is enabled. Disabling ALF!\n"); + m_alf = false; + } + if( ( m_MCTSEncConstraint ) && ( m_BIO ) ) + { + printf( "Warning: Constrained Encoding for Motion Constrained Tile Sets (MCTS) is enabled. Disabling BIO!\n" ); + m_BIO = false; + } + + #if JVET_O0238_PPS_OR_SLICE // If m_PPSorSliceFlag is equal to 1, for each PPS parameter below, // 0: value is signaled in slice header // >0: value is derived from PPS parameter as value - 1 @@ -3250,7 +3271,7 @@ bool EncAppCfg::xCheckParameter() m_PPSDepQuantEnabledIdc = 2; m_PPSRefPicListSPSIdc0 = 2; m_PPSRefPicListSPSIdc1 = 2; - m_PPSTemporalMVPEnabledIdc = 2; + m_PPSTemporalMVPEnabledIdc = m_TMVPModeId == 2 ? 0: ( int(m_TMVPModeId == 1 ? 1: 0) + 1); m_PPSMvdL1ZeroIdc = 2; m_PPSCollocatedFromL0Idc = 1; m_PPSSixMinusMaxNumMergeCandPlus1 = 1; @@ -3262,7 +3283,7 @@ bool EncAppCfg::xCheckParameter() m_PPSDepQuantEnabledIdc = 2; m_PPSRefPicListSPSIdc0 = 2; m_PPSRefPicListSPSIdc1 = 2; - m_PPSTemporalMVPEnabledIdc = 2; + m_PPSTemporalMVPEnabledIdc = m_TMVPModeId == 2 ? 0: ( int(m_TMVPModeId == 1 ? 1: 0) + 1); m_PPSMvdL1ZeroIdc = 0; m_PPSCollocatedFromL0Idc = 0; m_PPSSixMinusMaxNumMergeCandPlus1 = 1; @@ -3274,36 +3295,6 @@ bool EncAppCfg::xCheckParameter() } #endif - if ((m_MCTSEncConstraint) && (m_bLFCrossTileBoundaryFlag)) - { - printf("Warning: Constrained Encoding for Motion Constrained Tile Sets (MCTS) is enabled. Disabling filtering across tile boundaries!\n"); - m_bLFCrossTileBoundaryFlag = false; - } -#if JVET_O0238_PPS_OR_SLICE - if ((m_MCTSEncConstraint) && (m_PPSTemporalMVPEnabledIdc != 1)) -#else - if ((m_MCTSEncConstraint) && (m_TMVPModeId)) -#endif - { - printf("Warning: Constrained Encoding for Motion Constrained Tile Sets (MCTS) is enabled. Disabling TMVP!\n"); -#if JVET_O0238_PPS_OR_SLICE - m_PPSTemporalMVPEnabledIdc = 1; -#else - m_TMVPModeId = 0; -#endif - } - - if ((m_MCTSEncConstraint) && ( m_alf )) - { - printf("Warning: Constrained Encoding for Motion Constrained Tile Sets (MCTS) is enabled. Disabling ALF!\n"); - m_alf = false; - } - if( ( m_MCTSEncConstraint ) && ( m_BIO ) ) - { - printf( "Warning: Constrained Encoding for Motion Constrained Tile Sets (MCTS) is enabled. Disabling BIO!\n" ); - m_BIO = false; - } - if (m_toneMappingInfoSEIEnabled) { xConfirmPara( m_toneMapCodedDataBitDepth < 8 || m_toneMapCodedDataBitDepth > 14 , "SEIToneMapCodedDataBitDepth must be in rage 8 to 14"); @@ -3618,11 +3609,7 @@ void EncAppCfg::xPrintParameter() const int iWaveFrontSubstreams = m_entropyCodingSyncEnabledFlag ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; msg( VERBOSE, " WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_entropyCodingSyncEnabledFlag?1:0, iWaveFrontSubstreams); msg( VERBOSE, " ScalingList:%d ", m_useScalingListId ); -#if JVET_O0238_PPS_OR_SLICE - msg( VERBOSE, "TMVPMode:%d ", m_PPSTemporalMVPEnabledIdc != 1 ); -#else - msg( VERBOSE, "TMVPMode:%d ", m_TMVPModeId ); -#endif + msg( VERBOSE, "TMVPMode:%d ", m_TMVPModeId ); msg( VERBOSE, " DQ:%d ", m_depQuantEnabledFlag); msg( VERBOSE, " SignBitHidingFlag:%d ", m_signDataHidingEnabledFlag); msg( VERBOSE, "RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 554b7253854778426f9af9c380c7b15daf63bdaf..e3251be7873ea065a15b2913aab250a2a36d8bec 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -546,6 +546,7 @@ protected: uint32_t m_maxNumIBCMergeCand; ///< Max number of IBC merge candidates #endif + int m_TMVPModeId; #if JVET_O0238_PPS_OR_SLICE int m_PPSorSliceMode; bool m_constantSliceHeaderParamsEnabledFlag; @@ -558,8 +559,6 @@ protected: uint32_t m_PPSSixMinusMaxNumMergeCandPlus1; uint32_t m_PPSFiveMinusMaxNumSubblockMergeCandPlus1; uint32_t m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; -#else - int m_TMVPModeId; #endif bool m_depQuantEnabledFlag; bool m_signDataHidingEnabledFlag; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 4423276036a27f0ffcf2607ea249d46aa5bb7b93..a7ee826ec12c37e2ba204879bfc4b7e373e806f8 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -588,6 +588,7 @@ protected: #endif ScalingListMode m_useScalingListId; ///< Using quantization matrix i.e. 0=off, 1=default, 2=file. std::string m_scalingListFileName; ///< quantization matrix file name + int m_TMVPModeId; #if JVET_O0238_PPS_OR_SLICE bool m_constantSliceHeaderParamsEnabledFlag; int m_PPSDepQuantEnabledIdc; @@ -599,8 +600,6 @@ protected: uint32_t m_PPSSixMinusMaxNumMergeCandPlus1; uint32_t m_PPSFiveMinusMaxNumSubblockMergeCandPlus1; uint32_t m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; -#else - int m_TMVPModeId; #endif bool m_DepQuantEnabledFlag; bool m_SignDataHidingEnabledFlag; @@ -1516,6 +1515,8 @@ public: ScalingListMode getUseScalingListId () { return m_useScalingListId; } void setScalingListFileName ( const std::string &s ) { m_scalingListFileName = s; } const std::string& getScalingListFileName () const { return m_scalingListFileName; } + void setTMVPModeId ( int u ) { m_TMVPModeId = u; } + int getTMVPModeId () { return m_TMVPModeId; } #if JVET_O0238_PPS_OR_SLICE void setConstantSliceHeaderParamsEnabledFlag ( bool u ) { m_constantSliceHeaderParamsEnabledFlag = u; } bool getConstantSliceHeaderParamsEnabledFlag () { return m_constantSliceHeaderParamsEnabledFlag; } @@ -1537,9 +1538,6 @@ public: uint32_t getPPSFiveMinusMaxNumSubblockMergeCandPlus1 () { return m_PPSFiveMinusMaxNumSubblockMergeCandPlus1; } void setPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 ( uint32_t u ) { m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 = u; } uint32_t getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1 () { return m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1; } -#else - void setTMVPModeId ( int u ) { m_TMVPModeId = u; } - int getTMVPModeId () { return m_TMVPModeId; } #endif WeightedPredictionMethod getWeightedPredictionMethod() const { return m_weightedPredictionMethod; } void setWeightedPredictionMethod( WeightedPredictionMethod m ) { m_weightedPredictionMethod = m; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 0bbeea0b4d838dc65d2c58c2ae0395bccf3090b3..f8bfd4c081d02e0b07ab84de65e6814d8b85f7cf 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -2584,7 +2584,6 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& const SPS &sps = *tempCS->sps; if( sps.getSBTMVPEnabledFlag() ) - { Size bufSize = g_miScaling.scale( tempCS->area.lumaSize() ); mergeCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize ); @@ -3750,6 +3749,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct tempCS->initStructData(encTestMode.qp, encTestMode.lossless); MergeCtx mergeCtx; + if (sps.getSBTMVPEnabledFlag()) { Size bufSize = g_miScaling.scale(tempCS->area.lumaSize()); diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 77b132eda819470ae7cbbecaa9fbda20c08a0eee..509bd38338d702e58314689a6ebbc4972dff2c21 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -2189,10 +2189,12 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setList1IdxToList0Idx(); - -#if !JVET_O0238_PPS_OR_SLICE + if (m_pcEncLib->getTMVPModeId() == 2) { +#if JVET_O0238_PPS_OR_SLICE + assert (m_pcEncLib->getPPSTemporalMVPEnabledIdc() == 0); +#endif if (iGOPid == 0) // first picture in SOP (i.e. forward B) { pcSlice->setEnableTMVPFlag(0); @@ -2203,9 +2205,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setEnableTMVPFlag(1); } } -#endif #if JVET_O0238_PPS_OR_SLICE - if (m_pcEncLib->getPPSTemporalMVPEnabledIdc() != 1) + else if (m_pcEncLib->getTMVPModeId() == 1 && m_pcEncLib->getPPSTemporalMVPEnabledIdc() != 1) #else else if (m_pcEncLib->getTMVPModeId() == 1) #endif diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 0d4d313e1de57b6dcb926cf05f57b8dfaa711b49..22b467beeb1d7e1793d7c088ad532fe7c2df698f 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -1143,11 +1143,7 @@ void EncLib::xInitSPS(SPS &sps) sps.setBDPCMEnabledFlag(m_useBDPCM); #endif -#if !JVET_O0238_PPS_OR_SLICE sps.setSPSTemporalMVPEnabledFlag((getTMVPModeId() == 2 || getTMVPModeId() == 1)); -#else - sps.setSPSTemporalMVPEnabledFlag(true); // TODO - fix this correctly -#endif #if MAX_TB_SIZE_SIGNALLING sps.setLog2MaxTbSize ( m_log2MaxTbSize );