| 1 | /* | 
| 2 |  * Copyright (c) 2021 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_enc_av1.h | 
| 27 |  * \brief AV1 encoding API | 
| 28 |  * | 
| 29 |  * This file contains the \ref api_enc_av1 "AV1 encoding API". | 
| 30 |  * | 
| 31 |  */ | 
| 32 |  | 
| 33 | #ifndef VA_ENC_AV1_H | 
| 34 | #define VA_ENC_AV1_H | 
| 35 |  | 
| 36 | #ifdef __cplusplus | 
| 37 | extern "C"  { | 
| 38 | #endif | 
| 39 |  | 
| 40 | #include <stdint.h> | 
| 41 |  | 
| 42 | /** | 
| 43 |  * \defgroup api_enc_av1 AV1 encoding API | 
| 44 |  * | 
| 45 |  * This AV1 encoding API supports 8-bit/10bit 420 format only. | 
| 46 |  * | 
| 47 |  * @{ | 
| 48 |  */ | 
| 49 |  | 
| 50 | /** \brief Attribute value for VAConfigAttribEncAV1. | 
| 51 |  * | 
| 52 |  * This attribute decribes the supported features of an AV1 | 
| 53 |  * encoder configuration. | 
| 54 |  * | 
| 55 |  * All of the field values in this attribute are VA_FEATURE_* values, | 
| 56 |  * indicating support for the corresponding feature. | 
| 57 |  * | 
| 58 |  */ | 
| 59 | typedef union _VAConfigAttribValEncAV1 { | 
| 60 |     struct { | 
| 61 |         /** | 
| 62 |          * \brief Use 128x128 superblock. | 
| 63 |          * | 
| 64 |          * Allows setting use_128x128_superblock in the SPS. | 
| 65 |          */ | 
| 66 |         uint32_t support_128x128_superblock     : 2; | 
| 67 |         /** | 
| 68 |          * \brief Intra  filter. | 
| 69 |          * Allows setting enable_filter_intra in the SPS. | 
| 70 |          */ | 
| 71 |         uint32_t support_filter_intra           : 2; | 
| 72 |         /** | 
| 73 |          * \brief  Intra edge filter. | 
| 74 |          * Allows setting enable_intra_edge_filter in the SPS. | 
| 75 |          */ | 
| 76 |         uint32_t support_intra_edge_filter      : 2; | 
| 77 |         /** | 
| 78 |          * \brief  Interintra compound. | 
| 79 |          * Allows setting enable_interintra_compound in the SPS. | 
| 80 |          */ | 
| 81 |         uint32_t support_interintra_compound    : 2; | 
| 82 |         /** | 
| 83 |          * \brief  Masked compound. | 
| 84 |          * Allows setting enable_masked_compound in the SPS. | 
| 85 |          */ | 
| 86 |         uint32_t support_masked_compound        : 2; | 
| 87 |         /** | 
| 88 |          * \brief  Warped motion. | 
| 89 |          * Allows setting enable_warped_motion in the SPS. | 
| 90 |          */ | 
| 91 |         uint32_t support_warped_motion          : 2; | 
| 92 |         /** | 
| 93 |          * \brief  Palette mode. | 
| 94 |          * Allows setting palette_mode in the PPS. | 
| 95 |          */ | 
| 96 |         uint32_t support_palette_mode           : 2; | 
| 97 |         /** | 
| 98 |          * \brief  Dual filter. | 
| 99 |          * Allows setting enable_dual_filter in the SPS. | 
| 100 |          */ | 
| 101 |         uint32_t support_dual_filter            : 2; | 
| 102 |         /** | 
| 103 |          * \brief  Jnt compound. | 
| 104 |          * Allows setting enable_jnt_comp in the SPS. | 
| 105 |          */ | 
| 106 |         uint32_t support_jnt_comp               : 2; | 
| 107 |         /** | 
| 108 |          * \brief  Refrence frame mvs. | 
| 109 |          * Allows setting enable_ref_frame_mvs in the SPS. | 
| 110 |          */ | 
| 111 |         uint32_t support_ref_frame_mvs          : 2; | 
| 112 |         /** | 
| 113 |          * \brief  Super resolution. | 
| 114 |          * Allows setting enable_superres in the SPS. | 
| 115 |          */ | 
| 116 |         uint32_t support_superres               : 2; | 
| 117 |         /** | 
| 118 |          * \brief  Restoration. | 
| 119 |          * Allows setting enable_restoration in the SPS. | 
| 120 |          */ | 
| 121 |         uint32_t support_restoration            : 2; | 
| 122 |         /** | 
| 123 |          * \brief  Allow intraBC. | 
| 124 |          * Allows setting allow_intrabc in the PPS. | 
| 125 |          */ | 
| 126 |         uint32_t support_allow_intrabc          : 2; | 
| 127 |         /** | 
| 128 |          * \brief  Cdef channel strength. | 
| 129 |          * Allows setting cdef_y_strengths and cdef_uv_strengths in PPS. | 
| 130 |          */ | 
| 131 |         uint32_t support_cdef_channel_strength  : 2; | 
| 132 |         /** \brief Reserved bits for future, must be zero. */ | 
| 133 |         uint32_t reserved                       : 4; | 
| 134 |     } bits; | 
| 135 |     uint32_t value; | 
| 136 | } VAConfigAttribValEncAV1; | 
| 137 |  | 
| 138 | /** \brief Attribute value for VAConfigAttribEncAV1Ext1. */ | 
| 139 | typedef union _VAConfigAttribValEncAV1Ext1 { | 
| 140 |     struct { | 
| 141 |         /** | 
| 142 |          * \brief Fields indicate which types of interpolation filter are supported. | 
| 143 |          * (interpolation_filter & 0x01) == 1: eight_tap filter is supported, 0: not. | 
| 144 |          * (interpolation_filter & 0x02) == 1: eight_tap_smooth filter is supported, 0: not. | 
| 145 |          * (interpolation_filter & 0x04) == 1: eight_sharp filter is supported, 0: not. | 
| 146 |          * (interpolation_filter & 0x08) == 1: bilinear filter is supported, 0: not. | 
| 147 |          * (interpolation_filter & 0x10) == 1: switchable filter is supported, 0: not. | 
| 148 |          */ | 
| 149 |         uint32_t interpolation_filter          : 5; | 
| 150 |         /** | 
| 151 |          * \brief Min segmentId block size accepted. | 
| 152 |          * Application need to send seg_id_block_size in PPS equal or larger than this value. | 
| 153 |          */ | 
| 154 |         uint32_t min_segid_block_size_accepted : 8; | 
| 155 |         /** | 
| 156 |          * \brief Type of segment feature supported. | 
| 157 |          * (segment_feature_support & 0x01) == 1: SEG_LVL_ALT_Q is supported, 0: not. | 
| 158 |          * (segment_feature_support & 0x02) == 1: SEG_LVL_ALT_LF_Y_V is supported, 0: not. | 
| 159 |          * (segment_feature_support & 0x04) == 1: SEG_LVL_ALT_LF_Y_H is supported, 0: not. | 
| 160 |          * (segment_feature_support & 0x08) == 1: SEG_LVL_ALT_LF_U is supported, 0: not. | 
| 161 |          * (segment_feature_support & 0x10) == 1: SEG_LVL_ALT_LF_V is supported, 0: not. | 
| 162 |          * (segment_feature_support & 0x20) == 1: SEG_LVL_REF_FRAME is supported, 0: not. | 
| 163 |          * (segment_feature_support & 0x40) == 1: SEG_LVL_SKIP is supported, 0: not. | 
| 164 |          * (segment_feature_support & 0x80) == 1: SEG_LVL_GLOBALMV is supported, 0: not. | 
| 165 |          */ | 
| 166 |         uint32_t segment_feature_support       : 8; | 
| 167 |         /** \brief Reserved bits for future, must be zero. */ | 
| 168 |         uint32_t reserved                      : 11; | 
| 169 |     } bits; | 
| 170 |     uint32_t value; | 
| 171 | } VAConfigAttribValEncAV1Ext1; | 
| 172 |  | 
| 173 | /** \brief Attribute value for VAConfigAttribEncAV1Ext2. */ | 
| 174 | typedef union _VAConfigAttribValEncAV1Ext2 { | 
| 175 |     struct { | 
| 176 |         /** | 
| 177 |         * \brief Tile size bytes minus1. | 
| 178 |         * Specify the number of bytes needed to code tile size supported. | 
| 179 |         * This value need to be set in frame header obu. | 
| 180 |         */ | 
| 181 |         uint32_t tile_size_bytes_minus1        : 2; | 
| 182 |         /** | 
| 183 |         * \brief Tile size bytes minus1. | 
| 184 |         * Specify the fixed number of bytes needed to code syntax obu_size. | 
| 185 |         */ | 
| 186 |         uint32_t obu_size_bytes_minus1         : 2; | 
| 187 |         /** | 
| 188 |          * \brief tx_mode supported. | 
| 189 |          * (tx_mode_support & 0x01) == 1: ONLY_4X4 is supported, 0: not. | 
| 190 |          * (tx_mode_support & 0x02) == 1: TX_MODE_LARGEST is supported, 0: not. | 
| 191 |          * (tx_mode_support & 0x04) == 1: TX_MODE_SELECT is supported, 0: not. | 
| 192 |          */ | 
| 193 |         uint32_t tx_mode_support               : 3; | 
| 194 |         /** | 
| 195 |          * \brief Max tile num minus1. | 
| 196 |          * Specify the max number of tile supported by driver. | 
| 197 |          */ | 
| 198 |         uint32_t max_tile_num_minus1           : 13; | 
| 199 |         /** \brief Reserved bits for future, must be zero. */ | 
| 200 |         uint32_t reserved                      : 12; | 
| 201 |     } bits; | 
| 202 |     uint32_t value; | 
| 203 | } VAConfigAttribValEncAV1Ext2; | 
| 204 |  | 
| 205 | /** | 
| 206 |  * \brief Packed header types specific to AV1 encoding. | 
| 207 |  * | 
| 208 |  * Types of packed headers generally used for AV1 encoding. | 
| 209 |  * | 
| 210 |  */ | 
| 211 | typedef enum { | 
| 212 |     /** | 
| 213 |      * \brief Packed Sequence Parameter Set (SPS). | 
| 214 |      * | 
| 215 |      * The corresponding packed header data buffer shall contain the | 
| 216 |      * complete sequence_header_obu() syntax element. | 
| 217 |      * | 
| 218 |      */ | 
| 219 |      = VAEncPackedHeaderSequence, | 
| 220 |     /** | 
| 221 |      * \brief Packed Picture Parameter Set (PPS). | 
| 222 |      * | 
| 223 |      * The corresponding packed header data buffer shall contain the | 
| 224 |      * complete frame_header_obu() syntax element. | 
| 225 |      * | 
| 226 |      */ | 
| 227 |      = VAEncPackedHeaderPicture, | 
| 228 | } ; | 
| 229 |  | 
| 230 | /** | 
| 231 |  * \brief AV1 Encoding Sequence Parameter Buffer Structure. | 
| 232 |  * | 
| 233 |  * This structure conveys sequence level parameters. | 
| 234 |  * | 
| 235 |  */ | 
| 236 | typedef struct  _VAEncSequenceParameterBufferAV1 { | 
| 237 |     /** \brief AV1 profile setting. | 
| 238 |      *  value range [0..2]. | 
| 239 |      */ | 
| 240 |     uint8_t     seq_profile; | 
| 241 |  | 
| 242 |     /** \brief Level Setting of current operation point. | 
| 243 |      *  value range [0..23]. | 
| 244 |      */ | 
| 245 |     uint8_t     seq_level_idx; | 
| 246 |  | 
| 247 |     /** \brief Tier Setting of current operation point. | 
| 248 |      *  value range [0..1]. | 
| 249 |      */ | 
| 250 |     uint8_t     seq_tier; | 
| 251 |  | 
| 252 |     uint8_t     reserved8b; | 
| 253 |  | 
| 254 |     /** \brief Period between intra_only frames. */ | 
| 255 |     uint32_t    intra_period; | 
| 256 |  | 
| 257 |     /** \brief Period between I/P frames. | 
| 258 |      *  For hierarchical structure, this is the anchor frame distance. | 
| 259 |      */ | 
| 260 |     uint32_t    ip_period; | 
| 261 |  | 
| 262 |     /* \brief RC related fields. RC modes are set with VAConfigAttribRateControl. */ | 
| 263 |     /* For AV1, CBR implies HRD conformance and VBR implies no HRD conformance. */ | 
| 264 |  | 
| 265 |     /** | 
| 266 |      * \brief Initial bitrate set for this sequence in CBR or VBR modes. | 
| 267 |      * | 
| 268 |      * This field represents the initial bitrate value for CBR mode or | 
| 269 |      * initial max bitrate value for VBR mode in this sequence. | 
| 270 |      * i.e. if the encoder pipeline was created with a #VAConfigAttribRateControl | 
| 271 |      * attribute set to either \ref VA_RC_CBR or \ref VA_RC_VBR. | 
| 272 |      * | 
| 273 |      * The bitrate can be modified later on through | 
| 274 |      * #VAEncMiscParameterRateControl buffers. | 
| 275 |      */ | 
| 276 |     uint32_t    bits_per_second; | 
| 277 |  | 
| 278 |     union { | 
| 279 |         struct { | 
| 280 |             /** \brief Still picture encoding, no inter frame referencing. */ | 
| 281 |             uint32_t    still_picture                               : 1; | 
| 282 |             /** \brief Force using 128x128 or 64x64 Supper block */ | 
| 283 |             uint32_t    use_128x128_superblock                      : 1; | 
| 284 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 285 |             uint32_t    enable_filter_intra                         : 1; | 
| 286 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 287 |             uint32_t    enable_intra_edge_filter                    : 1; | 
| 288 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 289 |             uint32_t    enable_interintra_compound                  : 1; | 
| 290 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 291 |             uint32_t    enable_masked_compound                      : 1; | 
| 292 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 293 |             uint32_t    enable_warped_motion                        : 1; | 
| 294 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 295 |             uint32_t    enable_dual_filter                          : 1; | 
| 296 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 297 |             uint32_t    enable_order_hint                           : 1; | 
| 298 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 299 |             uint32_t    enable_jnt_comp                             : 1; | 
| 300 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 301 |             uint32_t    enable_ref_frame_mvs                        : 1; | 
| 302 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 303 |             uint32_t    enable_superres                             : 1; | 
| 304 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 305 |             uint32_t    enable_cdef                                 : 1; | 
| 306 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 307 |             uint32_t    enable_restoration                          : 1; | 
| 308 |             /** \brief Reserved bytes for future use, must be zero. */ | 
| 309 |             uint32_t    reserved_bits                               : 18; | 
| 310 |         } bits; | 
| 311 |         uint32_t value; | 
| 312 |     } seq_fields; | 
| 313 |  | 
| 314 |     /** \brief Corresponds to AV1 syntax element of the same name. | 
| 315 |      *  value range [0..7]. | 
| 316 |      */ | 
| 317 |     uint8_t     order_hint_bits_minus_1; | 
| 318 |  | 
| 319 |     /** \brief Reserved bytes for future use, must be zero */ | 
| 320 |     uint32_t                va_reserved[VA_PADDING_HIGH]; | 
| 321 | } VAEncSequenceParameterBufferAV1; | 
| 322 |  | 
| 323 | #define VA_AV1_MAX_SEGMENTS    8 | 
| 324 | #define VA_AV1_SEG_LVL_MAX     8 | 
| 325 |  | 
| 326 | /** | 
| 327 |  * \brief Segment parameters | 
| 328 |  */ | 
| 329 | typedef struct _VAEncSegParamAV1 { | 
| 330 |     union { | 
| 331 |         struct { | 
| 332 |             /** \brief Indicates if segmentation is enabled in the current frame. | 
| 333 |              *  If disabled, all the below parameters in the structure should | 
| 334 |              *  be set to 0, and ignored by driver. | 
| 335 |              */ | 
| 336 |             uint8_t     segmentation_enabled            : 1; | 
| 337 |  | 
| 338 |             /** | 
| 339 |              *  When segmentation_enabled equals 1 and segment_number > 0, | 
| 340 |              *  this parameter equals 1 indicates the segmentation map may | 
| 341 |              *  come from application, and that "Segment map data buffer" | 
| 342 |              *  should be provided with populated segment_id. If equals 0, | 
| 343 |              *  segmentation map should be inherited from a reference frame | 
| 344 |              *  (specified by \c primary_ref_frame). When segmentation_enabled or | 
| 345 |              *  segment_number equals 0, this parameter should be set to 0 | 
| 346 |              *  and ignored by driver. | 
| 347 |              */ | 
| 348 |             uint8_t     segmentation_update_map         : 1; | 
| 349 |             /** | 
| 350 |              * When segmentation_update_map equals 1, this parameter equaling 1 | 
| 351 |              * indicates segment id per block will be determined either from | 
| 352 |              * reference frame or from app. Equaling 0 means segment id per block | 
| 353 |              * will come from app. When segmentation_temporal_update equals 0, | 
| 354 |              * this parameter should be set to 0 and ignored by driver. | 
| 355 |             */ | 
| 356 |             uint8_t     segmentation_temporal_update    : 1; | 
| 357 |             /** \brief Reserved bytes for future use, must be zero. */ | 
| 358 |             uint8_t     reserved                        : 5; | 
| 359 |  | 
| 360 |         } bits; | 
| 361 |         uint8_t value; | 
| 362 |     } seg_flags; | 
| 363 |  | 
| 364 |     /** | 
| 365 |      *  If segmentation_enabled equals 1, this parameter indicates | 
| 366 |      *  the number of segments conveyed through VAAPI. In this case, | 
| 367 |      *  if segment_number equals 0, it will force the driver to determine | 
| 368 |      *  how many segments would be created as well as the segmentation map | 
| 369 |      *  to be generated. Also the driver shall write the segmentation_params() | 
| 370 |      *  syntax in the uncompressed header at \c bit_offset_segmentation (back-annotation). | 
| 371 |      *  In application, the rest parameters in this structure should be all | 
| 372 |      *  set to 0 and ignored by driver. And app should NOT send the | 
| 373 |      *  "Segment map data buffer". In packed uncompressed header | 
| 374 |      *  bitstream, app should write syntax element segmentation_enabled | 
| 375 |      *  as 0 and segmentation_params() should be only 1-bit-long. | 
| 376 |      *  If segment_number > 0, and segmentation_update_map = 1, app should provide | 
| 377 |      *  the "Segment map data buffer" and populate the rest of the | 
| 378 |      *  current data structure. And that underline encoder would honor | 
| 379 |      *  the segmentation parameters feature_data[0..segment_number-1][] | 
| 380 |      *  and feature_mask[0..segment_number-1], etc. | 
| 381 |      *  Value range [0..8]. | 
| 382 |      */ | 
| 383 |     uint8_t      segment_number; | 
| 384 |  | 
| 385 |     /** \brief segment parameters. | 
| 386 |      *  feature_data[][] is equivalent to variable FeatureData[][] in spec, | 
| 387 |      *  which is after clip3() operation. | 
| 388 |      *  Clip3(x, y, z) = (z<x)? x : ((z > y)? y : z); | 
| 389 |      *  The limit is defined in Segmentation_Feature_Max[ SEG_LVL_MAX ] = { | 
| 390 |      *  255, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, | 
| 391 |      *  MAX_LOOP_FILTER, 7, 0, 0 } | 
| 392 |      */ | 
| 393 |     int16_t     feature_data[VA_AV1_MAX_SEGMENTS][VA_AV1_SEG_LVL_MAX]; | 
| 394 |  | 
| 395 |     /** \brief Bit field to indicate each feature is enabled or not per | 
| 396 |      *  segment_id. Each bit is the feature_id. | 
| 397 |      */ | 
| 398 |     uint8_t     feature_mask[VA_AV1_MAX_SEGMENTS]; | 
| 399 |  | 
| 400 |     /** \brief Reserved bytes for future use, must be zero. */ | 
| 401 |     uint32_t                va_reserved[VA_PADDING_LOW]; | 
| 402 | } VAEncSegParamAV1; | 
| 403 |  | 
| 404 | /** | 
| 405 |  * \brief Segment map data buffer. | 
| 406 |  * | 
| 407 |  * This buffer is optional depending on the value of av1_segments.segmentation_enabled. | 
| 408 |  * If av1_segments.segmentation_enabled in the picture parameters equals 1, | 
| 409 |  * and RateControlMethod is not CQP and this surface is not provided by App, | 
| 410 |  * the encoder will determine the per block segmentation map. In this case, | 
| 411 |  * App should not provide the segmentation parameter data structure | 
| 412 |  * in frame header as well. If av1_segments.segmentation_enabled equals 1 | 
| 413 |  * and the segmentation map buffer is provided, app should embed the | 
| 414 |  * segmentation info in frame header, populate the VAEncSegParamAV1 structure with | 
| 415 |  * #VAEncMacroblockMapBufferType and the driver as well as the underline encoder | 
| 416 |  * should honor what is given by the app. | 
| 417 |  */ | 
| 418 | typedef struct _VAEncSegMapBufferAV1 { | 
| 419 |     /** \brief Segment map data size. */ | 
| 420 |     uint32_t    segmentMapDataSize; | 
| 421 |  | 
| 422 |     /** | 
| 423 |      * \brief Segment map. | 
| 424 |      * Size of this map is indicated by \ref segmentMapDataSize and each element | 
| 425 | 	 * in this map contains the segment id of a particular block. | 
| 426 |      * The element is indexed by raster scan order. | 
| 427 |      * The value of each entry should be in the range [0..7], inclusive. | 
| 428 |      */ | 
| 429 |     uint8_t    *pSegmentMap; | 
| 430 | } VAEncSegMapBufferAV1; | 
| 431 |  | 
| 432 | typedef enum { | 
| 433 |     /** \brief Identity transformation, 0-parameter. */ | 
| 434 |     VAAV1EncTransformationIdentity           = 0, | 
| 435 |     /** \brief Translational motion, 2-parameter. */ | 
| 436 |     VAAV1EncTransformationTranslation        = 1, | 
| 437 |     /** \brief Simplified affine with rotation + zoom only, 4-parameter. */ | 
| 438 |     VAAV1EncTransformationRotzoom            = 2, | 
| 439 |     /** \brief Affine, 6-parameter. */ | 
| 440 |     VAAV1EncTransformationAffine             = 3, | 
| 441 |     /** \brief Transformation count. */ | 
| 442 |     VAAV1EncTransformationCount | 
| 443 | } VAEncTransformationTypeAV1; | 
| 444 |  | 
| 445 | typedef struct _VAEncWarpedMotionParamsAV1{ | 
| 446 |  | 
| 447 |     /** \brief Specify the type of warped motion. */ | 
| 448 |     VAEncTransformationTypeAV1  wmtype; | 
| 449 |  | 
| 450 |     /** \brief Specify warp motion parameters. | 
| 451 |      *  wm.wmmat[] corresponds to gm_params[][] in spec. | 
| 452 |      *  Details in AV1 spec section 5.9.24 or refer to libaom code | 
| 453 |      *  https://aomedia.googlesource.com/aom/+/refs/heads/master/av1/decoder/decodeframe.c. | 
| 454 |      */ | 
| 455 |     int32_t                 wmmat[8]; | 
| 456 |  | 
| 457 |     /** \brief Valid or invalid on affine set. */ | 
| 458 |     uint8_t                 invalid; | 
| 459 |  | 
| 460 |     /** \brief Reserved bytes for future use, must be zero. */ | 
| 461 |     uint32_t                va_reserved[VA_PADDING_LOW]; | 
| 462 |  | 
| 463 | } VAEncWarpedMotionParamsAV1; | 
| 464 |  | 
| 465 | /** | 
| 466 |  * \brief Reference frame control. | 
| 467 |  * | 
| 468 |  * Suggest which frame to be used as reference along with preferred search order. | 
| 469 |  * | 
| 470 |  * search_idx#: index into ref_frame_idx[] to indicate that frame will be included | 
| 471 |  * in the reference list if value in range [1..7]. Invalid when value is 0. | 
| 472 |  * The order of the search_idx# indicates the preferred search order. | 
| 473 |  * | 
| 474 |  */ | 
| 475 | typedef union { | 
| 476 | 	struct | 
| 477 | 	{ | 
| 478 |         /** | 
| 479 |          * \brief Value used as index into ref_frame_idx[] to indicate that frame | 
| 480 |          * will be included in the reference list. | 
| 481 |          * valid value range: [1..7], invalid when value is 0. | 
| 482 |          */ | 
| 483 |         uint32_t search_idx0 : 3; | 
| 484 |         /** | 
| 485 |          * \brief Value used as index into ref_frame_idx[] to indicate that frame | 
| 486 |          * will be included in the reference list. | 
| 487 |          * valid value range: [1..7], invalid when value is 0. | 
| 488 |          */ | 
| 489 |         uint32_t search_idx1 : 3; | 
| 490 |         /** | 
| 491 |          * \brief Value used as index into ref_frame_idx[] to indicate that frame | 
| 492 |          * will be included in the reference list. | 
| 493 |          * valid value range: [1..7], invalid when value is 0. | 
| 494 |          */ | 
| 495 |         uint32_t search_idx2 : 3; | 
| 496 |         /** | 
| 497 |          * \brief Value used as index into ref_frame_idx[] to indicate that frame | 
| 498 |          * will be included in the reference list. | 
| 499 |          * valid value range: [1..7], invalid when value is 0. | 
| 500 |          */ | 
| 501 |         uint32_t search_idx3 : 3; | 
| 502 |         /** | 
| 503 |          * \brief Value used as index into ref_frame_idx[] to indicate that frame | 
| 504 |          * will be included in the reference list. | 
| 505 |          * valid value range: [1..7], invalid when value is 0. | 
| 506 |          */ | 
| 507 |         uint32_t search_idx4 : 3; | 
| 508 |         /** | 
| 509 |          * \brief Value used as index into ref_frame_idx[] to indicate that frame | 
| 510 |          * will be included in the reference list. | 
| 511 |          * valid value range: [1..7], invalid when value is 0. | 
| 512 |          */ | 
| 513 |         uint32_t search_idx5 : 3; | 
| 514 |         /** | 
| 515 |          * \brief Value used as index into ref_frame_idx[] to indicate that frame | 
| 516 |          * will be included in the reference list. | 
| 517 |          * valid value range: [1..7], invalid when value is 0. | 
| 518 |          */ | 
| 519 |         uint32_t search_idx6 : 3; | 
| 520 |  | 
| 521 |         /** \brief Reserved bytes for future use, must be zero. */ | 
| 522 |         uint32_t Reserved    : 11; | 
| 523 | 	} fields; | 
| 524 | 	uint32_t value; | 
| 525 | } VARefFrameCtrlAV1; | 
| 526 |  | 
| 527 | /** | 
| 528 |  * \brief AV1 Encoding Picture Parameter Buffer Structure. | 
| 529 |  * | 
| 530 |  * This structure conveys picture level parameters. | 
| 531 |  * | 
| 532 |  */ | 
| 533 | typedef struct  _VAEncPictureParameterBufferAV1 | 
| 534 | { | 
| 535 |     /** \brief AV1 encoder may support SupRes and dynamic scaling function. | 
| 536 |      *  For SupRes, underline encoder is responsible to do downscaling. | 
| 537 |      *  For dynamic scaling, app should provide the scaled raw source. | 
| 538 |      */ | 
| 539 |     /** \brief Raw source frame width in pixels. */ | 
| 540 |     uint16_t    frame_width_minus_1; | 
| 541 |     /** \brief Raw source frame height in pixels. */ | 
| 542 |     uint16_t    frame_height_minus_1; | 
| 543 |  | 
| 544 |     /** \brief Surface to store reconstructed frame, not used for enc only case. */ | 
| 545 |     VASurfaceID reconstructed_frame; | 
| 546 |  | 
| 547 |     /** \brief Buffer to store coded data. */ | 
| 548 |     VABufferID  coded_buf; | 
| 549 |  | 
| 550 |     /** \brief Reference frame buffers. | 
| 551 |      *  Each entry of the array specifies the surface index of the picture | 
| 552 |      *  that is referred by current picture or will be referred by any future | 
| 553 |      *  picture. The valid entries take value from 0 to 127, inclusive. | 
| 554 |      *  Non-valid entries, those do not point to pictures which are referred | 
| 555 |      *  by current picture or future pictures, should take value 0xFF. | 
| 556 |      *  Other values are not allowed. | 
| 557 |      * | 
| 558 |      *  Application should update this array based on the refreshing | 
| 559 |      *  information expected. | 
| 560 |      */ | 
| 561 |     VASurfaceID reference_frames[8]; | 
| 562 |  | 
| 563 |     /** \brief Reference index list. | 
| 564 |      *  Contains a list of indices into refernce_frames[]. | 
| 565 |      *  Indice with refernce frames range: [LAST_FRAME - LAST_FRAME, | 
| 566 |      *  LAST2_FRAME - LAST_FRAME, ..., ALTREF2_FRAME - LAST_FRAME]. | 
| 567 |      *  #define LAST_FRAME 1 | 
| 568 |      *  #define LAST2_FRAME 2 | 
| 569 |      *  #define LAST3_FRAME 3 | 
| 570 |      *  #define GOLDEN_FRAME 4 | 
| 571 |      *  #define BWDREF_FRAME 5 | 
| 572 |      *  #define ALTREF_FRAME 6 | 
| 573 |      *  #define ALTREF2_FRAME 7 | 
| 574 |      *  value range [0..7]. | 
| 575 |      */ | 
| 576 |     uint8_t     ref_frame_idx[7]; | 
| 577 |  | 
| 578 |     uint8_t     reserved8bits0; | 
| 579 |  | 
| 580 |     /** \brief primary reference frame. | 
| 581 |      *  Index into reference_frames[] | 
| 582 |      *  segment id map, context table, etc. come from the reference | 
| 583 |      *  frame pointed by this index. | 
| 584 |      *  value range [0..7]. | 
| 585 |      */ | 
| 586 |     uint8_t     primary_ref_frame; | 
| 587 |  | 
| 588 |     /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 589 |     uint8_t     order_hint; | 
| 590 |  | 
| 591 |     uint16_t    reserved16bits0; | 
| 592 |  | 
| 593 |     /** \brief Suggest which frames to be used as references. | 
| 594 |      *  see struct #VARefFrameCtrl for details. | 
| 595 |      */ | 
| 596 |     VARefFrameCtrlAV1     ref_frame_ctrl_l0; | 
| 597 |     VARefFrameCtrlAV1     ref_frame_ctrl_l1; | 
| 598 |  | 
| 599 |     union { | 
| 600 |         struct { | 
| 601 |             /** \brief frame type. | 
| 602 |              *  0:  key_frame. | 
| 603 |              *  1:  inter_frame. | 
| 604 |              *  2:  intra_only frame. | 
| 605 |              *  3:  switch_frame (app needs to set error_resilient_mode = 1, | 
| 606 |              *      refresh_frame_flags, etc approperately.). | 
| 607 |              */ | 
| 608 |             uint32_t    frame_type                      : 2; | 
| 609 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 610 |             uint32_t    error_resilient_mode            : 1; | 
| 611 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 612 |             uint32_t    disable_cdf_update              : 1; | 
| 613 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 614 |             uint32_t    use_superres                    : 1; | 
| 615 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 616 |             uint32_t    allow_high_precision_mv         : 1; | 
| 617 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 618 |             uint32_t    use_ref_frame_mvs               : 1; | 
| 619 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 620 |             uint32_t    disable_frame_end_update_cdf    : 1; | 
| 621 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 622 |             uint32_t    reduced_tx_set                  : 1; | 
| 623 |  | 
| 624 |             /** \brief For single tile group, app may choose to use one frame obu | 
| 625 |              *  to replace one frame header obu + one tile group obu. | 
| 626 |              *  Invalid if num_tile_groups_minus1 > 0. | 
| 627 |              */ | 
| 628 |             uint32_t    enable_frame_obu                : 1; | 
| 629 |  | 
| 630 |             /** \brief Indicate the current frame will be used as a long term reference. */ | 
| 631 |             uint32_t    long_term_reference             : 1; | 
| 632 |             /** \brief If the encoded frame will not be referred by other frames, | 
| 633 |              * its recon may not be generated in order to save memory bandwidth. | 
| 634 |              */ | 
| 635 |             uint32_t    disable_frame_recon             : 1; | 
| 636 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 637 |             uint32_t    allow_intrabc                   : 1; | 
| 638 |             /** \brief Equal to 1 indicates that intra blocks may use palette encoding. | 
| 639 |              * Otherwise disable palette encoding. | 
| 640 |              */ | 
| 641 |             uint32_t    palette_mode_enable             : 1; | 
| 642 |             /** \brief Reserved bytes for future use, must be zero. */ | 
| 643 |             uint32_t    reserved                        : 18; | 
| 644 |         } bits; | 
| 645 |         uint32_t value; | 
| 646 |     } picture_flags; | 
| 647 |  | 
| 648 |     /** \brief Block size for each Segment ID in Segment Map. | 
| 649 |      *  0: 16x16 block size, default value; | 
| 650 |      *  1: 32x32 block size; | 
| 651 |      *  2: 64x64 block size; | 
| 652 |      *  3: 8x8 block size. | 
| 653 |      */ | 
| 654 |     uint8_t     seg_id_block_size; | 
| 655 |  | 
| 656 |     /** \brief Number of tile groups minus 1. | 
| 657 |      *  value range [0..255]. | 
| 658 |      */ | 
| 659 |     uint8_t     num_tile_groups_minus1; | 
| 660 |  | 
| 661 |     /** \brief Temporal id of the frame.*/ | 
| 662 |     uint8_t     temporal_id; | 
| 663 |  | 
| 664 |     /** \brief Deblock filter parameters. | 
| 665 |      *  value range [0..63]. | 
| 666 |      */ | 
| 667 |     uint8_t     filter_level[2]; | 
| 668 |     uint8_t     filter_level_u; | 
| 669 |     uint8_t     filter_level_v; | 
| 670 |  | 
| 671 |     union { | 
| 672 |         struct { | 
| 673 |             /** \brief Sharpness level for deblock filter. | 
| 674 |              *  value range [0..7]. | 
| 675 |              */ | 
| 676 |             uint8_t     sharpness_level                 : 3; | 
| 677 |             uint8_t     mode_ref_delta_enabled          : 1; | 
| 678 |             uint8_t     mode_ref_delta_update           : 1; | 
| 679 |             /** \brief Reserved bytes for future use, must be zero. */ | 
| 680 |             uint8_t     reserved                        : 3; | 
| 681 |         } bits; | 
| 682 |         uint8_t    value; | 
| 683 |     } loop_filter_flags; | 
| 684 |  | 
| 685 |     /** \brief Super resolution scale denominator. | 
| 686 |      *  value range [9..16]. | 
| 687 |      */ | 
| 688 |     uint8_t     superres_scale_denominator; | 
| 689 |     /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 690 |     uint8_t     interpolation_filter; | 
| 691 |  | 
| 692 |     /** \brief Loop filter ref deltas. | 
| 693 |      *  value range [-63..63]. | 
| 694 |      */ | 
| 695 |     int8_t      ref_deltas[8]; | 
| 696 |  | 
| 697 |     /** \brief Loop filter mode deltas. | 
| 698 |      *  value range [-63..63]. | 
| 699 |      */ | 
| 700 |     int8_t      mode_deltas[2]; | 
| 701 |  | 
| 702 |     /** \brief Quantization params. */ | 
| 703 |     uint8_t     base_qindex; | 
| 704 |     int8_t      y_dc_delta_q; | 
| 705 |     int8_t      u_dc_delta_q; | 
| 706 |     int8_t      u_ac_delta_q; | 
| 707 |     int8_t      v_dc_delta_q; | 
| 708 |     int8_t      v_ac_delta_q; | 
| 709 |  | 
| 710 |     /** \brief Min value for base q index for BRC. | 
| 711 |      *  value range [1..255]. | 
| 712 |      */ | 
| 713 |     uint8_t     min_base_qindex; | 
| 714 |  | 
| 715 |     /** \brief Max value for base q index for BRC. | 
| 716 |      *  value range [1..255]. | 
| 717 |      */ | 
| 718 |     uint8_t     max_base_qindex; | 
| 719 |  | 
| 720 |     /** \brief Quantization matrix. */ | 
| 721 |     union { | 
| 722 |         struct { | 
| 723 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 724 |             uint16_t    using_qmatrix                   : 1; | 
| 725 |             /** \brief Following parameters only valid when using_qmatrix == 1. */ | 
| 726 |             uint16_t    qm_y                            : 4; | 
| 727 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 728 |             uint16_t    qm_u                            : 4; | 
| 729 |             /** \brief Corresponds to AV1 syntax element of the same name. */ | 
| 730 |             uint16_t    qm_v                            : 4; | 
| 731 |             /** \brief Reserved bytes for future use, must be zero. */ | 
| 732 |             uint16_t    reserved                        : 3; | 
| 733 |         } bits; | 
| 734 |         uint16_t    value; | 
| 735 |     } qmatrix_flags; | 
| 736 |  | 
| 737 |     uint16_t reserved16bits1; | 
| 738 |  | 
| 739 |     union { | 
| 740 |         struct { | 
| 741 |             /** \brief Specify whether quantizer index delta values are present. | 
| 742 |              *  value range [0..1]. */ | 
| 743 |             uint32_t    delta_q_present                 : 1; | 
| 744 |             /** \brief Corresponds to AV1 syntax element of the same name. | 
| 745 |              *  value range [0..3]. */ | 
| 746 |             uint32_t    delta_q_res                     : 2; | 
| 747 |  | 
| 748 |             /** \brief Specify whether loop filter delta values are present. | 
| 749 |              *  value range [0..1]. */ | 
| 750 |             uint32_t    delta_lf_present                : 1; | 
| 751 |             /** \brief Corresponds to AV1 syntax element of the same name. | 
| 752 |              *  value range [0..3]. */ | 
| 753 |             uint32_t    delta_lf_res                    : 2; | 
| 754 |             /** \brief Corresponds to AV1 syntax element of the same name. | 
| 755 |              *  value range [0..1]. */ | 
| 756 |             uint32_t    delta_lf_multi                  : 1; | 
| 757 |  | 
| 758 |             /** \brief Corresponds to AV1 syntax element of the same name. | 
| 759 |              *  0: ONLY_4X4; | 
| 760 |              *  1: TX_MODE_LARGEST; | 
| 761 |              *  2: TX_MODE_SELECT; | 
| 762 |              *  3: Invalid. | 
| 763 |              */ | 
| 764 |             uint32_t    tx_mode                         : 2; | 
| 765 |  | 
| 766 |             /** \brief Indicates whether to use single or compound reference prediction. | 
| 767 |              *  0: SINGLE_REFERENCE; | 
| 768 |              *  1: COMPOUND_REFERENCE; | 
| 769 |              *  2: REFERENCE_MODE_SELECT. | 
| 770 |              *  3: Invalid. | 
| 771 |              * | 
| 772 |              *  Value 2 means driver make decision to use single reference or compound reference. | 
| 773 |              */ | 
| 774 |             uint32_t    reference_mode                  : 2; | 
| 775 |             /** \brief Corresponds to AV1 syntax element of the same name. | 
| 776 |              *  value range [0..1]. | 
| 777 |              */ | 
| 778 |             uint32_t    skip_mode_present               : 1; | 
| 779 |             /** \brief Reserved bytes for future use, must be zero. */ | 
| 780 |             uint32_t    reserved                        : 20; | 
| 781 |         } bits; | 
| 782 |         uint32_t    value; | 
| 783 |     } mode_control_flags; | 
| 784 |  | 
| 785 |     /** \brief Segmentation parameters. */ | 
| 786 |     VAEncSegParamAV1    segments; | 
| 787 |  | 
| 788 |     /** \brief Number of tile columns. */ | 
| 789 |     uint8_t     tile_cols; | 
| 790 |     /** \brief Number of tile rows. */ | 
| 791 |     uint8_t     tile_rows; | 
| 792 |  | 
| 793 |     uint16_t    reserved16bits2; | 
| 794 |  | 
| 795 |     /** \brief The last tile column or row size needs to be derived. */ | 
| 796 |     uint16_t    width_in_sbs_minus_1[63]; | 
| 797 |     uint16_t    height_in_sbs_minus_1[63]; | 
| 798 |  | 
| 799 |     /** \brief specify which tile to use for the CDF update. | 
| 800 |      *  value range [0..127]*/ | 
| 801 |     uint16_t     context_update_tile_id; | 
| 802 |  | 
| 803 |     /** \brief Corresponds to AV1 syntax element of the same name. | 
| 804 |      *  value range [0..3]. | 
| 805 |      */ | 
| 806 |     uint8_t     cdef_damping_minus_3; | 
| 807 |     /** \brief Corresponds to AV1 syntax element of the same name. | 
| 808 |      *  value range [0..3]. | 
| 809 |      */ | 
| 810 |     uint8_t     cdef_bits; | 
| 811 |     /** \brief CDEF Y strengths. | 
| 812 |      *  value range [0..63]*/ | 
| 813 |     uint8_t     cdef_y_strengths[8]; | 
| 814 |     /** \brief CDEF UV strengths. | 
| 815 |      *  value range [0..63]*/ | 
| 816 |     uint8_t     cdef_uv_strengths[8]; | 
| 817 |  | 
| 818 |     union { | 
| 819 |         struct { | 
| 820 |             /** \brief Restoration type for Y frame. | 
| 821 |              *  value range [0..3]. | 
| 822 |              */ | 
| 823 |             uint16_t    yframe_restoration_type         : 2; | 
| 824 |             /** \brief Restoration type for Cb frame. | 
| 825 |              *  value range [0..3]. | 
| 826 |              */ | 
| 827 |             uint16_t    cbframe_restoration_type        : 2; | 
| 828 |             /** \brief Restoration type for Cr frame. | 
| 829 |              *  value range [0..3]. | 
| 830 |              */ | 
| 831 |             uint16_t    crframe_restoration_type        : 2; | 
| 832 |             /** \brief Corresponds to AV1 syntax element of the same name. | 
| 833 |              *  value range [0..2]. | 
| 834 |              */ | 
| 835 |             uint16_t    lr_unit_shift                   : 2; | 
| 836 |             /** \brief Corresponds to AV1 syntax element of the same name. | 
| 837 |              *  value range [0..1]. | 
| 838 |              */ | 
| 839 |             uint16_t    lr_uv_shift                     : 1; | 
| 840 |             /** \brief Reserved bytes for future use, must be zero. */ | 
| 841 |             uint16_t    reserved                        : 7; | 
| 842 |         } bits; | 
| 843 |         uint16_t    value; | 
| 844 |     } loop_restoration_flags; | 
| 845 |  | 
| 846 |     /** \brief Global motion. */ | 
| 847 |     VAEncWarpedMotionParamsAV1    wm[7]; | 
| 848 |  | 
| 849 |     /** | 
| 850 |      *  Offset in bits for syntax base_q_idx in packed frame header bit stream | 
| 851 |      *  from the start of the packed header data. | 
| 852 |      *  In BRC mode, this parameter should be set and driver will update base_q_idx in | 
| 853 |      *  uncompressed header according to this offset. | 
| 854 |      *  In CQP mode, this parameter should be set to 0 and ignored by driver. | 
| 855 |      */ | 
| 856 |     uint32_t    bit_offset_qindex; | 
| 857 |     /** | 
| 858 |      *  Offset in bits for syntax segmentation_enabled of frame header OBU | 
| 859 |      *  in packed frame header bit stream from the start of the packed header data. | 
| 860 |      *  Valid only in auto segmentation mode. Other than that, this parameter | 
| 861 |      *  should be set to 0 and ignored by driver. | 
| 862 |      */ | 
| 863 |     uint32_t    bit_offset_segmentation; | 
| 864 |     /** | 
| 865 |      *  Offset in bits for syntax loop_filter_params() in packed frame | 
| 866 |      *  header bit stream from the start of the packed header data. | 
| 867 |      *  In BRC mode, this parameter should be set and driver will update filter params | 
| 868 |      *  in packed frame header according to this offset. | 
| 869 |      *  In CQP mode, this parameter should be set to 0 and ignored by driver. | 
| 870 |      */ | 
| 871 |     uint32_t    bit_offset_loopfilter_params; | 
| 872 |     /** | 
| 873 |      *  In BRC mode, underline encoder should generate the approperiate | 
| 874 |      *  CDEF values and write back into uncompressed header. And app | 
| 875 |      *  should provide default CDEF values in packed header. This parameter | 
| 876 |      *  should point to the starting bit of cdef_params() syntax structure | 
| 877 |      *  in packed header. | 
| 878 |      *  In CQP mode, this parameter should be set to 0 and ignored by driver. | 
| 879 |      */ | 
| 880 |     uint32_t    bit_offset_cdef_params; | 
| 881 |     /** | 
| 882 |      *  In BRC mode, this parameter indicates the actual bit usage of | 
| 883 |      *  cdef_params() syntax structure in packed uncompressed header. | 
| 884 |      *  In CQP mode, this parameter should be set to 0 and ignored by driver. | 
| 885 |      */ | 
| 886 |     uint32_t    size_in_bits_cdef_params; | 
| 887 |  | 
| 888 |     /** | 
| 889 |      *  Offset in bytes for syntax obu_size of frame header OBU in packed | 
| 890 |      *  frame header bit stream from the start of the packed header. The frame | 
| 891 |      *  header OBU size depends on the encoded tile sizes. It applies to both | 
| 892 |      *  Frame Header OBU and Frame OBU if obu_size needs to be updated by | 
| 893 |      *  underline encoder. Otherwise, app can set it to 0 and ignored by driver. | 
| 894 |      * | 
| 895 |      *  In BRC mode, obu_size needs to be updated and this parameter should be set. | 
| 896 |      *  In CQP mode, this parameter should be set to 0 and ignored by driver. | 
| 897 |      */ | 
| 898 |     uint32_t    byte_offset_frame_hdr_obu_size; | 
| 899 |  | 
| 900 |     /** | 
| 901 |      * Frame header OBU bit stream size in bits. The frame header obu packed bit | 
| 902 |      * stream contains an obu header, a 4-byte long obu_size field, frame_header_obu() | 
| 903 |      * syntax chain, and a trailing bit if not inside a frame obu. If \c enable_frame_obu == 1, | 
| 904 |      * the value should include and up to the last bit of frame_header_obu() and | 
| 905 |      * excluding the bits generated by byte_alignment(). If \c enable_frame_obu == 0, | 
| 906 |      * the value should include and up to the trailing bit at the end of the frame | 
| 907 |      * header obu. The size will be used by encoder to calculate the final frame | 
| 908 |      * header size after bit shifting due to auto segmentation. | 
| 909 |      * In CQP mode, this parameter should be set to 0 and ignored by driver. | 
| 910 |      */ | 
| 911 |     uint32_t    size_in_bits_frame_hdr_obu; | 
| 912 |  | 
| 913 |     /** \brief Tile Group OBU header */ | 
| 914 |     union { | 
| 915 |         struct { | 
| 916 |             /** \brief Corresponds to AV1 syntax element of the same name. | 
| 917 |              *  value range [0..1]. | 
| 918 |              */ | 
| 919 |             uint8_t     obu_extension_flag              : 1; | 
| 920 |             /** \brief Corresponds to AV1 syntax element of the same name. | 
| 921 |              *  value range [0..1]. | 
| 922 |              */ | 
| 923 |             uint8_t     obu_has_size_field              : 1; | 
| 924 |             /** \brief Corresponds to AV1 syntax element of the same name. | 
| 925 |              *  value range [0..7]. | 
| 926 |              */ | 
| 927 |             uint8_t     temporal_id                     : 3; | 
| 928 |             /** \brief Corresponds to AV1 syntax element of the same name. | 
| 929 |              *  value range [0..2]. | 
| 930 |              */ | 
| 931 |             uint8_t     spatial_id                      : 2; | 
| 932 |             /** \brief Reserved bytes for future use, must be zero. */ | 
| 933 |             uint8_t     reserved                        : 1; | 
| 934 |         } bits; | 
| 935 |         uint8_t     value; | 
| 936 |     } tile_group_obu_hdr_info; | 
| 937 |  | 
| 938 |     /** \brief The number of frames skipped prior to the current frame. | 
| 939 |      *  It includes only the skipped frames that were not counted before. | 
| 940 |      *  App may generate the "show_existing_frame" short frame header OBUs | 
| 941 |      *  and send to driver with the next frame. Default value 0. | 
| 942 |      */ | 
| 943 |     uint8_t     number_skip_frames; | 
| 944 |  | 
| 945 |     uint16_t    reserved16bits3; | 
| 946 |  | 
| 947 |     /** \brief Indicates the application forced frame size change in bytes. | 
| 948 |      * When the value is positive, the frame size is reduced. Otherwise, the frame | 
| 949 |      * size increases. The parameter can be used when application skips frames with | 
| 950 |      * setting of NumSkipFrames. And application can also use it for other scenarios | 
| 951 |      * such as inserting "show_existing_frame" at very end of the sequence. | 
| 952 |      */ | 
| 953 |     int32_t    skip_frames_reduced_size; | 
| 954 |  | 
| 955 |     /** \brief Reserved bytes for future use, must be zero. */ | 
| 956 |     uint32_t    va_reserved[VA_PADDING_HIGH]; | 
| 957 | } VAEncPictureParameterBufferAV1; | 
| 958 |  | 
| 959 | /** | 
| 960 |  * \brief Tile Group Buffer. | 
| 961 |  */ | 
| 962 | typedef struct _VAEncTileGroupBufferAV1 { | 
| 963 |     /** \brief Tile group start location. | 
| 964 |      *  The position of the first tile in current tile group | 
| 965 |      *  in raster scan order across the frame. | 
| 966 |      *  value range [0..127]. | 
| 967 |      */ | 
| 968 |     uint8_t  tg_start; | 
| 969 |     /** \brief Tile group end location. | 
| 970 |      *  The position of the last tile in current tile group | 
| 971 |      *  in raster scan order across the frame. | 
| 972 |      *  value range [0..127]. | 
| 973 |      */ | 
| 974 |     uint8_t  tg_end; | 
| 975 |  | 
| 976 |     /** \brief Reserved bytes for future use, must be zero. */ | 
| 977 |     uint32_t                va_reserved[VA_PADDING_LOW]; | 
| 978 | } VAEncTileGroupBufferAV1; | 
| 979 |  | 
| 980 | /**@}*/ | 
| 981 |  | 
| 982 | #ifdef __cplusplus | 
| 983 | } | 
| 984 | #endif | 
| 985 |  | 
| 986 | #endif /* VA_ENC_AV1_H */ | 
| 987 |  |