frontends/va: fixed an av1 decoding image corruption issue.
problem: When playing back some clips with loop restoration parameters enabled, the display image could be corrupted. solution: correct loop restoration unit size logic in vaapi interface. CC: 22.2 <mesa-stable> Reviewed-by: Leo Liu <leo.liu@amd.com> Signed-off-by: Ruijing Dong <ruijing.dong@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19146>
This commit is contained in:
@@ -112,6 +112,7 @@ void vlVaHandlePictureParameterBufferAV1(vlVaDriver *drv, vlVaContext *context,
|
||||
{
|
||||
VADecPictureParameterBufferAV1 *av1 = buf->data;
|
||||
int i, j;
|
||||
bool use_lr;
|
||||
|
||||
assert(buf->size >= sizeof(VADecPictureParameterBufferAV1) && buf->num_elements == 1);
|
||||
|
||||
@@ -290,13 +291,19 @@ void vlVaHandlePictureParameterBufferAV1(vlVaDriver *drv, vlVaContext *context,
|
||||
av1->loop_restoration_fields.bits.lr_unit_shift;
|
||||
context->desc.av1.picture_parameter.loop_restoration_fields.lr_uv_shift =
|
||||
av1->loop_restoration_fields.bits.lr_uv_shift;
|
||||
if (!av1->loop_restoration_fields.bits.lr_unit_shift) {
|
||||
context->desc.av1.picture_parameter.lr_unit_size[0] =
|
||||
256 >> (2 - av1->loop_restoration_fields.bits.lr_unit_shift);
|
||||
context->desc.av1.picture_parameter.lr_unit_size[1] =
|
||||
context->desc.av1.picture_parameter.lr_unit_size[2] =
|
||||
(context->desc.av1.picture_parameter.lr_unit_size[0] >>
|
||||
av1->loop_restoration_fields.bits.lr_uv_shift);
|
||||
|
||||
use_lr = av1->loop_restoration_fields.bits.yframe_restoration_type ||
|
||||
av1->loop_restoration_fields.bits.cbframe_restoration_type ||
|
||||
av1->loop_restoration_fields.bits.crframe_restoration_type;
|
||||
|
||||
if (use_lr) {
|
||||
context->desc.av1.picture_parameter.lr_unit_size[0]
|
||||
= 1 << (6 + av1->loop_restoration_fields.bits.lr_unit_shift);
|
||||
context->desc.av1.picture_parameter.lr_unit_size[1]
|
||||
= 1 << (6 + av1->loop_restoration_fields.bits.lr_unit_shift
|
||||
- av1->loop_restoration_fields.bits.lr_uv_shift);
|
||||
context->desc.av1.picture_parameter.lr_unit_size[2]
|
||||
= context->desc.av1.picture_parameter.lr_unit_size[1];
|
||||
} else {
|
||||
for (i = 0; i < 3; ++i)
|
||||
context->desc.av1.picture_parameter.lr_unit_size[i] = (1 << 8);
|
||||
|
||||
Reference in New Issue
Block a user