VA-API
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
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 {
122 
143 typedef struct _VAEncSequenceParameterBufferH264 {
145  unsigned char seq_parameter_set_id;
147  unsigned char level_idc;
149  unsigned int intra_period;
151  unsigned int intra_idr_period;
153  unsigned int ip_period;
165  unsigned int bits_per_second;
167  unsigned int max_num_ref_frames;
169  unsigned short picture_width_in_mbs;
171  unsigned short picture_height_in_mbs;
172 
173  union {
174  struct {
176  unsigned int chroma_format_idc : 2;
178  unsigned int frame_mbs_only_flag : 1;
180  unsigned int mb_adaptive_frame_field_flag : 1;
182  unsigned int seq_scaling_matrix_present_flag : 1;
184  unsigned int direct_8x8_inference_flag : 1;
186  unsigned int log2_max_frame_num_minus4 : 4;
188  unsigned int pic_order_cnt_type : 2;
190  unsigned int log2_max_pic_order_cnt_lsb_minus4 : 4;
192  unsigned int delta_pic_order_always_zero_flag : 1;
193  } bits;
194  unsigned int value;
195  } seq_fields;
196 
198  unsigned char bit_depth_luma_minus8;
200  unsigned char bit_depth_chroma_minus8;
201 
211  int offset_for_ref_frame[256];
217  unsigned char frame_cropping_flag;
223  unsigned int frame_crop_top_offset;
232  union {
233  struct {
235  unsigned int aspect_ratio_info_present_flag : 1;
237  unsigned int timing_info_present_flag : 1;
239  unsigned int bitstream_restriction_flag : 1;
241  unsigned int log2_max_mv_length_horizontal : 5;
243  unsigned int log2_max_mv_length_vertical : 5;
244  } bits;
245  unsigned int value;
246  } vui_fields;
248  unsigned char aspect_ratio_idc;
250  unsigned int sar_width;
252  unsigned int sar_height;
254  unsigned int num_units_in_tick;
256  unsigned int time_scale;
259 
280 typedef struct _VAEncPictureParameterBufferH264 {
288  VAPictureH264 CurrPic;
297  VAPictureH264 ReferenceFrames[16];
306 
308  unsigned char pic_parameter_set_id;
310  unsigned char seq_parameter_set_id;
311 
319  unsigned char last_picture;
320 
324  unsigned short frame_num;
325 
327  unsigned char pic_init_qp;
336 
341 
342  union {
343  struct {
345  unsigned int idr_pic_flag : 1;
347  unsigned int reference_pic_flag : 2;
349  unsigned int entropy_coding_mode_flag : 1;
351  unsigned int weighted_pred_flag : 1;
353  unsigned int weighted_bipred_idc : 2;
355  unsigned int constrained_intra_pred_flag : 1;
357  unsigned int transform_8x8_mode_flag : 1;
359  unsigned int deblocking_filter_control_present_flag : 1;
361  unsigned int redundant_pic_cnt_present_flag : 1;
363  unsigned int pic_order_present_flag : 1;
365  unsigned int pic_scaling_matrix_present_flag : 1;
366  } bits;
367  unsigned int value;
368  } pic_fields;
370 
393 typedef struct _VAEncSliceParameterBufferH264 {
395  unsigned int macroblock_address;
397  unsigned int num_macroblocks;
414  unsigned char slice_type;
416  unsigned char pic_parameter_set_id;
418  unsigned short idr_pic_id;
419 
423  unsigned short pic_order_cnt_lsb;
430  int delta_pic_order_cnt[2];
435  unsigned char direct_spatial_mv_pred_flag;
455  VAPictureH264 RefPicList0[32];
457  VAPictureH264 RefPicList1[32];
463  unsigned char luma_log2_weight_denom;
467  unsigned char luma_weight_l0_flag;
469  signed short luma_weight_l0[32];
471  signed short luma_offset_l0[32];
473  unsigned char chroma_weight_l0_flag;
475  signed short chroma_weight_l0[32][2];
477  signed short chroma_offset_l0[32][2];
479  unsigned char luma_weight_l1_flag;
481  signed short luma_weight_l1[32];
483  signed short luma_offset_l1[32];
485  unsigned char chroma_weight_l1_flag;
487  signed short chroma_weight_l1[32][2];
489  signed short chroma_offset_l1[32][2];
493  unsigned char cabac_init_idc;
495  signed char slice_qp_delta;
506 
517 #define VA_MB_PRED_AVAIL_TOP_LEFT (1 << 2)
518 
519 #define VA_MB_PRED_AVAIL_TOP (1 << 4)
520 
521 #define VA_MB_PRED_AVAIL_TOP_RIGHT (1 << 3)
522 
523 #define VA_MB_PRED_AVAIL_LEFT (1 << 6)
524 
536 typedef struct _VAEncMacroblockParameterBufferH264 {
544  unsigned char qp;
545 
546  union {
549  struct {
550  union {
559  unsigned int pred_avail_override_flag : 1;
569  unsigned int pred_avail_flags : 8;
570  } bits;
571  unsigned int value;
572  } intra_fields;
577  struct {
578  union {
579  } bits;
580  unsigned int value;
581  } inter_fields;
583  } info;
585 
588 #ifdef __cplusplus
589 }
590 #endif
591 
592 #endif /* VA_ENC_H264_H */
int delta_pic_order_cnt_bottom
Valid if pic_order_present_flag and this is a bottom field.
Definition: va_enc_h264.h:425
unsigned char chroma_weight_l0_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:473
signed char second_chroma_qp_index_offset
Range: -12 to 12, inclusive.
Definition: va_enc_h264.h:340
Packed Supplemental Enhancement Information (SEI).
Definition: va_enc_h264.h:120
unsigned char cabac_init_idc
Range: 0 to 2, inclusive.
Definition: va_enc_h264.h:493
unsigned char pic_parameter_set_id
The picture parameter set referred to in the slice header.
Definition: va_enc_h264.h:308
signed char chroma_qp_index_offset
Range: -12 to 12, inclusive.
Definition: va_enc_h264.h:338
unsigned short frame_num
The picture identifier. Range: 0 to , inclusive.
Definition: va_enc_h264.h:324
Misc packed header. See codec-specific definitions.
Definition: va.h:1004
VAPictureH264 CurrPic
Information about the picture to be encoded.
Definition: va_enc_h264.h:288
int offset_for_non_ref_pic
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:207
unsigned char frame_cropping_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:217
int offset_for_top_to_bottom_field
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:209
unsigned char chroma_weight_l1_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:485
unsigned short idr_pic_id
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:418
unsigned int frame_crop_left_offset
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:219
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:393
unsigned char num_ref_idx_l1_active_minus1
Maximum reference index for reference picture list 1. Range: 0 to 31, inclusive.
Definition: va_enc_h264.h:453
unsigned char num_ref_idx_l1_active_minus1
Maximum reference index for reference picture list 1. Range: 0 to 31, inclusive.
Definition: va_enc_h264.h:335
unsigned int intra_period
Period between I frames.
Definition: va_enc_h264.h:149
unsigned char chroma_log2_weight_denom
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:465
unsigned char last_picture
OR'd flags describing whether the picture is the last one or not.
Definition: va_enc_h264.h:319
unsigned char seq_parameter_set_id
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:145
unsigned char level_idc
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:147
unsigned int bits_per_second
Initial bitrate set for this sequence in CBR or VBR modes.
Definition: va_enc_h264.h:165
unsigned short picture_width_in_mbs
Picture width in macroblocks.
Definition: va_enc_h264.h:169
unsigned int ip_period
Period between I/P frames.
Definition: va_enc_h264.h:153
unsigned char num_ref_idx_active_override_flag
Specifies if _VAEncPictureParameterBufferH264::num_ref_idx_l0_active_minus1 or _VAEncPictureParameter...
Definition: va_enc_h264.h:445
unsigned char luma_weight_l0_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:467
unsigned char luma_weight_l1_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:479
Packed picture header.
Definition: va.h:991
VAGenericID VABufferID
Definition: va.h:920
unsigned char bit_depth_luma_minus8
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:198
unsigned char vui_parameters_present_flag
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:231
unsigned char luma_log2_weight_denom
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:463
unsigned int frame_crop_bottom_offset
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:225
Packed slice header.
Definition: va_enc_h264.h:110
unsigned char disable_deblocking_filter_idc
Range: 0 to 2, inclusive.
Definition: va_enc_h264.h:499
unsigned int time_scale
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:256
unsigned int frame_crop_right_offset
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:221
unsigned int sar_width
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:250
unsigned int num_macroblocks
Number of macroblocks in this slice.
Definition: va_enc_h264.h:397
signed char slice_beta_offset_div2
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:503
Packed sequence header.
Definition: va.h:989
unsigned int macroblock_address
Starting MB address for this slice.
Definition: va_enc_h264.h:395
Packed Sequence Parameter Set (SPS).
Definition: va_enc_h264.h:88
unsigned int num_units_in_tick
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:254
unsigned char pic_parameter_set_id
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:416
unsigned char num_ref_frames_in_pic_order_cnt_cycle
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:205
unsigned char qp
Quantization parameter.
Definition: va_enc_h264.h:544
unsigned int max_num_ref_frames
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:167
VABufferID macroblock_info
Per-MB encoder configuration buffer, or VA_INVALID_ID.
Definition: va_enc_h264.h:410
unsigned int intra_idr_period
Period between IDR frames.
Definition: va_enc_h264.h:151
unsigned char slice_type
Slice type. Range: 0..2, 5..7, i.e. no switching slices.
Definition: va_enc_h264.h:414
unsigned short picture_height_in_mbs
Picture height in macroblocks.
Definition: va_enc_h264.h:171
unsigned char aspect_ratio_idc
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:248
signed char slice_alpha_c0_offset_div2
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:501
Packed Picture Parameter Set (PPS).
Definition: va_enc_h264.h:97
unsigned char bit_depth_chroma_minus8
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:200
unsigned char num_ref_idx_l0_active_minus1
Maximum reference index for reference picture list 0. Range: 0 to 31, inclusive.
Definition: va_enc_h264.h:449
unsigned short pic_order_cnt_lsb
The picture order count modulo MaxPicOrderCntLsb.
Definition: va_enc_h264.h:423
Sequence parameter for H.264 encoding in baseline, main & high profiles.
Definition: va_enc_h264.h:143
unsigned int frame_crop_top_offset
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:223
Macroblock parameter for H.264 encoding in baseline, main & high profiles.
Definition: va_enc_h264.h:536
unsigned int sar_height
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:252
VABufferID coded_buf
Output encoded bitstream.
Definition: va_enc_h264.h:305
unsigned char seq_parameter_set_id
The active sequence parameter set. Range: 0 to 31, inclusive.
Definition: va_enc_h264.h:310
unsigned char num_ref_idx_l0_active_minus1
Maximum reference index for reference picture list 0. Range: 0 to 31, inclusive.
Definition: va_enc_h264.h:331
Picture parameter for H.264 encoding in baseline, main & high profiles.
Definition: va_enc_h264.h:280
Packed slice header.
Definition: va.h:993
unsigned char pic_init_qp
pic_init_qp_minus26 + 26.
Definition: va_enc_h264.h:327
signed char slice_qp_delta
Same as the H.264 bitstream syntax element.
Definition: va_enc_h264.h:495