frontends/va: Only keep current slice RefPicList for HEVC

This is only used for slice header parsing now.

Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34698>
This commit is contained in:
David Rosca 2025-05-06 16:54:05 +02:00 committed by Marge Bot
parent 639a95cd77
commit 5edac5cd92
2 changed files with 7 additions and 8 deletions

View file

@ -277,11 +277,11 @@ void vlVaHandleSliceParameterBufferHEVC(vlVaContext *context, vlVaBuffer *buf)
/* Depending on slice_type, only update relevant reference */
case 0: /* HEVC_SLICE_B */
for (int j = 0 ; j < 15 ; j++)
context->desc.h265.RefPicList[slice_index][1][j] = h265->RefPicList[1][j];
context->desc.h265.RefPicList[1][j] = h265->RefPicList[1][j];
FALLTHROUGH;
case 1: /* HEVC_SLICE_P */
for (int j = 0 ; j < 15 ; j++)
context->desc.h265.RefPicList[slice_index][0][j] = h265->RefPicList[0][j];
context->desc.h265.RefPicList[0][j] = h265->RefPicList[0][j];
FALLTHROUGH;
default:
break;
@ -443,7 +443,6 @@ void vlVaDecoderHEVCBitstreamHeader(vlVaContext *context, vlVaBuffer *buf)
vl_rbsp_u(&rbsp, 1); /* slice_sao_chroma_flag */
}
unsigned cur_slice = pic->slice_parameter.slice_count - 1;
unsigned ltr_start = pic->NumPocStCurrBefore + pic->NumPocStCurrAfter;
unsigned ref_pic_list_modification_flag_l0 = 0, ref_pic_list_modification_flag_l1 = 0;
@ -464,7 +463,7 @@ void vlVaDecoderHEVCBitstreamHeader(vlVaContext *context, vlVaBuffer *buf)
for (unsigned i = 0; i <= num_ref_l0_minus1; i++) {
unsigned idx = vl_rbsp_u(&rbsp, num_bits);
if (idx >= ltr_start && idx < ltr_start + num_long_term_sps)
pic->RefPicSetLtCurr[idx - ltr_start] = pic->RefPicList[cur_slice][0][i];
pic->RefPicSetLtCurr[idx - ltr_start] = pic->RefPicList[0][i];
}
}
if (slice_type == PIPE_H265_SLICE_TYPE_B) {
@ -475,7 +474,7 @@ void vlVaDecoderHEVCBitstreamHeader(vlVaContext *context, vlVaBuffer *buf)
for (unsigned i = 0; i <= num_ref_l1_minus1; i++) {
unsigned idx = vl_rbsp_u(&rbsp, num_bits);
if (idx >= ltr_start && idx < ltr_start + num_long_term_sps)
pic->RefPicSetLtCurr[idx - ltr_start] = pic->RefPicList[cur_slice][1][i];
pic->RefPicSetLtCurr[idx - ltr_start] = pic->RefPicList[1][i];
}
}
}
@ -483,7 +482,7 @@ void vlVaDecoderHEVCBitstreamHeader(vlVaContext *context, vlVaBuffer *buf)
/* If no modification is used, we can use the RefPicList directly. */
if (!ref_pic_list_modification_flag_l0) {
for (unsigned i = 0; i < pic->NumPocLtCurr; i++) {
uint8_t idx = pic->RefPicList[cur_slice][0][i + ltr_start];
uint8_t idx = pic->RefPicList[0][i + ltr_start];
if (i < num_long_term_sps) {
assert(idx != 0xff);
pic->RefPicSetLtCurr[i] = idx;
@ -494,7 +493,7 @@ void vlVaDecoderHEVCBitstreamHeader(vlVaContext *context, vlVaBuffer *buf)
pic->LtCurrDone = true;
} else if (slice_type == PIPE_H265_SLICE_TYPE_B && !ref_pic_list_modification_flag_l1) {
for (unsigned i = 0; i < pic->NumPocLtCurr; i++) {
uint8_t idx = pic->RefPicList[cur_slice][1][i + ltr_start];
uint8_t idx = pic->RefPicList[1][i + ltr_start];
if (i < num_long_term_sps) {
assert(idx != 0xff);
pic->RefPicSetLtCurr[i] = idx;

View file

@ -1706,7 +1706,7 @@ struct pipe_h265_picture_desc
uint8_t RefPicSetStCurrBefore[8];
uint8_t RefPicSetStCurrAfter[8];
uint8_t RefPicSetLtCurr[8];
uint8_t RefPicList[PIPE_H265_MAX_SLICES][2][15];
uint8_t RefPicList[2][15];
bool UseRefPicList;
bool UseStRpsBits;
bool LtCurrDone;