diff --git a/doc/software-manual.tex b/doc/software-manual.tex index 27957a7f0e56384f4af6ea5f488d0fcd8ef38805..a2d25b91f5fe6e0c91e06aa45a831f50fafae1b0 100644 --- a/doc/software-manual.tex +++ b/doc/software-manual.tex @@ -983,6 +983,12 @@ Valid values are: main, high. NB: There is currently only limited validation that the encoder configuration complies with the profile, level and tier constraints. \\ +\Option{SubProfile} & +%\ShortOption{\None} & +\Default{0} & +Indicates interoperability metadata registered as specified by X Recommendation ITU-T T.35. +\\ + \Option{EnableDecodingParameterSet} & %\ShortOption{\None} & \Default{false} & diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 0ef3310865a86ae215863d183910d5eee5250e03..bfa865126b19d44bfe7cca8ba29aed7e41639f45 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -88,6 +88,9 @@ void EncApp::xInitLibCfg() #endif m_cEncLib.setProfile ( m_profile); m_cEncLib.setLevel ( m_levelTier, m_level); +#if JVET_N0276_CONSTRAINT_FLAGS + m_cEncLib.setSubProfile ( m_subProfile ); +#endif m_cEncLib.setProgressiveSourceFlag ( m_progressiveSourceFlag); m_cEncLib.setInterlacedSourceFlag ( m_interlacedSourceFlag); m_cEncLib.setNonPackedConstraintFlag ( m_nonPackedConstraintFlag); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index d2e1baac1dd70fd217d1ce9563c0ab2e9597a34d..ccfd68e262db1f5bf3fe934673371257d0fcb05e 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -861,6 +861,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("Profile", extendedProfile, NONE, "Profile name to use for encoding. Use main (for main), main10 (for main10), main-still-picture, main-RExt (for Range Extensions profile), any of the RExt specific profile names, or none") ("Level", m_level, Level::NONE, "Level limit to be used, eg 5.1, or none") ("Tier", m_levelTier, Level::MAIN, "Tier to use for interpretation of --Level (main or high only)") +#if JVET_N0276_CONSTRAINT_FLAGS + ("SubProfile", m_subProfile, 0u, "Sub-profile idc") +#endif ("EnableDecodingParameterSet", m_decodingParameterSetEnabled, false, "Enables writing of Decoding Parameter Set") ("MaxBitDepthConstraint", m_bitDepthConstraint, 0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters") ("MaxChromaFormatConstraint", tmpConstraintChromaFormat, 0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters") diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index ca9e4ebd1be65fec61c3395a6212c200df551aa9..3845bb4c05440556c62bb050abb9c27bb6683e41 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -166,6 +166,9 @@ protected: Profile::Name m_profile; Level::Tier m_levelTier; Level::Name m_level; +#if JVET_N0276_CONSTRAINT_FLAGS + uint32_t m_subProfile; +#endif uint32_t m_bitDepthConstraint; ChromaFormat m_chromaFormatConstraint; bool m_intraConstraintFlag; diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index e043b54ecd58773b6d3782937bab6ad337a1993e..503a0780b59dca5def1e0938b8b0b223627b33f5 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -2752,6 +2752,9 @@ ProfileTierLevel::ProfileTierLevel() : m_profileSpace (0) , m_tierFlag (Level::MAIN) , m_profileIdc (Profile::NONE) +#if JVET_N0276_CONSTRAINT_FLAGS + , m_subProfileIdc (0) +#endif , m_levelIdc (Level::NONE) , m_progressiveSourceFlag (false) , m_interlacedSourceFlag (false) @@ -2770,6 +2773,9 @@ PTL::PTL() ProfileTierLevel::ProfileTierLevel() : m_tierFlag (Level::MAIN) , m_profileIdc (Profile::NONE) +#if JVET_N0276_CONSTRAINT_FLAGS + , m_subProfileIdc (0) +#endif , m_levelIdc (Level::NONE) { ::memset(m_subLayerLevelPresentFlag, 0, sizeof(m_subLayerLevelPresentFlag )); diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index dbf268b56f67fac12c370887bc8eb2304e1b6794..978d223b47d0f309071d6229e348634ada421306 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -402,6 +402,9 @@ class ProfileTierLevel Profile::Name m_profileIdc; #if !JVET_M0101_HLS bool m_profileCompatibilityFlag[32]; +#endif +#if JVET_N0276_CONSTRAINT_FLAGS + uint32_t m_subProfileIdc; #endif Level::Name m_levelIdc; @@ -434,6 +437,11 @@ public: Profile::Name getProfileIdc() const { return m_profileIdc; } void setProfileIdc(Profile::Name x) { m_profileIdc = x; } +#if JVET_N0276_CONSTRAINT_FLAGS + uint32_t getSubProfileIdc() const { return m_subProfileIdc; } + void setSubProfileIdc(uint32_t x) { m_subProfileIdc = x; } +#endif + #if !JVET_M0101_HLS bool getProfileCompatibilityFlag(int i) const { return m_profileCompatibilityFlag[i]; } void setProfileCompatibilityFlag(int i, bool x) { m_profileCompatibilityFlag[i] = x; } diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index bf9f0828927165ba5d6510754b4f09d10f2da56a..b4c43fb889135319426a28701a04223b9fe05fc4 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -2557,6 +2557,9 @@ void HLSyntaxReader::parseProfileTierLevel(ProfileTierLevel *ptl, int maxNumSubL uint32_t symbol; 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_N0276_CONSTRAINT_FLAGS + READ_CODE(24 , symbol, "general_sub_profile_idc" ); ptl->setSubProfileIdc (symbol); +#endif parseConstraintInfo( ptl->getConstraintInfo() ); diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 1274fb042ae081b7fd0adfae40ab648f4195cb08..68134e2c6b79f763b43e15e8fcbcc05137b9490f 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -208,6 +208,9 @@ protected: Profile::Name m_profile; Level::Tier m_levelTier; Level::Name m_level; +#if JVET_N0276_CONSTRAINT_FLAGS + uint32_t m_subProfile; +#endif bool m_progressiveSourceFlag; bool m_interlacedSourceFlag; bool m_nonPackedConstraintFlag; @@ -704,6 +707,9 @@ public: void setProfile(Profile::Name profile) { m_profile = profile; } void setLevel(Level::Tier tier, Level::Name level) { m_levelTier = tier; m_level = level; } +#if JVET_N0276_CONSTRAINT_FLAGS + void setSubProfile(uint32_t subProfile) { m_subProfile = subProfile; } +#endif bool getIntraOnlyConstraintFlag() const { return m_bIntraOnlyConstraintFlag; } void setIntraOnlyConstraintFlag(bool bVal) { m_bIntraOnlyConstraintFlag = bVal; } diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 2b1f406550c3f97f4768b34ea26547a06947827e..4dea49e55d644dda6fb8b4a7ba04962bf781dc6a 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -951,6 +951,9 @@ void EncLib::xInitSPS(SPS &sps) profileTierLevel.setLevelIdc (m_level); profileTierLevel.setTierFlag (m_levelTier); profileTierLevel.setProfileIdc (m_profile); +#if JVET_N0276_CONSTRAINT_FLAGS + profileTierLevel.setSubProfileIdc (m_subProfile); +#endif profileTierLevel.setProfileCompatibilityFlag (m_profile, 1); profileTierLevel.setProgressiveSourceFlag (m_progressiveSourceFlag); profileTierLevel.setInterlacedSourceFlag (m_interlacedSourceFlag); @@ -1026,6 +1029,9 @@ void EncLib::xInitSPS(SPS &sps) profileTierLevel->setLevelIdc (m_level); profileTierLevel->setTierFlag (m_levelTier); profileTierLevel->setProfileIdc (m_profile); +#if JVET_N0276_CONSTRAINT_FLAGS + profileTierLevel->setSubProfileIdc (m_subProfile); +#endif #endif /* XXX: should Main be marked as compatible with still picture? */ diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 94a3729fa3e929f70f94bd93b39991d8800d2284..b57fbc86cfa7a58c79f31c805b2ffe77ebd5c418 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -1813,6 +1813,9 @@ 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_N0276_CONSTRAINT_FLAGS + WRITE_CODE( ptl->getSubProfileIdc(), 24, "general_sub_profile_idc" ); +#endif codeConstraintInfo(ptl->getConstraintInfo()); @@ -1884,6 +1887,7 @@ void HLSWriter::codeProfileTier( const ProfileTierLevel* ptl, const bool /*bIsSu { WRITE_CODE( ptl->getProfileSpace(), 2 , PTL_TRACE_TEXT("profile_space" )); WRITE_FLAG( ptl->getTierFlag()==Level::HIGH, PTL_TRACE_TEXT("tier_flag" )); + WRITE_CODE( int(ptl->getProfileIdc()), 5 , PTL_TRACE_TEXT("profile_idc" )); for(int j = 0; j < 32; j++) {