From c4cbc034a31574f42f09a69af8de7ff3412de510 Mon Sep 17 00:00:00 2001 From: Brian Heng <brian.heng@broadcom.com> Date: Tue, 6 Aug 2019 13:49:01 -0700 Subject: [PATCH] JVET-O0526: Setting the minimum CTU size to 32x32. --- source/App/EncoderApp/EncAppCfg.cpp | 6 ++++++ source/Lib/CommonLib/TypeDef.h | 2 ++ source/Lib/DecoderLib/VLCReader.cpp | 8 ++++++++ source/Lib/EncoderLib/VLCWriter.cpp | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 3294ed525..044ef7517 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -2616,8 +2616,14 @@ bool EncAppCfg::xCheckParameter() 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"); +#if JVET_O0526_MIN_CTU_SIZE + xConfirmPara( m_uiCTUSize < 32, "CTUSize must be greater than or equal to 32"); + xConfirmPara( m_uiCTUSize > 128, "CTUSize must be less than or equal to 128"); + xConfirmPara( m_uiCTUSize != 32 && m_uiCTUSize != 64 && m_uiCTUSize != 128, "CTUSize must be a power of 2 (32, 64, or 128)"); +#else xConfirmPara( m_uiCTUSize < 16, "Maximum partition width size should be larger than or equal to 16"); xConfirmPara( m_uiCTUSize < 16, "Maximum partition height size should be larger than or equal to 16"); +#endif #if !JVET_O0640_PICTURE_SIZE_CONSTRAINT xConfirmPara( (m_iSourceWidth % (1<<MIN_CU_LOG2))!=0, "Resulting coded frame width must be a multiple of the minimum unit size"); xConfirmPara( (m_iSourceHeight % (1<<MIN_CU_LOG2))!=0, "Resulting coded frame height must be a multiple of the minimum unit size"); diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 2f47b2e91..3e39fc498 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -170,6 +170,8 @@ #define JVET_O0669_REMOVE_ALF_COEFF_PRED 1 // JVET-O0425/O0427/O0669: remove prediction in ALF coefficients coding +#define JVET_O0526_MIN_CTU_SIZE 1 // JVET-O0526: Minimum CTU size 32x32 + #define JVET_O0545_MAX_TB_SIGNALLING 1 // JVET-O0545: Configurable maximum transform size #define JVET_O0541_IMPLICIT_MTS_CONDITION 1 // JVET_O0541: Decouple the intra implicit transform selection from an inter MTS related SPS flag diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 7e5b0c48a..7873df718 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -1180,9 +1180,17 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) unsigned maxBTSize[3] = { 0, 0, 0 }; unsigned maxTTSize[3] = { 0, 0, 0 }; READ_FLAG(uiCode, "qtbtt_dual_tree_intra_flag"); pcSPS->setUseDualITree(uiCode); + +#if JVET_O0526_MIN_CTU_SIZE + READ_CODE(2, uiCode, "log2_ctu_size_minus5"); pcSPS->setCTUSize(1 << (uiCode + 5)); + CHECK(uiCode > 2, "log2_ctu_size_minus5 must be less than or equal to 2"); + pcSPS->setMaxCodingDepth(uiCode+3); + pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode+3); +#else READ_UVLC(uiCode, "log2_ctu_size_minus2"); pcSPS->setCTUSize(1 << (uiCode + 2)); pcSPS->setMaxCodingDepth(uiCode); pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); +#endif pcSPS->setMaxCUWidth(pcSPS->getCTUSize()); pcSPS->setMaxCUHeight(pcSPS->getCTUSize()); diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 5e6eaa0cc..ce6cc0e51 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -803,7 +803,11 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } } WRITE_FLAG(pcSPS->getUseDualITree(), "qtbtt_dual_tree_intra_flag"); +#if JVET_O0526_MIN_CTU_SIZE + WRITE_CODE(g_aucLog2[pcSPS->getCTUSize()] - 5, 2, "log2_ctu_size_minus5"); +#else WRITE_UVLC(g_aucLog2[pcSPS->getCTUSize()] - MIN_CU_LOG2, "log2_ctu_size_minus2"); +#endif WRITE_UVLC(pcSPS->getLog2MinCodingBlockSize() - 2, "log2_min_luma_coding_block_size_minus2"); WRITE_FLAG(pcSPS->getSplitConsOverrideEnabledFlag(), "partition_constraints_override_enabled_flag"); WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(I_SLICE)] - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_tile_group_luma"); -- GitLab