Module: Mesa Branch: main Commit: 1d3cb3f188fc59061b1f70c78bd72742e42aa804 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d3cb3f188fc59061b1f70c78bd72742e42aa804
Author: Jasber Chen <[email protected]> Date: Wed Nov 23 10:14:31 2022 +0800 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 <[email protected]> Reviewed-by: Boyuan Zhang <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19943> --- 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[1][j] = h265->RefPicList[1][j]; + FALLTHROUGH; + case 1: /* HEVC_SLICE_P */ for (int j = 0 ; j < 15 ; j++) - context->desc.h265.RefPicList[i][j] = h265->RefPicList[i][j]; + context->desc.h265.RefPicList[0][j] = h265->RefPicList[0][j]; + FALLTHROUGH; + default: + break; } context->desc.h265.UseRefPicList = true;
