bool VaapiDecoderH265::fillPicture(const PicturePtr& picture, const H265SliceHdr* const slice) { VAPictureParameterBufferHEVC* param; if (!picture->editPicture(param)) return false; param->CurrPic.picture_id = picture->getSurfaceID(); param->CurrPic.pic_order_cnt = picture->m_poc; fillReference(param->ReferenceFrames, N_ELEMENTS(param->ReferenceFrames)); H265PPS* pps = slice->pps; H265SPS* sps = pps->sps; #define FILL(h, f) param->f = h->f FILL(sps, pic_width_in_luma_samples); FILL(sps, pic_height_in_luma_samples); #define FILL_PIC(h, f) param->pic_fields.bits.f = h->f FILL_PIC(sps, chroma_format_idc); FILL_PIC(sps, separate_colour_plane_flag); FILL_PIC(sps, pcm_enabled_flag); FILL_PIC(sps, scaling_list_enabled_flag); FILL_PIC(pps, transform_skip_enabled_flag); FILL_PIC(sps, amp_enabled_flag); FILL_PIC(sps, strong_intra_smoothing_enabled_flag); FILL_PIC(pps, sign_data_hiding_enabled_flag); FILL_PIC(pps, constrained_intra_pred_flag); FILL_PIC(pps, cu_qp_delta_enabled_flag); FILL_PIC(pps, weighted_pred_flag); FILL_PIC(pps, weighted_bipred_flag); FILL_PIC(pps, transquant_bypass_enabled_flag); FILL_PIC(pps, tiles_enabled_flag); FILL_PIC(pps, entropy_coding_sync_enabled_flag); param->pic_fields.bits.pps_loop_filter_across_slices_enabled_flag = pps->loop_filter_across_slices_enabled_flag; FILL_PIC(pps, loop_filter_across_tiles_enabled_flag); FILL_PIC(sps, pcm_loop_filter_disabled_flag); //how to fill this? //NoPicReorderingFlag //NoBiPredFlag param->sps_max_dec_pic_buffering_minus1 = sps->max_dec_pic_buffering_minus1[0]; FILL(sps, bit_depth_luma_minus8); FILL(sps, bit_depth_chroma_minus8); FILL(sps, pcm_sample_bit_depth_luma_minus1); FILL(sps, pcm_sample_bit_depth_chroma_minus1); FILL(sps, log2_min_luma_coding_block_size_minus3); FILL(sps, log2_diff_max_min_luma_coding_block_size); FILL(sps, log2_min_transform_block_size_minus2); FILL(sps, log2_diff_max_min_transform_block_size); FILL(sps, log2_min_pcm_luma_coding_block_size_minus3); FILL(sps, log2_diff_max_min_pcm_luma_coding_block_size); FILL(sps, max_transform_hierarchy_depth_intra); FILL(sps, max_transform_hierarchy_depth_inter); FILL(pps, init_qp_minus26); FILL(pps, diff_cu_qp_delta_depth); param->pps_cb_qp_offset = pps->cb_qp_offset; param->pps_cr_qp_offset = pps->cr_qp_offset; FILL(pps, log2_parallel_merge_level_minus2); FILL(pps, num_tile_columns_minus1); FILL(pps, num_tile_rows_minus1); for (int i = 0; i <= pps->num_tile_columns_minus1; i++) { param->column_width_minus1[i] = pps->column_width_minus1[i]; } for (int i = 0; i <= pps->num_tile_rows_minus1; i++) { param->row_height_minus1[i] = pps->row_height_minus1[i]; } #define FILL_SLICE(h, f) param->slice_parsing_fields.bits.f = h->f #define FILL_SLICE_1(h, f) param->slice_parsing_fields.bits.h##_##f = h->f FILL_SLICE(pps, lists_modification_present_flag); FILL_SLICE(sps, long_term_ref_pics_present_flag); FILL_SLICE_1(sps, temporal_mvp_enabled_flag); FILL_SLICE(pps, cabac_init_present_flag); FILL_SLICE(pps, output_flag_present_flag); FILL_SLICE(pps, dependent_slice_segments_enabled_flag); FILL_SLICE_1(pps, slice_chroma_qp_offsets_present_flag); FILL_SLICE(sps, sample_adaptive_offset_enabled_flag); FILL_SLICE(pps, deblocking_filter_override_enabled_flag); param->slice_parsing_fields.bits.pps_disable_deblocking_filter_flag = pps->deblocking_filter_disabled_flag; FILL_SLICE(pps, slice_segment_header_extension_present_flag); /* how to fill following fields RapPicFlag IdrPicFlag IntraPicFlag */ FILL(sps, log2_max_pic_order_cnt_lsb_minus4); FILL(sps, num_short_term_ref_pic_sets); param->num_long_term_ref_pic_sps = sps->num_long_term_ref_pics_sps; FILL(pps, num_ref_idx_l0_default_active_minus1); FILL(pps, num_ref_idx_l1_default_active_minus1); param->pps_beta_offset_div2 = pps->beta_offset_div2; param->pps_tc_offset_div2 = pps->tc_offset_div2; FILL(pps, num_extra_slice_header_bits); /* how to fill this st_rps_bits*/ #undef FILL #undef FILL_PIC #undef FILL_SLICE #undef FILL_SLICE_1 return true; }