OSDN Git Service

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