xref: /aosp_15_r20/external/libva/va/va_dec_vvc.h (revision 54e60f844a168e9a219354de272cd517ee8cd4b7)
1 /*
2  * Copyright (c) 2024 Intel Corporation. All Rights Reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sub license, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial portions
14  * of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19  * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
20  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 /**
26  * \file va_dec_vvc.h
27  * \brief The VVC decoding API
28  *
29  * This file contains the \ref api_dec_vvc "VVC decoding API".
30  */
31 
32 #ifndef VA_DEC_VVC_H
33 #define VA_DEC_VVC_H
34 
35 #include <stdint.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /**
42  * \defgroup api_dec_vvc VVC decoding API
43  *
44  * This VVC decoding API supports Main 10 profile and Multilayer Main 10 profile.
45  * And it supports only long slice format.
46  *
47  * @{
48  */
49 
50 /**
51  * \brief Weighted Prediction Parameters.
52  */
53 typedef struct _VAWeightedPredInfo {
54     /** \brief Weighted Prediction parameters.
55      *  All the parameters except reserved bytes are VVC syntax.
56      */
57     uint8_t                 luma_log2_weight_denom;
58     int8_t                  delta_chroma_log2_weight_denom;
59     uint8_t                 num_l0_weights;
60     uint8_t                 luma_weight_l0_flag[15];
61     uint8_t                 chroma_weight_l0_flag[15];
62     int8_t                  delta_luma_weight_l0[15];
63     int8_t                  luma_offset_l0[15];
64     int8_t                  delta_chroma_weight_l0[15][2];
65     int16_t                 delta_chroma_offset_l0[15][2];
66     uint8_t                 num_l1_weights;
67     uint8_t                 luma_weight_l1_flag[15];
68     uint8_t                 chroma_weight_l1_flag[15];
69     int8_t                  delta_luma_weight_l1[15];
70     int8_t                  luma_offset_l1[15];
71     int8_t                  delta_chroma_weight_l1[15][2];
72     int16_t                 delta_chroma_offset_l1[15][2];
73     /** \brief Reserved for future use, must be zero */
74     uint16_t                reserved16b;
75     uint32_t                reserved32b;
76 } VAWeightedPredInfo;
77 
78 /**
79  * \brief VVC Decoding Picture Parameter Buffer Structure
80  *
81  * This structure conveys picture level parameters and should be sent once
82  * per frame.
83  *
84  * Host decoder is required to send in a buffer of VAPictureParameterBufferVVC
85  * as the first va buffer for each frame.
86  *
87  */
88 typedef struct  _VAPictureParameterBufferVVC {
89     /** \brief buffer description of decoded current picture
90      */
91     VAPictureVVC            CurrPic;
92     /** \brief buffer description of reference frames in DPB */
93     VAPictureVVC            ReferenceFrames[15];
94     /** \brief picture width, shall be integer multiple of Max(8, MinCbSizeY). */
95     uint16_t                pps_pic_width_in_luma_samples;
96     /** \brief picture height, shall be integer multiple of Max(8, MinCbSizeY). */
97     uint16_t                pps_pic_height_in_luma_samples;
98 
99     /** \brief sequence level parameters.
100      *  All the parameters except reserved bytes are VVC syntax or spec variables.
101      */
102     uint16_t                sps_num_subpics_minus1;
103     uint8_t                 sps_chroma_format_idc;
104     uint8_t                 sps_bitdepth_minus8;
105     uint8_t                 sps_log2_ctu_size_minus5;
106     uint8_t                 sps_log2_min_luma_coding_block_size_minus2;
107     uint8_t                 sps_log2_transform_skip_max_size_minus2;
108     /** \brief chroma QP mapping table.
109      *  ChromaQpTable[][] corresponds to VVC spec variable with the same name.
110      *  It is derived according to formula (57) in VVC spec section 7.4.3.4.
111      */
112     int8_t                  ChromaQpTable[3][111];
113     uint8_t                 sps_six_minus_max_num_merge_cand;
114     uint8_t                 sps_five_minus_max_num_subblock_merge_cand;
115     uint8_t                 sps_max_num_merge_cand_minus_max_num_gpm_cand;
116     uint8_t                 sps_log2_parallel_merge_level_minus2;
117     uint8_t                 sps_min_qp_prime_ts;
118     uint8_t                 sps_six_minus_max_num_ibc_merge_cand;
119     uint8_t                 sps_num_ladf_intervals_minus2;
120     int8_t                  sps_ladf_lowest_interval_qp_offset;
121     int8_t                  sps_ladf_qp_offset[4];
122     uint16_t                sps_ladf_delta_threshold_minus1[4];
123     /** \brief Reserved for future use, must be zero */
124     uint32_t                reserved32b01[VA_PADDING_LOW - 2];
125 
126     union {
127         struct {
128             uint64_t        sps_subpic_info_present_flag                                    : 1;
129             uint64_t        sps_independent_subpics_flag                                    : 1;
130             uint64_t        sps_subpic_same_size_flag                                       : 1;
131             uint64_t        sps_entropy_coding_sync_enabled_flag                            : 1;
132             uint64_t        sps_qtbtt_dual_tree_intra_flag                                  : 1;
133             uint64_t        sps_max_luma_transform_size_64_flag                             : 1;
134             uint64_t        sps_transform_skip_enabled_flag                                 : 1;
135             uint64_t        sps_bdpcm_enabled_flag                                          : 1;
136             uint64_t        sps_mts_enabled_flag                                            : 1;
137             uint64_t        sps_explicit_mts_intra_enabled_flag                             : 1;
138             uint64_t        sps_explicit_mts_inter_enabled_flag                             : 1;
139             uint64_t        sps_lfnst_enabled_flag                                          : 1;
140             uint64_t        sps_joint_cbcr_enabled_flag                                     : 1;
141             uint64_t        sps_same_qp_table_for_chroma_flag                               : 1;
142             uint64_t        sps_sao_enabled_flag                                            : 1;
143             uint64_t        sps_alf_enabled_flag                                            : 1;
144             uint64_t        sps_ccalf_enabled_flag                                          : 1;
145             uint64_t        sps_lmcs_enabled_flag                                           : 1;
146             uint64_t        sps_sbtmvp_enabled_flag                                         : 1;
147             uint64_t        sps_amvr_enabled_flag                                           : 1;
148             uint64_t        sps_smvd_enabled_flag                                           : 1;
149             uint64_t        sps_mmvd_enabled_flag                                           : 1;
150             uint64_t        sps_sbt_enabled_flag                                            : 1;
151             uint64_t        sps_affine_enabled_flag                                         : 1;
152             uint64_t        sps_6param_affine_enabled_flag                                  : 1;
153             uint64_t        sps_affine_amvr_enabled_flag                                    : 1;
154             uint64_t        sps_affine_prof_enabled_flag                                    : 1;
155             uint64_t        sps_bcw_enabled_flag                                            : 1;
156             uint64_t        sps_ciip_enabled_flag                                           : 1;
157             uint64_t        sps_gpm_enabled_flag                                            : 1;
158             uint64_t        sps_isp_enabled_flag                                            : 1;
159             uint64_t        sps_mrl_enabled_flag                                            : 1;
160             uint64_t        sps_mip_enabled_flag                                            : 1;
161             uint64_t        sps_cclm_enabled_flag                                           : 1;
162             uint64_t        sps_chroma_horizontal_collocated_flag                           : 1;
163             uint64_t        sps_chroma_vertical_collocated_flag                             : 1;
164             uint64_t        sps_palette_enabled_flag                                        : 1;
165             uint64_t        sps_act_enabled_flag                                            : 1;
166             uint64_t        sps_ibc_enabled_flag                                            : 1;
167             uint64_t        sps_ladf_enabled_flag                                           : 1;
168             uint64_t        sps_explicit_scaling_list_enabled_flag                          : 1;
169             uint64_t        sps_scaling_matrix_for_lfnst_disabled_flag                      : 1;
170             uint64_t        sps_scaling_matrix_for_alternative_colour_space_disabled_flag   : 1;
171             uint64_t        sps_scaling_matrix_designated_colour_space_flag                 : 1;
172             uint64_t        sps_virtual_boundaries_enabled_flag                             : 1;
173             uint64_t        sps_virtual_boundaries_present_flag                             : 1;
174             /** \brief Reserved for future use, must be zero */
175             uint64_t        reserved                                                        : 18;
176         } bits;
177         uint64_t            value;
178     } sps_flags;
179 
180     /** \brief picture level parameters.
181      *  All the parameters except reserved bytes are VVC syntax or spec variables.
182      */
183     /** \brief number of vertical virtual boundaries on the picture.
184      *  NumVerVirtualBoundaries corresponds to VVC spec variable with the same name.
185      *  It is derived according to formula (78) in VVC spec section 7.4.3.8.
186      */
187     uint8_t                 NumVerVirtualBoundaries;
188     /** \brief number of horizontal virtual boundaries on the picture.
189      *  NumHorVirtualBoundaries corresponds to VVC spec variable with the same name.
190      *  It is derived according to formula (80) in VVC spec section 7.4.3.8.
191      */
192     uint8_t                 NumHorVirtualBoundaries;
193     /** \brief location of the vertical virtual boundary in units of luma samples.
194      *  VirtualBoundaryPosX[] corresponds to VVC spec variable with the same name.
195      *  It is derived according to formula (79) in VVC spec section 7.4.3.8.
196      */
197     uint16_t                VirtualBoundaryPosX[3];
198     /** \brief location of the horizontal virtual boundary in units of luma samples.
199      *  VirtualBoundaryPosY[] corresponds to VVC spec variable with the same name.
200      *  It is derived according to formula (81) in VVC spec section 7.4.3.8.
201      */
202     uint16_t                VirtualBoundaryPosY[3];
203 
204     int32_t                 pps_scaling_win_left_offset;
205     int32_t                 pps_scaling_win_right_offset;
206     int32_t                 pps_scaling_win_top_offset;
207     int32_t                 pps_scaling_win_bottom_offset;
208 
209     int8_t                  pps_num_exp_tile_columns_minus1;
210     uint16_t                pps_num_exp_tile_rows_minus1;
211     uint16_t                pps_num_slices_in_pic_minus1;
212     uint16_t                pps_pic_width_minus_wraparound_offset;
213     int8_t                  pps_cb_qp_offset;
214     int8_t                  pps_cr_qp_offset;
215     int8_t                  pps_joint_cbcr_qp_offset_value;
216     uint8_t                 pps_chroma_qp_offset_list_len_minus1;
217     int8_t                  pps_cb_qp_offset_list[6];
218     int8_t                  pps_cr_qp_offset_list[6];
219     int8_t                  pps_joint_cbcr_qp_offset_list[6];
220     /** \brief Reserved for future use, must be zero */
221     uint16_t                reserved16b01;
222     uint32_t                reserved32b02[VA_PADDING_LOW - 2];
223 
224     union {
225         struct {
226             uint32_t        pps_loop_filter_across_tiles_enabled_flag                       : 1;
227             uint32_t        pps_rect_slice_flag                                             : 1;
228             uint32_t        pps_single_slice_per_subpic_flag                                : 1;
229             uint32_t        pps_loop_filter_across_slices_enabled_flag                      : 1;
230             uint32_t        pps_weighted_pred_flag                                          : 1;
231             uint32_t        pps_weighted_bipred_flag                                        : 1;
232             uint32_t        pps_ref_wraparound_enabled_flag                                 : 1;
233             uint32_t        pps_cu_qp_delta_enabled_flag                                    : 1;
234             uint32_t        pps_cu_chroma_qp_offset_list_enabled_flag                       : 1;
235             uint32_t        pps_deblocking_filter_override_enabled_flag                     : 1;
236             uint32_t        pps_deblocking_filter_disabled_flag                             : 1;
237             uint32_t        pps_dbf_info_in_ph_flag                                         : 1;
238             uint32_t        pps_sao_info_in_ph_flag                                         : 1;
239             uint32_t        pps_alf_info_in_ph_flag                                         : 1;
240             /** \brief Reserved for future use, must be zero */
241             uint32_t        reserved                                                        : 18;
242         } bits;
243         uint32_t            value;
244     } pps_flags;
245 
246     /** \brief picture header parameters.
247      *  All the parameters except reserved bytes are VVC syntax or spec variables.
248      */
249     uint8_t                 ph_lmcs_aps_id;
250     uint8_t                 ph_scaling_list_aps_id;
251     uint8_t                 ph_log2_diff_min_qt_min_cb_intra_slice_luma;
252     uint8_t                 ph_max_mtt_hierarchy_depth_intra_slice_luma;
253     uint8_t                 ph_log2_diff_max_bt_min_qt_intra_slice_luma;
254     uint8_t                 ph_log2_diff_max_tt_min_qt_intra_slice_luma;
255     uint8_t                 ph_log2_diff_min_qt_min_cb_intra_slice_chroma;
256     uint8_t                 ph_max_mtt_hierarchy_depth_intra_slice_chroma;
257     uint8_t                 ph_log2_diff_max_bt_min_qt_intra_slice_chroma;
258     uint8_t                 ph_log2_diff_max_tt_min_qt_intra_slice_chroma;
259     uint8_t                 ph_cu_qp_delta_subdiv_intra_slice;
260     uint8_t                 ph_cu_chroma_qp_offset_subdiv_intra_slice;
261     uint8_t                 ph_log2_diff_min_qt_min_cb_inter_slice;
262     uint8_t                 ph_max_mtt_hierarchy_depth_inter_slice;
263     uint8_t                 ph_log2_diff_max_bt_min_qt_inter_slice;
264     uint8_t                 ph_log2_diff_max_tt_min_qt_inter_slice;
265     uint8_t                 ph_cu_qp_delta_subdiv_inter_slice;
266     uint8_t                 ph_cu_chroma_qp_offset_subdiv_inter_slice;
267     /** \brief Reserved for future use, must be zero */
268     uint16_t                reserved16b02;
269     uint32_t                reserved32b03[VA_PADDING_LOW - 2];
270 
271     union {
272         struct {
273             uint32_t        ph_non_ref_pic_flag                                             : 1;
274             uint32_t        ph_alf_enabled_flag                                             : 1;
275             uint32_t        ph_alf_cb_enabled_flag                                          : 1;
276             uint32_t        ph_alf_cr_enabled_flag                                          : 1;
277             uint32_t        ph_alf_cc_cb_enabled_flag                                       : 1;
278             uint32_t        ph_alf_cc_cr_enabled_flag                                       : 1;
279             uint32_t        ph_lmcs_enabled_flag                                            : 1;
280             uint32_t        ph_chroma_residual_scale_flag                                   : 1;
281             uint32_t        ph_explicit_scaling_list_enabled_flag                           : 1;
282             uint32_t        ph_virtual_boundaries_present_flag                              : 1;
283             uint32_t        ph_temporal_mvp_enabled_flag                                    : 1;
284             uint32_t        ph_mmvd_fullpel_only_flag                                       : 1;
285             uint32_t        ph_mvd_l1_zero_flag                                             : 1;
286             uint32_t        ph_bdof_disabled_flag                                           : 1;
287             uint32_t        ph_dmvr_disabled_flag                                           : 1;
288             uint32_t        ph_prof_disabled_flag                                           : 1;
289             uint32_t        ph_joint_cbcr_sign_flag                                         : 1;
290             uint32_t        ph_sao_luma_enabled_flag                                        : 1;
291             uint32_t        ph_sao_chroma_enabled_flag                                      : 1;
292             uint32_t        ph_deblocking_filter_disabled_flag                              : 1;
293             /** \brief Reserved for future use, must be zero */
294             uint32_t        reserved                                                        : 12;
295         } bits;
296         uint32_t            value;
297     } ph_flags;
298 
299     /** \brief Reserved for future use, must be zero */
300     uint32_t                reserved32b04;
301 
302     union {
303         struct {
304             /** \brief Flag to indicate if current picture is an intra picture.
305              *  Takes value 1 when all slices of current picture are intra slices.
306              *  Takes value 0 when some slices of current picture may not be
307              *  intra slices.
308              */
309             uint32_t        IntraPicFlag                                                    : 1;    // [0..1]
310             /** \brief Reserved for future use, must be zero */
311             uint32_t        reserved                                                        : 31;
312         } fields;
313         uint32_t            value;
314     } PicMiscFlags;
315 
316     /** \brief Reserved bytes for future use, must be zero */
317     uint32_t                reserved32b[VA_PADDING_HIGH + 1];
318 
319 } VAPictureParameterBufferVVC;
320 
321 /**
322  * \brief VVC Slice Parameter Buffer Structure
323  *
324  * VASliceParameterBufferVVC structure should be accompanied by a
325  * slice data buffer, which holds the whole packed slice NAL unit bit stream
326  * with emulation prevention bytes not removed.
327  *
328  * This structure conveys parameters related to slice header and should
329  * be sent once per slice.
330  */
331 typedef struct  _VASliceParameterBufferVVC {
332     /** @name Codec-independent Slice Parameter Buffer base. */
333 
334     /**@{*/
335 
336     /** \brief Number of bytes in the slice data buffer for this slice
337      * counting from and including NAL unit header.
338      */
339     uint32_t                slice_data_size;
340     /** \brief The offset to the NAL unit header for this slice */
341     uint32_t                slice_data_offset;
342     /** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_XXX. */
343     uint32_t                slice_data_flag;
344     /**
345      * \brief Byte offset from NAL unit header to the beginning of slice_data().
346      *
347      * This byte offset is relative to and includes the NAL unit header
348      * and represents the number of bytes parsed in the slice_header()
349      * after the removal of any emulation prevention bytes in
350      * there. However, the slice data buffer passed to the hardware is
351      * the original bitstream, thus including any emulation prevention
352      * bytes.
353      */
354     uint32_t                slice_data_byte_offset;
355     /** \brief index into ReferenceFrames[]
356      * RefPicList[][] corresponds to VVC spec variable with the same name.
357      * Value range [0..14, 0xFF], where 0xFF indicates invalid entry.
358      */
359     uint8_t                 RefPicList[2][15];
360 
361     /**
362      * \brief the subpicture ID of the subpicture that contains the slice.
363      * The value of the variable CurrSubpicIdx
364      * is derived to be such that SubpicIdVal[CurrSubpicIdx] is equal
365      * to sh_subpic_id. CurrSubpicIdx is the index of array VASubPicArrayBufferVVC.SubPicSet[].
366      * And it is the spec variable with the same name.
367      */
368     uint16_t                sh_subpic_id;
369     /* parameters below are VVC syntax or spec variables. */
370     uint16_t                sh_slice_address;
371     uint16_t                sh_num_tiles_in_slice_minus1;
372     uint8_t                 sh_slice_type;
373     uint8_t                 sh_num_alf_aps_ids_luma;
374     uint8_t                 sh_alf_aps_id_luma[7];
375     uint8_t                 sh_alf_aps_id_chroma;
376     uint8_t                 sh_alf_cc_cb_aps_id;
377     uint8_t                 sh_alf_cc_cr_aps_id;
378     /**
379      * \brief NumRefIdxActive[i] - 1 specifies the maximum reference index
380      * for RPL i that may be used to decode the slice. When NumRefIdxActive[i]
381      * is equal to 0, no reference index for RPL i is used to decode the slice.
382      * NumRefIdxActive[] corresponds to VVC spec variable with the same name.
383      * It is derived according to formula (138) in VVC spec section 7.4.8.
384      */
385     uint8_t                 NumRefIdxActive[2];
386     uint8_t                 sh_collocated_ref_idx;
387     /**
388      * \brief initial value of the QpY quantization parameter for the slice.
389      * SliceQpY corresponds to VVC spec variable with the same name.
390      * It is derived according to formula (86) in VVC spec section 7.4.3.8
391      * and formula (139) in VVC Spec section 7.4.8.
392      */
393     int8_t                  SliceQpY;
394     /* parameters below are VVC syntax. */
395     int8_t                  sh_cb_qp_offset;
396     int8_t                  sh_cr_qp_offset;
397     int8_t                  sh_joint_cbcr_qp_offset;
398     int8_t                  sh_luma_beta_offset_div2;
399     int8_t                  sh_luma_tc_offset_div2;
400     int8_t                  sh_cb_beta_offset_div2;
401     int8_t                  sh_cb_tc_offset_div2;
402     int8_t                  sh_cr_beta_offset_div2;
403     int8_t                  sh_cr_tc_offset_div2;
404     /** \brief Reserved bytes for future use, must be zero */
405     uint8_t                 reserved8b[VA_PADDING_LOW - 1];
406     uint32_t                reserved32b;
407 
408     // weighted prediction info
409     VAWeightedPredInfo      WPInfo;
410 
411     union {
412         struct {
413             /* flags below are VVC syntax. */
414             uint32_t        sh_alf_enabled_flag                                             : 1;
415             uint32_t        sh_alf_cb_enabled_flag                                          : 1;
416             uint32_t        sh_alf_cr_enabled_flag                                          : 1;
417             uint32_t        sh_alf_cc_cb_enabled_flag                                       : 1;
418             uint32_t        sh_alf_cc_cr_enabled_flag                                       : 1;
419             uint32_t        sh_lmcs_used_flag                                               : 1;
420             uint32_t        sh_explicit_scaling_list_used_flag                              : 1;
421             uint32_t        sh_cabac_init_flag                                              : 1;
422             uint32_t        sh_collocated_from_l0_flag                                      : 1;
423             uint32_t        sh_cu_chroma_qp_offset_enabled_flag                             : 1;
424             uint32_t        sh_sao_luma_used_flag                                           : 1;
425             uint32_t        sh_sao_chroma_used_flag                                         : 1;
426             uint32_t        sh_deblocking_filter_disabled_flag                              : 1;
427             uint32_t        sh_dep_quant_used_flag                                          : 1;
428             uint32_t        sh_sign_data_hiding_used_flag                                   : 1;
429             uint32_t        sh_ts_residual_coding_disabled_flag                             : 1;
430             /** \brief Reserved for future use, must be zero */
431             uint32_t        reserved                                                        : 16;
432         } bits;
433         uint32_t            value;
434     } sh_flags;
435 
436     /** \brief Reserved bytes for future use, must be zero */
437     uint32_t                va_reserved[VA_PADDING_MEDIUM];
438 } VASliceParameterBufferVVC;
439 
440 /**
441  * \brief VVC Scaling List Data Structure
442  *
443  * Host decoder sends in an array of VVC Scaling Lists through one or multiple
444  * buffers which may contain 1 to 8 VAScalingListVVC data structures in total.
445  * Each buffer contains an integer number of VAScalingListVVC data structures
446  * with no gap in between.
447  * Driver may store the data internally. Host decoder may choose not to
448  * send the same scaling list data for each frame. When a VAScalingListVVC
449  * structure carries a same value of aps_adaptation_parameter_set_id
450  * as a previously stored structure, driver should override the old structure
451  * with values in the new structure.
452  * VAIQMatrixBufferType is used to send this buffer.
453  */
454 typedef struct _VAScalingListVVC {
455     /** \brief VVC syntax to specify the identifier for the APS.*/
456     uint8_t                 aps_adaptation_parameter_set_id;
457     /** \brief Reserved for future use, must be zero */
458     uint8_t                 reserved8b;
459     /**
460      * \brief Specifies the spec variable ScalingMatrixDCRec[id−14],
461      * where id = [14..27].
462      */
463     uint8_t                 ScalingMatrixDCRec[14];
464     /**
465      * \brief Specifies the spec variable ScalingMatrixRec[id][x][y],
466      * where id = [0..1]. Check section 7.4.3.20 for derivation process.
467      */
468     uint8_t                 ScalingMatrixRec2x2[2][2][2];
469     /**
470      * \brief Specifies the spec variable ScalingMatrixRec[id][x][y],
471      * where id = [2..7]. Check section 7.4.3.20 for derivation process.
472      */
473     uint8_t                 ScalingMatrixRec4x4[6][4][4];
474     /**
475      * \brief Specifies the spec variable ScalingMatrixRec[id][x][y],
476      * where id = [8..27]. Check section 7.4.3.20 for derivation process.
477      */
478     uint8_t                 ScalingMatrixRec8x8[20][8][8];
479 
480     /** \brief Reserved bytes for future use, must be zero */
481     uint32_t                va_reserved[VA_PADDING_MEDIUM];
482 } VAScalingListVVC;
483 
484 /**
485  * \brief VVC Adaptive Loop Filter Data Structure
486  *
487  * Host decoder sends in an array of VVC ALF sets through one or multiple
488  * buffers which may contain 1 to 8 VAAlfDataVVC data structures in total.
489  * Each buffer contains an integer number of VAAlfDataVVC data structures
490  * with no gap in between.
491  * Driver may store the data internally. Host decoder may choose not to
492  * send the same ALF data for each frame. When a VAAlfDataVVC structure
493  * carries a same value of aps_adaptation_parameter_set_id as a previously
494  * stored structure, driver should override the old structure
495  * with values in the new structure.
496  * VAAlfBufferType is used to send this buffer.
497  */
498 typedef struct _VAAlfDataVVC {
499     /**
500      * \brief VVC Adaptive Loop Filter parameters.
501      * All the parameters except reserved bytes are VVC syntax or spec variables.
502      */
503     uint8_t                 aps_adaptation_parameter_set_id;
504     uint8_t                 alf_luma_num_filters_signalled_minus1;
505     uint8_t                 alf_luma_coeff_delta_idx[25];
506     int8_t                  filtCoeff[25][12];
507     uint8_t                 alf_luma_clip_idx[25][12];
508     uint8_t                 alf_chroma_num_alt_filters_minus1;
509     int8_t                  AlfCoeffC[8][6];
510     uint8_t                 alf_chroma_clip_idx[8][6];
511     uint8_t                 alf_cc_cb_filters_signalled_minus1;
512     int8_t                  CcAlfApsCoeffCb[4][7];
513     uint8_t                 alf_cc_cr_filters_signalled_minus1;
514     int8_t                  CcAlfApsCoeffCr[4][7];
515     /** \brief Reserved bytes for future use, must be zero */
516     uint16_t                reserved16b;
517     uint32_t                reserved32b;
518 
519     union {
520         struct {
521             uint32_t        alf_luma_filter_signal_flag                                     : 1;
522             uint32_t        alf_chroma_filter_signal_flag                                   : 1;
523             uint32_t        alf_cc_cb_filter_signal_flag                                    : 1;
524             uint32_t        alf_cc_cr_filter_signal_flag                                    : 1;
525             uint32_t        alf_luma_clip_flag                                              : 1;
526             uint32_t        alf_chroma_clip_flag                                            : 1;
527             /** \brief Reserved for future use, must be zero */
528             uint32_t        reserved                                                        : 26;
529         } bits;
530         uint32_t            value;
531     } alf_flags;
532 
533     /** \brief Reserved for future use, must be zero */
534     uint32_t                va_reserved[VA_PADDING_MEDIUM];
535 } VAAlfDataVVC;
536 
537 /**
538  * \brief VVC Luma Mapping with Chroma Scaling Data Structure
539  *
540  * Host decoder sends in an array of VVC LMCS sets through one or multiple
541  * buffers which may contain 1 to 4 VALmcsDataVVC data structures in total.
542  * Each buffer contains an integer number of VALmcsDataVVC data structures
543  * with no gap in between.
544  * Driver may store the data internally. Host decoder may choose not to
545  * send the same LMCS data for each frame. When a VALmcsDataVVC structure
546  * carries a same value of aps_adaptation_parameter_set_id as a previously
547  * stored structure, driver should override the old structure
548  * with values in the new structure.
549  * VALmcsBufferType is used to send this buffer.
550  */
551 typedef struct _VALmcsDataVVC {
552     /**
553      * \brief VVC Luma Mapping with Chroma Scaling parameters.
554      * All the parameters except reserved bytes are VVC syntax or spec variables.
555      */
556     uint8_t                 aps_adaptation_parameter_set_id;
557     uint8_t                 lmcs_min_bin_idx;
558     uint8_t                 lmcs_delta_max_bin_idx;
559     int16_t                 lmcsDeltaCW[16];
560     int8_t                  lmcsDeltaCrs;
561     /** \brief Reserved for future use, must be zero */
562     uint8_t                 reserved8b[VA_PADDING_LOW - 1];
563     uint32_t                va_reserved[VA_PADDING_MEDIUM];
564 } VALmcsDataVVC;
565 
566 /**
567  * \brief VVC SubPicture Data Structure
568  *
569  * Host decoder sends in an array of VVC SubPic sets through one or
570  * multiple buffers which contain sps_num_subpics_minus1 + 1
571  * VASubPicVVC data structures in total. Each buffer contains
572  * an integer number of VASubPicVVC data structures with no gap in between.
573  * The Subpic sets are sent sequentially in the order of indices
574  * from 0 to sps_num_subpics_minus1 according to the bitstream.
575  * VASubPicBufferType is used to send this buffer.
576  */
577 typedef struct _VASubPicVVC {
578     /**
579      * \brief VVC SubPicture layout parameters.
580      * All the parameters except reserved bytes are VVC syntax or spec variables.
581      */
582     uint16_t                sps_subpic_ctu_top_left_x;
583     uint16_t                sps_subpic_ctu_top_left_y;
584     uint16_t                sps_subpic_width_minus1;
585     uint16_t                sps_subpic_height_minus1;
586     /** \brief the subpicture ID of the i-th subpicture.
587      *  It is same variable as in VVC spec.
588      */
589     uint16_t                SubpicIdVal;
590 
591     union {
592         struct {
593             uint16_t        sps_subpic_treated_as_pic_flag                                  : 1;
594             uint16_t        sps_loop_filter_across_subpic_enabled_flag                      : 1;
595             /** \brief Reserved for future use, must be zero */
596             uint16_t        reserved                                                        : 14;
597         } bits;
598         uint16_t            value;
599     } subpic_flags;
600 
601     /** \brief Reserved for future use, must be zero */
602     uint32_t                va_reserved[VA_PADDING_LOW];
603 } VASubPicVVC;
604 
605 /**
606  * \brief data buffer of tile widths and heights.
607  * VATileBufferType is used to send this buffer.
608  *
609  * Host decoder sends in number of pps_num_exp_tile_columns_minus1 + 1
610  * tile column widths of pps_tile_column_width_minus1[i], followed by
611  * number of pps_num_exp_tile_rows_minus1 + 1 of tile row heights of
612  * pps_tile_row_height_minus1[i], through one or multiple buffers.
613  * Each tile width or height is formatted as
614      uint16_t                tile_dimension;
615  * Each buffer contains an integer number of tile_dimension with
616  * no gap in between.
617  * The buffers with type VATileBufferType should be submitted for each
618  * picture. And driver will derive the tile structure from it.
619  * When pps_num_exp_tile_columns_minus1 + pps_num_exp_tile_rows_minus1 equals 0,
620  * this buffer is still submitted by app to driver.
621  */
622 
623 
624 /**
625   * \brief VVC SliceStruct Data Structure
626   *
627   * Host decoder sends in an array of SliceStruct sets through one or multiple
628   * buffers. These SliceStruct sets contain only the "explicit" slices parsed
629   * from PPS header.
630   * Each SliceStruct set is described by VASliceStructVVC data structure.
631   * Each buffer contains an integer number of VASliceStructVVC data structures,
632   * which are laid out sequentially in the order of
633   * ascending slice indices according to the spec with no gap in between.
634   *
635   * When pps_rect_slice_flag equals 0 or there are no explicit slices,
636   * this buffer is not submitted by app to driver. Otherwise, for each picture,
637   * this buffer should be submitted.
638   *
639   * Note: When pps_slice_width_in_tiles_minus1 + pps_slice_height_in_tiles_minus1
640   * equals 0, if the sum of pps_exp_slice_height_in_ctus_minus1 + 1 of all those
641   * slices with same SliceTopLeftTileIdx value is less than the height of tile
642   * SliceTopLeftTileIdx in unit of CTUs, driver should derive the rest slices in
643   * that tile according to equation (21) in spec section 6.5.1. And VASliceStructVVC
644   * for these (derived) slices are not passed in to LibVA by App.
645   *
646   * App should populate the data entries regardless of values of
647   * pps_single_slice_per_subpic_flag or sps_subpic_info_present_flag.
648   *
649   * VASliceStructBufferType is used to send this buffer.
650   */
651 typedef struct _VASliceStructVVC {
652     /** \brief the tile index of which the starting CTU (top-left) of
653      *  the slice belongs to. The tile index is in raster scan order.
654      *  Same syntax variable as in VVC spec.
655      */
656     uint16_t                SliceTopLeftTileIdx;
657     /* plus 1 specifies the width of the rectangular slice in units
658      * of tile columns.
659      */
660     uint16_t                pps_slice_width_in_tiles_minus1;
661     /* plus 1 specifies the height of the rectangular slice in units
662      * of tile rows. If the slice does not cover the whole tile,
663      * pps_slice_height_in_tiles_minus1 shall be 0.
664      */
665     uint16_t                pps_slice_height_in_tiles_minus1;
666     /* plus 1 specifies the height of the rectangular slice in units
667      * of CTU rows.
668      * If pps_slice_width_in_tiles_minus1 + pps_slice_height_in_tiles_minus1 > 0,
669      * set this value to 0.
670      * If pps_slice_width_in_tiles_minus1 + pps_slice_height_in_tiles_minus1 == 0,
671      * and if there is only one slice in tile, set this value to the number of
672      * CTU rows of the tile minus 1, otherwise, set the value equal to
673      * corresponding pps_exp_slice_height_in_ctus_minus1 from bitstream.
674      */
675     uint16_t                pps_exp_slice_height_in_ctus_minus1;
676 
677     /** \brief Reserved for future use, must be zero */
678     uint32_t                va_reserved[VA_PADDING_LOW];
679 } VASliceStructVVC;
680 
681 
682 /**@}*/
683 
684 #ifdef __cplusplus
685 }
686 #endif
687 
688 #endif /* VA_DEC_VVC_H */
689