39 va_pic->picture_id = VA_INVALID_ID;
40 va_pic->flags = VA_PICTURE_H264_INVALID;
41 va_pic->TopFieldOrderCnt = 0;
42 va_pic->BottomFieldOrderCnt = 0;
57 if (pic_structure == 0)
66 va_pic->flags |= (pic_structure &
PICT_TOP_FIELD) ? VA_PICTURE_H264_TOP_FIELD : VA_PICTURE_H264_BOTTOM_FIELD;
68 va_pic->flags |= pic->
long_ref ? VA_PICTURE_H264_LONG_TERM_REFERENCE : VA_PICTURE_H264_SHORT_TERM_REFERENCE;
70 va_pic->TopFieldOrderCnt = 0;
72 va_pic->TopFieldOrderCnt = pic->
field_poc[0];
74 va_pic->BottomFieldOrderCnt = 0;
76 va_pic->BottomFieldOrderCnt = pic->
field_poc[1];
99 for (i = 0; i < dpb->
size; i++) {
100 VAPictureH264 *
const va_pic = &dpb->
va_pics[i];
102 VAPictureH264 temp_va_pic;
105 if ((temp_va_pic.flags ^ va_pic->flags) & (VA_PICTURE_H264_TOP_FIELD | VA_PICTURE_H264_BOTTOM_FIELD)) {
106 va_pic->flags |= temp_va_pic.flags & (VA_PICTURE_H264_TOP_FIELD | VA_PICTURE_H264_BOTTOM_FIELD);
108 if (temp_va_pic.flags & VA_PICTURE_H264_TOP_FIELD) {
109 va_pic->TopFieldOrderCnt = temp_va_pic.TopFieldOrderCnt;
111 va_pic->BottomFieldOrderCnt = temp_va_pic.BottomFieldOrderCnt;
131 dpb.
va_pics = pic_param->ReferenceFrames;
141 for (i = 0; i < 16; i++) {
159 unsigned int ref_count)
161 unsigned int i, n = 0;
162 for (i = 0; i < ref_count; i++)
163 if (ref_list[i].f.reference)
187 unsigned char *luma_weight_flag,
188 short luma_weight[32],
189 short luma_offset[32],
190 unsigned char *chroma_weight_flag,
191 short chroma_weight[32][2],
192 short chroma_offset[32][2])
199 for (i = 0; i < h->
ref_count[list]; i++) {
209 for (j = 0; j < 2; j++) {
215 chroma_offset[i][j] = 0;
229 VAPictureParameterBufferH264 *pic_param;
230 VAIQMatrixBufferH264 *iq_matrix;
232 av_dlog(avctx,
"start_frame()\n");
243 pic_param->picture_width_in_mbs_minus1 = s->
mb_width - 1;
244 pic_param->picture_height_in_mbs_minus1 = s->
mb_height - 1;
248 pic_param->seq_fields.value = 0;
253 pic_param->seq_fields.bits.mb_adaptive_frame_field_flag = h->
sps.
mb_aff;
255 pic_param->seq_fields.bits.MinLumaBiPredSize8x8 = h->
sps.
level_idc >= 31;
257 pic_param->seq_fields.bits.pic_order_cnt_type = h->
sps.
poc_type;
258 pic_param->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = h->
sps.
log2_max_poc_lsb - 4;
262 pic_param->slice_group_change_rate_minus1 = 0;
263 pic_param->pic_init_qp_minus26 = h->
pps.
init_qp - 26;
264 pic_param->pic_init_qs_minus26 = h->
pps.
init_qs - 26;
267 pic_param->pic_fields.value = 0;
268 pic_param->pic_fields.bits.entropy_coding_mode_flag = h->
pps.
cabac;
277 pic_param->pic_fields.bits.reference_pic_flag = h->
nal_ref_idc != 0;
284 memcpy(iq_matrix->ScalingList4x4, h->
pps.
scaling_matrix4,
sizeof(iq_matrix->ScalingList4x4));
285 memcpy(iq_matrix->ScalingList8x8, h->
pps.
scaling_matrix8,
sizeof(iq_matrix->ScalingList8x8));
294 av_dlog(avctx,
"end_frame()\n");
305 VASliceParameterBufferH264 *slice_param;
307 av_dlog(avctx,
"decode_slice(): buffer %p, size %d\n", buffer, size);
331 &slice_param->luma_weight_l0_flag, slice_param->luma_weight_l0, slice_param->luma_offset_l0,
332 &slice_param->chroma_weight_l0_flag, slice_param->chroma_weight_l0, slice_param->chroma_offset_l0);
334 &slice_param->luma_weight_l1_flag, slice_param->luma_weight_l1, slice_param->luma_offset_l1,
335 &slice_param->chroma_weight_l1_flag, slice_param->chroma_weight_l1, slice_param->chroma_offset_l1);
340 .
name =
"h264_vaapi",
struct DPB DPB
Decoded Picture Buffer (DPB).
static int dpb_add(DPB *dpb, Picture *pic)
Append picture to the decoded picture buffer, in a VA API form that merges the second field picture a...
int chroma_qp_index_offset[2]
int ff_vaapi_common_end_frame(MpegEncContext *s)
Common AVHWAccel.end_frame() implementation.
int luma_weight_flag[2]
7.4.3.2 luma_weight_lX_flag
AVHWAccel ff_h264_vaapi_hwaccel
HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the b...
int max_size
Max number of reference frames. This is FF_ARRAY_ELEMS(VAPictureParameterBufferH264.ReferenceFrames)
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
This structure is used to share data between the Libav library and the client video application...
int long_ref
1->long term reference 0->short term reference
uint8_t scaling_matrix4[6][16]
int deblocking_filter_parameters_present
deblocking_filter_parameters_present_flag
void * hwaccel_context
Hardware accelerator context.
int gaps_in_frame_num_allowed_flag
int luma_weight[48][2][2]
int bit_depth_chroma
bit_depth_chroma_minus8 + 8
Picture ref_list[2][48]
0..15: frame refs, 16..47: mbaff field refs.
int cabac
entropy_coding_mode_flag
unsigned int ref_count[2]
num_ref_idx_l0/1_active_minus1 + 1
static int get_bits_count(const GetBitContext *s)
int ff_h264_get_slice_type(const H264Context *h)
Reconstruct bitstream slice_type.
int redundant_pic_cnt_present
redundant_pic_cnt_present_flag
int mb_height
number of MBs horizontally & vertically
int luma_log2_weight_denom
int chroma_weight[48][2][2][2]
H.264 / AVC / MPEG4 part10 codec.
static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Decode the given H.264 slice with VA API.
int mb_aff
mb_adaptive_frame_field_flag
int poc_type
pic_order_cnt_type
int constrained_intra_pred
constrained_intra_pred_flag
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
void * ff_vaapi_alloc_pic_param(struct vaapi_context *vactx, unsigned int size)
Allocate a new picture parameter buffer.
int direct_spatial_mv_pred
int weighted_pred
weighted_pred_flag
int residual_color_transform_flag
residual_colour_transform_flag
int delta_pic_order_always_zero_flag
uint8_t scaling_matrix8[6][64]
int ref_frame_count
num_ref_frames
const char * name
Name of the hardware accelerated codec.
Picture * current_picture_ptr
pointer to the current picture
unsigned int slice_param_size
Size of a VASliceParameterBuffer element.
int size
Current number of reference frames in the DPB.
int init_qp
pic_init_qp_minus26 + 26
int frame_num
h264 frame_num (raw frame_num from slice header)
int direct_8x8_inference_flag
int pic_order_present
pic_order_present_flag
int chroma_log2_weight_denom
static int end_frame(AVCodecContext *avctx)
End a hardware decoding based frame.
static int start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
Initialize and start decoding a frame with VA API.
int slice_alpha_c0_offset
main external API structure.
VASliceParameterBufferBase * ff_vaapi_alloc_slice(struct vaapi_context *vactx, const uint8_t *buffer, uint32_t size)
Allocate a new slice descriptor for the input slice.
#define FF_ARRAY_ELEMS(a)
int log2_max_poc_lsb
log2_max_pic_order_cnt_lsb_minus4
int field_poc[2]
h264 top/bottom POC
int transform_8x8_mode
transform_8x8_mode_flag
#define FIELD_OR_MBAFF_PICTURE
int init_qs
pic_init_qs_minus26 + 26
static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param, H264Context *h)
Fill in VA API reference frames array.
int log2_max_frame_num
log2_max_frame_num_minus4 + 4
static void fill_vaapi_plain_pred_weight_table(H264Context *h, int list, unsigned char *luma_weight_flag, short luma_weight[32], short luma_offset[32], unsigned char *chroma_weight_flag, short chroma_weight[32][2], short chroma_offset[32][2])
Fill in prediction weight table.
void * ff_vaapi_alloc_iq_matrix(struct vaapi_context *vactx, unsigned int size)
Allocate a new IQ matrix buffer.
static VASurfaceID ff_vaapi_get_surface_id(Picture *pic)
Extract VASurfaceID from a Picture.
int bit_depth_luma
bit_depth_luma_minus8 + 8
static void init_vaapi_pic(VAPictureH264 *va_pic)
Initialize an empty VA API picture.
Decoded Picture Buffer (DPB).
int pic_id
h264 pic_num (short -> no wrap version of pic_num, pic_num & max_pic_num; long -> long_pic_num) ...
int slice_group_count
num_slice_groups_minus1 + 1
static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32], Picture *ref_list, unsigned int ref_count)
Fill in VA API reference picture lists from the Libav reference picture list.
VAPictureH264 * va_pics
Pointer to VAPictureParameterBufferH264.ReferenceFrames array.
int chroma_weight_flag[2]
7.4.3.2 chroma_weight_lX_flag
static void fill_vaapi_pic(VAPictureH264 *va_pic, Picture *pic, int pic_structure)
Translate an Libav Picture into its VA API form.
int deblocking_filter
disable_deblocking_filter_idc with 1 <-> 0
int short_ref_count
number of actual short term references
int mb_slice_group_map_type