OSDN Git Service

update NEWS for libva 2.4.0
[android-x86/hardware-intel-common-libva.git] / va / va_enc_hevc.h
1 /*
2  * Copyright (c) 2007-2014 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_hevc.h
27  * \brief The HEVC encoding API
28  *
29  * This file contains the \ref api_enc_hevc "HEVC encoding API".
30  *
31  */
32
33 #ifndef VA_ENC_HEVC_H
34 #define VA_ENC_HEVC_H
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 #include <stdint.h>
41
42 /**
43  * \defgroup api_enc_hevc HEVC encoding API
44  *
45  * @{
46  */
47
48 /**
49  * @name Picture flags
50  *
51  * Those flags flags are meant to signal when a picture marks the end
52  * of a sequence, a stream, or even both at once.
53  *
54  * @{
55  */
56 /**
57  * \brief Marks the last picture in the sequence.
58  *
59  * i.e. the driver appends \c end_of_seq() NAL unit to the encoded frame.
60  */
61 #define HEVC_LAST_PICTURE_EOSEQ     0x01
62 /**
63  * \brief Marks the last picture in the stream.
64  *
65  * i.e. the driver appends \c end_of_stream() NAL unit to the encoded frame.
66  */
67 #define HEVC_LAST_PICTURE_EOSTREAM  0x02
68 /**@}*/
69
70 /**
71  * \brief Packed header types specific to HEVC encoding.
72  *
73  * Types of packed headers generally used for HEVC encoding. Each
74  * associated packed header data buffer shall contain the start code
75  * prefix 0x000001 followed by the complete NAL unit, thus also
76  * including the \c nal_unit_type.
77  *
78  * Note: the start code prefix can contain an arbitrary number of leading
79  * zeros. The driver will skip them for emulation prevention bytes insertion,
80  * if necessary.
81  */
82 typedef enum {
83     /**
84      * \brief Packed Video Parameter Set (VPS).
85      *
86      * The corresponding packed header data buffer shall contain the
87      * complete video_parameter_set_rbsp() syntax element.
88      *
89      * Note: packed \c nal_unit_type shall be equal to 32.
90      */
91     VAEncPackedHeaderHEVC_VPS   = VAEncPackedHeaderSequence,
92     /**
93      * \brief Packed Sequence Parameter Set (SPS).
94      *
95      * The corresponding packed header data buffer shall contain the
96      * complete seq_parameter_set_rbsp() syntax element.
97      *
98      * Note: packed \c nal_unit_type shall be equal to 33.
99      */
100     VAEncPackedHeaderHEVC_SPS   = VAEncPackedHeaderSequence,
101     /**
102      * \brief Packed Picture Parameter Set (PPS).
103      *
104      * The corresponding packed header data buffer shall contain the
105      * complete pic_parameter_set_rbsp() syntax element.
106      *
107      * Note: packed \c nal_unit_type shall be equal to 34.
108      */
109     VAEncPackedHeaderHEVC_PPS   = VAEncPackedHeaderPicture,
110     /**
111      * \brief Packed slice header.
112      *
113      * The corresponding packed header data buffer shall contain the
114      * \c slice_header() syntax element only, along with any start
115      * code prefix and NAL unit type preceeding it. i.e. this means
116      * that the buffer does not contain any of the \c slice_data() or
117      * the \c rbsp_slice_trailing_bits().
118      *
119      * Note: packed \c nal_unit_type shall be equal to 0 to 9 (non-IRAP
120      * picture), or 16 to 21 (IRAP picture).
121      */
122     VAEncPackedHeaderHEVC_Slice = VAEncPackedHeaderSlice,
123     /**
124      * \brief Packed Supplemental Enhancement Information (SEI).
125      *
126      * The corresponding packed header data buffer shall contain the
127      * complete sei_rbsp() syntax element, thus including several
128      * sei_message() elements if necessary.
129      *
130      * Note: packed \c nal_unit_type shall be equal to 39 or 40.
131      *
132      * @deprecated
133      * This is a deprecated packed header flag, All applications can use
134      * \c VA_ENC_PACKED_HEADER_RAW_DATA to pass the corresponding packed
135      * SEI header data buffer to the driver
136      */
137     VAEncPackedHeaderHEVC_SEI  va_deprecated_enum = (0x80000000 | 1),
138 } VAEncPackedHeaderTypeHEVC;
139
140 /**
141  * \brief Sequence parameter for HEVC encoding in main & main 10
142  * profiles.
143  *
144  * This structure holds information for \c seq_parameter_set_data() as
145  * defined by the HEVC specification.
146  *
147  * If packed sequence headers mode is used, i.e. if the encoding
148  * pipeline was configured with the #VA_ENC_PACKED_HEADER_SEQUENCE
149  * flag, then the driver expects two more buffers to be provided to
150  * the same \c vaRenderPicture() as this buffer:
151  * - a #VAEncPackedHeaderParameterBuffer with type set to
152  *   VAEncPackedHeaderType::VAEncPackedHeaderSequence ;
153  * - a #VAEncPackedHeaderDataBuffer which holds the actual packed
154  *   header data.
155  *
156  * If \c seq_scaling_matrix_present_flag is set to \c 1, then a
157  * #VAQMatrixBufferHEVC buffer shall also be provided within the same
158  * \c vaRenderPicture() call as this sequence parameter buffer.
159  */
160 typedef struct _VAEncSequenceParameterBufferHEVC {
161     /** \brief Same as the HEVC bitstream syntax element.
162      *  value range [1..2].
163      */
164     uint8_t     general_profile_idc;
165     /** \brief Same as the HEVC bitstream syntax element.
166      *  general_level_idc shall be set equal to a value of 30 times the level
167      *  numbers allowed [1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1, 5.2, 6, 6.1, 6.2]
168      */
169     uint8_t     general_level_idc;
170     /** \brief Same as the HEVC bitstream syntax element.
171      *  Only value 0 is allowed for level value below 4, exclusive.
172      */
173     uint8_t     general_tier_flag;
174     /** \brief Period between I frames. */
175     uint32_t    intra_period;
176     /** \brief Period between IDR frames. */
177     uint32_t    intra_idr_period;
178     /** \brief Period between I/P frames. */
179     uint32_t    ip_period;
180     /**
181      * \brief Initial bitrate set for this sequence in CBR or VBR modes.
182      *
183      * This field represents the initial bitrate value for this
184      * sequence if CBR or VBR mode is used, i.e. if the encoder
185      * pipeline was created with a #VAConfigAttribRateControl
186      * attribute set to either \ref VA_RC_CBR or \ref VA_RC_VBR.
187      *
188      * The bitrate can be modified later on through
189      * #VAEncMiscParameterRateControl buffers.
190      */
191     uint32_t    bits_per_second;
192     /** \brief Picture width in pixel samples.
193      *  Its value must be multiple of min CU size.
194      */
195     uint16_t    pic_width_in_luma_samples;
196     /** \brief Picture height in pixel samples.
197      *  Its value must be multiple of min CU size.
198      */
199     uint16_t    pic_height_in_luma_samples;
200
201     union {
202         struct {
203             /** \brief Same as the HEVC bitstream syntax element. */
204             uint32_t    chroma_format_idc                              : 2;
205             /** \brief Same as the HEVC bitstream syntax element. */
206             uint32_t    separate_colour_plane_flag                     : 1;
207             /** \brief Same as the HEVC bitstream syntax element. */
208             uint32_t    bit_depth_luma_minus8                          : 3;
209             /** \brief Same as the HEVC bitstream syntax element. */
210             uint32_t    bit_depth_chroma_minus8                        : 3;
211             /** \brief Same as the HEVC bitstream syntax element. */
212             uint32_t    scaling_list_enabled_flag                      : 1;
213             /** \brief Same as the HEVC bitstream syntax element. */
214             uint32_t    strong_intra_smoothing_enabled_flag            : 1;
215             /** \brief Same as the HEVC bitstream syntax element. */
216             uint32_t    amp_enabled_flag                               : 1;
217             /** \brief Same as the HEVC bitstream syntax element. */
218             uint32_t    sample_adaptive_offset_enabled_flag            : 1;
219             /** \brief Same as the HEVC bitstream syntax element. */
220             uint32_t    pcm_enabled_flag                               : 1;
221             /** \brief Same as the HEVC bitstream syntax element. */
222             uint32_t    pcm_loop_filter_disabled_flag                  : 1;
223             /** \brief Same as the HEVC bitstream syntax element. */
224             uint32_t    sps_temporal_mvp_enabled_flag                  : 1;
225
226             uint32_t    reserved_bits                                  : 16;
227         } bits;
228         uint32_t value;
229     } seq_fields;
230
231     /** \brief Same as the HEVC bitstream syntax element.
232      *  value range [0..3]
233      */
234     uint8_t     log2_min_luma_coding_block_size_minus3;
235
236     /** \brief Same as the HEVC bitstream syntax element.
237      */
238     uint8_t     log2_diff_max_min_luma_coding_block_size;
239
240     /** \brief Same as the HEVC bitstream syntax element.
241      *  value range [0..3]
242      */
243     uint8_t     log2_min_transform_block_size_minus2;
244
245     /** \brief Same as the HEVC bitstream syntax element.
246      */
247     uint8_t     log2_diff_max_min_transform_block_size;
248
249     /** \brief Same as the HEVC bitstream syntax element.
250      *  value range [2]
251      */
252     uint8_t     max_transform_hierarchy_depth_inter;
253
254     /** \brief Same as the HEVC bitstream syntax element.
255      *  value range [2]
256      */
257     uint8_t     max_transform_hierarchy_depth_intra;
258
259     /** \brief Same as the HEVC bitstream syntax element. */
260     uint32_t    pcm_sample_bit_depth_luma_minus1;
261
262     /** \brief Same as the HEVC bitstream syntax element. */
263     uint32_t    pcm_sample_bit_depth_chroma_minus1;
264
265     /** \brief Same as the HEVC bitstream syntax element. */
266     uint32_t    log2_min_pcm_luma_coding_block_size_minus3;
267
268     /** \brief Derived from the HEVC bitstream syntax element.
269     *  log2_min_pcm_luma_coding_block_size_minus3 +
270     *  log2_diff_max_min_pcm_luma_coding_block_size
271     */
272     uint32_t    log2_max_pcm_luma_coding_block_size_minus3;
273
274     /** @name VUI parameters (optional) */
275     /**@{*/
276     /** \brief Same as the HEVC bitstream syntax element. */
277     uint8_t     vui_parameters_present_flag;
278     union {
279         struct {
280             /** \brief Same as the HEVC bitstream syntax element. */
281             uint32_t    aspect_ratio_info_present_flag                 : 1;
282             /** \brief Same as the HEVC bitstream syntax element. */
283             uint32_t    neutral_chroma_indication_flag                 : 1;
284             /** \brief Same as the HEVC bitstream syntax element. */
285             uint32_t    field_seq_flag                                 : 1;
286             /** \brief Same as the HEVC bitstream syntax element. */
287             uint32_t    vui_timing_info_present_flag                   : 1;
288             /** \brief Same as the HEVC bitstream syntax element. */
289             uint32_t    bitstream_restriction_flag                     : 1;
290             /** \brief Same as the HEVC bitstream syntax element. */
291             uint32_t    tiles_fixed_structure_flag                     : 1;
292             /** \brief Same as the HEVC bitstream syntax element. */
293             uint32_t    motion_vectors_over_pic_boundaries_flag        : 1;
294             /** \brief Same as the HEVC bitstream syntax element. */
295             uint32_t    restricted_ref_pic_lists_flag                  : 1;
296             /** \brief Range: 0 to 16, inclusive. */
297             uint32_t    log2_max_mv_length_horizontal                  : 5;
298             /** \brief Range: 0 to 16, inclusive. */
299             uint32_t    log2_max_mv_length_vertical                    : 5;
300         } bits;
301         uint32_t value;
302     } vui_fields;
303     /** \brief Same as the HEVC bitstream syntax element. */
304     uint8_t     aspect_ratio_idc;
305     /** \brief Same as the HEVC bitstream syntax element. */
306     uint32_t    sar_width;
307     /** \brief Same as the HEVC bitstream syntax element. */
308     uint32_t    sar_height;
309     /** \brief Same as the HEVC bitstream syntax element. */
310     uint32_t    vui_num_units_in_tick;
311     /** \brief Same as the HEVC bitstream syntax element. */
312     uint32_t    vui_time_scale;
313     /** \brief Same as the HEVC bitstream syntax element. */
314     uint16_t    min_spatial_segmentation_idc;
315     /** \brief Same as the HEVC bitstream syntax element. */
316     uint8_t     max_bytes_per_pic_denom;
317     /** \brief Same as the HEVC bitstream syntax element. */
318     uint8_t     max_bits_per_min_cu_denom;
319
320     /** \brief Reserved bytes for future use, must be zero */
321     uint32_t                va_reserved[VA_PADDING_MEDIUM];
322     /**@}*/
323 } VAEncSequenceParameterBufferHEVC;
324
325 /****************************
326  * HEVC data structures
327  ****************************/
328 /**
329  * \brief Picture parameter for HEVC encoding in main & main 10
330  * profiles.
331  *
332  * This structure holds information for \c pic_parameter_set_rbsp() as
333  * defined by the HEVC specification.
334  *
335  * If packed picture headers mode is used, i.e. if the encoding
336  * pipeline was configured with the #VA_ENC_PACKED_HEADER_PICTURE
337  * flag, then the driver expects two more buffers to be provided to
338  * the same \c vaRenderPicture() as this buffer:
339  * - a #VAEncPackedHeaderParameterBuffer with type set to
340  *   VAEncPackedHeaderType::VAEncPackedHeaderPicture ;
341  * - a #VAEncPackedHeaderDataBuffer which holds the actual packed
342  *   header data.
343  *
344  * If \c pic_scaling_matrix_present_flag is set to \c 1, then a
345  * #VAQMatrixBufferHEVC buffer shall also be provided within the same
346  * \c vaRenderPicture() call as this picture parameter buffer.
347  */
348 typedef struct _VAEncPictureParameterBufferHEVC {
349     /**
350      * \brief Information about the picture to be encoded.
351      *
352      * See #VAPictureHEVC for further description of each field.
353      * Note that decoded_curr_pic.picture_id represents the reconstructed
354      * (decoded) picture. User provides a scratch VA surface ID here.
355      * Long term reference and RPS related fields should be set to 0
356      * and ignored.
357      */
358     VAPictureHEVC   decoded_curr_pic;
359     /**
360      * \brief Decoded Picture Buffer (DPB).
361      *
362      * This array represents the list of reconstructed (decoded)
363      * frames used as reference. It is important to keep track of
364      * reconstructed frames so that they can be used later on as
365      * reference for P or B-frames encoding.
366      */
367     VAPictureHEVC   reference_frames[15];
368     /**
369      * \brief Output encoded bitstream.
370      *
371      * \ref coded_buf has type #VAEncCodedBufferType. It should be
372      * large enough to hold the compressed NAL slice and possibly VPS, SPS
373      * and PPS NAL units, and other NAL units such as SEI.
374      */
375     VABufferID      coded_buf;
376
377     /** \brief collocated reference picture buffer index of ReferenceFrames[].
378      * Please note it is different from HEVC syntac element collocated_ref_idx.
379      * When  the HEVC syntax element slice_temporal_mvp_enable_flag takes value 0,
380      * collocated_ref_pic_index should take value 0xFF. .
381      * Range: [0..14, 0xFF]
382      */
383     uint8_t         collocated_ref_pic_index;
384
385     /**
386      * \brief OR'd flags describing whether the picture is the last one or not.
387      *
388      * This fields holds 0 if the picture to be encoded is not the last
389      * one in the stream or sequence. Otherwise, it is a combination of
390      * \ref HEVC_LAST_PICTURE_EOSEQ or \ref HEVC_LAST_PICTURE_EOSTREAM.
391      */
392     uint8_t         last_picture;
393
394     /** \brief \c init_qp_minus26 + 26. */
395     uint8_t         pic_init_qp;
396
397     /** \brief Corresponds to HEVC syntax element of the same name. */
398     uint8_t         diff_cu_qp_delta_depth;
399
400     /** \brief Corresponds to HEVC syntax element of the same name. */
401     int8_t          pps_cb_qp_offset;
402
403     /** \brief Corresponds to HEVC syntax element of the same name. */
404     int8_t          pps_cr_qp_offset;
405
406     /** \brief Corresponds to HEVC syntax element of the same name. */
407     uint8_t         num_tile_columns_minus1;
408
409     /** \brief Corresponds to HEVC syntax element of the same name. */
410     uint8_t         num_tile_rows_minus1;
411
412     /** \brief Corresponds to HEVC syntax element of the same name. */
413     uint8_t         column_width_minus1[19];
414
415     /** \brief Corresponds to HEVC syntax element of the same name. */
416     uint8_t         row_height_minus1[21];
417
418     /** \brief Corresponds to HEVC syntax element of the same name. */
419     uint8_t         log2_parallel_merge_level_minus2;
420
421     /** \brief Application may set the CTU bit size limit based on
422      *  spec requirement (A.3.2), or other value for special purpose.
423      *  If the value is set 0, no bit size limit is checked.
424      */
425     uint8_t         ctu_max_bitsize_allowed;
426
427     /** \brief Maximum reference index for reference picture list 0.
428      *   value range: [0..14].
429      */
430     uint8_t         num_ref_idx_l0_default_active_minus1;
431
432     /** \brief Maximum reference index for reference picture list 1.
433      *  value range: [0..14].
434      */
435     uint8_t         num_ref_idx_l1_default_active_minus1;
436
437     /** \brief PPS header
438      *  Used by GPU to generate new slice headers in slice size control.
439      *  value range: [0..63].
440      */
441     uint8_t         slice_pic_parameter_set_id;
442
443     /** \brief NAL unit type
444      *  Used by GPU to generate new slice headers in slice size control.
445      *  value range: [0..63].
446      */
447     uint8_t         nal_unit_type;
448
449     union {
450         struct {
451             /** \brief Is picture an IDR picture? */
452             uint32_t    idr_pic_flag                                   : 1;
453             /** \brief Picture type.
454              *  I  - 1;
455              *  P  - 2;
456              *  B  - 3;
457              *  B1 - 4;
458              *  B2 - 5;
459              * B1 and B2 are frame types for hierachical B, explanation
460              * can refer to num_b_in_gop[].
461              */
462             uint32_t    coding_type                                    : 3;
463             /** \brief Is picture a reference picture? */
464             uint32_t    reference_pic_flag                             : 1;
465             /** \brief Corresponds to HEVC syntax element of the same name. */
466             uint32_t    dependent_slice_segments_enabled_flag          : 1;
467             /** \brief Corresponds to HEVC syntax element of the same name. */
468             uint32_t    sign_data_hiding_enabled_flag                  : 1;
469             /** \brief Corresponds to HEVC syntax element of the same name. */
470             uint32_t    constrained_intra_pred_flag                    : 1;
471             /** \brief Corresponds to HEVC syntax element of the same name. */
472             uint32_t    transform_skip_enabled_flag                    : 1;
473             /** \brief Corresponds to HEVC syntax element of the same name. */
474             uint32_t    cu_qp_delta_enabled_flag                       : 1;
475             /** \brief Corresponds to HEVC syntax element of the same name. */
476             uint32_t    weighted_pred_flag                             : 1;
477             /** \brief Corresponds to HEVC syntax element of the same name. */
478             uint32_t    weighted_bipred_flag                           : 1;
479             /** \brief Corresponds to HEVC syntax element of the same name. */
480             uint32_t    transquant_bypass_enabled_flag                 : 1;
481             /** \brief Corresponds to HEVC syntax element of the same name. */
482             uint32_t    tiles_enabled_flag                             : 1;
483             /** \brief Corresponds to HEVC syntax element of the same name. */
484             uint32_t    entropy_coding_sync_enabled_flag               : 1;
485             /** \brief Corresponds to HEVC syntax element of the same name. */
486             uint32_t    loop_filter_across_tiles_enabled_flag          : 1;
487             /** \brief Corresponds to HEVC syntax element of the same name. */
488             uint32_t    pps_loop_filter_across_slices_enabled_flag     : 1;
489             /** \brief A combination of HEVC syntax element of
490              *  sps_scaling_list_data_present_flag and
491              *  pps_scaling_list_data_present_flag
492              *  when scaling_list_enable_flag is 0, it must be 0.
493              */
494             uint32_t    scaling_list_data_present_flag                 : 1;
495             /** \brief indicate the current picture contains significant
496              *  screen contents (text, characters, etc.) or animated image.
497              *  GPU may want to treat them differently from normal video.
498              *  For example, encoder may choose a small transform unit size
499              *  and may use transform skip mode.
500              */
501             uint32_t    screen_content_flag                            : 1;
502             /**
503              *  When either weighted_pred_flag or weighted_bipred_flag is
504              *  turned on, the flag enable_gpu_weighted_prediction requests
505              *  GPU to determine weighted prediction factors. In this case,
506              *  the following parameters in slice control data structure
507              *  shall be ignored:
508              *  luma_log2_weight_denom, delta_chroma_log2_weight_denom,
509              *  luma_offset_l0[15], luma_offset_l1[15],
510              *  delta_luma_weight_l0[15], delta_luma_weight_l1[15],
511              *  chroma_offset_l0[15][2], chroma_offset_l1[15][2],
512              *  and delta_chroma_weight_l0[15][2], delta_chroma_weight_l1[15][2].
513              */
514             uint32_t    enable_gpu_weighted_prediction                 : 1;
515             /** \brief HEVC syntax element in slice segment header
516              *  GPU uses it to generate new slice headers in slice size control.
517              */
518             uint32_t    no_output_of_prior_pics_flag                   : 1;
519             uint32_t    reserved                                       : 11;
520         } bits;
521         uint32_t        value;
522     } pic_fields;
523
524     /** \brief Reserved bytes for future use, must be zero */
525     uint32_t                va_reserved[VA_PADDING_HIGH];
526 } VAEncPictureParameterBufferHEVC;
527
528 /**
529  * \brief Slice parameter for HEVC encoding in main & main 10 profiles.
530  *
531  * This structure holds information for \c
532  * slice_segment_layer_rbsp() as defined by the HEVC
533  * specification.
534  *
535  * If packed slice headers mode is used, i.e. if the encoding
536  * pipeline was configured with the #VA_ENC_PACKED_HEADER_SLICE
537  * flag, then the driver expects two more buffers to be provided to
538  * the same \c vaRenderPicture() as this buffer:
539  * - a #VAEncPackedHeaderParameterBuffer with type set to
540  *   VAEncPackedHeaderType::VAEncPackedHeaderSlice ;
541  * - a #VAEncPackedHeaderDataBuffer which holds the actual packed
542  *   header data.
543  *
544  */
545 typedef struct _VAEncSliceParameterBufferHEVC {
546     /** \brief Starting CTU address for this slice. */
547     uint32_t        slice_segment_address;
548     /** \brief Number of CTUs in this slice. */
549     uint32_t        num_ctu_in_slice;
550
551     /** \brief Slice type.
552      *  Corresponds to HEVC syntax element of the same name.
553      */
554     uint8_t         slice_type;
555     /** \brief Same as the HEVC bitstream syntax element. */
556     uint8_t         slice_pic_parameter_set_id;
557
558     /** \brief Maximum reference index for reference picture list 0.
559      *  Range: 0 to 14, inclusive.
560      */
561     uint8_t         num_ref_idx_l0_active_minus1;
562     /** \brief Maximum reference index for reference picture list 1.
563      *  Range: 0 to 14, inclusive.
564      */
565     uint8_t         num_ref_idx_l1_active_minus1;
566     /** \brief Reference picture list 0 (for P slices). */
567     VAPictureHEVC   ref_pic_list0[15];
568     /** \brief Reference picture list 1 (for B slices). */
569     VAPictureHEVC   ref_pic_list1[15];
570     /**@}*/
571
572     /** @name pred_weight_table() */
573     /**@{*/
574     /** \brief Same as the HEVC bitstream syntax element. */
575     uint8_t         luma_log2_weight_denom;
576     /** \brief Same as the HEVC bitstream syntax element. */
577     int8_t          delta_chroma_log2_weight_denom;
578     /** \brief Same as the HEVC bitstream syntax element. */
579     int8_t          delta_luma_weight_l0[15];
580     /** \brief Same as the HEVC bitstream syntax element. */
581     int8_t          luma_offset_l0[15];
582     /** \brief Same as the HEVC bitstream syntax element. */
583     int8_t          delta_chroma_weight_l0[15][2];
584     /** \brief Same as the HEVC spec variable ChromaOffsetL0[]. */
585     int8_t          chroma_offset_l0[15][2];
586     /** \brief Same as the HEVC bitstream syntax element. */
587     int8_t          delta_luma_weight_l1[15];
588     /** \brief Same as the HEVC bitstream syntax element. */
589     int8_t          luma_offset_l1[15];
590     /** \brief Same as the HEVC bitstream syntax element. */
591     int8_t          delta_chroma_weight_l1[15][2];
592     /** \brief Same as the HEVC spec variable ChromaOffsetL1[]. */
593     int8_t          chroma_offset_l1[15][2];
594     /**@}*/
595
596     /** \brief Corresponds to HEVC spec variable MaxNumMergeCand.
597      *  Range: [1..5].
598      */
599     uint8_t         max_num_merge_cand;
600
601     /** \brief Same as the HEVC bitstream syntax element. */
602     int8_t          slice_qp_delta;
603
604     /** \brief Same as the HEVC bitstream syntax element. */
605     int8_t          slice_cb_qp_offset;
606
607     /** \brief Same as the HEVC bitstream syntax element. */
608     int8_t          slice_cr_qp_offset;
609
610     /** \brief Same as the HEVC bitstream syntax element. */
611     int8_t          slice_beta_offset_div2;
612
613     /** \brief Same as the HEVC bitstream syntax element. */
614     int8_t          slice_tc_offset_div2;
615
616     union {
617         struct {
618             /** \brief Indicates if current slice is the last one in picture */
619             uint32_t    last_slice_of_pic_flag                         : 1;
620             /** \brief Corresponds to HEVC syntax element of the same name */
621             uint32_t    dependent_slice_segment_flag                   : 1;
622             /** \brief Corresponds to HEVC syntax element of the same name */
623             uint32_t    colour_plane_id                                : 2;
624             /** \brief Corresponds to HEVC syntax element of the same name. */
625             uint32_t    slice_temporal_mvp_enabled_flag                : 1;
626             /** \brief Corresponds to HEVC syntax element of the same name. */
627             uint32_t    slice_sao_luma_flag                            : 1;
628             /** \brief Corresponds to HEVC syntax element of the same name. */
629             uint32_t    slice_sao_chroma_flag                          : 1;
630             /** \brief Corresponds to HEVC syntax element of the same name.
631              *  if this flag is set to 0, num_ref_idx_l0_active_minus1 should be
632              *  equal to num_ref_idx_l0_default_active_minus1
633              *  as well as for that for l1.
634              */
635             uint32_t    num_ref_idx_active_override_flag               : 1;
636             /** \brief Corresponds to HEVC syntax element of the same name. */
637             uint32_t    mvd_l1_zero_flag                               : 1;
638             /** \brief Corresponds to HEVC syntax element of the same name. */
639             uint32_t    cabac_init_flag                             : 1;
640             /** \brief Corresponds to HEVC syntax element of the same name. */
641             uint32_t    slice_deblocking_filter_disabled_flag          : 2;
642             /** \brief Corresponds to HEVC syntax element of the same name. */
643             uint32_t    slice_loop_filter_across_slices_enabled_flag   : 1;
644             /** \brief Corresponds to HEVC syntax element of the same name. */
645             uint32_t    collocated_from_l0_flag                        : 1;
646         } bits;
647         uint32_t        value;
648     } slice_fields;
649
650     /** \brief Reserved bytes for future use, must be zero */
651     uint32_t                va_reserved[VA_PADDING_MEDIUM];
652     /**@}*/
653 } VAEncSliceParameterBufferHEVC;
654
655 /**
656  * \brief HEVC Quantization Matrix Buffer Structure
657  *
658  * This structure is sent once per frame,
659  * and only when scaling_list_enabled_flag = 1 and scaling_list_data_present_flag = 1.
660  * Only when scaling_list_data_present_flag = 1, app still
661  * needs to send in this structure. When scaling_list_enabled_flag = 1 and
662  * scaling_list_data_present_flag = 0, driver is responsible to generate
663  * the default scaling list values.
664  *
665  * Matrix entries are in raster scan order which follows HEVC spec.
666  */
667 typedef struct _VAQMatrixBufferHEVC
668 {
669     /**
670      * \brief scaling lists,
671      * corresponds to same HEVC spec syntax element
672      * ScalingList[ i ][ MatrixID ][ j ].
673      *
674      * \brief 4x4 scaling,
675      */
676     uint8_t             scaling_lists_4x4[3][2][16];
677     /**
678      * \brief 8x8 scaling,
679      */
680     uint8_t             scaling_lists_8x8[3][2][64];
681     /**
682      * \brief 16x16 scaling,
683      * correspongs i = 2, MatrixID is in the range of 0 to 5,
684      * inclusive. And j is in the range of 0 to 63, inclusive.
685      */
686     uint8_t             scaling_lists_16x16[3][2][64];
687     /**
688      * \brief 32x32 scaling,
689      * correspongs i = 3, MatrixID is in the range of 0 to 1,
690      * inclusive. And j is in the range of 0 to 63, inclusive.
691      */
692     uint8_t             scaling_lists_32x32[2][64];
693     /**
694      * \brief DC values of the 16x16 scaling lists,
695      * corresponds to HEVC spec syntax
696      * scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
697      * with sizeID = 2 and matrixID in the range of 0 to 5, inclusive.
698      */
699     uint8_t             scaling_list_dc_16x16[3][2];
700     /**
701      * \brief DC values of the 32x32 scaling lists,
702      * corresponds to HEVC spec syntax
703      * scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
704      * with sizeID = 3 and matrixID in the range of 0 to 1, inclusive.
705      */
706     uint8_t             scaling_list_dc_32x32[2];
707
708     /** \brief Reserved bytes for future use, must be zero */
709     uint32_t                va_reserved[VA_PADDING_LOW];
710 } VAQMatrixBufferHEVC;
711
712 /**@}*/
713
714 #ifdef __cplusplus
715 }
716 #endif
717
718 #endif /* VA_ENC_HEVC_H */