Mesa (main): frontends/va: Add AV1 parameter buffers functions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 13 14:19:59 UTC 2021


Module: Mesa
Branch: main
Commit: 9cc4c1d8f819d0868a1c51ef91cf6f0242d1ec91
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9cc4c1d8f819d0868a1c51ef91cf6f0242d1ec91

Author: Leo Liu <leo.liu at amd.com>
Date:   Sat Aug  7 16:01:43 2021 -0400

frontends/va: Add AV1 parameter buffers functions

Includes picture parameter and slice parameter buffers.

Signed-off-by: Leo Liu <leo.liu at amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12307>

---

 meson.build                            |   2 +-
 src/gallium/frontends/va/meson.build   |   2 +-
 src/gallium/frontends/va/picture_av1.c | 356 +++++++++++++++++++++++++++++++++
 src/gallium/frontends/va/va_private.h  |   2 +
 4 files changed, 360 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 2c4bee4724c..7b87017b46f 100644
--- a/meson.build
+++ b/meson.build
@@ -766,7 +766,7 @@ endif
 with_gallium_va = false
 dep_va = null_dep
 if _va != 'disabled'
-  dep_va = dependency('libva', version : '>= 1.1.0', required : _va == 'enabled')
+  dep_va = dependency('libva', version : '>= 1.8.0', required : _va == 'enabled')
   if dep_va.found()
     dep_va_headers = dep_va.partial_dependency(compile_args : true)
     with_gallium_va = true
