From 8d44a48ee0fbf50e347036063da5a01df9ee7957 Mon Sep 17 00:00:00 2001 From: jeffqjiangNew <142832361+jeffqjiangNew@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:08:19 -0500 Subject: [PATCH] Fixed a bug in reference picture list modification parsing. (#143) * * rocDecode/HEVC: Fixed the random crash associated with undecodable RASL pictures. - When a CRA picutre occurs, all the pictures in the DPB are emptied. However, the following RASL (Random Access Skipped Leading) picture can still reference these emptied pictures, making them undecodeble. - We initialized the reference picture lists with (0xFF), representing invalid picture index. Normally these invalid indices are replaced by valid values during RPS decoding. However, on undecodable RASL pictures, we can not find an existing reference picture in DPB, leaving the invalid index untouched and resulting invalid indexing later on. - Now we initialize the reference picture lists with a valid value 0. Also we add index range check on reference buffer at VA-API layer to avoid invalid memory access. * * rocDecode/HEVC: Fixed a typo in sampel app message. * *rocDecode/HEVC: Fixed a bug in reference picture list modification parsing. - This fixed the test failure of two conformance streams. [ROCm/rocdecode commit: c9cfcde12df31faadadc2388d457f75989b9c7c0] --- projects/rocdecode/src/parser/hevc_parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/rocdecode/src/parser/hevc_parser.cpp b/projects/rocdecode/src/parser/hevc_parser.cpp index a60ba63ea8..83d173890f 100644 --- a/projects/rocdecode/src/parser/hevc_parser.cpp +++ b/projects/rocdecode/src/parser/hevc_parser.cpp @@ -1781,7 +1781,7 @@ bool HEVCVideoParser::ParseSliceHeader(uint8_t *nalu, size_t size) { m_sh_->ref_pic_list_modification_flag_l0 = Parser::GetBit(nalu, offset); if (m_sh_->ref_pic_list_modification_flag_l0) { - for (int i = 0; i < m_sh_->num_ref_idx_l0_active_minus1; i++) { + for (int i = 0; i <= m_sh_->num_ref_idx_l0_active_minus1; i++) { m_sh_->list_entry_l0[i] = Parser::ReadBits(nalu, offset, list_entry_bits); } } @@ -1789,7 +1789,7 @@ bool HEVCVideoParser::ParseSliceHeader(uint8_t *nalu, size_t size) { if (m_sh_->slice_type == HEVC_SLICE_TYPE_B) { m_sh_->ref_pic_list_modification_flag_l1 = Parser::GetBit(nalu, offset); if (m_sh_->ref_pic_list_modification_flag_l1) { - for (int i = 0; i < m_sh_->num_ref_idx_l1_active_minus1; i++) { + for (int i = 0; i <= m_sh_->num_ref_idx_l1_active_minus1; i++) { m_sh_->list_entry_l1[i] = Parser::ReadBits(nalu, offset, list_entry_bits); } }