2 * Copyright (c) 2014 Intel Corporation. All Rights Reserved.
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:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
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.
27 * \brief The VP9 decoding API
29 * This file contains the \ref api_dec_vp9 "VP9 decoding API".
40 * \defgroup api_dec_vp9 VP9 decoding API
42 * This VP9 decoding API supports 8-bit 420 format only.
51 * \brief VP9 Decoding Picture Parameter Buffer Structure
53 * This structure conveys picture level parameters.
54 * App should send a surface with this data structure down to VAAPI once
58 typedef struct _VADecPictureParameterBufferVP9
60 /** \brief picture width
61 * Picture original resolution. The value may not be multiple of 8.
64 /** \brief picture height
65 * Picture original resolution. The value may not be multiple of 8.
67 uint16_t frame_height;
69 /** \brief Surface indices of reference frames in DPB.
71 * Each entry of the list specifies the surface index of the picture
72 * that is referred by current picture or will be referred by any future
74 * Application who calls this API should update this list based on the
75 * refreshing information from VP9 bitstream.
77 VASurfaceID reference_frames[8];
83 /** \brief flags for current picture
84 * same syntax and semantic as those in VP9 code
86 uint32_t subsampling_x : 1;
87 uint32_t subsampling_y : 1;
88 uint32_t frame_type : 1;
89 uint32_t show_frame : 1;
90 uint32_t error_resilient_mode : 1;
91 uint32_t intra_only : 1;
92 uint32_t allow_high_precision_mv : 1;
93 uint32_t mcomp_filter_type : 3;
94 uint32_t frame_parallel_decoding_mode : 1;
95 uint32_t reset_frame_context : 2;
96 uint32_t refresh_frame_context : 1;
97 uint32_t frame_context_idx : 2;
98 uint32_t segmentation_enabled : 1;
100 /** \brief corresponds to variable temporal_update in VP9 code.
102 uint32_t segmentation_temporal_update : 1;
103 /** \brief corresponds to variable update_mb_segmentation_map
106 uint32_t segmentation_update_map : 1;
108 /** \brief Index of reference_frames[] and points to the
109 * LAST reference frame.
110 * It corresponds to active_ref_idx[0] in VP9 code.
112 uint32_t last_ref_frame : 3;
113 /** \brief Sign Bias of the LAST reference frame.
114 * It corresponds to ref_frame_sign_bias[LAST_FRAME] in VP9 code.
116 uint32_t last_ref_frame_sign_bias : 1;
117 /** \brief Index of reference_frames[] and points to the
118 * GOLDERN reference frame.
119 * It corresponds to active_ref_idx[1] in VP9 code.
121 uint32_t golden_ref_frame : 3;
122 /** \brief Sign Bias of the GOLDERN reference frame.
123 * Corresponds to ref_frame_sign_bias[GOLDERN_FRAME] in VP9 code.
125 uint32_t golden_ref_frame_sign_bias : 1;
126 /** \brief Index of reference_frames[] and points to the
127 * ALTERNATE reference frame.
128 * Corresponds to active_ref_idx[2] in VP9 code.
130 uint32_t alt_ref_frame : 3;
131 /** \brief Sign Bias of the ALTERNATE reference frame.
132 * Corresponds to ref_frame_sign_bias[ALTREF_FRAME] in VP9 code.
134 uint32_t alt_ref_frame_sign_bias : 1;
135 /** \brief Lossless Mode
136 * LosslessFlag = base_qindex == 0 &&
137 * y_dc_delta_q == 0 &&
138 * uv_dc_delta_q == 0 &&
139 * uv_ac_delta_q == 0;
140 * Where base_qindex, y_dc_delta_q, uv_dc_delta_q and uv_ac_delta_q
141 * are all variables in VP9 code.
143 uint32_t lossless_flag : 1;
148 /* following parameters have same syntax with those in VP9 code */
149 uint8_t filter_level;
150 uint8_t sharpness_level;
152 /** \brief number of tile rows specified by (1 << log2_tile_rows).
153 * It corresponds the variable with same name in VP9 code.
155 uint8_t log2_tile_rows;
156 /** \brief number of tile columns specified by (1 << log2_tile_columns).
157 * It corresponds the variable with same name in VP9 code.
159 uint8_t log2_tile_columns;
160 /** \brief Number of bytes taken up by the uncompressed frame header,
161 * which corresponds to byte length of function
162 * read_uncompressed_header() in VP9 code.
163 * Specifically, it is the byte count from bit stream buffer start to
164 * the last byte of uncompressed frame header.
165 * If there are other meta data in the buffer before uncompressed header,
166 * its size should be also included here.
168 uint8_t frame_header_length_in_bytes;
170 /** \brief The byte count of compressed header the bitstream buffer,
171 * which corresponds to syntax first_partition_size in code.
173 uint16_t first_partition_size;
175 /** These values are segment probabilities with same names in VP9
176 * function setup_segmentation(). They should be parsed directly from
177 * bitstream by application.
179 uint8_t mb_segment_tree_probs[7];
180 uint8_t segment_pred_probs[3];
182 /** \brief VP9 Profile definition
183 * value range [0..3].
187 /** \brief VP9 bit depth per sample
188 * same for both luma and chroma samples.
192 /** \brief Reserved bytes for future use, must be zero */
193 uint32_t va_reserved[VA_PADDING_MEDIUM];
195 } VADecPictureParameterBufferVP9;
200 * \brief VP9 Segmentation Parameter Data Structure
202 * This structure conveys per segment parameters.
203 * 8 of this data structure will be included in VASegmentationParameterBufferVP9
204 * and sent to API in a single buffer.
207 typedef struct _VASegmentParameterVP9
213 /** \brief Indicates if per segment reference frame indicator
215 * Corresponding to variable feature_enabled when
216 * j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
218 uint16_t segment_reference_enabled : 1;
219 /** \brief Specifies per segment reference indication.
224 * Value can be derived from variable data when
225 * j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
227 uint16_t segment_reference : 2;
228 /** \brief Indicates if per segment skip feature is enabled.
229 * Corresponding to variable feature_enabled when
230 * j == SEG_LVL_SKIP in function setup_segmentation() VP9 code.
232 uint16_t segment_reference_skipped : 1;
237 /** \brief Specifies the filter level information per segment.
238 * The value corresponds to variable lfi->lvl[seg][ref][mode] in VP9 code,
239 * where m is [ref], and n is [mode] in FilterLevel[m][n].
241 uint8_t filter_level[4][2];
242 /** \brief Specifies per segment Luma AC quantization scale.
243 * Corresponding to y_dequant[qindex][1] in vp9_mb_init_quantizer()
244 * function of VP9 code.
246 int16_t luma_ac_quant_scale;
247 /** \brief Specifies per segment Luma DC quantization scale.
248 * Corresponding to y_dequant[qindex][0] in vp9_mb_init_quantizer()
249 * function of VP9 code.
251 int16_t luma_dc_quant_scale;
252 /** \brief Specifies per segment Chroma AC quantization scale.
253 * Corresponding to uv_dequant[qindex][1] in vp9_mb_init_quantizer()
254 * function of VP9 code.
256 int16_t chroma_ac_quant_scale;
257 /** \brief Specifies per segment Chroma DC quantization scale.
258 * Corresponding to uv_dequant[qindex][0] in vp9_mb_init_quantizer()
259 * function of VP9 code.
261 int16_t chroma_dc_quant_scale;
263 /** \brief Reserved bytes for future use, must be zero */
264 uint32_t va_reserved[VA_PADDING_LOW];
266 } VASegmentParameterVP9;
271 * \brief VP9 Slice Parameter Buffer Structure
273 * This structure conveys parameters related to segmentation data and should be
274 * sent once per frame.
276 * When segmentation is disabled, only SegParam[0] has valid values,
277 * all other entries should be populated with 0.
278 * Otherwise, all eight entries should be valid.
280 * Slice data buffer of VASliceDataBufferType is used
281 * to send the bitstream which should include whole or part of partition 0
282 * (at least compressed header) to the end of frame.
285 typedef struct _VASliceParameterBufferVP9
287 /** \brief The byte count of current frame in the bitstream buffer,
288 * starting from first byte of the buffer.
289 * It uses the name slice_data_size to be consitent with other codec,
290 * but actually means frame_data_size.
292 uint32_t slice_data_size;
294 * offset to the first byte of partition data (control partition)
296 uint32_t slice_data_offset;
298 * see VA_SLICE_DATA_FLAG_XXX definitions
300 uint32_t slice_data_flag;
303 * \brief per segment information
305 VASegmentParameterVP9 seg_param[8];
307 /** \brief Reserved bytes for future use, must be zero */
308 uint32_t va_reserved[VA_PADDING_LOW];
310 } VASliceParameterBufferVP9;
319 #endif /* VA_DEC_VP9_H */