Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: third_party/libva/va/va_enc_vp9.h

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

Powered by Google App Engine
This is Rietveld 408576698