From d9e7eb067d36768d82f5412a23705e48174e75d3 Mon Sep 17 00:00:00 2001 From: biaowang <biao.wang@huawei.com> Date: Tue, 11 Feb 2020 20:30:00 +0100 Subject: [PATCH] JVET-P0117:Scalability - PTL and decoder capability --- source/Lib/CommonLib/Slice.cpp | 4 +++ source/Lib/CommonLib/Slice.h | 11 ++++++ source/Lib/CommonLib/TypeDef.h | 2 ++ source/Lib/DecoderLib/VLCReader.cpp | 52 +++++++++++++++++++++++++++-- source/Lib/DecoderLib/VLCReader.h | 4 ++- source/Lib/EncoderLib/VLCWriter.cpp | 46 +++++++++++++++++++++++-- source/Lib/EncoderLib/VLCWriter.h | 4 ++- 7 files changed, 116 insertions(+), 7 deletions(-) diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 94b0c5405c..18d1c2dee8 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -2056,6 +2056,10 @@ SPS::SPS() , m_chromaFormatIdc (CHROMA_420) , m_separateColourPlaneFlag ( 0 ) , m_uiMaxTLayers ( 1) +#if JVET_P0117_PTL_SCALABILITY +, m_ptlDpbHrdParamsPresentFlag (1) +, m_SubLayerDpbParamsFlag (0) +#endif // Structure , m_maxWidthInLumaSamples (352) , m_maxHeightInLumaSamples (288) diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 5add6de938..517d6db5a8 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -1201,6 +1201,11 @@ private: uint32_t m_uiMaxTLayers; // maximum number of temporal layers +#if JVET_P0117_PTL_SCALABILITY + bool m_ptlDpbHrdParamsPresentFlag; + bool m_SubLayerDpbParamsFlag; +#endif + // Structure uint32_t m_maxWidthInLumaSamples; uint32_t m_maxHeightInLumaSamples; @@ -1581,6 +1586,12 @@ void setCCALFEnabledFlag( bool b ) uint32_t getMaxTLayers() const { return m_uiMaxTLayers; } void setMaxTLayers( uint32_t uiMaxTLayers ) { CHECK( uiMaxTLayers > MAX_TLAYER, "Invalid number T-layers" ); m_uiMaxTLayers = uiMaxTLayers; } +#if JVET_P0117_PTL_SCALABILITY + bool getPtlDpbHrdParamsPresentFlag() const { return m_ptlDpbHrdParamsPresentFlag; } + void setPtlDpbHrdParamsPresentFlag(bool b) { m_ptlDpbHrdParamsPresentFlag = b; } + bool getSubLayerDpbParamsFlag() const { return m_SubLayerDpbParamsFlag; } + void setSubLayerDpbParamsFlag(bool b) { m_SubLayerDpbParamsFlag = b; } +#endif bool getTemporalIdNestingFlag() const { return m_bTemporalIdNestingFlag; } void setTemporalIdNestingFlag( bool bValue ) { m_bTemporalIdNestingFlag = bValue; } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index c3b0b4a289..3d86b86838 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -50,6 +50,8 @@ #include <assert.h> #include <cassert> +#define JVET_P0117_PTL_SCALABILITY 1 // JVET-P0117: sps_ptl_dpb_hrd_params_present_flag related syntax change, others in JVET-Q0786 + #define JVET_Q0505_CHROAM_QM_SIGNALING_400 1 //JVET-Q0505: Cleanup of chroma quantization matrix signaling for 400 color format #define JVET_Q0786_PTL_only 1 // JVET-Q0786: modifications to VPS syntax - PTL part only (signal PTL for single layer OLSs) diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 05325441f3..26ebcfdae0 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -1271,6 +1271,21 @@ void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, uint32_t firstSubLay } } +#if JVET_P0117_PTL_SCALABILITY +void HLSyntaxReader::dpb_parameters(int maxSubLayersMinus1, bool subLayerInfoFlag, SPS *pcSPS) +{ + uint32_t uiCode; + for (int i = (subLayerInfoFlag ? 0 : maxSubLayersMinus1); i <= maxSubLayersMinus1; i++) + { + READ_UVLC(uiCode, "sps_max_dec_pic_buffering_minus1[i]"); + pcSPS->setMaxDecPicBuffering(uiCode + 1, i); + READ_UVLC(uiCode, "sps_max_num_reorder_pics[i]"); + pcSPS->setNumReorderPics(uiCode, i); + READ_UVLC(uiCode, "sps_max_latency_increase_plus1[i]"); + pcSPS->setMaxLatencyIncreasePlus1(uiCode, i); + } +} +#endif void HLSyntaxReader::parseSPS(SPS* pcSPS) { @@ -1283,13 +1298,28 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) 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"); +#if JVET_P0117_PTL_SCALABILITY + READ_CODE(4, uiCode, "sps_reserved_zero_4bits"); + CHECK(uiCode != 0, "sps_reserved_zero_4bits not equal to zero"); + READ_FLAG(uiCode, "sps_ptl_dpb_hrd_params_present_flag"); pcSPS->setPtlDpbHrdParamsPresentFlag(uiCode); +#else READ_CODE(5, uiCode, "sps_reserved_zero_5bits"); CHECK(uiCode != 0, "sps_reserved_zero_5bits not equal to zero"); +#endif + +#if JVET_P0117_PTL_SCALABILITY + if (pcSPS->getPtlDpbHrdParamsPresentFlag()) + { +#endif #if JVET_Q0786_PTL_only - parseProfileTierLevel(pcSPS->getProfileTierLevel(), true, pcSPS->getMaxTLayers() - 1); + parseProfileTierLevel(pcSPS->getProfileTierLevel(), true, pcSPS->getMaxTLayers() - 1); #else - parseProfileTierLevel(pcSPS->getProfileTierLevel(), pcSPS->getMaxTLayers() - 1); + parseProfileTierLevel(pcSPS->getProfileTierLevel(), pcSPS->getMaxTLayers() - 1); +#endif + +#if JVET_P0117_PTL_SCALABILITY + } #endif READ_FLAG(uiCode, "gdr_enabled_flag"); @@ -1527,6 +1557,16 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_CODE(4, uiCode, "log2_max_pic_order_cnt_lsb_minus4"); pcSPS->setBitsForPOC( 4 + uiCode ); CHECK(uiCode > 12, "Invalid code"); +#if JVET_P0117_PTL_SCALABILITY + if (pcSPS->getMaxTLayers() - 1 > 0) + { + READ_FLAG(uiCode, "sps_sublayer_dpb_params_flag"); pcSPS->setSubLayerDpbParamsFlag(uiCode ? true : false); + } + if (pcSPS->getPtlDpbHrdParamsPresentFlag()) + { + dpb_parameters(pcSPS->getMaxTLayers() - 1, pcSPS->getSubLayerDpbParamsFlag(), pcSPS); + } +#else // KJS: Marakech decision: sub-layers added back uint32_t subLayerOrderingInfoPresentFlag; if (pcSPS->getMaxTLayers() > 1) @@ -1558,6 +1598,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) break; } } +#endif READ_FLAG(uiCode, "long_term_ref_pics_flag"); pcSPS->setLongTermRefsPresent(uiCode); READ_FLAG( uiCode, "inter_layer_ref_pics_present_flag" ); pcSPS->setInterLayerPresentFlag( uiCode ); @@ -1957,6 +1998,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setNumHorVirtualBoundaries( 0 ); } +#if JVET_P0117_PTL_SCALABILITY + if (pcSPS->getPtlDpbHrdParamsPresentFlag()) + { +#endif TimingInfo *timingInfo = pcSPS->getTimingInfo(); READ_FLAG( uiCode, "general_hrd_parameters_present_flag"); pcSPS->setHrdParametersPresentFlag(uiCode); if( pcSPS->getHrdParametersPresentFlag() ) @@ -1974,6 +2019,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) parseHrdParameters(pcSPS->getHrdParameters(), pcSPS->getMaxTLayers() - 1, pcSPS->getMaxTLayers() - 1); } } +#if JVET_P0117_PTL_SCALABILITY + } +#endif #if JVET_Q0042_VUI READ_FLAG( uiCode, "field_seq_flag"); pcSPS->setFieldSeqFlag(uiCode); diff --git a/source/Lib/DecoderLib/VLCReader.h b/source/Lib/DecoderLib/VLCReader.h index cf68f5d2d4..fc59342f78 100644 --- a/source/Lib/DecoderLib/VLCReader.h +++ b/source/Lib/DecoderLib/VLCReader.h @@ -192,7 +192,9 @@ public: #if JVET_Q0795_CCALF void ccAlfFilter( Slice *pcSlice ); #endif - +#if JVET_P0117_PTL_SCALABILITY + void dpb_parameters(int maxSubLayersMinus1, bool subLayerInfoFlag, SPS *pcSPS); +#endif private: #if !JVET_Q0210_UEK_REMOVAL int alfGolombDecode( const int k, const bool signed_val=true ); diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 2ad1b2d30b..f3df2dcf7a 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -837,6 +837,17 @@ void HLSWriter::codeHrdParameters( const HRDParameters *hrd, const uint32_t firs } } +#if JVET_P0117_PTL_SCALABILITY +void HLSWriter::dpb_parameters(int maxSubLayersMinus1, bool subLayerInfoFlag, const SPS *pcSPS) +{ + for (uint32_t i = (subLayerInfoFlag ? 0 : maxSubLayersMinus1); i <= maxSubLayersMinus1; i++) + { + WRITE_UVLC(pcSPS->getMaxDecPicBuffering(i) - 1, "max_dec_pic_buffering_minus1[i]"); + WRITE_UVLC(pcSPS->getNumReorderPics(i), "max_num_reorder_pics[i]"); + WRITE_UVLC(pcSPS->getMaxLatencyIncreasePlus1(i), "max_latency_increase_plus1[i]"); + } +} +#endif void HLSWriter::codeSPS( const SPS* pcSPS ) { @@ -848,13 +859,26 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) CHECK(pcSPS->getMaxTLayers() == 0, "Maximum number of temporal sub-layers is '0'"); WRITE_CODE(pcSPS->getMaxTLayers() - 1, 3, "sps_max_sub_layers_minus1"); +#if JVET_P0117_PTL_SCALABILITY + WRITE_CODE(0, 4, "sps_reserved_zero_4bits"); + WRITE_FLAG(pcSPS->getPtlDpbHrdParamsPresentFlag(), "sps_ptl_dpb_hrd_params_present_flag"); +#else WRITE_CODE(0, 5, "sps_reserved_zero_5bits"); +#endif +#if JVET_P0117_PTL_SCALABILITY + if (pcSPS->getPtlDpbHrdParamsPresentFlag()) + { +#endif #if JVET_Q0786_PTL_only - codeProfileTierLevel( pcSPS->getProfileTierLevel(), true, pcSPS->getMaxTLayers() - 1 ); + codeProfileTierLevel(pcSPS->getProfileTierLevel(), true, pcSPS->getMaxTLayers() - 1); #else - codeProfileTierLevel( pcSPS->getProfileTierLevel(), pcSPS->getMaxTLayers() - 1 ); + codeProfileTierLevel(pcSPS->getProfileTierLevel(), pcSPS->getMaxTLayers() - 1); +#endif +#if JVET_P0117_PTL_SCALABILITY + } #endif + WRITE_FLAG(pcSPS->getGDREnabledFlag(), "gdr_enabled_flag"); WRITE_CODE( pcSPS->getSPSId (), 4, "sps_seq_parameter_set_id" ); @@ -996,6 +1020,15 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getUseWPBiPred() ? 1 : 0, "sps_weighted_bipred_flag" ); // Use of Weighting Bi-Prediction (B_SLICE) WRITE_CODE(pcSPS->getBitsForPOC()-4, 4, "log2_max_pic_order_cnt_lsb_minus4"); + +#if JVET_P0117_PTL_SCALABILITY + if (pcSPS->getMaxTLayers() - 1 > 0) + WRITE_FLAG(pcSPS->getSubLayerDpbParamsFlag(), "sps_sublayer_dpb_params_flag"); + if (pcSPS->getPtlDpbHrdParamsPresentFlag()) + { + dpb_parameters(pcSPS->getMaxTLayers() - 1, pcSPS->getSubLayerDpbParamsFlag(), pcSPS); + } +#else // KJS: Marakech decision: sub-layers added back const bool subLayerOrderingInfoPresentFlag = 1; if (pcSPS->getMaxTLayers() > 1) @@ -1012,6 +1045,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) break; } } +#endif CHECK( pcSPS->getMaxCUWidth() != pcSPS->getMaxCUHeight(), "Rectangular CTUs not supported" ); WRITE_FLAG(pcSPS->getLongTermRefsPresent() ? 1 : 0, "long_term_ref_pics_flag"); WRITE_FLAG( pcSPS->getInterLayerPresentFlag() ? 1 : 0, "inter_layer_ref_pics_present_flag" ); @@ -1309,7 +1343,10 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_CODE((pcSPS->getVirtualBoundariesPosY(i)>>3), 13, "sps_virtual_boundaries_pos_y"); } } - +#if JVET_P0117_PTL_SCALABILITY + if (pcSPS->getPtlDpbHrdParamsPresentFlag()) + { +#endif const TimingInfo *timingInfo = pcSPS->getTimingInfo(); WRITE_FLAG(pcSPS->getHrdParametersPresentFlag(), "general_hrd_parameters_present_flag"); if( pcSPS->getHrdParametersPresentFlag() ) @@ -1326,6 +1363,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) codeHrdParameters(pcSPS->getHrdParameters(), pcSPS->getMaxTLayers() - 1, pcSPS->getMaxTLayers() - 1); } } +#if JVET_P0117_PTL_SCALABILITY + } +#endif #if JVET_Q0042_VUI WRITE_FLAG(pcSPS->getFieldSeqFlag(), "field_seq_flag"); diff --git a/source/Lib/EncoderLib/VLCWriter.h b/source/Lib/EncoderLib/VLCWriter.h index 01e8ed40ec..0b447bbb1d 100644 --- a/source/Lib/EncoderLib/VLCWriter.h +++ b/source/Lib/EncoderLib/VLCWriter.h @@ -150,7 +150,9 @@ public: void codeScalingList ( const ScalingList &scalingList ); void alfFilter( const AlfParam& alfParam, const bool isChroma, const int altIdx ); - +#if JVET_P0117_PTL_SCALABILITY + void dpb_parameters(int maxSubLayersMinus1, bool subLayerInfoFlag, const SPS *pcSPS); +#endif private: #if !JVET_Q0210_UEK_REMOVAL void alfGolombEncode( const int coeff, const int k, const bool signed_coeff=true ); -- GitLab