|
| 1 | +/* |
| 2 | + * Copyright (c) 2022 MTHREADS 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_avs2.h |
| 27 | + * \brief The AVS2 decoding API |
| 28 | + * |
| 29 | + * This file contains the \ref api_dec_avs2 "AVS2 decoding API". |
| 30 | + */ |
| 31 | + |
| 32 | +#ifndef VA_DEC_AVS2_H |
| 33 | +#define VA_DEC_AVS2_H |
| 34 | + |
| 35 | +#include <stdint.h> |
| 36 | + |
| 37 | +#ifdef __cplusplus |
| 38 | +extern "C" { |
| 39 | +#endif |
| 40 | + |
| 41 | +/** |
| 42 | + * \defgroup api_dec_avs2 AVS2 decoding API |
| 43 | + * |
| 44 | + * This AVS2 decoding API supports Main and Main10 profiles. |
| 45 | + * And it supports both short slice format and long slice format. |
| 46 | + * |
| 47 | + * @{ |
| 48 | + */ |
| 49 | + |
| 50 | +#define VA_AVS2_MAX_REF_COUNT 7 |
| 51 | + |
| 52 | +typedef enum { |
| 53 | + VA_AVS2_I_IMG = 0, |
| 54 | + VA_AVS2_P_IMG = 1, |
| 55 | + VA_AVS2_B_IMG = 2, |
| 56 | + VA_AVS2_F_IMG = 3, |
| 57 | + VA_AVS2_S_IMG = 4, |
| 58 | + VA_AVS2_G_IMG = 5, |
| 59 | + VA_AVS2_GB_IMG = 6, |
| 60 | +} VAAVS2PicType; |
| 61 | + |
| 62 | +typedef struct _VAPictureAVS2 { |
| 63 | + /** |
| 64 | + * \brief reconstructed picture buffer surface index |
| 65 | + * invalid when taking value VA_INVALID_SURFACE. |
| 66 | + */ |
| 67 | + VASurfaceID surface_id; |
| 68 | + |
| 69 | + int16_t doi; |
| 70 | + int16_t poi; |
| 71 | + |
| 72 | + int num_ref; |
| 73 | + int16_t ref_doi[VA_AVS2_MAX_REF_COUNT]; |
| 74 | + int16_t ref_poi[VA_AVS2_MAX_REF_COUNT]; |
| 75 | + |
| 76 | + /** \brief Reserved bytes for future use, must be zero */ |
| 77 | + uint32_t va_reserved[VA_PADDING_LOW]; |
| 78 | +} VAPictureAVS2; |
| 79 | + |
| 80 | +/** |
| 81 | + * \brief AVS2 Decoding Picture Parameter Buffer Structure |
| 82 | + * |
| 83 | + * This structure conveys picture level parameters and should be sent once |
| 84 | + * per frame. |
| 85 | + */ |
| 86 | +typedef struct _VAPictureParameterBufferAVS2 { |
| 87 | + uint32_t non_ref_flag : 1; // [ 0] |
| 88 | + uint32_t num_of_ref : 3; // [ 3: 1] |
| 89 | + uint32_t reserved_0 : 28; // [31: 4] |
| 90 | + |
| 91 | + VAPictureAVS2 CurrPic; |
| 92 | + VAPictureAVS2 ref_list[VA_AVS2_MAX_REF_COUNT]; |
| 93 | + |
| 94 | + uint32_t width : 16; // [15: 0] |
| 95 | + uint32_t height : 16; // [31:16] |
| 96 | + |
| 97 | + uint32_t log2_lcu_size_minus4 : 2; // [ 1: 0] |
| 98 | + uint32_t chroma_format : 2; // [ 3: 2] |
| 99 | + uint32_t output_bit_depth_minus8 : 2; // [ 5: 4] |
| 100 | + uint32_t weighted_skip_enable : 1; // [ 6] |
| 101 | + uint32_t multi_hypothesis_skip_enable : 1; // [ 7] |
| 102 | + uint32_t nonsquare_intra_prediction_enable : 1; // [ 8] |
| 103 | + uint32_t dph_enable : 1; // [ 9] |
| 104 | + uint32_t encoding_bit_depth_minus8 : 2; // [11:10] |
| 105 | + uint32_t field_coded_sequence : 1; // [ 12] |
| 106 | + uint32_t pmvr_enable : 1; // [ 13] |
| 107 | + uint32_t nonsquare_quadtree_transform_enable : 1; // [ 14] |
| 108 | + uint32_t inter_amp_enable : 1; // [ 15] |
| 109 | + uint32_t secondary_transform_enable_flag : 1; // [ 16] |
| 110 | + uint32_t fixed_pic_qp : 1; // [ 17] |
| 111 | + uint32_t pic_qp : 7; // [24:18] |
| 112 | + uint32_t picture_structure : 1; // [ 25] |
| 113 | + uint32_t top_field_picture_flag : 1; // [ 26] |
| 114 | + uint32_t scene_picture_disable : 1; // [ 27] |
| 115 | + uint32_t scene_reference_enable : 1; // [ 28] |
| 116 | + uint32_t pic_type : 3; // [31:29] VAAVS2PicType |
| 117 | + |
| 118 | + uint32_t lf_cross_slice_enable_flag : 1; // [ 0] |
| 119 | + uint32_t lf_pic_dbk_disable_flag : 1; // [ 1] |
| 120 | + uint32_t sao_enable : 1; // [ 2] |
| 121 | + uint32_t alf_enable : 1; // [ 3] |
| 122 | + uint32_t pic_alf_on_Y : 1; // [ 4] |
| 123 | + uint32_t pic_alf_on_U : 1; // [ 5] |
| 124 | + uint32_t pic_alf_on_V : 1; // [ 6] |
| 125 | + uint32_t pic_weight_quant_enable : 1; // [ 7] |
| 126 | + uint32_t pic_weight_quant_data_index : 2; // [ 9: 8] |
| 127 | + uint32_t reserved_1 : 22; // [31:10] |
| 128 | + |
| 129 | + int8_t alpha_c_offset; // -8 ~ +8 |
| 130 | + int8_t beta_offset; // -8 ~ +8 |
| 131 | + int8_t chroma_quant_param_delta_cb; // -16 ~ +16 |
| 132 | + int8_t chroma_quant_param_delta_cr; // -16 ~ +16 |
| 133 | + |
| 134 | + uint8_t wq_mat[16 + 64]; |
| 135 | + |
| 136 | + // alf_coeff[ 0-15: luma, 16:cb, 17:cr ][ ] |
| 137 | + int8_t alf_coeff[16 + 2][9]; |
| 138 | + |
| 139 | + /** \brief Reserved bytes for future use, must be zero */ |
| 140 | + uint32_t va_reserved[VA_PADDING_LOW]; |
| 141 | +} VAPictureParameterBufferAVS2; |
| 142 | + |
| 143 | +/** |
| 144 | + * \brief AVS2 Slice Parameter Buffer Structure |
| 145 | + * |
| 146 | + * Slice data buffer of VASliceDataBufferType is used to send the bitstream data. |
| 147 | + * When send AVS2 slice data, start code and slice header should be included. |
| 148 | + */ |
| 149 | +typedef struct _VASliceParameterBufferAVS2 { |
| 150 | + uint32_t slice_data_size; /* number of bytes in the slice data buffer for this slice */ |
| 151 | + uint32_t slice_data_offset; /* the offset to the first byte of slice data */ |
| 152 | + uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ |
| 153 | + |
| 154 | + uint16_t lcu_start_x; |
| 155 | + uint16_t lcu_start_y; |
| 156 | + |
| 157 | + uint32_t fixed_slice_qp : 1; |
| 158 | + uint32_t slice_qp : 7; |
| 159 | + uint32_t slice_sao_enable_Y : 1; |
| 160 | + uint32_t slice_sao_enable_U : 1; |
| 161 | + uint32_t slice_sao_enable_V : 1; |
| 162 | + uint32_t vlc_byte_offset : 4; |
| 163 | + uint32_t reserved : 17; |
| 164 | + |
| 165 | + /** \brief Reserved bytes for future use, must be zero */ |
| 166 | + uint32_t va_reserved[VA_PADDING_LOW]; |
| 167 | +} VASliceParameterBufferAVS2; |
| 168 | + |
| 169 | +/**@}*/ |
| 170 | + |
| 171 | +#ifdef __cplusplus |
| 172 | +} |
| 173 | +#endif |
| 174 | + |
| 175 | +#endif /* VA_DEC_AVS2_H */ |
0 commit comments