hardware/intel/libva
Révision | fb57f5c15e72c39efeb2a10492a327110d6a06c8 (tree) |
---|---|
l'heure | 2016-05-27 14:06:48 |
Auteur | Wang, Ce <ce.wang@inte...> |
Commiter | Xiang, Haihao |
Add API for VP9 Encode
Signed-off-by: Wang, Ce <ce.wang@intel.com>
Signed-off-by: bzhao11 <bo.zhao@intel.com>
[Haihao: include va_enc_vp9.h in va core include file]
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit 1c314d6a6e6aad9c73ec4837d78e4e3c99137f3b)
@@ -74,6 +74,7 @@ LOCAL_COPY_HEADERS := \ | ||
74 | 74 | va_enc_hevc.h \ |
75 | 75 | va_enc_jpeg.h \ |
76 | 76 | va_enc_vp8.h \ |
77 | + va_enc_vp9.h \ | |
77 | 78 | va_dec_vp9.h \ |
78 | 79 | va_version.h |
79 | 80 |
@@ -52,6 +52,7 @@ libva_source_h = \ | ||
52 | 52 | va_enc_jpeg.h \ |
53 | 53 | va_enc_vp8.h \ |
54 | 54 | va_enc_mpeg2.h \ |
55 | + va_enc_vp9.h \ | |
55 | 56 | va_tpi.h \ |
56 | 57 | va_version.h \ |
57 | 58 | va_vpp.h \ |
@@ -2945,6 +2945,7 @@ typedef struct _VAPictureHEVC | ||
2945 | 2945 | #include <va/va_enc_jpeg.h> |
2946 | 2946 | #include <va/va_enc_mpeg2.h> |
2947 | 2947 | #include <va/va_enc_vp8.h> |
2948 | +#include <va/va_enc_vp9.h> | |
2948 | 2949 | #include <va/va_vpp.h> |
2949 | 2950 | |
2950 | 2951 | /**@}*/ |
@@ -0,0 +1,598 @@ | ||
1 | +/* | |
2 | + * Copyright (c) 2007-2015 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_vp9.h | |
27 | + * \brief VP9 encoding API | |
28 | + * | |
29 | + * This file contains the \ref api_enc_vp9 "VP9 encoding API". | |
30 | + * | |
31 | + */ | |
32 | + | |
33 | +#ifndef VA_ENC_VP9_H | |
34 | +#define VA_ENC_VP9_H | |
35 | + | |
36 | +#ifdef __cplusplus | |
37 | +extern "C" { | |
38 | +#endif | |
39 | + | |
40 | +/** | |
41 | + * \defgroup api_enc_vp9 VP9 encoding API | |
42 | + * | |
43 | + * @{ | |
44 | + */ | |
45 | + | |
46 | +/** | |
47 | + * \brief VP9 Encoding Status Data Buffer Structure | |
48 | + * | |
49 | + * This structure is used to convey status data from encoder to application. | |
50 | + * Driver allocates VACodedBufferVP9Status as a private data buffer. | |
51 | + * Driver encapsulates the status buffer with a VACodedBufferSegment, | |
52 | + * and sets VACodedBufferSegment.status to be VA_CODED_BUF_STATUS_CODEC_SPECIFIC. | |
53 | + * And driver associates status data segment to the bit stream buffer segment | |
54 | + * by setting VACodedBufferSegment.next of coded_buf (bit stream) to the private | |
55 | + * buffer segment of status data. | |
56 | + * Application accesses it by calling VAMapBuffer() with VAEncCodedBufferType. | |
57 | + */ | |
58 | +typedef struct _VACodedBufferVP9Status | |
59 | +{ | |
60 | + /** Final quantization index used (yac), determined by BRC. | |
61 | + * Application is providing quantization index deltas | |
62 | + * ydc(0), y2dc(1), y2ac(2), uvdc(3), uvac(4) that are applied to all segments | |
63 | + * and segmentation qi deltas, they will not be changed by BRC. | |
64 | + */ | |
65 | + uint16_t base_qp_index; | |
66 | + | |
67 | + /** Final loopfilter levels for the frame, if segmentation is disabled only | |
68 | + * index 0 is used. | |
69 | + * If loop_filter_level is 0, it indicates loop filter is disabled. | |
70 | + */ | |
71 | + uint8_t loop_filter_level; | |
72 | + | |
73 | + /** | |
74 | + * Long term reference frame indication from BRC. BRC recommends the | |
75 | + * current frame that is being queried is a good candidate for a long | |
76 | + * term reference. | |
77 | + */ | |
78 | + uint8_t long_term_indication; | |
79 | + | |
80 | + /* suggested next frame width */ | |
81 | + uint16_t next_frame_width; | |
82 | + | |
83 | + /* suggested next frame height */ | |
84 | + uint16_t next_frame_height; | |
85 | + | |
86 | +} VACodedBufferVP9Status; | |
87 | + | |
88 | +/** | |
89 | + * \brief VP9 Encoding Sequence Parameter Buffer Structure | |
90 | + * | |
91 | + * This structure conveys sequence level parameters. | |
92 | + * | |
93 | + */ | |
94 | +typedef struct _VAEncSequenceParameterBufferVP9 | |
95 | +{ | |
96 | + /** \brief Frame size note: | |
97 | + * Picture resolution may change frame by frame. | |
98 | + * Application needs to allocate surfaces and frame buffers based on | |
99 | + * max frame resolution in case resolution changes for later frames. | |
100 | + * The source and recon surfaces allocated should be 64x64(SB) aligned | |
101 | + * on both horizontal and vertical directions. | |
102 | + * But buffers on the surfaces need to be aligned to CU boundaries. | |
103 | + */ | |
104 | + /* maximum frame width in pixels for the whole sequence */ | |
105 | + uint32_t max_frame_width; | |
106 | + | |
107 | + /* maximum frame height in pixels for the whole sequence */ | |
108 | + uint32_t max_frame_height; | |
109 | + | |
110 | + /* auto keyframe placement, non-zero means enable auto keyframe placement */ | |
111 | + uint32_t kf_auto; | |
112 | + | |
113 | + /* keyframe minimum interval */ | |
114 | + uint32_t kf_min_dist; | |
115 | + | |
116 | + /* keyframe maximum interval */ | |
117 | + uint32_t kf_max_dist; | |
118 | + | |
119 | + | |
120 | + /* RC related fields. RC modes are set with VAConfigAttribRateControl */ | |
121 | + /* For VP9, CBR implies HRD conformance and VBR implies no HRD conformance */ | |
122 | + | |
123 | + /** | |
124 | + * Initial bitrate set for this sequence in CBR or VBR modes. | |
125 | + * | |
126 | + * This field represents the initial bitrate value for this | |
127 | + * sequence if CBR or VBR mode is used, i.e. if the encoder | |
128 | + * pipeline was created with a #VAConfigAttribRateControl | |
129 | + * attribute set to either \ref VA_RC_CBR or \ref VA_RC_VBR. | |
130 | + * | |
131 | + * The bitrate can be modified later on through | |
132 | + * #VAEncMiscParameterRateControl buffers. | |
133 | + */ | |
134 | + uint32_t bits_per_second; | |
135 | + | |
136 | + /* Period between key frames */ | |
137 | + uint32_t intra_period; | |
138 | + | |
139 | +} VAEncSequenceParameterBufferVP9; | |
140 | + | |
141 | + | |
142 | +/** | |
143 | + * \brief VP9 Encoding Picture Parameter Buffer Structure | |
144 | + * | |
145 | + * This structure conveys picture level parameters. | |
146 | + * | |
147 | + */ | |
148 | +typedef struct _VAEncPictureParameterBufferVP9 | |
149 | +{ | |
150 | + /** VP9 encoder may support dynamic scaling function. | |
151 | + * If enabled (enable_dynamic_scaling is set), application may request | |
152 | + * GPU encodes picture with a different resolution from the raw source. | |
153 | + * GPU should handle the scaling process of source and | |
154 | + * all reference frames. | |
155 | + */ | |
156 | + /* raw source frame width in pixels */ | |
157 | + uint32_t frame_width_src; | |
158 | + /* raw source frame height in pixels */ | |
159 | + uint32_t frame_height_src; | |
160 | + | |
161 | + /* to be encoded frame width in pixels */ | |
162 | + uint32_t frame_width_dst; | |
163 | + /* to be encoded frame height in pixels */ | |
164 | + uint32_t frame_height_dst; | |
165 | + | |
166 | + /* surface to store reconstructed frame, not used for enc only case */ | |
167 | + VASurfaceID reconstructed_frame; | |
168 | + | |
169 | + /** \brief reference frame buffers | |
170 | + * Each entry of the array specifies the surface index of the picture | |
171 | + * that is referred by current picture or will be referred by any future | |
172 | + * picture. The valid entries take value from 0 to 127, inclusive. | |
173 | + * Non-valid entries, those do not point to pictures which are referred | |
174 | + * by current picture or future pictures, should take value 0xFF. | |
175 | + * Other values are not allowed. | |
176 | + * | |
177 | + * Application should update this array based on the refreshing | |
178 | + * information expected. | |
179 | + */ | |
180 | + VASurfaceID reference_frames[8]; | |
181 | + | |
182 | + /* buffer to store coded data */ | |
183 | + VABufferID coded_buf; | |
184 | + | |
185 | + union { | |
186 | + struct { | |
187 | + /* force this frame to be a keyframe */ | |
188 | + uint32_t force_kf : 1; | |
189 | + | |
190 | + /** \brief Indiates which frames to be used as reference. | |
191 | + * (Ref_frame_ctrl & 0x01) ? 1: last frame as reference frame, 0: not. | |
192 | + * (Ref_frame_ctrl & 0x02) ? 1: golden frame as reference frame, 0: not. | |
193 | + * (Ref_frame_ctrl & 0x04) ? 1: alt frame as reference frame, 0: not. | |
194 | + * L0 is for forward prediction. | |
195 | + * L1 is for backward prediction. | |
196 | + */ | |
197 | + uint32_t ref_frame_ctrl_l0 : 3; | |
198 | + uint32_t ref_frame_ctrl_l1 : 3; | |
199 | + | |
200 | + /** \brief Last Reference Frame index | |
201 | + * Specifies the index to RefFrameList[] which points to the LAST | |
202 | + * reference frame. It corresponds to active_ref_idx[0] in VP9 code. | |
203 | + */ | |
204 | + uint32_t ref_last_idx : 3; | |
205 | + | |
206 | + /** \brief Specifies the Sign Bias of the LAST reference frame. | |
207 | + * It corresponds to ref_frame_sign_bias[LAST_FRAME] in VP9 code. | |
208 | + */ | |
209 | + uint32_t ref_last_sign_bias : 1; | |
210 | + | |
211 | + /** \brief GOLDEN Reference Frame index | |
212 | + * Specifies the index to RefFrameList[] which points to the Golden | |
213 | + * reference frame. It corresponds to active_ref_idx[1] in VP9 code. | |
214 | + */ | |
215 | + uint32_t ref_gf_idx : 3; | |
216 | + | |
217 | + /** \brief Specifies the Sign Bias of the GOLDEN reference frame. | |
218 | + * It corresponds to ref_frame_sign_bias[GOLDEN_FRAME] in VP9 code. | |
219 | + */ | |
220 | + uint32_t ref_gf_sign_bias : 1; | |
221 | + | |
222 | + /** \brief Alternate Reference Frame index | |
223 | + * Specifies the index to RefFrameList[] which points to the Alternate | |
224 | + * reference frame. It corresponds to active_ref_idx[2] in VP9 code. | |
225 | + */ | |
226 | + uint32_t ref_arf_idx : 3; | |
227 | + | |
228 | + /** \brief Specifies the Sign Bias of the ALTERNATE reference frame. | |
229 | + * It corresponds to ref_frame_sign_bias[ALTREF_FRAME] in VP9 code. | |
230 | + */ | |
231 | + uint32_t ref_arf_sign_bias : 1; | |
232 | + | |
233 | + /* The temporal id the frame belongs to */ | |
234 | + uint32_t temporal_id : 8; | |
235 | + | |
236 | + uint32_t reserved : 5; | |
237 | + } bits; | |
238 | + uint32_t value; | |
239 | + } ref_flags; | |
240 | + | |
241 | + union { | |
242 | + struct { | |
243 | + /** | |
244 | + * Indicates if the current frame is a key frame or not. | |
245 | + * Corresponds to the same VP9 syntax element in frame tag. | |
246 | + */ | |
247 | + uint32_t frame_type : 1; | |
248 | + | |
249 | + /** \brief show_frame | |
250 | + * 0: current frame is not for display | |
251 | + * 1: current frame is for display | |
252 | + */ | |
253 | + uint32_t show_frame : 1; | |
254 | + | |
255 | + /** | |
256 | + * The following fields correspond to the same VP9 syntax elements | |
257 | + * in the frame header. | |
258 | + */ | |
259 | + uint32_t error_resilient_mode : 1; | |
260 | + | |
261 | + /** \brief Indicate intra-only for inter pictures. | |
262 | + * Must be 0 for key frames. | |
263 | + * 0: inter frame use both intra and inter blocks | |
264 | + * 1: inter frame use only intra blocks. | |
265 | + */ | |
266 | + uint32_t intra_only : 1; | |
267 | + | |
268 | + /** \brief Indicate high precision mode for Motion Vector prediction | |
269 | + * 0: normal mode | |
270 | + * 1: high precision mode | |
271 | + */ | |
272 | + uint32_t allow_high_precision_mv : 1; | |
273 | + | |
274 | + /** \brief Motion Compensation Filter type | |
275 | + * 0: eight-tap (only this mode is supported now.) | |
276 | + * 1: eight-tap-smooth | |
277 | + * 2: eight-tap-sharp | |
278 | + * 3: bilinear | |
279 | + * 4: switchable | |
280 | + */ | |
281 | + uint32_t mcomp_filter_type : 3; | |
282 | + uint32_t frame_parallel_decoding_mode : 1; | |
283 | + uint32_t reset_frame_context : 2; | |
284 | + uint32_t refresh_frame_context : 1; | |
285 | + uint32_t frame_context_idx : 2; | |
286 | + uint32_t segmentation_enabled : 1; | |
287 | + | |
288 | + /* corresponds to variable temporal_update in VP9 code. | |
289 | + * Indicates whether Segment ID is from bitstream or from previous | |
290 | + * frame. | |
291 | + * 0: Segment ID from bitstream | |
292 | + * 1: Segment ID from previous frame | |
293 | + */ | |
294 | + uint32_t segmentation_temporal_update : 1; | |
295 | + | |
296 | + /* corresponds to variable update_mb_segmentation_map in VP9 code. | |
297 | + * Indicates how hardware determines segmentation ID | |
298 | + * 0: intra block - segment id is 0; | |
299 | + * inter block - segment id from previous frame | |
300 | + * 1: intra block - segment id from bitstream (app or GPU decides) | |
301 | + * inter block - depends on segmentation_temporal_update | |
302 | + */ | |
303 | + uint32_t segmentation_update_map : 1; | |
304 | + | |
305 | + /** \brief Specifies if the picture is coded in lossless mode. | |
306 | + * | |
307 | + * lossless_mode = base_qindex == 0 && y_dc_delta_q == 0 \ | |
308 | + * && uv_dc_delta_q == 0 && uv_ac_delta_q == 0; | |
309 | + * Where base_qindex, y_dc_delta_q, uv_dc_delta_q and uv_ac_delta_q | |
310 | + * are all variables in VP9 code. | |
311 | + * | |
312 | + * When enabled, tx_mode needs to be set to 4x4 only and all | |
313 | + * tu_size in CU record set to 4x4 for entire frame. | |
314 | + * Software also has to program such that final_qindex=0 and | |
315 | + * final_filter_level=0 following the Quant Scale and | |
316 | + * Filter Level Table in Segmentation State section. | |
317 | + * Hardware forces Hadamard Tx when this bit is set. | |
318 | + * When lossless_mode is on, BRC has to be turned off. | |
319 | + * 0: normal mode | |
320 | + * 1: lossless mode | |
321 | + */ | |
322 | + uint32_t lossless_mode : 1; | |
323 | + | |
324 | + /** \brief MV prediction mode. Corresponds to VP9 variable with same name. | |
325 | + * comp_prediction_mode = 0: single prediction ony, | |
326 | + * comp_prediction_mode = 1: compound prediction, | |
327 | + * comp_prediction_mode = 2: hybrid prediction | |
328 | + * | |
329 | + * Not mandatory. App may suggest the setting based on power or | |
330 | + * performance. Kernal may use it as a guildline and decide the proper | |
331 | + * setting on its own. | |
332 | + */ | |
333 | + uint32_t comp_prediction_mode : 2; | |
334 | + | |
335 | + /** \brief Indicate how segmentation is specified | |
336 | + * 0 application specifies segmentation partitioning and | |
337 | + * relevant parameters. | |
338 | + * 1 GPU may decide on segmentation. If application already | |
339 | + * provides segmentation information, GPU may choose to | |
340 | + * honor it and further split into more levels if possible. | |
341 | + */ | |
342 | + uint32_t auto_segmentation : 1; | |
343 | + | |
344 | + /** \brief Indicate super frame syntax should be inserted | |
345 | + * 0 current frame is not encapsulated in super frame structure | |
346 | + * 1 current fame is to be encapsulated in super frame structure. | |
347 | + * super frame index syntax will be inserted by encoder at | |
348 | + * the end of current frame. | |
349 | + */ | |
350 | + uint32_t super_frame_flag : 1; | |
351 | + | |
352 | + uint32_t reserved : 10; | |
353 | + } bits; | |
354 | + uint32_t value; | |
355 | + } pic_flags; | |
356 | + | |
357 | + /** \brief indicate which frames in DPB should be refreshed. | |
358 | + * same syntax and semantic as in VP9 code. | |
359 | + */ | |
360 | + uint8_t refresh_frame_flags; | |
361 | + | |
362 | + /** \brief Base Q index in the VP9 term. | |
363 | + * Added with per segment delta Q index to get Q index of Luma AC. | |
364 | + */ | |
365 | + uint8_t luma_ac_qindex; | |
366 | + | |
367 | + /** | |
368 | + * Q index delta from base Q index in the VP9 term for Luma DC. | |
369 | + */ | |
370 | + int8_t luma_dc_qindex_delta; | |
371 | + | |
372 | + /** | |
373 | + * Q index delta from base Q index in the VP9 term for Chroma AC. | |
374 | + */ | |
375 | + int8_t chroma_ac_qindex_delta; | |
376 | + | |
377 | + /** | |
378 | + * Q index delta from base Q index in the VP9 term for Chroma DC. | |
379 | + */ | |
380 | + int8_t chroma_dc_qindex_delta; | |
381 | + | |
382 | + /** \brief filter level | |
383 | + * Corresponds to the same VP9 syntax element in frame header. | |
384 | + */ | |
385 | + uint8_t filter_level; | |
386 | + | |
387 | + /** | |
388 | + * Controls the deblocking filter sensitivity. | |
389 | + * Corresponds to the same VP9 syntax element in frame header. | |
390 | + */ | |
391 | + uint8_t sharpness_level; | |
392 | + | |
393 | + /** \brief Loop filter level reference delta values. | |
394 | + * Contains a list of 4 delta values for reference frame based block-level | |
395 | + * loop filter adjustment. | |
396 | + * If no update, set to 0. | |
397 | + * value range [-63..63] | |
398 | + */ | |
399 | + int8_t ref_lf_delta[4]; | |
400 | + | |
401 | + /** \brief Loop filter level mode delta values. | |
402 | + * Contains a list of 4 delta values for coding mode based MB-level loop | |
403 | + * filter adjustment. | |
404 | + * If no update, set to 0. | |
405 | + * value range [-63..63] | |
406 | + */ | |
407 | + int8_t mode_lf_delta[2]; | |
408 | + | |
409 | + /** | |
410 | + * Offset from starting position of output bitstream in bits where | |
411 | + * ref_lf_delta[] should be inserted. This offset should cover any metadata | |
412 | + * ahead of uncompressed header in inserted bit stream buffer (the offset | |
413 | + * should be same as that for final output bitstream buffer). | |
414 | + * | |
415 | + * In BRC mode, always insert ref_lf_delta[] (This implies uncompressed | |
416 | + * header should have mode_ref_delta_enabled=1 and mode_ref_delta_update=1). | |
417 | + */ | |
418 | + uint16_t bit_offset_ref_lf_delta; | |
419 | + | |
420 | + /** | |
421 | + * Offset from starting position of output bitstream in bits where | |
422 | + * mode_lf_delta[] should be inserted. | |
423 | + * | |
424 | + * In BRC mode, always insert mode_lf_delta[] (This implies uncompressed | |
425 | + * header should have mode_ref_delta_enabled=1 and mode_ref_delta_update=1). | |
426 | + */ | |
427 | + uint16_t bit_offset_mode_lf_delta; | |
428 | + | |
429 | + /** | |
430 | + * Offset from starting position of output bitstream in bits where (loop) | |
431 | + * filter_level should be inserted. | |
432 | + */ | |
433 | + uint16_t bit_offset_lf_level; | |
434 | + | |
435 | + /** | |
436 | + * Offset from starting position of output bitstream in bits where | |
437 | + * Base Qindex should be inserted. | |
438 | + */ | |
439 | + uint16_t bit_offset_qindex; | |
440 | + | |
441 | + /** | |
442 | + * Offset from starting position of output bitstream in bits where | |
443 | + * First Partition Size should be inserted. | |
444 | + */ | |
445 | + uint16_t bit_offset_first_partition_size; | |
446 | + | |
447 | + /** | |
448 | + * Offset from starting position of output bitstream in bits where | |
449 | + * segmentation_enabled is located in bitstream. When auto_segmentation | |
450 | + * is enabled, GPU uses this offset to locate and update the | |
451 | + * segmentation related information. | |
452 | + */ | |
453 | + uint16_t bit_offset_segmentation; | |
454 | + | |
455 | + /** \brief length in bit of segmentation portion from the location | |
456 | + * in bit stream where segmentation_enabled syntax is coded. | |
457 | + * When auto_segmentation is enabled, GPU uses this bit size to locate | |
458 | + * and update the information after segmentation. | |
459 | + */ | |
460 | + uint16_t bit_size_segmentation; | |
461 | + | |
462 | + | |
463 | + /** \brief log2 of number of tile rows | |
464 | + * Corresponds to the same VP9 syntax element in frame header. | |
465 | + * value range [0..2] | |
466 | + */ | |
467 | + uint8_t log2_tile_rows; | |
468 | + | |
469 | + /** \brief log2 of number of tile columns | |
470 | + * Corresponds to the same VP9 syntax element in frame header. | |
471 | + * value range [0..5] | |
472 | + */ | |
473 | + uint8_t log2_tile_columns; | |
474 | + | |
475 | + /** \brief indicate frame-skip happens | |
476 | + * Application may choose to drop/skip one or mulitple encoded frames or | |
477 | + * to-be-encoded frame due to various reasons such as insufficient | |
478 | + * bandwidth. | |
479 | + * Application uses the following three flags to inform GPU about frame-skip. | |
480 | + * | |
481 | + * value range of skip_frame_flag: [0..2] | |
482 | + * 0 - encode as normal, no skip; | |
483 | + * 1 - one or more frames were skipped by application prior to the | |
484 | + * current frame. Encode the current frame as normal. The driver | |
485 | + * will pass the number_skip_frames and skip_frames_size | |
486 | + * to bit rate control for adjustment. | |
487 | + * 2 - the current frame is to be skipped. Do not encode it but encrypt | |
488 | + * the packed header contents. This is for the secure encoding case | |
489 | + * where application generates a frame of all skipped blocks. | |
490 | + * The packed header will contain the skipped frame. | |
491 | + */ | |
492 | + uint8_t skip_frame_flag; | |
493 | + | |
494 | + /** \brief The number of frames skipped prior to the current frame. | |
495 | + * It includes only the skipped frames that were not counted before, | |
496 | + * and does not include the frame with skip_frame_flag == 2. | |
497 | + * Valid when skip_frame_flag = 1. | |
498 | + */ | |
499 | + uint8_t number_skip_frames; | |
500 | + | |
501 | + /** \brief When skip_frame_flag = 1, the size of the skipped frames in bits. | |
502 | + * It includes only the skipped frames that were not counted before, | |
503 | + * and does not include the frame size with skip_frame_flag = 2. | |
504 | + * When skip_frame_flag = 2, it is the size of the current skipped frame | |
505 | + * that is to be encrypted. | |
506 | + */ | |
507 | + uint32_t skip_frames_size; | |
508 | + | |
509 | +} VAEncPictureParameterBufferVP9; | |
510 | + | |
511 | + | |
512 | +/** | |
513 | + * \brief Per segment parameters | |
514 | + */ | |
515 | +typedef struct _VAEncSegParamVP9 | |
516 | +{ | |
517 | + union { | |
518 | + struct { | |
519 | + /** \brief Indicates if per segment reference frame indicator is enabled. | |
520 | + * Corresponding to variable feature_enabled when | |
521 | + * j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code. | |
522 | + */ | |
523 | + uint8_t segment_reference_enabled : 1; | |
524 | + | |
525 | + /** \brief Specifies per segment reference indication. | |
526 | + * 0: reserved | |
527 | + * 1: Last ref | |
528 | + * 2: golden | |
529 | + * 3: altref | |
530 | + * Value can be derived from variable data when | |
531 | + * j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code. | |
532 | + * value range: [0..3] | |
533 | + */ | |
534 | + uint8_t segment_reference : 2; | |
535 | + | |
536 | + /** \brief Indicates if per segment skip mode is enabled. | |
537 | + * Corresponding to variable feature_enabled when | |
538 | + * j == SEG_LVL_SKIP in function setup_segmentation() VP9 code. | |
539 | + */ | |
540 | + uint8_t segment_reference_skipped : 1; | |
541 | + | |
542 | + uint8_t reserved : 4; | |
543 | + | |
544 | + } bits; | |
545 | + uint8_t value; | |
546 | + } seg_flags; | |
547 | + | |
548 | + /** \brief Specifies per segment Loop Filter Delta. | |
549 | + * Must be 0 when segmentation_enabled == 0. | |
550 | + * value range: [-63..63] | |
551 | + */ | |
552 | + int8_t segment_lf_level_delta; | |
553 | + | |
554 | + /** \brief Specifies per segment QIndex Delta. | |
555 | + * Must be 0 when segmentation_enabled == 0. | |
556 | + * value range: [-255..255] | |
557 | + */ | |
558 | + int16_t segment_qindex_delta; | |
559 | + | |
560 | +} VAEncSegParamVP9; | |
561 | + | |
562 | +/** | |
563 | + * Structure to convey all segment related information. | |
564 | + * If segmentation is disabled, this data structure is still required. | |
565 | + * In this case, only seg_data[0] contains valid data. | |
566 | + * This buffer is sent once per frame. | |
567 | + * | |
568 | + * The buffer is created with VABufferType VAQMatrixBufferType. | |
569 | + * | |
570 | + */ | |
571 | +typedef struct _VAEncMiscParameterTypeVP9PerSegmantParam | |
572 | +{ | |
573 | + /** | |
574 | + * Parameters for 8 segments. | |
575 | + */ | |
576 | + VAEncSegParamVP9 seg_data[8]; | |
577 | + | |
578 | +} VAEncMiscParameterTypeVP9PerSegmantParam; | |
579 | + | |
580 | + | |
581 | +/** | |
582 | + * \brief VP9 Block Segmentation ID Buffer | |
583 | + * | |
584 | + * The application provides a buffer of VAEncMacroblockMapBufferType containing | |
585 | + * the initial segmentation id for each 8x8 block, one byte each, in raster scan order. | |
586 | + * Rate control may reassign it. For example, a 640x480 video, the buffer has 4800 entries. | |
587 | + * The value of each entry should be in the range [0..7], inclusive. | |
588 | + * If segmentation is not enabled, the application does not need to provide it. | |
589 | + */ | |
590 | + | |
591 | + | |
592 | +/**@}*/ | |
593 | + | |
594 | +#ifdef __cplusplus | |
595 | +} | |
596 | +#endif | |
597 | + | |
598 | +#endif /* VA_ENC_VP9_H */ |