41 va_pic->picture_id = VA_INVALID_ID;
42 va_pic->flags = VA_PICTURE_H264_INVALID;
43 va_pic->TopFieldOrderCnt = 0;
44 va_pic->BottomFieldOrderCnt = 0;
59 if (pic_structure == 0)
68 va_pic->flags |= (pic_structure &
PICT_TOP_FIELD) ? VA_PICTURE_H264_TOP_FIELD : VA_PICTURE_H264_BOTTOM_FIELD;
70 va_pic->flags |= pic->
long_ref ? VA_PICTURE_H264_LONG_TERM_REFERENCE : VA_PICTURE_H264_SHORT_TERM_REFERENCE;
72 va_pic->TopFieldOrderCnt = 0;
74 va_pic->TopFieldOrderCnt = pic->
field_poc[0];
76 va_pic->BottomFieldOrderCnt = 0;
78 va_pic->BottomFieldOrderCnt = pic->
field_poc[1];
101 for (
i = 0;
i < dpb->
size;
i++) {
102 VAPictureH264 *
const va_pic = &dpb->
va_pics[
i];
104 VAPictureH264 temp_va_pic;
107 if ((temp_va_pic.flags ^ va_pic->flags) & (VA_PICTURE_H264_TOP_FIELD | VA_PICTURE_H264_BOTTOM_FIELD)) {
108 va_pic->flags |= temp_va_pic.flags & (VA_PICTURE_H264_TOP_FIELD | VA_PICTURE_H264_BOTTOM_FIELD);
110 if (temp_va_pic.flags & VA_PICTURE_H264_TOP_FIELD) {
111 va_pic->TopFieldOrderCnt = temp_va_pic.TopFieldOrderCnt;
113 va_pic->BottomFieldOrderCnt = temp_va_pic.BottomFieldOrderCnt;
133 dpb.
va_pics = pic_param->ReferenceFrames;
137 for (
i = 0;
i <
h->short_ref_count;
i++) {
143 for (
i = 0;
i < 16;
i++) {
161 unsigned int ref_count)
163 unsigned int i, n = 0;
164 for (
i = 0;
i < ref_count;
i++)
165 if (ref_list[
i].reference)
167 ref_list[
i].reference);
190 unsigned char *luma_weight_flag,
191 short luma_weight[32],
192 short luma_offset[32],
193 unsigned char *chroma_weight_flag,
194 short chroma_weight[32][2],
195 short chroma_offset[32][2])
213 for (j = 0; j < 2; j++) {
219 chroma_offset[
i][j] = 0;
234 VAPictureParameterBufferH264 pic_param;
235 VAIQMatrixBufferH264 iq_matrix;
240 pic_param = (VAPictureParameterBufferH264) {
241 .picture_width_in_mbs_minus1 =
h->mb_width - 1,
242 .picture_height_in_mbs_minus1 =
h->mb_height - 1,
243 .bit_depth_luma_minus8 =
sps->bit_depth_luma - 8,
244 .bit_depth_chroma_minus8 =
sps->bit_depth_chroma - 8,
245 .num_ref_frames =
sps->ref_frame_count,
247 .chroma_format_idc =
sps->chroma_format_idc,
248 .residual_colour_transform_flag =
sps->residual_color_transform_flag,
249 .gaps_in_frame_num_value_allowed_flag =
sps->gaps_in_frame_num_allowed_flag,
250 .frame_mbs_only_flag =
sps->frame_mbs_only_flag,
251 .mb_adaptive_frame_field_flag =
sps->mb_aff,
252 .direct_8x8_inference_flag =
sps->direct_8x8_inference_flag,
253 .MinLumaBiPredSize8x8 =
sps->level_idc >= 31,
254 .log2_max_frame_num_minus4 =
sps->log2_max_frame_num - 4,
255 .pic_order_cnt_type =
sps->poc_type,
256 .log2_max_pic_order_cnt_lsb_minus4 =
sps->log2_max_poc_lsb - 4,
257 .delta_pic_order_always_zero_flag =
sps->delta_pic_order_always_zero_flag,
259 .pic_init_qp_minus26 =
pps->init_qp - 26,
260 .pic_init_qs_minus26 =
pps->init_qs - 26,
261 .chroma_qp_index_offset =
pps->chroma_qp_index_offset[0],
262 .second_chroma_qp_index_offset =
pps->chroma_qp_index_offset[1],
264 .entropy_coding_mode_flag =
pps->cabac,
265 .weighted_pred_flag =
pps->weighted_pred,
266 .weighted_bipred_idc =
pps->weighted_bipred_idc,
267 .transform_8x8_mode_flag =
pps->transform_8x8_mode,
268 .field_pic_flag =
h->picture_structure !=
PICT_FRAME,
269 .constrained_intra_pred_flag =
pps->constrained_intra_pred,
270 .pic_order_present_flag =
pps->pic_order_present,
271 .deblocking_filter_control_present_flag =
pps->deblocking_filter_parameters_present,
272 .redundant_pic_cnt_present_flag =
pps->redundant_pic_cnt_present,
273 .reference_pic_flag =
h->nal_ref_idc != 0,
275 .frame_num =
h->poc.frame_num,
284 VAPictureParameterBufferType,
285 &pic_param,
sizeof(pic_param));
289 memcpy(iq_matrix.ScalingList4x4,
290 pps->scaling_matrix4,
sizeof(iq_matrix.ScalingList4x4));
291 memcpy(iq_matrix.ScalingList8x8[0],
292 pps->scaling_matrix8[0],
sizeof(iq_matrix.ScalingList8x8[0]));
293 memcpy(iq_matrix.ScalingList8x8[1],
294 pps->scaling_matrix8[3],
sizeof(iq_matrix.ScalingList8x8[0]));
297 VAIQMatrixBufferType,
298 &iq_matrix,
sizeof(iq_matrix));
335 VASliceParameterBufferH264 slice_param;
338 slice_param = (VASliceParameterBufferH264) {
339 .slice_data_size =
size,
340 .slice_data_offset = 0,
341 .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
349 .slice_qp_delta = sl->
qscale -
h->ps.pps->init_qp,
363 &slice_param.luma_weight_l0_flag,
364 slice_param.luma_weight_l0,
365 slice_param.luma_offset_l0,
366 &slice_param.chroma_weight_l0_flag,
367 slice_param.chroma_weight_l0,
368 slice_param.chroma_offset_l0);
370 &slice_param.luma_weight_l1_flag,
371 slice_param.luma_weight_l1,
372 slice_param.luma_offset_l1,
373 &slice_param.chroma_weight_l1_flag,
374 slice_param.chroma_weight_l1,
375 slice_param.chroma_offset_l1);
378 &slice_param,
sizeof(slice_param),
389 .
p.
name =
"h264_vaapi",