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>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41016>
This commit is contained in:
David Rosca 2026-04-17 09:22:00 +02:00 committed by Marge Bot
parent 630a4d2249
commit c2a4fa33b8

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)) {