From 1d3cb3f188fc59061b1f70c78bd72742e42aa804 Mon Sep 17 00:00:00 2001 From: Jasber Chen Date: Wed, 23 Nov 2022 10:14:31 +0800 Subject: [PATCH] frontends/va: partially updating RefPicList depends on slice type problem casused by one frame with multiple slices and different slices type. Invalid referenced values came from slice P/I would overwrite previous update. Signed-off-by: Jasber Chen Reviewed-by: Boyuan Zhang Part-of: --- src/gallium/frontends/va/picture_hevc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/va/picture_hevc.c b/src/gallium/frontends/va/picture_hevc.c index 881adda03a6..783ddb828a6 100644 --- a/src/gallium/frontends/va/picture_hevc.c +++ b/src/gallium/frontends/va/picture_hevc.c @@ -228,9 +228,19 @@ void vlVaHandleSliceParameterBufferHEVC(vlVaContext *context, vlVaBuffer *buf) VASliceParameterBufferHEVC *h265 = buf->data; assert(buf->size >= sizeof(VASliceParameterBufferHEVC) && buf->num_elements == 1); - for (int i = 0 ; i < 2 ; i++) { + + switch(h265->LongSliceFlags.fields.slice_type) { + /* Depending on slice_type, only update relevant reference */ + case 0: /* HEVC_SLICE_B */ for (int j = 0 ; j < 15 ; j++) - context->desc.h265.RefPicList[i][j] = h265->RefPicList[i][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[0][j] = h265->RefPicList[0][j]; + FALLTHROUGH; + default: + break; } context->desc.h265.UseRefPicList = true;