frontends/va: Fix finding LTRs from POCs in HEVC decode

This should only consider valid entries, not loop over the entire array.
In addition the array size was wrong before.

Fixes: 779edc0759 ("frontends/va: Correctly derive HEVC StCurrBefore, StCurrAfter and LtCurr")
Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com>
(cherry picked from commit c2a4fa33b8)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41269>
This commit is contained in:
David Rosca 2026-04-17 09:22:00 +02:00 committed by Eric Engestrom
parent b07b674765
commit 3b276be9e5
2 changed files with 4 additions and 2 deletions

View file

@ -1164,7 +1164,7 @@
"description": "frontends/va: Fix finding LTRs from POCs in HEVC decode",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "779edc07598399435d83874e7f0086be9d28317e",
"notes": null

View file

@ -420,7 +420,9 @@ void vlVaDecoderHEVCBitstreamHeader(vlVaContext *context, vlVaBuffer *buf)
/* We know the POCs for all LTRs from slice header, fill the LTR ref pic
* set with them. */
for (uint8_t i = 0; i < ltr_idx; i++) {
for (uint8_t j = 0; j < sizeof(pic->PicOrderCntVal); ++j) {
for (uint8_t j = 0; j < 15; ++j) {
if (!pic->ref[j])
continue;
uint32_t refpoc = pic->PicOrderCntVal[j];
if ((ltr_tmp[i].msb && ltr_tmp[i].poc == refpoc) ||
(!ltr_tmp[i].msb && ltr_tmp[i].poc == refpoc % max_poc)) {