{
VADecPictureParameterBufferAV1 *av1 = buf->data;
int i, j;
+ bool use_lr;
assert(buf->size >= sizeof(VADecPictureParameterBufferAV1) && buf->num_elements == 1);
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);