From ce14c9547d6d49d18bbbafde4aa1292ad74f725a Mon Sep 17 00:00:00 2001 From: Guichun Li <guichunli@tencent.com> Date: Wed, 4 Mar 2020 16:42:53 -0800 Subject: [PATCH] Add encoder configuration checks for MinQTChromaISlice and related parameters to ensure they are in valid range. --- source/App/EncoderApp/EncAppCfg.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index fecbcd9ea..7b227f222 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -2694,7 +2694,9 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_uiMinQT[1] < minCuSize, "Min Luma QT size in non-I slices should be larger than or equal to minCuSize"); xConfirmPara((m_iSourceWidth % minCuSize ) || (m_iSourceHeight % minCuSize), "Picture width or height is not a multiple of minCuSize"); const int minDiff = (int)floorLog2(m_uiMinQT[2]) - std::max(MIN_CU_LOG2, (int)m_log2MinCuSize - (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)); - xConfirmPara(minDiff < 0 , "Min Chroma QT size in I slices is smaller than Min Luma CU size even considering color format"); + xConfirmPara( minDiff < 0 , "Min Chroma QT size in I slices is smaller than Min Luma CU size even considering color format"); + xConfirmPara( (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)) > std::min(64, (int)m_uiCTUSize), + "Min Chroma QT size in I slices should be smaller than or equal to CTB size or CB size after implicit split of CTB"); #else xConfirmPara( m_uiMinQT[0] < 1<<MIN_CU_LOG2, "Minimum QT size should be larger than or equal to 4"); xConfirmPara( m_uiMinQT[1] < 1<<MIN_CU_LOG2, "Minimum QT size should be larger than or equal to 4"); @@ -2714,13 +2716,15 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_uiMaxBT[0] > m_uiCTUSize, "Maximum BT size for luma block in I slice should be smaller than or equal to CTUSize"); xConfirmPara( m_uiMaxBT[1] < m_uiMinQT[1], "Maximum BT size for luma block in non I slice should be larger than minimum QT size"); xConfirmPara( m_uiMaxBT[1] > m_uiCTUSize, "Maximum BT size for luma block in non I slice should be smaller than or equal to CTUSize"); - xConfirmPara( m_uiMaxBT[2] < m_uiMinQT[2], "Maximum BT size for chroma block in I slice should be larger than minimum QT size"); + xConfirmPara( m_uiMaxBT[2] < (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), + "Maximum BT size for chroma block in I slice should be larger than minimum QT size"); xConfirmPara( m_uiMaxBT[2] > m_uiCTUSize, "Maximum BT size for chroma block in I slice should be smaller than or equal to CTUSize"); xConfirmPara( m_uiMaxTT[0] < m_uiMinQT[0], "Maximum TT size for luma block in I slice should be larger than minimum QT size"); xConfirmPara( m_uiMaxTT[0] > m_uiCTUSize, "Maximum TT size for luma block in I slice should be smaller than or equal to CTUSize"); xConfirmPara( m_uiMaxTT[1] < m_uiMinQT[1], "Maximum TT size for luma block in non I slice should be larger than minimum QT size"); xConfirmPara( m_uiMaxTT[1] > m_uiCTUSize, "Maximum TT size for luma block in non I slice should be smaller than or equal to CTUSize"); - xConfirmPara( m_uiMaxTT[2] < m_uiMinQT[2], "Maximum TT size for chroma block in I slice should be larger than minimum QT size"); + xConfirmPara( m_uiMaxTT[2] < (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), + "Maximum TT size for chroma block in I slice should be larger than minimum QT size"); xConfirmPara( m_uiMaxTT[2] > m_uiCTUSize, "Maximum TT size for chroma block in I slice should be smaller than or equal to CTUSize"); #endif #if JVET_Q0468_Q0469_MIN_LUMA_CB_AND_MIN_QT_FIX @@ -2737,8 +2741,8 @@ bool EncAppCfg::xCheckParameter() } if (m_uiMaxMTTHierarchyDepthIChroma == 0) { - xConfirmPara(m_uiMaxBT[2] != m_uiMinQT[2], "MaxBTChromaISlice shall be equal to MinQTChromaISlice when MaxMTTHierarchyDepthISliceC is 0."); - xConfirmPara(m_uiMaxTT[2] != m_uiMinQT[2], "MaxTTChromaISlice shall be equal to MinQTChromaISlice when MaxMTTHierarchyDepthISliceC is 0."); + xConfirmPara(m_uiMaxBT[2] != (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), "MaxBTChromaISlice shall be equal to MinQTChromaISlice when MaxMTTHierarchyDepthISliceC is 0."); + xConfirmPara(m_uiMaxTT[2] != (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), "MaxTTChromaISlice shall be equal to MinQTChromaISlice when MaxMTTHierarchyDepthISliceC is 0."); } if (m_uiMaxMTTHierarchyDepthI == 0) { -- GitLab