From 4e796e63e9a0286c1102ded7dd4ee0bbff57cb13 Mon Sep 17 00:00:00 2001 From: Jonatan Samuelsson <jonatan.samuelsson@divideon.com> Date: Thu, 21 Nov 2019 22:42:20 +0100 Subject: [PATCH] JVET-P0217 PTL syntax cleanup --- source/Lib/CommonLib/TypeDef.h | 2 ++ source/Lib/DecoderLib/VLCReader.cpp | 18 ++++++++++++++++++ source/Lib/EncoderLib/VLCWriter.cpp | 8 ++++++++ 3 files changed, 28 insertions(+) diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index e730ceb6ed..5a4c39f57d 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -88,6 +88,8 @@ #define JVET_P0526_PLT_ENCODER 1 // JVET-P0526: PLT encoder improvement +#define JVET_P0217_PTL_SYNTAX_CLEANUP 1 // JVET-P0217: On Profile, tier, and level syntax structure + #define JVET_P0641_REMOVE_2xN_CHROMA_INTRA 1 // JVET-P0641: removing 2xN chroma intra blocks #define JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP 1 // JVET-P0445: encoder speed up for sub-block based merge candidate search diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 209303c8b2..d9f7d47aa1 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -3579,6 +3579,12 @@ void HLSyntaxReader::parseProfileTierLevel(ProfileTierLevel *ptl, int maxNumSubL READ_CODE(7 , symbol, "general_profile_idc" ); ptl->setProfileIdc (Profile::Name(symbol)); READ_FLAG( symbol, "general_tier_flag" ); ptl->setTierFlag (symbol ? Level::HIGH : Level::MAIN); +#if JVET_P0217_PTL_SYNTAX_CLEANUP + parseConstraintInfo( ptl->getConstraintInfo() ); + + READ_CODE( 8, symbol, "general_level_idc" ); ptl->setLevelIdc( Level::Name( symbol ) ); +#endif + READ_CODE(8, symbol, "num_sub_profiles"); uint8_t numSubProfiles = symbol; ptl->setNumSubProfile( numSubProfiles ); @@ -3587,9 +3593,11 @@ void HLSyntaxReader::parseProfileTierLevel(ProfileTierLevel *ptl, int maxNumSubL READ_CODE(32, symbol, "general_sub_profile_idc[i]"); ptl->setSubProfileIdc(i, symbol); } +#if !JVET_P0217_PTL_SYNTAX_CLEANUP parseConstraintInfo( ptl->getConstraintInfo() ); READ_CODE(8 , symbol, "general_level_idc" ); ptl->setLevelIdc (Level::Name(symbol)); +#endif for (int i = 0; i < maxNumSubLayersMinus1; i++) { @@ -3608,6 +3616,16 @@ void HLSyntaxReader::parseProfileTierLevel(ProfileTierLevel *ptl, int maxNumSubL READ_CODE(8 , symbol, "sub_layer_level_idc" ); ptl->setSubLayerLevelIdc (i, Level::Name(symbol)); } } +#if JVET_P0217_PTL_SYNTAX_CLEANUP + ptl->setSubLayerLevelIdc(maxNumSubLayersMinus1, ptl->getLevelIdc()); + for( int i = maxNumSubLayersMinus1 - 1; i >= 0; i-- ) + { + if( !ptl->getSubLayerLevelPresentFlag( i ) ) + { + ptl->setSubLayerLevelIdc( i, ptl->getSubLayerLevelIdc( i + 1 ) ); + } + } +#endif } diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 61e63d55ab..368f6a9162 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -2347,15 +2347,23 @@ void HLSWriter::codeProfileTierLevel ( const ProfileTierLevel* ptl, int maxN WRITE_CODE( int(ptl->getProfileIdc()), 7 , "general_profile_idc" ); WRITE_FLAG( ptl->getTierFlag()==Level::HIGH, "general_tier_flag" ); +#if JVET_P0217_PTL_SYNTAX_CLEANUP + codeConstraintInfo( ptl->getConstraintInfo() ); + + WRITE_CODE( int( ptl->getLevelIdc() ), 8, "general_level_idc" ); +#endif + WRITE_CODE(ptl->getNumSubProfile(), 8, "num_sub_profiles"); for (int i = 0; i < ptl->getNumSubProfile(); i++) { WRITE_CODE(ptl->getSubProfileIdc(i) , 32, "general_sub_profile_idc[i]"); } +#if !JVET_P0217_PTL_SYNTAX_CLEANUP codeConstraintInfo(ptl->getConstraintInfo()); WRITE_CODE( int(ptl->getLevelIdc()), 8 , "general_level_idc" ); +#endif for (int i = 0; i < maxNumSubLayersMinus1; i++) { -- GitLab