diff --git a/cfg/per-sequence/BasketballPass.cfg b/cfg/per-sequence/BasketballPass.cfg index c6b756c9423418e82deebceaf0a87ec08e33cf24..1f8fa9011f29cb68602cdcfa63d6a4adfd06b2a2 100644 --- a/cfg/per-sequence/BasketballPass.cfg +++ b/cfg/per-sequence/BasketballPass.cfg @@ -1,11 +1,11 @@ #======== File I/O =============== -InputFile : BasketballPass_416x240_50.yuv +InputFile : D:\sequences/BasketballPass_416x240_50.yuv InputBitDepth : 8 # Input bitdepth InputChromaFormat : 420 # Ratio of luminance to chrominance samples FrameRate : 50 # Frame Rate per second FrameSkip : 0 # Number of frames to be skipped in input SourceWidth : 416 # Input frame width SourceHeight : 240 # Input frame height -FramesToBeEncoded : 500 # Number of frames to be coded - +FramesToBeEncoded : 1 # Number of frames to be coded +EnableDecodingCapabilityInformation : 1 Level : 2.1 diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index 6c79dd01b2e5ee937ea1eaea4e1e96cdd1bea1f8..58073dcea4f12f26c9907a30122e3733b4c7fcc0 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -561,7 +561,11 @@ bool DecApp::isNewPicture(ifstream *bitstreamFile, class InputByteStream *bytest // NUT that indicate the start of a new picture case NAL_UNIT_ACCESS_UNIT_DELIMITER: +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + case NAL_UNIT_DCI: +#else case NAL_UNIT_DPS: +#endif case NAL_UNIT_VPS: case NAL_UNIT_SPS: case NAL_UNIT_PPS: diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 8759f3e5f6574679db3acfa5c982277e79e85a72..a0e734a48fec896ff25f46457942b3438fd8f2b6 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -836,7 +836,11 @@ void EncApp::xInitLibCfg() #endif m_cEncLib.setCostMode ( m_costMode ); m_cEncLib.setUseRecalculateQPAccordingToLambda ( m_recalculateQPAccordingToLambda ); +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + m_cEncLib.setDCIEnabled ( m_DCIEnabled ); +#else m_cEncLib.setDecodingParameterSetEnabled ( m_decodingParameterSetEnabled ); +#endif #if HEVC_SEI m_cEncLib.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); #endif @@ -1239,7 +1243,11 @@ void EncApp::rateStatsAccum(const AccessUnit& au, const std::vector<uint32_t>& a case NAL_UNIT_CODED_SLICE_GDR: case NAL_UNIT_CODED_SLICE_RADL: case NAL_UNIT_CODED_SLICE_RASL: +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + case NAL_UNIT_DCI: +#else case NAL_UNIT_DPS: +#endif case NAL_UNIT_VPS: case NAL_UNIT_SPS: case NAL_UNIT_PPS: diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 50b0ac983a1dfa0477154d241b0dc6b522790dc1..f85df48e446c80b9084078423a805604ffbd6db4 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -862,7 +862,11 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("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)") ("SubProfile", cfg_SubProfile, cfg_SubProfile, "Sub-profile idc") +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + ("EnableDecodingCapabilityInformation", m_DCIEnabled, false, "Enables writing of Decoding Capability Information") +#else ("EnableDecodingParameterSet", m_decodingParameterSetEnabled, false, "Enables writing of Decoding Parameter Set") +#endif ("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") ("IntraConstraintFlag", m_intraConstraintFlag, false, "Value of general_intra_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)") diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index a709009502670f59b47e0bc3ba554cbc7495fee2..525389d6ccb93afd39613b9f56ca29647e2de736 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -696,8 +696,12 @@ protected: #if HEVC_SEI int m_activeParameterSetsSEIEnabled; #endif - bool m_decodingParameterSetEnabled; ///< enable decoding parameter set +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + bool m_DCIEnabled; ///< enable DCI +#else + bool m_decodingParameterSetEnabled; ///< enable decoding parameter set +#endif bool m_hrdParametersPresentFlag; ///< enable generation of HRD parameters bool m_vuiParametersPresentFlag; ///< enable generation of VUI parameters bool m_aspectRatioInfoPresentFlag; ///< Signals whether aspect_ratio_idc is present diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp index 7bd1333159a6690ae84778fda2ff9d2832488fe0..8ec4e5f855a20ce8279cf8a02073b87a0c59faaf 100644 --- a/source/Lib/CommonLib/Rom.cpp +++ b/source/Lib/CommonLib/Rom.cpp @@ -70,7 +70,11 @@ const char* nalUnitTypeToString(NalUnitType type) case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP"; case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; case NAL_UNIT_CODED_SLICE_GDR: return "GDR"; +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + case NAL_UNIT_DCI: return "DCI"; +#else case NAL_UNIT_DPS: return "DPS"; +#endif case NAL_UNIT_VPS: return "VPS"; case NAL_UNIT_SPS: return "SPS"; case NAL_UNIT_PPS: return "PPS"; diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 767a26f055f4ee8d6f360f35352d7e2e61639ee8..a51b16f2a4c2dc068eed3ff8b2f09d85ef974140 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -81,7 +81,9 @@ Slice::Slice() , m_biDirPred ( false ) , m_iSliceQpDelta ( 0 ) , m_iDepth ( 0 ) +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP , m_dps ( nullptr ) +#endif , m_pcSPS ( NULL ) , m_pcPPS ( NULL ) , m_pcPic ( NULL ) @@ -3501,7 +3503,9 @@ ParameterSetManager::ParameterSetManager() : m_spsMap(MAX_NUM_SPS) , m_ppsMap(MAX_NUM_PPS) , m_apsMap(MAX_NUM_APS * MAX_NUM_APS_TYPE) +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP , m_dpsMap(MAX_NUM_DPS) +#endif , m_vpsMap(MAX_NUM_VPS) , m_activeDPSId(-1) , m_activeSPSId(-1) @@ -3558,8 +3562,10 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP) #endif { SPS *sps = m_spsMap.getPS(spsId); + if (sps) { +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP int dpsId = sps->getDecodingParameterSetId(); if ((m_activeDPSId!=-1) && (dpsId != m_activeDPSId )) { @@ -3587,7 +3593,7 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP) m_dpsMap.setActive(dpsId); } } - +#endif int vpsId = sps->getVPSId(); if(vpsId != 0) { diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 556b519f2edead0023d7bb59558f6d85f90050be..410e7fbf61fb711cbf35e9fc4ffb43806c6a65fd 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -832,6 +832,29 @@ public: #endif }; #endif + +#if JVET_Q0117_PARAMETER_SETS_CLEANUP // Rename DPS to DCI (decoding_capability_information) +class DCI +{ +private: + int m_maxSubLayersMinus1; + std::vector<ProfileTierLevel> m_profileTierLevel; + +public: + DCI() + : m_maxSubLayersMinus1(0) + {}; + + virtual ~DCI() {}; + + int getMaxSubLayersMinus1() const { return m_maxSubLayersMinus1; } + void setMaxSubLayersMinus1(int val) { m_maxSubLayersMinus1 = val; } + + size_t getNumPTLs() const { return m_profileTierLevel.size(); } + void setProfileTierLevel(const std::vector<ProfileTierLevel>& val) { m_profileTierLevel = val; } + const ProfileTierLevel& getProfileTierLevel(int idx) const { return m_profileTierLevel[idx]; } +}; +#else class DPS { private: @@ -856,6 +879,11 @@ public: void setProfileTierLevel(const std::vector<ProfileTierLevel> &val) { m_profileTierLevel = val; } const ProfileTierLevel& getProfileTierLevel(int idx) const { return m_profileTierLevel[idx]; } }; +<<<<<<< HEAD +======= +#endif + +>>>>>>> effa8e16... Commit Q0117. HLS clenup: DPS is changed to DCI class VPS { @@ -1408,8 +1436,10 @@ public: int getSPSId() const { return m_SPSId; } void setSPSId(int i) { m_SPSId = i; } +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP void setDecodingParameterSetId(int val) { m_decodingParameterSetId = val; } int getDecodingParameterSetId() const { return m_decodingParameterSetId; } +#endif int getVPSId() const { return m_VPSId; } void setVPSId(int i) { m_VPSId = i; } @@ -2731,7 +2761,9 @@ private: // access channel +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP const DPS* m_dps; +#endif const VPS* m_pcVPS; const SPS* m_pcSPS; const PPS* m_pcPPS; @@ -2801,8 +2833,11 @@ public: void setPicHeader( const PicHeader* pcPicHeader ) { m_pcPicHeader = pcPicHeader; } const PicHeader* getPicHeader() const { return m_pcPicHeader; } int getRefIdx4MVPair( RefPicList eCurRefPicList, int nCurRefIdx ); + +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP void setDPS( DPS* dps ) { m_dps = dps; } const DPS* getDPS() const { return m_dps; } +#endif void setSPS( const SPS* pcSPS ) { m_pcSPS = pcSPS; } const SPS* getSPS() const { return m_pcSPS; } @@ -3308,13 +3343,14 @@ public: void storeVPS(VPS *vps, const std::vector<uint8_t> &naluData) { m_vpsMap.storePS(vps->getVPSId(), vps, &naluData); } VPS* getVPS( int vpsId ) { return m_vpsMap.getPS( vpsId ); }; +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP void storeDPS(DPS *dps, const std::vector<uint8_t> &naluData) { m_dpsMap.storePS( dps->getDecodingParameterSetId(), dps, &naluData); }; //! get pointer to existing video parameter set DPS* getDPS(int dpsId) { return m_dpsMap.getPS(dpsId); }; bool getDPSChangedFlag(int dpsId) const { return m_dpsMap.getChangedFlag(dpsId); } void clearDPSChangedFlag(int dpsId) { m_dpsMap.clearChangedFlag(dpsId); } DPS* getFirstDPS() { return m_dpsMap.getFirstPS(); }; - +#endif //! store sequence parameter set and take ownership of it void storeSPS(SPS *sps, const std::vector<uint8_t> &naluData) { m_spsMap.storePS( sps->getSPSId(), sps, &naluData); }; //! get pointer to existing sequence parameter set @@ -3347,15 +3383,18 @@ public: APS* getFirstAPS() { return m_apsMap.getFirstPS(); }; bool activateAPS(int apsId, int apsType); const SPS* getActiveSPS()const { return m_spsMap.getPS(m_activeSPSId); }; +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP const DPS* getActiveDPS()const { return m_dpsMap.getPS(m_activeDPSId); }; - +#endif void checkAuApsContent( APS *aps, std::vector<int>& accessUnitApsNals ) { m_apsMap.checkAuApsContent( aps, accessUnitApsNals ); } protected: ParameterSetMap<SPS> m_spsMap; ParameterSetMap<PPS> m_ppsMap; ParameterSetMap<APS> m_apsMap; +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP ParameterSetMap<DPS> m_dpsMap; +#endif ParameterSetMap<VPS> m_vpsMap; APS* m_apss[ALF_CTB_MAX_NUM_APS]; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 52a6bc99a662ca0ef7d1684f9f321c6106e339bd..f54d4a9b7fae9da62b2717b17feaf44a16f04e5a 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -144,9 +144,13 @@ #define JVET_Q0820_ACT 1 // JVET-Q0820: ACT bug fixes and reversible ACT transform +<<<<<<< HEAD #define JVET_Q0814_DPB 1 // JVET-Q0814: DPB capacity is based on picture units regardless of the resoltuion #define ENABLING_MULTI_SPS 1 // Bug fix to enable multiple SPS #define SPS_ID_CHECK 1 // add SPS id check to be the same within CLVS, related to mixed_nalu_types_in_pic_flag +======= +#define JVET_Q0117_PARAMETER_SETS_CLEANUP 1 // JVET-Q0117: cleanups on parameter sets +>>>>>>> effa8e16... Commit Q0117. HLS clenup: DPS is changed to DCI #define JVET_Q0353_ACT_SW_FIX 1 // JVET-Q0353: Bug fix of ACT @@ -968,7 +972,11 @@ enum NalUnitType NAL_UNIT_RESERVED_IRAP_VCL_11, NAL_UNIT_RESERVED_IRAP_VCL_12, +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + NAL_UNIT_DCI, // 13 +#else NAL_UNIT_DPS, // 13 +#endif NAL_UNIT_VPS, // 14 NAL_UNIT_SPS, // 15 NAL_UNIT_PPS, // 16 diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index 5d147c31f3eee7d80406a3ff00b3d5f196866bb5..99803824886aff4aa1b2637e79d5bf34fdfbd38c 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -271,7 +271,11 @@ struct UnitAreaRelative : public UnitArea class SPS; class VPS; +#if JVET_Q0117_PARAMETER_SETS_CLEANUP +class DCI; +#else class DPS; +#endif class PPS; class Slice; diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 39dd8184c6310ce152bfe2059c0b8a9bba869d7a..cffd19296df6b4528244bc86c1e9c1276b78afbc 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -1573,7 +1573,12 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl for( auto& naluTemporalId : m_accessUnitNals ) { - if( naluTemporalId.first != NAL_UNIT_DPS + if( +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + naluTemporalId.first != NAL_UNIT_DCI +#else + naluTemporalId.first != NAL_UNIT_DPS +#endif && naluTemporalId.first != NAL_UNIT_VPS && naluTemporalId.first != NAL_UNIT_SPS && naluTemporalId.first != NAL_UNIT_EOS @@ -2139,6 +2144,17 @@ void DecLib::xDecodeVPS( InputNALUnit& nalu ) m_parameterSetManager.storeVPS( m_vps, nalu.getBitstream().getFifo()); } +#if JVET_Q0117_PARAMETER_SETS_CLEANUP +void DecLib::xDecodeDCI(InputNALUnit& nalu) +{ + DCI* dci = new DCI(); + m_HLSReader.setBitstream(&nalu.getBitstream()); + + CHECK(nalu.m_temporalId, "The value of TemporalId of DPS NAL units shall be equal to 0"); + + m_HLSReader.parseDCI(dci); +} +#else void DecLib::xDecodeDPS( InputNALUnit& nalu ) { DPS* dps = new DPS(); @@ -2149,6 +2165,7 @@ void DecLib::xDecodeDPS( InputNALUnit& nalu ) m_HLSReader.parseDPS( dps ); m_parameterSetManager.storeDPS( dps, nalu.getBitstream().getFifo() ); } +#endif void DecLib::xDecodeSPS( InputNALUnit& nalu ) { @@ -2208,11 +2225,15 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay) m_vps->m_targetOlsIdx = iTargetOlsIdx; #endif return false; - +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + case NAL_UNIT_DCI: + xDecodeDCI( nalu ); + return false; +#else case NAL_UNIT_DPS: xDecodeDPS( nalu ); return false; - +#endif case NAL_UNIT_SPS: xDecodeSPS( nalu ); return false; @@ -2362,6 +2383,8 @@ void DecLib::checkNalUnitConstraints( uint32_t naluType ) const ConstraintInfo *cInfo = m_parameterSetManager.getActiveSPS()->getProfileTierLevel()->getConstraintInfo(); xCheckNalUnitConstraintFlags( cInfo, naluType ); } + +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP if (m_parameterSetManager.getActiveDPS() != NULL) { const DPS *dps = m_parameterSetManager.getActiveDPS(); @@ -2372,6 +2395,7 @@ void DecLib::checkNalUnitConstraints( uint32_t naluType ) xCheckNalUnitConstraintFlags( cInfo, naluType ); } } +#endif } void DecLib::xCheckNalUnitConstraintFlags( const ConstraintInfo *cInfo, uint32_t naluType ) { diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index cb3d10736a6aa2211adf1201a5836db14207f300..807e9f62a03c4de2146b7067ccf6fc01e0c8435b 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -244,7 +244,11 @@ protected: void xDecodePicHeader( InputNALUnit& nalu ); bool xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDisplay); void xDecodeVPS( InputNALUnit& nalu ); +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + void xDecodeDCI( InputNALUnit& nalu ); +#else void xDecodeDPS( InputNALUnit& nalu ); +#endif void xDecodeSPS( InputNALUnit& nalu ); void xDecodePPS( InputNALUnit& nalu ); void xDecodeAPS(InputNALUnit& nalu); diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 09c2df8c252ec7bdfd0bfc54b9096f94c3321e63..3c5e3e1f8c069bb49093ec2ee25f6f2304ae374e 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -1311,7 +1311,12 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) #if ENABLE_TRACING xTraceSPSHeader (); #endif + +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + READ_CODE(4, uiCode, "sps_seq_parameter_set_id"); pcSPS->setSPSId(uiCode); +#else READ_CODE( 4, uiCode, "sps_decoding_parameter_set_id"); pcSPS->setDecodingParameterSetId( uiCode ); +#endif READ_CODE( 4, uiCode, "sps_video_parameter_set_id" ); pcSPS->setVPSId( uiCode ); READ_CODE(3, uiCode, "sps_max_sub_layers_minus1"); pcSPS->setMaxTLayers (uiCode + 1); CHECK(uiCode > 6, "Invalid maximum number of T-layer signalled"); @@ -1341,9 +1346,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG(uiCode, "gdr_enabled_flag"); pcSPS->setGDREnabledFlag(uiCode); - +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP READ_CODE(4, uiCode, "sps_seq_parameter_set_id"); pcSPS->setSPSId(uiCode); - +#endif READ_CODE(2, uiCode, "chroma_format_idc"); pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) ); if( pcSPS->getChromaFormatIdc() == CHROMA_444 ) @@ -2149,6 +2154,40 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) xReadRbspTrailingBits(); } +#if JVET_Q0117_PARAMETER_SETS_CLEANUP +void HLSyntaxReader::parseDCI(DCI* dci) +{ +#if ENABLE_TRACING + xTraceDPSHeader(); +#endif + uint32_t symbol; + + READ_CODE(3, symbol, "dci_max_sub_layers_minus1"); dci->setMaxSubLayersMinus1(symbol); + READ_CODE(1, symbol, "dci_reserved_zero_bit"); CHECK(symbol != 0, "dci_reserved_zero_bit must be equal to zero"); + + uint32_t numPTLs; + READ_CODE(4, numPTLs, "dci_num_ptls_minus1"); + numPTLs += 1; + + std::vector<ProfileTierLevel> ptls; + ptls.resize(numPTLs); + for (int i = 0; i < numPTLs; i++) + { + parseProfileTierLevel(&ptls[i], 0); + } + dci->setProfileTierLevel(ptls); + + READ_FLAG(symbol, "dci_extension_flag"); + if (symbol) + { + while (xMoreRbspData()) + { + READ_FLAG(symbol, "dci_extension_data_flag"); + } + } + xReadRbspTrailingBits(); +} +#else void HLSyntaxReader::parseDPS(DPS* dps) { #if ENABLE_TRACING @@ -2189,6 +2228,7 @@ void HLSyntaxReader::parseDPS(DPS* dps) } xReadRbspTrailingBits(); } +#endif void HLSyntaxReader::parseVPS(VPS* pcVPS) { diff --git a/source/Lib/DecoderLib/VLCReader.h b/source/Lib/DecoderLib/VLCReader.h index 12c86f315c3aaac7e56b1cfa14b80694ddc213eb..104374a2d753fb2c974010893a10fc60ea91c572 100644 --- a/source/Lib/DecoderLib/VLCReader.h +++ b/source/Lib/DecoderLib/VLCReader.h @@ -156,7 +156,11 @@ protected: public: void setBitstream ( InputBitstream* p ) { m_pcBitstream = p; } void parseVPS ( VPS* pcVPS ); +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + void parseDCI ( DCI* dci ); +#else void parseDPS ( DPS* dps ); +#endif void parseSPS ( SPS* pcSPS ); void parsePPS ( PPS* pcPPS ); void parseAPS ( APS* pcAPS ); diff --git a/source/Lib/EncoderLib/AnnexBwrite.h b/source/Lib/EncoderLib/AnnexBwrite.h index 37f967684409f3fc59c8b18e3dfeaa99c860eaab..dff2f5b23dac5f37d8fc5ff2dd18fd62b78c805d 100644 --- a/source/Lib/EncoderLib/AnnexBwrite.h +++ b/source/Lib/EncoderLib/AnnexBwrite.h @@ -59,7 +59,13 @@ static std::vector<uint32_t> writeAnnexB(std::ostream& out, const AccessUnit& au uint32_t size = 0; /* size of annexB unit in bytes */ static const uint8_t start_code_prefix[] = {0,0,0,1}; - if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_DPS || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_VPS || nalu.m_nalUnitType == NAL_UNIT_PPS) + if (it == au.begin() +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + || nalu.m_nalUnitType == NAL_UNIT_DCI +#else + || nalu.m_nalUnitType == NAL_UNIT_DPS +#endif + || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_VPS || nalu.m_nalUnitType == NAL_UNIT_PPS) { /* From AVC, When any of the following conditions are fulfilled, the * zero_byte syntax element shall be present: diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index bcfd9abb0fc2c67156a7bf32e663b4b5c0f11c08..68730ab9527392d54ca9a7608277aab6ef29fc6c 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -715,9 +715,17 @@ protected: #if !JVET_Q0814_DPB VPS m_cVPS; +<<<<<<< HEAD #endif +======= +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + DCI m_dci; + bool m_DCIEnabled; ///< enable DCI +#else +>>>>>>> effa8e16... Commit Q0117. HLS clenup: DPS is changed to DCI DPS m_dps; bool m_decodingParameterSetEnabled; ///< enable decoding parameter set +#endif bool m_recalculateQPAccordingToLambda; ///< recalculate QP value according to the lambda value #if HEVC_SEI int m_activeParameterSetsSEIEnabled; ///< enable active parameter set SEI message @@ -1840,9 +1848,18 @@ public: #if !JVET_Q0814_DPB void setVPS(VPS *p) { m_cVPS = *p; } VPS * getVPS() { return &m_cVPS; } +<<<<<<< HEAD #endif +======= + +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + void setDCI(DCI *p) { m_dci = *p; } + DCI* getDCI() { return &m_dci; } +#else +>>>>>>> effa8e16... Commit Q0117. HLS clenup: DPS is changed to DCI void setDPS(DPS *p) { m_dps = *p; } DPS* getDPS() { return &m_dps; } +#endif void setUseRecalculateQPAccordingToLambda (bool b) { m_recalculateQPAccordingToLambda = b; } bool getUseRecalculateQPAccordingToLambda () { return m_recalculateQPAccordingToLambda; } @@ -1857,8 +1874,13 @@ public: int getActiveParameterSetsSEIEnabled () { return m_activeParameterSetsSEIEnabled; } #endif +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + bool getDCIEnabled() { return m_DCIEnabled; } + void setDCIEnabled(bool i) { m_DCIEnabled = i; } +#else bool getDecodingParameterSetEnabled() { return m_decodingParameterSetEnabled; } void setDecodingParameterSetEnabled(bool i) { m_decodingParameterSetEnabled = i; } +#endif bool getHrdParametersPresentFlag() { return m_hrdParametersPresentFlag; } void setHrdParametersPresentFlag(bool i) { m_hrdParametersPresentFlag = i; } bool getVuiParametersPresentFlag() { return m_vuiParametersPresentFlag; } diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 81018e230011d307778e3e596de13265df03ade7..d6752b2cf7566b671e088531152ff9e894a2e971 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -317,7 +317,17 @@ int EncGOP::xWriteVPS (AccessUnit &accessUnit, const VPS *vps) accessUnit.push_back(new NALUnitEBSP(nalu)); return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; } - +#if JVET_Q0117_PARAMETER_SETS_CLEANUP +int EncGOP::xWriteDCI(AccessUnit& accessUnit, const DCI* dci) +{ + OutputNALUnit nalu(NAL_UNIT_DCI); + m_HLSWriter->setBitstream(&nalu.m_Bitstream); + CHECK(nalu.m_temporalId, "The value of TemporalId of DPS NAL units shall be equal to 0"); + m_HLSWriter->codeDCI(dci); + accessUnit.push_back(new NALUnitEBSP(nalu)); + return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; +} +#else int EncGOP::xWriteDPS (AccessUnit &accessUnit, const DPS *dps) { if (dps->getDecodingParameterSetId() !=0) @@ -334,6 +344,7 @@ int EncGOP::xWriteDPS (AccessUnit &accessUnit, const DPS *dps) return 0; } } +#endif int EncGOP::xWriteSPS( AccessUnit &accessUnit, const SPS *sps, const int layerId ) { @@ -395,9 +406,15 @@ int EncGOP::xWriteParameterSets(AccessUnit &accessUnit, Slice *slice, const bool { actualTotalBits += xWriteVPS(accessUnit, m_pcEncLib->getVPS()); } +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + actualTotalBits += xWriteDCI( accessUnit, m_pcEncLib->getDCI() ); +#else actualTotalBits += xWriteDPS( accessUnit, m_pcEncLib->getDPS() ); #endif +<<<<<<< HEAD +======= +>>>>>>> effa8e16... Commit Q0117. HLS clenup: DPS is changed to DCI if( m_pcEncLib->SPSNeedsWriting( slice->getSPS()->getSPSId() ) ) // Note this assumes that all changes to the SPS are made at the EncLib level prior to picture creation (EncLib::xGetNewPicBuffer). { CHECK( !( bSeqFirst ), "Unspecified error" ); // Implementations that use more than 1 SPS need to be aware of activation issues. @@ -501,7 +518,11 @@ void EncGOP::xWriteLeadingSEIOrdered (SEIMessages& seiMessages, SEIMessages& duI while ( (itNalu!=accessUnit.end())&& ( (*itNalu)->m_nalUnitType==NAL_UNIT_ACCESS_UNIT_DELIMITER || (*itNalu)->m_nalUnitType==NAL_UNIT_VPS +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + || (*itNalu)->m_nalUnitType==NAL_UNIT_DCI +#else || (*itNalu)->m_nalUnitType==NAL_UNIT_DPS +#endif || (*itNalu)->m_nalUnitType==NAL_UNIT_SPS || (*itNalu)->m_nalUnitType==NAL_UNIT_PPS )) @@ -4222,7 +4243,13 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni if( ( *it )->m_nalUnitType != NAL_UNIT_PREFIX_SEI && ( *it )->m_nalUnitType != NAL_UNIT_SUFFIX_SEI ) { numRBSPBytes += numRBSPBytes_nal; - if (it == accessUnit.begin() || (*it)->m_nalUnitType == NAL_UNIT_VPS || (*it)->m_nalUnitType == NAL_UNIT_DPS || (*it)->m_nalUnitType == NAL_UNIT_SPS || (*it)->m_nalUnitType == NAL_UNIT_PPS) + if (it == accessUnit.begin() || (*it)->m_nalUnitType == NAL_UNIT_VPS +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + || (*it)->m_nalUnitType == NAL_UNIT_DCI +#else + || (*it)->m_nalUnitType == NAL_UNIT_DPS +#endif + || (*it)->m_nalUnitType == NAL_UNIT_SPS || (*it)->m_nalUnitType == NAL_UNIT_PPS) { numRBSPBytes += 4; } diff --git a/source/Lib/EncoderLib/EncGOP.h b/source/Lib/EncoderLib/EncGOP.h index 30412774d2671a2a3b7e42e1e05dc31e5d36f1aa..928df5a6c3e730d48d5941a72c3b4a4c757fb196 100644 --- a/source/Lib/EncoderLib/EncGOP.h +++ b/source/Lib/EncoderLib/EncGOP.h @@ -321,7 +321,11 @@ protected: void xWriteDuSEIMessages (SEIMessages& duInfoSeiMessages, AccessUnit &accessUnit, int temporalId, const SPS *sps, std::deque<DUData> &duData); int xWriteVPS (AccessUnit &accessUnit, const VPS *vps); +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + int xWriteDCI (AccessUnit &accessUnit, const DCI *dci); +#else int xWriteDPS (AccessUnit &accessUnit, const DPS *dps); +#endif int xWriteSPS( AccessUnit &accessUnit, const SPS *sps, const int layerId = 0 ); int xWritePPS( AccessUnit &accessUnit, const PPS *pps, const int layerId = 0 ); int xWriteAPS( AccessUnit &accessUnit, APS *aps, const int layerId, const bool isPrefixNUT ); diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 65546a49bcd9b34c7f6292f23e54d1b3f8aa2589..a4b469c63e5c08549cca33e7b3e02f73dc13ae84 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -238,12 +238,19 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) #else xInitSPS( sps0, m_cVPS ); xInitVPS(m_cVPS, sps0); +<<<<<<< HEAD #endif +======= +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + int dciId = getDCIEnabled() ? 1 : 0; + xInitDCI(m_dci, sps0); +#else +>>>>>>> effa8e16... Commit Q0117. HLS clenup: DPS is changed to DCI int dpsId = getDecodingParameterSetEnabled() ? 1 : 0; xInitDPS(m_dps, sps0, dpsId); sps0.setDecodingParameterSetId(m_dps.getDecodingParameterSetId()); - +#endif #if ENABLE_SPLIT_PARALLELISM if( omp_get_dynamic() ) { @@ -1142,6 +1149,16 @@ void EncLib::xInitVPS(VPS& vps, const SPS& sps) } #endif +#if JVET_Q0117_PARAMETER_SETS_CLEANUP +void EncLib::xInitDCI(DCI& dci, const SPS& sps) +{ + dci.setMaxSubLayersMinus1(sps.getMaxTLayers() - 1); + std::vector<ProfileTierLevel> ptls; + ptls.resize(1); + ptls[0] = *sps.getProfileTierLevel(); + dci.setProfileTierLevel(ptls); +} +#else void EncLib::xInitDPS(DPS &dps, const SPS &sps, const int dpsId) { // The SPS must have already been set up. @@ -1153,6 +1170,7 @@ void EncLib::xInitDPS(DPS &dps, const SPS &sps, const int dpsId) ptls[0] = *sps.getProfileTierLevel(); dps.setProfileTierLevel(ptls); } +#endif #if JVET_Q0814_DPB void EncLib::xInitSPS( SPS& sps ) diff --git a/source/Lib/EncoderLib/EncLib.h b/source/Lib/EncoderLib/EncLib.h index b3533ffc4465ae30f7780b13beb8998aff797422..6fe267ae39a078b0cdc815199f4100834b563707 100644 --- a/source/Lib/EncoderLib/EncLib.h +++ b/source/Lib/EncoderLib/EncLib.h @@ -169,12 +169,22 @@ 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. +<<<<<<< HEAD void xInitDPS (DPS &dps, const SPS &sps, const int dpsId); ///< initialize DPS from encoder options #if JVET_Q0814_DPB void xInitVPS( const SPS& sps ); ///< initialize VPS from encoder options void xInitSPS( SPS& sps ); ///< initialize SPS from encoder options #else void xInitVPS(VPS& vps, const SPS& sps); ///< initialize VPS from encoder options +======= + void xInitVPS(VPS& vps, const SPS& sps); ///< initialize VPS from encoder options + +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + void xInitDCI(DCI& dci, const SPS& sps); ///< initialize DPS from encoder options +#else + void xInitDPS (DPS &dps, const SPS &sps, const int dpsId); ///< initialize DPS from encoder options +#endif +>>>>>>> effa8e16... Commit Q0117. HLS clenup: DPS is changed to DCI void xInitSPS ( SPS& sps, VPS& vps ); ///< initialize SPS from encoder options #endif 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 2a2073715e6f5994da039f8963eda8e716855368..1110d0699b6eff1d40d2e1f0721374e7edc272b7 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -854,7 +854,11 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) #if ENABLE_TRACING xTraceSPSHeader (); #endif +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + WRITE_CODE(pcSPS->getSPSId(), 4, "sps_seq_parameter_set_id"); +#else WRITE_CODE( pcSPS->getDecodingParameterSetId (), 4, "sps_decoding_parameter_set_id" ); +#endif WRITE_CODE( pcSPS->getVPSId(), 4, "sps_video_parameter_set_id" ); CHECK(pcSPS->getMaxTLayers() == 0, "Maximum number of temporal sub-layers is '0'"); @@ -880,9 +884,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) #endif WRITE_FLAG(pcSPS->getGDREnabledFlag(), "gdr_enabled_flag"); - +#if !JVET_Q0117_PARAMETER_SETS_CLEANUP WRITE_CODE( pcSPS->getSPSId (), 4, "sps_seq_parameter_set_id" ); - +#endif WRITE_CODE(int(pcSPS->getChromaFormatIdc ()), 2, "chroma_format_idc"); const ChromaFormat format = pcSPS->getChromaFormatIdc(); @@ -1459,7 +1463,28 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } xWriteRbspTrailingBits(); } +#if JVET_Q0117_PARAMETER_SETS_CLEANUP +void HLSWriter::codeDCI(const DCI* dci) +{ +#if ENABLE_TRACING + xTraceDPSHeader(); +#endif + WRITE_CODE(dci->getMaxSubLayersMinus1(), 3, "dci_max_sub_layers_minus1"); + WRITE_CODE(0, 1, "dci_reserved_zero_bit"); + uint32_t numPTLs = (uint32_t)dci->getNumPTLs(); + CHECK(numPTLs < 1, "At least one PTL must be available in DCI"); + WRITE_CODE(numPTLs - 1, 4, "dci_num_ptls_minus1"); + + for (int i = 0; i < numPTLs; i++) + { + ProfileTierLevel ptl = dci->getProfileTierLevel(i); + codeProfileTierLevel(&ptl, 0); + } + WRITE_FLAG(0, "dps_extension_flag"); + xWriteRbspTrailingBits(); +} +#else void HLSWriter::codeDPS( const DPS* dps ) { #if ENABLE_TRACING @@ -1485,7 +1510,7 @@ void HLSWriter::codeDPS( const DPS* dps ) WRITE_FLAG( 0, "dps_extension_flag" ); xWriteRbspTrailingBits(); } - +#endif void HLSWriter::codeVPS(const VPS* pcVPS) { #if ENABLE_TRACING diff --git a/source/Lib/EncoderLib/VLCWriter.h b/source/Lib/EncoderLib/VLCWriter.h index e0704cc210303c837ebf43d3bf57bce3cf7f2680..26f0221d5a3596b798f725fa968d227dcc0af970 100644 --- a/source/Lib/EncoderLib/VLCWriter.h +++ b/source/Lib/EncoderLib/VLCWriter.h @@ -131,10 +131,17 @@ public: void codeLmcsAps ( APS* pcAPS ); void codeScalingListAps ( APS* pcAPS ); void codeVPS ( const VPS* pcVPS ); +#if JVET_Q0117_PARAMETER_SETS_CLEANUP + void codeDCI ( const DCI* dci ); +#else void codeDPS ( const DPS* dps ); +<<<<<<< HEAD #if JVET_Q0775_PH_IN_SH void codePictureHeader ( PicHeader* picHeader, bool writeRbspTrailingBits ); #else +======= +#endif +>>>>>>> effa8e16... Commit Q0117. HLS clenup: DPS is changed to DCI void codePictureHeader ( PicHeader* picHeader ); #endif void codeSliceHeader ( Slice* pcSlice );