Roll src/third_party/WebKit 3529d49:06e8485 (svn 202554:202555)
[chromium-blink-merge.git] / third_party / libva / va / va_dec_vp9.h
blob2deddb0b4fc229f47829ce48619d0926a88028f2
1 /*
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
14 * of the Software.
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.
25 /**
26 * \file va_dec_vp9.h
27 * \brief The VP9 decoding API
29 * This file contains the \ref api_dec_vp9 "VP9 decoding API".
32 #ifndef VA_DEC_VP9_H
33 #define VA_DEC_VP9_H
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 /**
40 * \defgroup api_dec_vp9 VP9 decoding API
42 * This VP9 decoding API supports 8-bit 420 format only.
44 * @{
50 /**
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
55 * per frame.
58 typedef struct _VADecPictureParameterBufferVP9
60 /**@{*/
62 /** \brief picture width
63 * Picture original resolution. The value may not be multiple of 8.
65 uint16_t frame_width;
66 /** \brief picture height
67 * Picture original resolution. The value may not be multiple of 8.
69 uint16_t frame_height;
71 /** \brief Surface indices of reference frames in DPB.
73 * Each entry of the list specifies the surface index of the picture
74 * that is referred by current picture or will be referred by any future
75 * picture.
76 * Application who calls this API should update this list based on the
77 * refreshing information from VP9 bitstream.
79 VASurfaceID reference_frames[8];
81 union
83 struct
85 /** \brief flags for current picture
86 * same syntax and semantic as those in VP9 code
88 uint32_t subsampling_x : 1;
89 uint32_t subsampling_y : 1;
90 uint32_t frame_type : 1;
91 uint32_t show_frame : 1;
92 uint32_t error_resilient_mode : 1;
93 uint32_t intra_only : 1;
94 uint32_t allow_high_precision_mv : 1;
95 uint32_t mcomp_filter_type : 3;
96 uint32_t frame_parallel_decoding_mode : 1;
97 uint32_t reset_frame_context : 2;
98 uint32_t refresh_frame_context : 1;
99 uint32_t frame_context_idx : 2;
100 uint32_t segmentation_enabled : 1;
102 /** \brief corresponds to variable temporal_update in VP9 code.
104 uint32_t segmentation_temporal_update : 1;
105 /** \brief corresponds to variable update_mb_segmentation_map
106 * in VP9 code.
108 uint32_t segmentation_update_map : 1;
110 /** \brief Index of reference_frames[] and points to the
111 * LAST reference frame.
112 * It corresponds to active_ref_idx[0] in VP9 code.
114 uint32_t last_ref_frame : 3;
115 /** \brief Sign Bias of the LAST reference frame.
116 * It corresponds to ref_frame_sign_bias[LAST_FRAME] in VP9 code.
118 uint32_t last_ref_frame_sign_bias : 1;
119 /** \brief Index of reference_frames[] and points to the
120 * GOLDERN reference frame.
121 * It corresponds to active_ref_idx[1] in VP9 code.
123 uint32_t golden_ref_frame : 3;
124 /** \brief Sign Bias of the GOLDERN reference frame.
125 * Corresponds to ref_frame_sign_bias[GOLDERN_FRAME] in VP9 code.
127 uint32_t golden_ref_frame_sign_bias : 1;
128 /** \brief Index of reference_frames[] and points to the
129 * ALTERNATE reference frame.
130 * Corresponds to active_ref_idx[2] in VP9 code.
132 uint32_t alt_ref_frame : 3;
133 /** \brief Sign Bias of the ALTERNATE reference frame.
134 * Corresponds to ref_frame_sign_bias[ALTREF_FRAME] in VP9 code.
136 uint32_t alt_ref_frame_sign_bias : 1;
137 /** \brief Lossless Mode
138 * LosslessFlag = base_qindex == 0 &&
139 * y_dc_delta_q == 0 &&
140 * uv_dc_delta_q == 0 &&
141 * uv_ac_delta_q == 0;
142 * Where base_qindex, y_dc_delta_q, uv_dc_delta_q and uv_ac_delta_q
143 * are all variables in VP9 code.
145 uint32_t lossless_flag : 1;
146 } bits;
147 uint32_t value;
148 } pic_fields;
150 /* following parameters have same syntax with those in VP9 code */
151 uint8_t filter_level;
152 uint8_t sharpness_level;
154 /** \brief number of tile rows specified by (1 << log2_tile_rows).
155 * It corresponds the variable with same name in VP9 code.
157 uint8_t log2_tile_rows;
158 /** \brief number of tile columns specified by (1 << log2_tile_columns).
159 * It corresponds the variable with same name in VP9 code.
161 uint8_t log2_tile_columns;
162 /** \brief Number of bytes taken up by the uncompressed frame header,
163 * which corresponds to byte length of function
164 * read_uncompressed_header() in VP9 code.
165 * Specifically, it is the byte count from bit stream buffer start to
166 * the last byte of uncompressed frame header.
167 * If there are other meta data in the buffer before uncompressed header,
168 * its size should be also included here.
170 uint8_t frame_header_length_in_bytes;
172 /** \brief The byte count of compressed header the bitstream buffer,
173 * which corresponds to syntax first_partition_size in code.
175 uint16_t first_partition_size;
177 /** These values are segment probabilities with same names in VP9
178 * function setup_segmentation(). They should be parsed directly from
179 * bitstream by application.
181 uint8_t mb_segment_tree_probs[7];
182 uint8_t segment_pred_probs[3];
184 /** \brief VP9 Profile definition
185 * value can be 0 or 1.
187 uint8_t profile;
189 /**@}*/
191 } VADecPictureParameterBufferVP9;
196 * \brief VP9 Segmentation Parameter Data Structure
198 * This structure conveys per segment parameters.
199 * 8 of this data structure will be included in VASegmentationParameterBufferVP9
200 * and sent to API in a single buffer.
203 typedef struct _VASegmentParameterVP9
205 /**@{*/
207 union
209 struct
211 /** \brief Indicates if per segment reference frame indicator
212 * is enabled.
213 * Corresponding to variable feature_enabled when
214 * j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
216 uint16_t segment_reference_enabled : 1;
217 /** \brief Specifies per segment reference indication.
218 * 0: reserved
219 * 1: Last ref
220 * 2: golden
221 * 3: altref
222 * Value can be derived from variable data when
223 * j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
225 uint16_t segment_reference : 2;
226 /** \brief Indicates if per segment skip feature is enabled.
227 * Corresponding to variable feature_enabled when
228 * j == SEG_LVL_SKIP in function setup_segmentation() VP9 code.
230 uint16_t segment_reference_skipped : 1;
231 } fields;
232 uint16_t value;
233 } segment_flags;
235 /** \brief Specifies the filter level information per segment.
236 * The value corresponds to variable lfi->lvl[seg][ref][mode] in VP9 code,
237 * where m is [ref], and n is [mode] in FilterLevel[m][n].
239 uint8_t filter_level[4][2];
240 /** \brief Specifies per segment Luma AC quantization scale.
241 * Corresponding to y_dequant[qindex][1] in vp9_mb_init_quantizer()
242 * function of VP9 code.
244 int16_t luma_ac_quant_scale;
245 /** \brief Specifies per segment Luma DC quantization scale.
246 * Corresponding to y_dequant[qindex][0] in vp9_mb_init_quantizer()
247 * function of VP9 code.
249 int16_t luma_dc_quant_scale;
250 /** \brief Specifies per segment Chroma AC quantization scale.
251 * Corresponding to uv_dequant[qindex][1] in vp9_mb_init_quantizer()
252 * function of VP9 code.
254 int16_t chroma_ac_quant_scale;
255 /** \brief Specifies per segment Chroma DC quantization scale.
256 * Corresponding to uv_dequant[qindex][0] in vp9_mb_init_quantizer()
257 * function of VP9 code.
259 int16_t chroma_dc_quant_scale;
261 /**@}*/
263 } VASegmentParameterVP9;
268 * \brief VP9 Slice Parameter Buffer Structure
270 * This structure conveys parameters related to segmentation data and should be
271 * sent once per frame.
273 * When segmentation is disabled, only SegParam[0] has valid values,
274 * all other entries should be populated with 0.
275 * Otherwise, all eight entries should be valid.
277 * Slice data buffer of VASliceDataBufferType is used
278 * to send the bitstream which should include whole or part of partition 0
279 * (at least compressed header) to the end of frame.
282 typedef struct _VASliceParameterBufferVP9
284 /**@{*/
285 /** \brief The byte count of current frame in the bitstream buffer,
286 * starting from first byte of the buffer.
287 * It uses the name slice_data_size to be consitent with other codec,
288 * but actually means frame_data_size.
290 uint32_t slice_data_size;
292 * offset to the first byte of partition data (control partition)
294 uint32_t slice_data_offset;
296 * see VA_SLICE_DATA_FLAG_XXX definitions
298 uint32_t slice_data_flag;
301 * \brief per segment information
303 VASegmentParameterVP9 seg_param[8];
305 /**@}*/
307 } VASliceParameterBufferVP9;
310 /**@}*/
312 #ifdef __cplusplus
314 #endif
316 #endif /* VA_DEC_VP9_H */