diff --git a/src/gallium/frontends/va/meson.build b/src/gallium/frontends/va/meson.build
index 94df9edd1b8..69dee07a938 100644
--- a/src/gallium/frontends/va/meson.build
+++ b/src/gallium/frontends/va/meson.build
@@ -25,7 +25,7 @@ libva_st = static_library(
   files(
     'buffer.c', 'config.c', 'context.c', 'display.c', 'image.c', 'picture.c',
     'picture_mpeg12.c', 'picture_mpeg4.c', 'picture_h264.c', 'picture_hevc.c',
-    'picture_vc1.c', 'picture_mjpeg.c', 'picture_vp9.c','postproc.c',
+    'picture_vc1.c', 'picture_mjpeg.c', 'picture_vp9.c','picture_av1.c','postproc.c',
     'subpicture.c', 'surface.c', 'picture_h264_enc.c', 'picture_hevc_enc.c',
   ),
   c_args : [
diff --git a/src/gallium/frontends/va/picture_av1.c b/src/gallium/frontends/va/picture_av1.c
new file mode 100644
index 00000000000..1ac83fa4bd8
--- /dev/null
+++ b/src/gallium/frontends/va/picture_av1.c
@@ -0,0 +1,356 @@
+/**************************************************************************
+ *
+ * Copyright 2021 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "vl/vl_vlc.h"
+#include "va_private.h"
+
+#define AV1_REFS_PER_FRAME 7
+#define AV1_NUM_REF_FRAMES 8
+#define AV1_MAX_SEGMENTS 8
+#define AV1_SEG_LVL_MAX 8
+#define AV1_MAX_CDEF_BITS_ARRAY 8
+#define AV1_FG_MAX_NUM_Y_POINTS 14
+#define AV1_FG_MAX_NUM_CBR_POINTS 10
+#define AV1_FG_MAX_NUM_POS_LUMA 24
+#define AV1_FG_MAX_NUM_POS_CHROMA 25
+
+static void tile_info(vlVaContext *context, VADecPictureParameterBufferAV1 *av1)
+{
+   unsigned sbCols;
+   unsigned sbRows;
+   int width_sb;
+   int height_sb;
+   unsigned startSb, i;
+   unsigned MiCols = 2 * ((av1->frame_width_minus1 + 8) >> 3);
+   unsigned MiRows = 2 * ((av1->frame_height_minus1 + 8) >> 3);
+
+   unsigned TileColsLog2 = util_logbase2_ceil(av1->tile_cols);
+   unsigned TileRowsLog2 = util_logbase2_ceil(av1->tile_rows);
+
+   sbCols = (av1->seq_info_fields.fields.use_128x128_superblock) ?
+      ((MiCols + 31) >> 5) : ((MiCols + 15) >> 4);
+   sbRows = (av1->seq_info_fields.fields.use_128x128_superblock) ?
+      ((MiRows + 31) >> 5) : ((MiRows + 15) >> 4);
+
+   width_sb = sbCols;
+   height_sb = sbRows;
+
+   if (av1->pic_info_fields.bits.uniform_tile_spacing_flag) {
+      unsigned tileWidthSb, tileHeightSb;
+
+      tileWidthSb = (sbCols + (1 << TileColsLog2) - 1) >> TileColsLog2;
+      i = 0;
+      for (startSb = 0; startSb < sbCols; startSb += tileWidthSb) {
+         context->desc.av1.picture_parameter.tile_col_start_sb[i] = startSb;
+         i++;
+      }
+      context->desc.av1.picture_parameter.tile_col_start_sb[i] = sbCols;
+
+      tileHeightSb = (sbRows + (1 << TileRowsLog2) - 1) >> TileRowsLog2;
+      i = 0;
+      for (startSb = 0; startSb < sbRows; startSb += tileHeightSb) {
+         context->desc.av1.picture_parameter.tile_row_start_sb[i] = startSb;
+         i++;
+      }
+      context->desc.av1.picture_parameter.tile_row_start_sb[i] = sbRows;
+   } else {
+      unsigned widestTileSb = 0;
+
+      startSb = 0;
+      for (i = 0; startSb < sbCols; ++i) {
+         unsigned sizeSb;
+
+         context->desc.av1.picture_parameter.tile_col_start_sb[i] = startSb;
+         sizeSb = (av1->width_in_sbs_minus_1)[i] + 1;
+         widestTileSb = MAX2(sizeSb, widestTileSb);
+         startSb += sizeSb;
+         width_sb -= sizeSb;
+      }
+      context->desc.av1.picture_parameter.tile_col_start_sb[i] = startSb + width_sb;
+
+      startSb = 0;
+      for (i = 0; startSb < sbRows; ++i) {
+         unsigned height_in_sbs_minus_1 = (av1->height_in_sbs_minus_1)[i];
+
+         context->desc.av1.picture_parameter.tile_row_start_sb[i] = startSb;
+         startSb += height_in_sbs_minus_1 + 1;
+         height_sb -= height_in_sbs_minus_1 + 1;
+      }
+      context->desc.av1.picture_parameter.tile_row_start_sb[i] = startSb + height_sb;
+   }
+}
+
+void vlVaHandlePictureParameterBufferAV1(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
+{
+   VADecPictureParameterBufferAV1 *av1 = buf->data;
+   int i, j;
+
+   assert(buf->size >= sizeof(VADecPictureParameterBufferAV1) && buf->num_elements == 1);
+
+   context->desc.av1.picture_parameter.profile = av1->profile;
+   context->desc.av1.picture_parameter.seq_info_fields.use_128x128_superblock =
+      av1->seq_info_fields.fields.use_128x128_superblock;
+   context->desc.av1.picture_parameter.seq_info_fields.enable_filter_intra =
+      av1->seq_info_fields.fields.enable_filter_intra;
+   context->desc.av1.picture_parameter.seq_info_fields.enable_intra_edge_filter =
+      av1->seq_info_fields.fields.enable_intra_edge_filter;
+   context->desc.av1.picture_parameter.order_hint_bits_minus_1 = av1->order_hint_bits_minus_1;
+   context->desc.av1.picture_parameter.max_width = av1->frame_width_minus1 + 1;
+   context->desc.av1.picture_parameter.max_height = av1->frame_height_minus1 + 1;
+   context->desc.av1.picture_parameter.seq_info_fields.enable_interintra_compound =
+      av1->seq_info_fields.fields.enable_interintra_compound;
+   context->desc.av1.picture_parameter.seq_info_fields.enable_masked_compound =
+      av1->seq_info_fields.fields.enable_masked_compound;
+   context->desc.av1.picture_parameter.seq_info_fields.enable_dual_filter =
+      av1->seq_info_fields.fields.enable_dual_filter;
+   context->desc.av1.picture_parameter.seq_info_fields.enable_order_hint =
+      av1->seq_info_fields.fields.enable_order_hint;
+   context->desc.av1.picture_parameter.seq_info_fields.enable_jnt_comp =
+      av1->seq_info_fields.fields.enable_jnt_comp;
+
+   context->desc.av1.picture_parameter.seq_info_fields.ref_frame_mvs =
+      av1->seq_info_fields.fields.enable_order_hint;
+
+   context->desc.av1.picture_parameter.bit_depth_idx = av1->bit_depth_idx;
+   context->desc.av1.picture_parameter.seq_info_fields.mono_chrome =
+      av1->seq_info_fields.fields.mono_chrome;
+
+   context->desc.av1.picture_parameter.pic_info_fields.frame_type =
+      av1->pic_info_fields.bits.frame_type;
+   context->desc.av1.picture_parameter.pic_info_fields.show_frame =
+      av1->pic_info_fields.bits.show_frame;
+   context->desc.av1.picture_parameter.pic_info_fields.error_resilient_mode =
+      av1->pic_info_fields.bits.error_resilient_mode;
+   context->desc.av1.picture_parameter.pic_info_fields.disable_cdf_update =
+      av1->pic_info_fields.bits.disable_cdf_update;
+   context->desc.av1.picture_parameter.pic_info_fields.allow_screen_content_tools =
+      av1->pic_info_fields.bits.allow_screen_content_tools;
+   context->desc.av1.picture_parameter.pic_info_fields.force_integer_mv =
+      av1->pic_info_fields.bits.force_integer_mv;
+   context->desc.av1.picture_parameter.pic_info_fields.allow_intrabc =
+      av1->pic_info_fields.bits.allow_intrabc;
+   context->desc.av1.picture_parameter.pic_info_fields.use_superres =
+      av1->pic_info_fields.bits.use_superres;
+   context->desc.av1.picture_parameter.pic_info_fields.is_motion_mode_switchable =
+      av1->pic_info_fields.bits.is_motion_mode_switchable;
+   context->desc.av1.picture_parameter.pic_info_fields.allow_high_precision_mv =
+      av1->pic_info_fields.bits.allow_high_precision_mv;
+   context->desc.av1.picture_parameter.pic_info_fields.use_ref_frame_mvs =
+      av1->pic_info_fields.bits.use_ref_frame_mvs;
+   context->desc.av1.picture_parameter.pic_info_fields.disable_frame_end_update_cdf =
+      av1->pic_info_fields.bits.disable_frame_end_update_cdf;
+   context->desc.av1.picture_parameter.pic_info_fields.allow_warped_motion =
+      av1->pic_info_fields.bits.allow_warped_motion;
+
+   context->desc.av1.picture_parameter.current_frame_id = av1->current_frame;
+   context->desc.av1.picture_parameter.order_hint = av1->order_hint;
+   context->desc.av1.picture_parameter.primary_ref_frame = av1->primary_ref_frame;
+   context->desc.av1.picture_parameter.frame_width = av1->frame_width_minus1 + 1;
+   context->desc.av1.picture_parameter.frame_height = av1->frame_height_minus1 + 1;
+
+   context->desc.av1.picture_parameter.superres_scale_denominator =
+      av1->superres_scale_denominator;
+
+   for (i = 0; i < AV1_REFS_PER_FRAME; ++i)
+      context->desc.av1.picture_parameter.ref_frame_idx[i] = av1->ref_frame_idx[i];
+   context->desc.av1.picture_parameter.refresh_frame_flags = 1;
+
+   /* Tile Info */
+   context->desc.av1.picture_parameter.tile_cols = av1->tile_cols;
+   context->desc.av1.picture_parameter.tile_rows = av1->tile_rows;
+   context->desc.av1.picture_parameter.context_update_tile_id = av1->context_update_tile_id;
+   tile_info(context, av1);
+
+   /* Quantization Params */
+   context->desc.av1.picture_parameter.base_qindex =  av1->base_qindex;
+   context->desc.av1.picture_parameter.y_dc_delta_q = av1->y_dc_delta_q;
+   context->desc.av1.picture_parameter.u_dc_delta_q = av1->u_dc_delta_q;
+   context->desc.av1.picture_parameter.u_ac_delta_q = av1->u_ac_delta_q;
+   context->desc.av1.picture_parameter.v_dc_delta_q = av1->v_dc_delta_q;
+   context->desc.av1.picture_parameter.v_ac_delta_q = av1->v_ac_delta_q;
+   context->desc.av1.picture_parameter.qmatrix_fields.qm_y = av1->qmatrix_fields.bits.qm_y | 0xf;
+   context->desc.av1.picture_parameter.qmatrix_fields.qm_u = av1->qmatrix_fields.bits.qm_u | 0xf;
+   context->desc.av1.picture_parameter.qmatrix_fields.qm_v = av1->qmatrix_fields.bits.qm_v | 0xf;
+
+   /* Segmentation Params */
+   context->desc.av1.picture_parameter.seg_info.segment_info_fields.enabled =
+      av1->seg_info.segment_info_fields.bits.enabled;
+   context->desc.av1.picture_parameter.seg_info.segment_info_fields.update_map =
+      av1->seg_info.segment_info_fields.bits.update_map;
+   context->desc.av1.picture_parameter.seg_info.segment_info_fields.temporal_update =
+      av1->seg_info.segment_info_fields.bits.temporal_update;
+   for (i = 0; i < AV1_MAX_SEGMENTS; ++i) {
+      for (j = 0; j < AV1_SEG_LVL_MAX; ++j)
+         context->desc.av1.picture_parameter.seg_info.feature_data[i][j] =
+            av1->seg_info.feature_data[i][j];
+      context->desc.av1.picture_parameter.seg_info.feature_mask[i] = av1->seg_info.feature_mask[i];
+   }
+
+   /* Delta Q Params */
+   context->desc.av1.picture_parameter.mode_control_fields.delta_q_present_flag =
+      av1->mode_control_fields.bits.delta_q_present_flag;
+   context->desc.av1.picture_parameter.mode_control_fields.log2_delta_q_res =
+      av1->mode_control_fields.bits.log2_delta_q_res;
+
+   /* Delta LF Params */
+   context->desc.av1.picture_parameter.mode_control_fields.delta_lf_present_flag =
+      av1->mode_control_fields.bits.delta_lf_present_flag;
+   context->desc.av1.picture_parameter.mode_control_fields.log2_delta_lf_res =
+      av1->mode_control_fields.bits.log2_delta_lf_res;
+   context->desc.av1.picture_parameter.mode_control_fields.delta_lf_multi =
+      av1->mode_control_fields.bits.delta_lf_multi;
+
+   context->desc.av1.picture_parameter.mode_control_fields.tx_mode =
+      av1->mode_control_fields.bits.tx_mode;
+   context->desc.av1.picture_parameter.mode_control_fields.reference_select =
+      av1->mode_control_fields.bits.reference_select;
+   context->desc.av1.picture_parameter.mode_control_fields.reduced_tx_set_used =
+      av1->mode_control_fields.bits.reduced_tx_set_used;
+   context->desc.av1.picture_parameter.mode_control_fields.skip_mode_present =
+      av1->mode_control_fields.bits.skip_mode_present;
+
+   /* Loop Filter Params */
+   context->desc.av1.picture_parameter.interp_filter = av1->interp_filter;
+   for (i = 0; i < 2; ++i)
+      context->desc.av1.picture_parameter.filter_level[i] = av1->filter_level[i];
+   context->desc.av1.picture_parameter.filter_level_u = av1->filter_level_u;
+   context->desc.av1.picture_parameter.filter_level_v = av1->filter_level_v;
+   context->desc.av1.picture_parameter.loop_filter_info_fields.sharpness_level =
+      av1->loop_filter_info_fields.bits.sharpness_level;
+   context->desc.av1.picture_parameter.loop_filter_info_fields.mode_ref_delta_enabled =
+      av1->loop_filter_info_fields.bits.mode_ref_delta_enabled;
+   context->desc.av1.picture_parameter.loop_filter_info_fields.mode_ref_delta_update =
+      av1->loop_filter_info_fields.bits.mode_ref_delta_update;
+   for (i = 0; i < AV1_NUM_REF_FRAMES; ++i)
+      context->desc.av1.picture_parameter.ref_deltas[i] = av1->ref_deltas[i];
+   for (i = 0; i < 2; ++i)
+      context->desc.av1.picture_parameter.mode_deltas[i] = av1->mode_deltas[i];
+
+   /* CDEF Params */
+   context->desc.av1.picture_parameter.cdef_damping_minus_3 = av1->cdef_damping_minus_3;
+   context->desc.av1.picture_parameter.cdef_bits = av1->cdef_bits;
+   for (i = 0; i < AV1_MAX_CDEF_BITS_ARRAY; ++i) {
+      context->desc.av1.picture_parameter.cdef_y_strengths[i] = av1->cdef_y_strengths[i];
+      context->desc.av1.picture_parameter.cdef_uv_strengths[i] = av1->cdef_uv_strengths[i];
+   }
+
+   /* Loop Restoration Params */
+   context->desc.av1.picture_parameter.loop_restoration_fields.yframe_restoration_type =
+      av1->loop_restoration_fields.bits.yframe_restoration_type;
+   context->desc.av1.picture_parameter.loop_restoration_fields.cbframe_restoration_type =
+      av1->loop_restoration_fields.bits.cbframe_restoration_type;
+   context->desc.av1.picture_parameter.loop_restoration_fields.crframe_restoration_type =
+      av1->loop_restoration_fields.bits.crframe_restoration_type;
+   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);
+   } else {
+      for (i = 0; i < 3; ++i)
+         context->desc.av1.picture_parameter.lr_unit_size[i] = (1 << 8);
+   }
+
+   /* Global Motion Params */
+   for (i = 0; i < ARRAY_SIZE(av1->wm); ++i) {
+      context->desc.av1.picture_parameter.wm[i].wmtype = av1->wm[i].wmtype;
+      for (j = 0; j < ARRAY_SIZE(av1->wm[0].wmmat); ++j)
+         context->desc.av1.picture_parameter.wm[i].wmmat[j] = av1->wm[i].wmmat[j];
+   }
+
+   /* Film Grain Params */
+   context->desc.av1.picture_parameter.film_grain_info.film_grain_info_fields.apply_grain =
+      av1->film_grain_info.film_grain_info_fields.bits.apply_grain;
+   context->desc.av1.picture_parameter.film_grain_info.film_grain_info_fields.chroma_scaling_from_luma =
+      av1->film_grain_info.film_grain_info_fields.bits.chroma_scaling_from_luma;
+   context->desc.av1.picture_parameter.film_grain_info.film_grain_info_fields.grain_scaling_minus_8 =
+      av1->film_grain_info.film_grain_info_fields.bits.grain_scaling_minus_8;
+   context->desc.av1.picture_parameter.film_grain_info.film_grain_info_fields.ar_coeff_lag =
+      av1->film_grain_info.film_grain_info_fields.bits.ar_coeff_lag;
+   context->desc.av1.picture_parameter.film_grain_info.film_grain_info_fields.ar_coeff_shift_minus_6 =
+      av1->film_grain_info.film_grain_info_fields.bits.ar_coeff_shift_minus_6;
+   context->desc.av1.picture_parameter.film_grain_info.film_grain_info_fields.grain_scale_shift =
+      av1->film_grain_info.film_grain_info_fields.bits.grain_scale_shift;
+   context->desc.av1.picture_parameter.film_grain_info.film_grain_info_fields.overlap_flag =
+      av1->film_grain_info.film_grain_info_fields.bits.overlap_flag;
+   context->desc.av1.picture_parameter.film_grain_info.film_grain_info_fields.clip_to_restricted_range =
+      av1->film_grain_info.film_grain_info_fields.bits.clip_to_restricted_range;
+
+   context->desc.av1.picture_parameter.film_grain_info.grain_seed = av1->film_grain_info.grain_seed;
+   context->desc.av1.picture_parameter.film_grain_info.num_y_points = av1->film_grain_info.num_y_points;
+   for (i = 0; i < AV1_FG_MAX_NUM_Y_POINTS; ++i) {
+      context->desc.av1.picture_parameter.film_grain_info.point_y_value[i] =
+         av1->film_grain_info.point_y_value[i];
+      context->desc.av1.picture_parameter.film_grain_info.point_y_scaling[i] =
+         av1->film_grain_info.point_y_scaling[i];
+   }
+   context->desc.av1.picture_parameter.film_grain_info.num_cb_points = av1->film_grain_info.num_cb_points;
+   context->desc.av1.picture_parameter.film_grain_info.num_cr_points = av1->film_grain_info.num_cr_points;
+   for (i = 0; i < AV1_FG_MAX_NUM_CBR_POINTS; ++i) {
+      context->desc.av1.picture_parameter.film_grain_info.point_cb_value[i] =
+         av1->film_grain_info.point_cb_value[i];
+      context->desc.av1.picture_parameter.film_grain_info.point_cb_scaling[i] =
+         av1->film_grain_info.point_cb_scaling[i];
+      context->desc.av1.picture_parameter.film_grain_info.point_cr_value[i] =
+         av1->film_grain_info.point_cr_value[i];
+      context->desc.av1.picture_parameter.film_grain_info.point_cr_scaling[i] =
+         av1->film_grain_info.point_cr_scaling[i];
+   }
+
+   for (i = 0; i < AV1_FG_MAX_NUM_POS_LUMA; ++i)
+      context->desc.av1.picture_parameter.film_grain_info.ar_coeffs_y[i] =
+         av1->film_grain_info.ar_coeffs_y[i];
+   for (i = 0; i < AV1_FG_MAX_NUM_POS_CHROMA; ++i) {
+      context->desc.av1.picture_parameter.film_grain_info.ar_coeffs_cb[i] =
+         av1->film_grain_info.ar_coeffs_cb[i];
+      context->desc.av1.picture_parameter.film_grain_info.ar_coeffs_cr[i] =
+         av1->film_grain_info.ar_coeffs_cr[i];
+   }
+   context->desc.av1.picture_parameter.film_grain_info.cb_mult = av1->film_grain_info.cb_mult;
+   context->desc.av1.picture_parameter.film_grain_info.cb_luma_mult = av1->film_grain_info.cb_luma_mult;
+   context->desc.av1.picture_parameter.film_grain_info.cb_offset = av1->film_grain_info.cb_offset;
+   context->desc.av1.picture_parameter.film_grain_info.cr_mult = av1->film_grain_info.cr_mult;
+   context->desc.av1.picture_parameter.film_grain_info.cr_luma_mult = av1->film_grain_info.cr_luma_mult;
+   context->desc.av1.picture_parameter.film_grain_info.cr_offset = av1->film_grain_info.cr_offset;
+
+   for (i = 0 ; i < AV1_NUM_REF_FRAMES; ++i) {
+      if (av1->pic_info_fields.bits.frame_type == 0)
+         context->desc.av1.ref[i] = NULL;
+      else
+         vlVaGetReferenceFrame(drv, av1->ref_frame_map[i], &context->desc.av1.ref[i]);
+   }
+}
+
+void vlVaHandleSliceParameterBufferAV1(vlVaContext *context, vlVaBuffer *buf, unsigned int num)
+{
+   VASliceParameterBufferAV1 *av1 = buf->data;
+
+   context->desc.av1.slice_parameter.slice_data_size[num >> 1] = av1->slice_data_size;
+   context->desc.av1.slice_parameter.slice_data_offset[num >> 1] = av1->slice_data_offset;
+}
diff --git a/src/gallium/frontends/va/va_private.h b/src/gallium/frontends/va/va_private.h
index be9bcd1bf5b..f42e0b88bbf 100644
--- a/src/gallium/frontends/va/va_private.h
+++ b/src/gallium/frontends/va/va_private.h
@@ -454,6 +454,8 @@ void vlVaHandleSliceParameterBufferMJPEG(vlVaContext *context, vlVaBuffer *buf);
 void vlVaHandlePictureParameterBufferVP9(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf);
 void vlVaHandleSliceParameterBufferVP9(vlVaContext *context, vlVaBuffer *buf);
 void vlVaDecoderVP9BitstreamHeader(vlVaContext *context, vlVaBuffer *buf);
+void vlVaHandlePictureParameterBufferAV1(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf);
+void vlVaHandleSliceParameterBufferAV1(vlVaContext *context, vlVaBuffer *buf, unsigned int num);
 void getEncParamPresetH264(vlVaContext *context);
 void getEncParamPresetH265(vlVaContext *context);
 VAStatus vlVaHandleVAEncPictureParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf);



More information about the mesa-commit mailing list