diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index c36aa6260c13a54965077622a9233f43aeb36a63..c9f7094d192d899eaad2258dc5714e2480ef7a52 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -3523,9 +3523,16 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP) } else { +#if JVET_P0185 + m_vpsMap.clear(); + m_vpsMap.allocatePS(0); + m_activeVPSId = 0; + m_vpsMap.setActive(0); +#else //No actual VPS m_activeVPSId = -1; m_vpsMap.clear(); +#endif } #endif @@ -3585,6 +3592,14 @@ void ParameterSetMap<SPS>::setID(SPS* parameterSet, const int psId) parameterSet->setSPSId(psId); } +#if JVET_P0185 +template <> +void ParameterSetMap<VPS>::setID(VPS* parameterSet, const int psId) +{ + parameterSet->setVPSId(psId); +} +#endif + ProfileTierLevel::ProfileTierLevel() : m_tierFlag (Level::MAIN) , m_profileIdc (Profile::NONE) diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index ebc05e16c7f9b1badc73d13ae6032ffa15423bb4..10445a769b60b0fc870b8f50c224fc1bdb907439 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -753,6 +753,9 @@ class VPS private: int m_VPSId; uint32_t m_uiMaxLayers; +#if JVET_P0185 + uint32_t m_vpsMaxSubLayers; +#endif uint32_t m_vpsIncludedLayerId[MAX_VPS_LAYERS]; bool m_vpsExtensionFlag; @@ -768,6 +771,11 @@ public: uint32_t getMaxLayers() const { return m_uiMaxLayers; } void setMaxLayers(uint32_t l) { m_uiMaxLayers = l; } +#if JVET_P0185 + uint32_t getMaxSubLayers() const { return m_vpsMaxSubLayers; } + void setMaxSubLayers(uint32_t value) { m_vpsMaxSubLayers = value; } +#endif + bool getVPSExtensionFlag() const { return m_vpsExtensionFlag; } void setVPSExtensionFlag(bool t) { m_vpsExtensionFlag = t; } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 23835bbbd7df5bcc3f1c81f3f37473cbe8c81768..52230ea43ce8f6cb3fce2e55aefbf1ea535880cd 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -277,6 +277,8 @@ #define JVET_P0171_SUBPICTURE_LAYOUT 1 //JVET-P0171: subpicture layout +#define JVET_P0185 1 // Infer vps_max_layers_minus1 to be equal to 0 when not present and also signal vps_max_sub_layers_minus1 + #define HEVC_SEI 0 // SEI messages that are defined in HEVC, but not in VVC typedef std::pair<int, bool> TrMode; diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 90f16d75c198dd736c4dfbe5230de2fc01e47769..713d78f38d51f17412fa0372d18943b0b053eaef 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -2155,7 +2155,10 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) READ_CODE(4, uiCode, "vps_video_parameter_set_id"); pcVPS->setVPSId(uiCode); #endif - READ_CODE(8, uiCode, "vps_max_layers_minus1"); pcVPS->setMaxLayers(uiCode + 1); CHECK(uiCode + 1 > MAX_VPS_LAYERS, "Invalid code"); + READ_CODE(8, uiCode, "vps_max_layers_minus1"); pcVPS->setMaxLayers(uiCode + 1); CHECK(uiCode + 1 > MAX_VPS_LAYERS, "Invalid code"); +#if JVET_P0185 + READ_CODE(3, uiCode, "vps_max_sub_layers_minus1"); pcVPS->setMaxSubLayers(uiCode + 1); +#endif for (uint32_t i = 0; i <= pcVPS->getMaxLayers() - 1; i++) { READ_CODE(7, uiCode, "vps_included_layer_id"); pcVPS->setVPSIncludedLayerId(uiCode, i); diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index c5d620fd1bfec70a0cadfb4ec32e8669dde345d6..c38ef30789b736aaa92e9de29b432bd27d79711b 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -244,7 +244,11 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) // initialize SPS xInitSPS(sps0); +#if JVET_P0185 + xInitVPS(m_cVPS, sps0); +#else xInitVPS(m_cVPS); +#endif int dpsId = getDecodingParameterSetEnabled() ? 1 : 0; xInitDPS(m_dps, sps0, dpsId); @@ -1335,7 +1339,11 @@ void EncLib::xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Pict } -void EncLib::xInitVPS(VPS &vps) +#if JVET_P0185 +void EncLib::xInitVPS(VPS& vps, const SPS& sps) +#else +void EncLib::xInitVPS(VPS& vps) +#endif { // The SPS must have already been set up. // set the VPS profile information. @@ -1346,6 +1354,10 @@ void EncLib::xInitVPS(VPS &vps) { vps.setVPSIncludedLayerId(0, i); } +#if JVET_P0185 + vps.setMaxSubLayers(sps.getMaxTLayers()); +#endif + } void EncLib::xInitDPS(DPS &dps, const SPS &sps, const int dpsId) diff --git a/source/Lib/EncoderLib/EncLib.h b/source/Lib/EncoderLib/EncLib.h index 6bfa2db54c2fe68715839c8cdd789762f21b8e68..c5b338d5f5910878c6882445a93955a767e1e194 100644 --- a/source/Lib/EncoderLib/EncLib.h +++ b/source/Lib/EncoderLib/EncLib.h @@ -178,7 +178,11 @@ public: protected: void xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Picture*& rpcPic, int ppsId ); ///< get picture buffer which will be processed. If ppsId<0, then the ppsMap will be queried for the first match. - void xInitVPS (VPS &vps); ///< initialize VPS from encoder options +#if JVET_P0185 + void xInitVPS(VPS& vps, const SPS& sps); ///< initialize VPS from encoder options +#else + void xInitVPS(VPS& vps); ///< initialize VPS from encoder options +#endif void xInitDPS (DPS &dps, const SPS &sps, const int dpsId); ///< initialize DPS from encoder options void xInitSPS (SPS &sps); ///< initialize SPS from encoder options void xInitPPS (PPS &pps, const SPS &sps); ///< initialize PPS from encoder options diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 37827f392287997761223a2c9381e3d8e3651b71..8a4339e5da510adff848940ece9ec87e5af016c3 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -1454,6 +1454,10 @@ void HLSWriter::codeVPS(const VPS* pcVPS) #endif WRITE_CODE(pcVPS->getVPSId(), 4, "vps_video_parameter_set_id"); WRITE_CODE(pcVPS->getMaxLayers() - 1, 8, "vps_max_layers_minus1"); +#if JVET_P0185 + CHECK(pcVPS->getMaxSubLayers() < 1 || pcVPS->getMaxSubLayers() > 7, "vps_max_sub_layers_minus1 must be in range 0..6"); + WRITE_CODE(pcVPS->getMaxSubLayers() - 1, 3, "vps_max_sub_layers_minus1"); +#endif for (uint32_t i = 0; i <= pcVPS->getMaxLayers() - 1; i++) { WRITE_CODE(pcVPS->getVPSIncludedLayerId(i), 7, "vps_included_layer_id");