diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 81c41b921f15a6cc8240ceebc1310955dd00e582..f358314bfc9a4c3eaa42ae8a31d7b1ee244b2187 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -2310,7 +2310,7 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) } #if JVET_R0191_ASPECT3 - CHECK( pcVPS->m_numDpbParams > pcVPS->getNumMultiLayeredOlss(),"The value of vps_num_dpb_params_minus1 shall be in the range of 0 to NumMultiLayerOlss ? 1, inclusive"); + CHECK( pcVPS->m_numDpbParams > pcVPS->getNumMultiLayeredOlss(),"The value of vps_num_dpb_params_minus1 shall be in the range of 0 to NumMultiLayerOlss - 1, inclusive"); std::vector<bool> isDPBParamReferred(pcVPS->m_numDpbParams, false); #endif @@ -2384,7 +2384,7 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) #if JVET_R0191_ASPECT3 for( int i = 0; i < pcVPS->m_numDpbParams; i++ ) { - CHECK( !isDPBParamReferred[i],"Each dpb_parameters( ) syntax structure in the VPS shall be referred to by at least one value of vps_ols_dpb_params_idx[i] for i in the range of 0 to NumMultiLayerOlss ? 1, inclusive"); + CHECK( !isDPBParamReferred[i],"Each dpb_parameters( ) syntax structure in the VPS shall be referred to by at least one value of vps_ols_dpb_params_idx[i] for i in the range of 0 to NumMultiLayerOlss - 1, inclusive"); } #endif if (!pcVPS->getEachLayerIsAnOlsFlag()) @@ -2405,7 +2405,7 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) READ_UVLC(uiCode, "num_ols_hrd_params_minus1"); pcVPS->setNumOlsHrdParamsMinus1(uiCode); #if JVET_R0191_ASPECT3 - CHECK( uiCode >= pcVPS->getNumMultiLayeredOlss(),"The value of vps_num_ols_hrd_params_minus1 shall be in the range of 0 to NumMultiLayerOlss ? 1, inclusive"); + CHECK( uiCode >= pcVPS->getNumMultiLayeredOlss(),"The value of vps_num_ols_hrd_params_minus1 shall be in the range of 0 to NumMultiLayerOlss - 1, inclusive"); std::vector<bool> isHRDParamReferred( uiCode + 1, false); #else CHECK(uiCode >= pcVPS->getTotalNumOLSs(),"The value of num_ols_hrd_params_minus1 shall be in the range of 0 to TotalNumOlss - 1, inclusive"); @@ -2458,7 +2458,7 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) #if JVET_R0191_ASPECT3 for( int i = 0; i <= pcVPS->getNumOlsHrdParamsMinus1(); i++ ) { - CHECK( !isHRDParamReferred[i], "Each ols_hrd_parameters( ) syntax structure in the VPS shall be referred to by at least one value of vps_ols_hrd_idx[ i ] for i in the range of 1 to NumMultiLayerOlss ? 1, inclusive"); + CHECK( !isHRDParamReferred[i], "Each ols_hrd_parameters( ) syntax structure in the VPS shall be referred to by at least one value of vps_ols_hrd_idx[ i ] for i in the range of 1 to NumMultiLayerOlss - 1, inclusive"); } #endif } diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index f3712e73bcd3f8d7dc8397be85c34bece3a43dec..6f8c06a57d37f25c1f2e14af1b46a3d7d9c5dc71 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -985,10 +985,10 @@ void EncLib::xInitVPS( const SPS& sps ) m_vps->deriveOutputLayerSets(); m_vps->deriveTargetOutputLayerSet( m_vps->m_targetOlsIdx ); - // number of the DPB parameters is set equal to the number of OLS - if( !m_vps->getAllIndependentLayersFlag() ) + // number of the DPB parameters is set equal to the number of OLS containing multi layers + if( !m_vps->getEachLayerIsAnOlsFlag() ) { - m_vps->m_numDpbParams = m_vps->m_totalNumOLSs; + m_vps->m_numDpbParams = m_vps->getNumMultiLayeredOlss(); } if( m_vps->m_dpbParameters.size() != m_vps->m_numDpbParams ) @@ -1001,56 +1001,64 @@ void EncLib::xInitVPS( const SPS& sps ) m_vps->m_dpbMaxTemporalId.resize( m_vps->m_numDpbParams ); } - for( int olsIdx = 0; olsIdx < m_vps->m_numOutputLayersInOls.size(); olsIdx++ ) + for( int olsIdx = 0, dpbIdx = 0; olsIdx < m_vps->m_numOutputLayersInOls.size(); olsIdx++ ) { - if( std::find( m_vps->m_layerIdInOls[olsIdx].begin(), m_vps->m_layerIdInOls[olsIdx].end(), m_layerId ) != m_vps->m_layerIdInOls[olsIdx].end() ) - { - m_vps->setOlsDpbPicWidth( olsIdx, std::max<int>( sps.getMaxPicWidthInLumaSamples(), m_vps->getOlsDpbPicSize( olsIdx ).width ) ); - m_vps->setOlsDpbPicHeight( olsIdx, std::max<int>( sps.getMaxPicHeightInLumaSamples(), m_vps->getOlsDpbPicSize( olsIdx ).height ) ); - } + if ( m_vps->getNumLayersInOls(olsIdx) > 1 ) + { + if( std::find( m_vps->m_layerIdInOls[olsIdx].begin(), m_vps->m_layerIdInOls[olsIdx].end(), m_layerId ) != m_vps->m_layerIdInOls[olsIdx].end() ) + { + m_vps->setOlsDpbPicWidth( olsIdx, std::max<int>( sps.getMaxPicWidthInLumaSamples(), m_vps->getOlsDpbPicSize( olsIdx ).width ) ); + m_vps->setOlsDpbPicHeight( olsIdx, std::max<int>( sps.getMaxPicHeightInLumaSamples(), m_vps->getOlsDpbPicSize( olsIdx ).height ) ); + } - m_vps->setOlsDpbParamsIdx( olsIdx, olsIdx ); + m_vps->setOlsDpbParamsIdx( olsIdx, dpbIdx ); + dpbIdx++; + } } - for( int i = 0; i < m_vps->m_numDpbParams; i++ ) + //for( int i = 0; i < m_vps->m_numDpbParams; i++ ) + for( int i = 0; i < m_vps->m_numOutputLayersInOls.size(); i++ ) { - int olsIdx = i; + if ( m_vps->getNumLayersInOls(i) > 1 ) + { + int dpbIdx = m_vps->getOlsDpbParamsIdx( i ); - if( m_vps->getMaxSubLayers() == 1 ) - { - // When vps_max_sublayers_minus1 is equal to 0, the value of dpb_max_temporal_id[ i ] is inferred to be equal to 0. - m_vps->m_dpbMaxTemporalId[i] = 0; - } - else - { - if( m_vps->getAllLayersSameNumSublayersFlag() ) + if( m_vps->getMaxSubLayers() == 1 ) { - // When vps_max_sublayers_minus1 is greater than 0 and vps_all_layers_same_num_sublayers_flag is equal to 1, the value of dpb_max_temporal_id[ i ] is inferred to be equal to vps_max_sublayers_minus1. - m_vps->m_dpbMaxTemporalId[i] = m_vps->getMaxSubLayers() - 1; + // When vps_max_sublayers_minus1 is equal to 0, the value of dpb_max_temporal_id[ dpbIdx ] is inferred to be equal to 0. + m_vps->m_dpbMaxTemporalId[dpbIdx] = 0; } else { - m_vps->m_dpbMaxTemporalId[i] = m_maxTempLayer; + if( m_vps->getAllLayersSameNumSublayersFlag() ) + { + // When vps_max_sublayers_minus1 is greater than 0 and vps_all_layers_same_num_sublayers_flag is equal to 1, the value of dpb_max_temporal_id[ dpbIdx ] is inferred to be equal to vps_max_sublayers_minus1. + m_vps->m_dpbMaxTemporalId[dpbIdx] = m_vps->getMaxSubLayers() - 1; + } + else + { + m_vps->m_dpbMaxTemporalId[dpbIdx] = m_maxTempLayer; + } + } + + for( int j = ( m_vps->m_sublayerDpbParamsPresentFlag ? 0 : m_vps->m_dpbMaxTemporalId[dpbIdx] ); j <= m_vps->m_dpbMaxTemporalId[dpbIdx]; j++ ) + { + m_vps->m_dpbParameters[dpbIdx].m_maxDecPicBuffering[j] = profileLevelTierFeatures.getMaxDpbSize( m_vps->getOlsDpbPicSize( i ).width * m_vps->getOlsDpbPicSize( i ).height ); + m_vps->m_dpbParameters[dpbIdx].m_numReorderPics[j] = m_vps->m_dpbParameters[dpbIdx].m_maxDecPicBuffering[j]; + m_vps->m_dpbParameters[dpbIdx].m_maxLatencyIncreasePlus1[j] = 0; } - } - for( int j = ( m_vps->m_sublayerDpbParamsPresentFlag ? 0 : m_vps->m_dpbMaxTemporalId[i] ); j <= m_vps->m_dpbMaxTemporalId[i]; j++ ) - { - m_vps->m_dpbParameters[i].m_maxDecPicBuffering[j] = profileLevelTierFeatures.getMaxDpbSize( m_vps->getOlsDpbPicSize( olsIdx ).width * m_vps->getOlsDpbPicSize( olsIdx ).height ); - m_vps->m_dpbParameters[i].m_numReorderPics[j] = m_vps->m_dpbParameters[i].m_maxDecPicBuffering[j]; - m_vps->m_dpbParameters[i].m_maxLatencyIncreasePlus1[j] = 0; - } - - for( int j = ( m_vps->m_sublayerDpbParamsPresentFlag ? m_vps->m_dpbMaxTemporalId[i] : 0 ); j < m_vps->m_dpbMaxTemporalId[i]; j++ ) - { - // When max_dec_pic_buffering_minus1[ i ] is not present for i in the range of 0 to maxSubLayersMinus1 - 1, inclusive, due to subLayerInfoFlag being equal to 0, it is inferred to be equal to max_dec_pic_buffering_minus1[ maxSubLayersMinus1 ]. - m_vps->m_dpbParameters[i].m_maxDecPicBuffering[j] = m_vps->m_dpbParameters[i].m_maxDecPicBuffering[m_vps->m_dpbMaxTemporalId[i]]; + for( int j = ( m_vps->m_sublayerDpbParamsPresentFlag ? m_vps->m_dpbMaxTemporalId[dpbIdx] : 0 ); j < m_vps->m_dpbMaxTemporalId[dpbIdx]; j++ ) + { + // When max_dec_pic_buffering_minus1[ dpbIdx ] is not present for dpbIdx in the range of 0 to maxSubLayersMinus1 - 1, inclusive, due to subLayerInfoFlag being equal to 0, it is inferred to be equal to max_dec_pic_buffering_minus1[ maxSubLayersMinus1 ]. + m_vps->m_dpbParameters[dpbIdx].m_maxDecPicBuffering[j] = m_vps->m_dpbParameters[dpbIdx].m_maxDecPicBuffering[m_vps->m_dpbMaxTemporalId[dpbIdx]]; - // When max_num_reorder_pics[ i ] is not present for i in the range of 0 to maxSubLayersMinus1 - 1, inclusive, due to subLayerInfoFlag being equal to 0, it is inferred to be equal to max_num_reorder_pics[ maxSubLayersMinus1 ]. - m_vps->m_dpbParameters[i].m_numReorderPics[j] = m_vps->m_dpbParameters[i].m_numReorderPics[m_vps->m_dpbMaxTemporalId[i]]; + // When max_num_reorder_pics[ dpbIdx ] is not present for dpbIdx in the range of 0 to maxSubLayersMinus1 - 1, inclusive, due to subLayerInfoFlag being equal to 0, it is inferred to be equal to max_num_reorder_pics[ maxSubLayersMinus1 ]. + m_vps->m_dpbParameters[dpbIdx].m_numReorderPics[j] = m_vps->m_dpbParameters[dpbIdx].m_numReorderPics[m_vps->m_dpbMaxTemporalId[dpbIdx]]; - // When max_latency_increase_plus1[ i ] is not present for i in the range of 0 to maxSubLayersMinus1 - 1, inclusive, due to subLayerInfoFlag being equal to 0, it is inferred to be equal to max_latency_increase_plus1[ maxSubLayersMinus1 ]. - m_vps->m_dpbParameters[i].m_maxLatencyIncreasePlus1[j] = m_vps->m_dpbParameters[i].m_maxLatencyIncreasePlus1[m_vps->m_dpbMaxTemporalId[i]]; + // When max_latency_increase_plus1[ dpbIdx ] is not present for dpbIdx in the range of 0 to maxSubLayersMinus1 - 1, inclusive, due to subLayerInfoFlag being equal to 0, it is inferred to be equal to max_latency_increase_plus1[ maxSubLayersMinus1 ]. + m_vps->m_dpbParameters[dpbIdx].m_maxLatencyIncreasePlus1[j] = m_vps->m_dpbParameters[dpbIdx].m_maxLatencyIncreasePlus1[m_vps->m_dpbMaxTemporalId[dpbIdx]]; + } } } }