VA-API  2.19.0
va_enc_h264.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2011 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 
32 #ifndef VA_ENC_H264_H
33 #define VA_ENC_H264_H
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
58 #define H264_LAST_PICTURE_EOSEQ 0x01
59 
64 #define H264_LAST_PICTURE_EOSTREAM 0x02
65 
79 typedef enum {
125  VAEncPackedHeaderH264_SEI va_deprecated_enum = (0x80000000 | 1),
127 
148 typedef struct _VAEncSequenceParameterBufferH264 {
152  uint8_t level_idc;
154  uint32_t intra_period;
158  uint32_t ip_period;
170  uint32_t bits_per_second;
177 
178  union {
179  struct {
181  uint32_t chroma_format_idc : 2;
183  uint32_t frame_mbs_only_flag : 1;
193  uint32_t pic_order_cnt_type : 2;
198  } bits;
199  uint32_t value;
200  } seq_fields;
201 
206 
216  int32_t offset_for_ref_frame[256];
237  union {
238  struct {
250  uint32_t fixed_frame_rate_flag : 1;
252  uint32_t low_delay_hrd_flag : 1;
256  uint32_t reserved : 16;
257  } bits;
258  uint32_t value;
259  } vui_fields;
263  uint32_t sar_width;
265  uint32_t sar_height;
269  uint32_t time_scale;
270 
272  uint32_t va_reserved[VA_PADDING_LOW];
275 
296 typedef struct _VAEncPictureParameterBufferH264 {
304  VAPictureH264 CurrPic;
313  VAPictureH264 ReferenceFrames[16];
322 
327 
335  uint8_t last_picture;
336 
340  uint16_t frame_num;
341 
343  uint8_t pic_init_qp;
352 
357 
358  union {
359  struct {
361  uint32_t idr_pic_flag : 1;
363  uint32_t reference_pic_flag : 2;
367  uint32_t weighted_pred_flag : 1;
369  uint32_t weighted_bipred_idc : 2;
382  } bits;
383  uint32_t value;
384  } pic_fields;
385 
387  uint32_t va_reserved[VA_PADDING_LOW];
389 
390 typedef struct _VAEncQPBufferH264 {
391  /*
392  * \brief This structure holds QP per 16x16 macroblock. Buffer size shall be
393  * sufficient to fit the slice or frame to be encoded depending on if it is a
394  * slice level or frame level encoding.
395  */
396  uint8_t qp;
397 } VAEncQPBufferH264;
398 
420 typedef struct _VAEncSliceParameterBufferH264 {
424  uint32_t num_macroblocks;
441  uint8_t slice_type;
445  uint16_t idr_pic_id;
446 
457  int32_t delta_pic_order_cnt[2];
462  uint8_t direct_spatial_mv_pred_flag;
482  VAPictureH264 RefPicList0[32];
484  VAPictureH264 RefPicList1[32];
496  signed short luma_weight_l0[32];
498  signed short luma_offset_l0[32];
502  signed short chroma_weight_l0[32][2];
504  signed short chroma_offset_l0[32][2];
508  signed short luma_weight_l1[32];
510  signed short luma_offset_l1[32];
514  signed short chroma_weight_l1[32][2];
516  signed short chroma_offset_l1[32][2];
520  uint8_t cabac_init_idc;
531 
533  uint32_t va_reserved[VA_PADDING_LOW];
536 
547 #define VA_MB_PRED_AVAIL_TOP_LEFT (1 << 2)
548 
549 #define VA_MB_PRED_AVAIL_TOP (1 << 4)
550 
551 #define VA_MB_PRED_AVAIL_TOP_RIGHT (1 << 3)
552 
553 #define VA_MB_PRED_AVAIL_LEFT (1 << 6)
554 
566 typedef struct _VAEncMacroblockParameterBufferH264 {
574  uint8_t qp;
575 
576  union {
579  union {
580  struct {
599  uint32_t pred_avail_flags : 8;
600  } bits;
601  uint32_t value;
602  } intra_fields;
607  union {
608  struct {
609  uint32_t reserved;
610  } bits;
611  uint32_t value;
612  } inter_fields;
614  } info;
615 
617  uint32_t va_reserved[VA_PADDING_LOW];
619 
626 typedef struct _VAEncMiscParameterSubMbPartPelH264 {
627  uint32_t disable_inter_sub_mb_partition;
628  union {
629  struct {
630  uint32_t disable_16x16_inter_mb_partition : 1;
631  uint32_t disable_16x8_inter_mb_partition : 1;
632  uint32_t disable_8x16_inter_mb_partition : 1;
633  uint32_t disable_8x8_inter_mb_partition : 1;
634  uint32_t disable_8x4_inter_mb_partition : 1;
635  uint32_t disable_4x8_inter_mb_partition : 1;
636  uint32_t disable_4x4_inter_mb_partition : 1;
637  uint32_t reserved : 1;
638  } bits;
639  uint8_t value;
640  } inter_sub_mb_partition_mask;
641 
650  uint8_t sub_pel_mode;
651  uint8_t reserved[3];
655 #ifdef __cplusplus
656 }
657 #endif
658 
659 #endif /* VA_ENC_H264_H */
uint8_t num_ref_idx_l1_active_minus1
Maximum reference index for reference picture list 1. Range: 0 to 31, inclusive.
Definition: va_enc_h264.h:351
uint8_t qp
Quantization parameter.
Definition: va_enc_h264.h:574
uint32_t pic_order_cnt_type
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:193
uint32_t log2_max_frame_num_minus4
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:191
uint32_t log2_max_mv_length_vertical
Range: 0 to 16, inclusive.
Definition: va_enc_h264.h:248
uint8_t last_picture
OR&#39;d flags describing whether the picture is the last one or not.
Definition: va_enc_h264.h:335
uint8_t level_idc
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:152
uint8_t aspect_ratio_idc
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:261
VAPictureH264 CurrPic
Information about the picture to be encoded.
Definition: va_enc_h264.h:304
uint32_t reference_pic_flag
Is picture a reference picture?
Definition: va_enc_h264.h:363
uint8_t num_ref_idx_l0_active_minus1
Maximum reference index for reference picture list 0. Range: 0 to 31, inclusive.
Definition: va_enc_h264.h:347
uint32_t weighted_bipred_idc
Range: 0 to 2, inclusive.
Definition: va_enc_h264.h:369
uint16_t frame_num
The picture identifier. Range: 0 to , inclusive.
Definition: va_enc_h264.h:340
uint32_t time_scale
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:269
uint32_t frame_crop_left_offset
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:224
uint8_t num_ref_idx_active_override_flag
Specifies if _VAEncPictureParameterBufferH264::num_ref_idx_l0_active_minus1 or _VAEncPictureParameter...
Definition: va_enc_h264.h:472
VAEncPackedHeaderTypeH264
Packed header types specific to H.264 encoding.
Definition: va_enc_h264.h:79
Slice parameter for H.264 encoding in baseline, main & high profiles.
Definition: va_enc_h264.h:420
uint32_t pic_order_present_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:379
uint8_t num_ref_idx_l1_active_minus1
Maximum reference index for reference picture list 1. Range: 0 to 31, inclusive.
Definition: va_enc_h264.h:480
uint32_t ip_period
Period between I/P frames.
Definition: va_enc_h264.h:158
uint32_t aspect_ratio_info_present_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:240
uint8_t luma_log2_weight_denom
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:490
uint32_t constrained_intra_pred_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:371
uint32_t pic_scaling_matrix_present_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:381
uint32_t log2_max_mv_length_horizontal
Range: 0 to 16, inclusive.
Definition: va_enc_h264.h:246
int32_t offset_for_non_ref_pic
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:212
uint8_t luma_weight_l0_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:494
uint32_t pred_avail_override_flag
Flag specified to override MB neighbour availability bits from VME stage.
Definition: va_enc_h264.h:589
MB partition modes and 1/2 1/4 motion search configuration.
Definition: va_enc_h264.h:626
int8_t second_chroma_qp_index_offset
Range: -12 to 12, inclusive.
Definition: va_enc_h264.h:356
uint8_t seq_parameter_set_id
The active sequence parameter set. Range: 0 to 31, inclusive.
Definition: va_enc_h264.h:326
uint32_t num_units_in_tick
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:267
uint32_t seq_scaling_matrix_present_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:187
uint32_t reserved
Reserved for future use, must be zero.
Definition: va_enc_h264.h:256
int8_t slice_beta_offset_div2
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:530
uint32_t motion_vectors_over_pic_boundaries_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:254
uint16_t picture_height_in_mbs
Picture height in macroblocks.
Definition: va_enc_h264.h:176
uint8_t frame_cropping_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:222
Packed Supplemental Enhancement Information (SEI).
Definition: va_enc_h264.h:125
Packed picture header.
Definition: va.h:2327
uint8_t luma_weight_l1_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:506
uint32_t transform_8x8_mode_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:373
VAGenericID VABufferID
Definition: va.h:1977
uint32_t intra_idr_period
Period between IDR frames.
Definition: va_enc_h264.h:156
uint32_t enable_sub_pel_mode
Precison of motion search 0:Integer mode searching 1:Half-pel mode searching 2:Reserved 3:Quarter-pel...
Definition: va_enc_h264.h:649
uint32_t fixed_frame_rate_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:250
uint32_t pred_avail_flags
Bitwise representation of which macroblocks are available for intra prediction.
Definition: va_enc_h264.h:599
uint32_t timing_info_present_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:242
uint8_t disable_deblocking_filter_idc
Range: 0 to 2, inclusive.
Definition: va_enc_h264.h:526
uint32_t log2_max_pic_order_cnt_lsb_minus4
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:195
uint32_t deblocking_filter_control_present_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:375
Packed slice header.
Definition: va_enc_h264.h:110
uint32_t sar_height
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:265
int8_t chroma_qp_index_offset
Range: -12 to 12, inclusive.
Definition: va_enc_h264.h:354
uint32_t redundant_pic_cnt_present_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:377
uint8_t chroma_weight_l0_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:500
uint8_t pic_init_qp
pic_init_qp_minus26 + 26.
Definition: va_enc_h264.h:343
uint8_t bit_depth_luma_minus8
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:203
uint32_t direct_8x8_inference_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:189
uint32_t chroma_format_idc
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:181
uint16_t idr_pic_id
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:445
uint8_t num_ref_frames_in_pic_order_cnt_cycle
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:210
uint8_t seq_parameter_set_id
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:150
int32_t offset_for_top_to_bottom_field
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:214
uint32_t weighted_pred_flag
Is weighted prediction applied to P slices?
Definition: va_enc_h264.h:367
uint8_t num_ref_idx_l0_active_minus1
Maximum reference index for reference picture list 0. Range: 0 to 31, inclusive.
Definition: va_enc_h264.h:476
Packed sequence header.
Definition: va.h:2325
uint8_t bit_depth_chroma_minus8
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:205
Packed Sequence Parameter Set (SPS).
Definition: va_enc_h264.h:88
uint8_t pic_parameter_set_id
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:443
uint8_t vui_parameters_present_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:236
uint32_t intra_period
Period between I frames.
Definition: va_enc_h264.h:154
int32_t delta_pic_order_cnt_bottom
Valid if pic_order_present_flag and this is a bottom field.
Definition: va_enc_h264.h:452
VABufferID macroblock_info
Per-MB encoder configuration buffer, or VA_INVALID_ID.
Definition: va_enc_h264.h:437
uint8_t chroma_weight_l1_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:512
#define VA_PADDING_LOW
Definition: va.h:359
uint8_t pic_parameter_set_id
The picture parameter set referred to in the slice header.
Definition: va_enc_h264.h:324
int8_t slice_qp_delta
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:522
uint32_t idr_pic_flag
Is picture an IDR picture?
Definition: va_enc_h264.h:361
uint32_t low_delay_hrd_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:252
uint16_t picture_width_in_mbs
Picture width in macroblocks.
Definition: va_enc_h264.h:174
uint32_t bitstream_restriction_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:244
uint32_t sar_width
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:263
int8_t slice_alpha_c0_offset_div2
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:528
uint32_t mb_adaptive_frame_field_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:185
uint32_t max_num_ref_frames
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:172
uint32_t frame_mbs_only_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:183
Packed Picture Parameter Set (PPS).
Definition: va_enc_h264.h:97
uint32_t entropy_coding_mode_flag
Selects CAVLC (0) or CABAC (1) entropy coding mode.
Definition: va_enc_h264.h:365
uint32_t frame_crop_top_offset
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:228
uint16_t pic_order_cnt_lsb
The picture order count modulo MaxPicOrderCntLsb.
Definition: va_enc_h264.h:450
uint8_t cabac_init_idc
Range: 0 to 2, inclusive.
Definition: va_enc_h264.h:520
Sequence parameter for H.264 encoding in baseline, main & high profiles.
Definition: va_enc_h264.h:148
uint32_t frame_crop_bottom_offset
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:230
Macroblock parameter for H.264 encoding in baseline, main & high profiles.
Definition: va_enc_h264.h:566
uint32_t num_macroblocks
Number of macroblocks in this slice.
Definition: va_enc_h264.h:424
VABufferID coded_buf
Output encoded bitstream.
Definition: va_enc_h264.h:321
Picture parameter for H.264 encoding in baseline, main & high profiles.
Definition: va_enc_h264.h:296
uint8_t slice_type
Slice type. Range: 0..2, 5..7, i.e. no switching slices.
Definition: va_enc_h264.h:441
Packed slice header.
Definition: va.h:2329
uint32_t frame_crop_right_offset
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:226
uint32_t macroblock_address
Starting MB address for this slice.
Definition: va_enc_h264.h:422
uint32_t bits_per_second
Initial bitrate set for this sequence in CBR or VBR modes.
Definition: va_enc_h264.h:170
uint8_t chroma_log2_weight_denom
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:492
uint32_t delta_pic_order_always_zero_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:197