* rocDecode/HEVC: Added in stream DPB buffer size change detection and handling. (#482)

This commit is contained in:
jeffqjiangNew
2024-12-19 17:29:52 -05:00
committed by GitHub
parent 0b24f96bbb
commit 5336913a09
2 changed files with 5 additions and 10 deletions
+5 -9
View File
@@ -1530,9 +1530,6 @@ ParserResult HevcVideoParser::ParseSliceHeader(uint8_t *nalu, size_t size, HevcS
if (m_active_sps_id_ != pps_ptr->pps_seq_parameter_set_id) {
m_active_sps_id_ = pps_ptr->pps_seq_parameter_set_id;
sps_ptr = &sps_list_[m_active_sps_id_];
// Re-set DPB size.
dpb_buffer_.dpb_size = sps_ptr->sps_max_dec_pic_buffering_minus1[sps_ptr->sps_max_sub_layers_minus1] + 1;
dpb_buffer_.dpb_size = dpb_buffer_.dpb_size > HEVC_MAX_DPB_FRAMES ? HEVC_MAX_DPB_FRAMES : dpb_buffer_.dpb_size;
new_seq_activated_ = true; // Note: clear this flag after the actions are taken.
}
sps_ptr = &sps_list_[m_active_sps_id_];
@@ -1551,14 +1548,13 @@ ParserResult HevcVideoParser::ParseSliceHeader(uint8_t *nalu, size_t size, HevcS
pic_width_ = sps_ptr->pic_width_in_luma_samples;
pic_height_ = sps_ptr->pic_height_in_luma_samples;
// Take care of the case where a new SPS replaces the old SPS with the same id but with different dimensions
// Re-set DPB size.
dpb_buffer_.dpb_size = sps_ptr->sps_max_dec_pic_buffering_minus1[sps_ptr->sps_max_sub_layers_minus1] + 1;
dpb_buffer_.dpb_size = dpb_buffer_.dpb_size > HEVC_MAX_DPB_FRAMES ? HEVC_MAX_DPB_FRAMES : dpb_buffer_.dpb_size;
new_seq_activated_ = true; // Note: clear this flag after the actions are taken.
}
// Check and adjust decode buffer pool size if needed
if (new_seq_activated_) {
// Check DPB buffer size change
uint32_t max_dec_pic_buffering = sps_ptr->sps_max_dec_pic_buffering_minus1[sps_ptr->sps_max_sub_layers_minus1] + 1;
if (dpb_buffer_.dpb_size != max_dec_pic_buffering) {
dpb_buffer_.dpb_size = max_dec_pic_buffering;
dpb_buffer_.dpb_size = dpb_buffer_.dpb_size > HEVC_MAX_DPB_FRAMES ? HEVC_MAX_DPB_FRAMES : dpb_buffer_.dpb_size;
CheckAndAdjustDecBufPoolSize(dpb_buffer_.dpb_size);
}