23 #include <vdpau/vdpau.h>
40 VdpPictureInfoHEVC *
info = &pic_ctx->
info.hevc;
41 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
42 VdpPictureInfoHEVC444 *info2 = &pic_ctx->
info.hevc_444;
49 &
pps->scaling_list : &
sps->scaling_list;
54 info->chroma_format_idc =
sps->chroma_format_idc;
55 info->separate_colour_plane_flag =
sps->separate_colour_plane_flag;
56 info->pic_width_in_luma_samples =
sps->width;
57 info->pic_height_in_luma_samples =
sps->height;
58 info->bit_depth_luma_minus8 =
sps->bit_depth - 8;
59 info->bit_depth_chroma_minus8 =
sps->bit_depth - 8;
60 info->log2_max_pic_order_cnt_lsb_minus4 =
sps->log2_max_poc_lsb - 4;
63 info->sps_max_dec_pic_buffering_minus1 =
sps->temporal_layer[
sps->max_sub_layers - 1].max_dec_pic_buffering - 1;
64 info->log2_min_luma_coding_block_size_minus3 =
sps->log2_min_cb_size - 3;
65 info->log2_diff_max_min_luma_coding_block_size =
sps->log2_diff_max_min_coding_block_size;
66 info->log2_min_transform_block_size_minus2 =
sps->log2_min_tb_size - 2;
67 info->log2_diff_max_min_transform_block_size =
sps->log2_max_trafo_size -
sps->log2_min_tb_size;
68 info->max_transform_hierarchy_depth_inter =
sps->max_transform_hierarchy_depth_inter;
69 info->max_transform_hierarchy_depth_intra =
sps->max_transform_hierarchy_depth_intra;
70 info->scaling_list_enabled_flag =
sps->scaling_list_enable_flag;
72 for (
size_t i = 0;
i < 6;
i++) {
73 for (
size_t j = 0; j < 16; j++) {
77 info->ScalingList4x4[
i][j] = sl->
sl[0][
i][pos];
79 for (
size_t j = 0; j < 64; j++) {
83 info->ScalingList8x8[
i][j] = sl->
sl[1][
i][pos];
86 info->ScalingList16x16[
i][j] = sl->
sl[2][
i][pos];
90 info->ScalingList32x32[
i][j] = sl->
sl[3][
i * 3][pos];
99 info->ScalingListDCCoeff32x32[
i] = sl->
sl_dc[1][
i * 3];
102 info->amp_enabled_flag =
sps->amp_enabled_flag;
103 info->sample_adaptive_offset_enabled_flag =
sps->sao_enabled;
104 info->pcm_enabled_flag =
sps->pcm_enabled_flag;
105 if (
info->pcm_enabled_flag) {
107 info->pcm_sample_bit_depth_luma_minus1 =
sps->pcm.bit_depth - 1;
109 info->pcm_sample_bit_depth_chroma_minus1 =
sps->pcm.bit_depth_chroma - 1;
111 info->log2_min_pcm_luma_coding_block_size_minus3 =
sps->pcm.log2_min_pcm_cb_size - 3;
113 info->log2_diff_max_min_pcm_luma_coding_block_size =
sps->pcm.log2_max_pcm_cb_size -
sps->pcm.log2_min_pcm_cb_size;
115 info->pcm_loop_filter_disabled_flag =
sps->pcm.loop_filter_disable_flag;
119 info->num_short_term_ref_pic_sets =
sps->nb_st_rps;
120 info->long_term_ref_pics_present_flag =
sps->long_term_ref_pics_present_flag;
123 info->num_long_term_ref_pics_sps =
sps->num_long_term_ref_pics_sps;
124 info->sps_temporal_mvp_enabled_flag =
sps->sps_temporal_mvp_enabled_flag;
125 info->strong_intra_smoothing_enabled_flag =
sps->sps_strong_intra_smoothing_enable_flag;
128 info->dependent_slice_segments_enabled_flag =
pps->dependent_slice_segments_enabled_flag;
129 info->output_flag_present_flag =
pps->output_flag_present_flag;
130 info->num_extra_slice_header_bits =
pps->num_extra_slice_header_bits;
131 info->sign_data_hiding_enabled_flag =
pps->sign_data_hiding_flag;
132 info->cabac_init_present_flag =
pps->cabac_init_present_flag;
133 info->num_ref_idx_l0_default_active_minus1 =
pps->num_ref_idx_l0_default_active - 1;
134 info->num_ref_idx_l1_default_active_minus1 =
pps->num_ref_idx_l1_default_active - 1;
135 info->init_qp_minus26 =
pps->pic_init_qp_minus26;
136 info->constrained_intra_pred_flag =
pps->constrained_intra_pred_flag;
137 info->transform_skip_enabled_flag =
pps->transform_skip_enabled_flag;
138 info->cu_qp_delta_enabled_flag =
pps->cu_qp_delta_enabled_flag;
140 info->diff_cu_qp_delta_depth =
pps->diff_cu_qp_delta_depth;
141 info->pps_cb_qp_offset =
pps->cb_qp_offset;
142 info->pps_cr_qp_offset =
pps->cr_qp_offset;
143 info->pps_slice_chroma_qp_offsets_present_flag =
pps->pic_slice_level_chroma_qp_offsets_present_flag;
144 info->weighted_pred_flag =
pps->weighted_pred_flag;
145 info->weighted_bipred_flag =
pps->weighted_bipred_flag;
146 info->transquant_bypass_enabled_flag =
pps->transquant_bypass_enable_flag;
147 info->tiles_enabled_flag =
pps->tiles_enabled_flag;
148 info->entropy_coding_sync_enabled_flag =
pps->entropy_coding_sync_enabled_flag;
149 if (
info->tiles_enabled_flag) {
151 info->num_tile_columns_minus1 =
pps->num_tile_columns - 1;
153 info->num_tile_rows_minus1 =
pps->num_tile_rows - 1;
155 info->uniform_spacing_flag =
pps->uniform_spacing_flag;
159 for (ssize_t
i = 0;
i <
pps->num_tile_columns;
i++) {
160 info->column_width_minus1[
i] =
pps->column_width[
i] - 1;
165 for (ssize_t
i = 0;
i <
pps->num_tile_rows;
i++) {
166 info->row_height_minus1[
i] =
pps->row_height[
i] - 1;
170 info->loop_filter_across_tiles_enabled_flag =
pps->loop_filter_across_tiles_enabled_flag;
172 info->pps_loop_filter_across_slices_enabled_flag =
pps->seq_loop_filter_across_slices_enabled_flag;
173 info->deblocking_filter_control_present_flag =
pps->deblocking_filter_control_present_flag;
176 info->deblocking_filter_override_enabled_flag =
pps->deblocking_filter_override_enabled_flag;
179 info->pps_deblocking_filter_disabled_flag =
pps->disable_dbf;
182 info->pps_beta_offset_div2 =
pps->beta_offset / 2;
185 info->pps_tc_offset_div2 =
pps->tc_offset / 2;
186 info->lists_modification_present_flag =
pps->lists_modification_present_flag;
187 info->log2_parallel_merge_level_minus2 =
pps->log2_parallel_merge_level - 2;
188 info->slice_segment_header_extension_present_flag =
pps->slice_header_extension_present_flag;
197 info->CurrRpsIdx =
sps->nb_st_rps;
199 for (
size_t i = 0;
i <
sps->nb_st_rps;
i++) {
201 info->CurrRpsIdx =
i;
230 info->CurrPicOrderCntVal =
h->poc;
233 for (
size_t i = 0;
i < 16;
i++) {
234 info->RefPics[
i] = VDP_INVALID_HANDLE;
235 info->PicOrderCntVal[
i] = 0;
236 info->IsLongTerm[
i] = 0;
244 "VDPAU only supports up to 16 references in the DPB. "
245 "This frame may not be decoded correctly.\n");
260 info->IsLongTerm[j] = 0;
267 if (
info->NumPocStCurrBefore > 8) {
269 "VDPAU only supports up to 8 references in StCurrBefore. "
270 "This frame may not be decoded correctly.\n");
271 info->NumPocStCurrBefore = 8;
276 if (
info->NumPocStCurrAfter > 8) {
278 "VDPAU only supports up to 8 references in StCurrAfter. "
279 "This frame may not be decoded correctly.\n");
280 info->NumPocStCurrAfter = 8;
285 if (
info->NumPocLtCurr > 8) {
287 "VDPAU only supports up to 8 references in LtCurr. "
288 "This frame may not be decoded correctly.\n");
289 info->NumPocLtCurr = 8;
298 for (
size_t k = 0; k < 16; k++) {
299 if (
id ==
info->RefPics[k]) {
300 info->RefPicSetStCurrBefore[j] = k;
321 for (
size_t k = 0; k < 16; k++) {
322 if (
id ==
info->RefPics[k]) {
323 info->RefPicSetStCurrAfter[j] = k;
339 for (ssize_t
i = 0, j = 0;
i <
h->rps[
LT_CURR].nb_refs;
i++) {
344 for (
size_t k = 0; k < 16; k++) {
345 if (
id ==
info->RefPics[k]) {
346 info->RefPicSetLtCurr[j] = k;
361 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
362 if (
sps->sps_range_extension_flag) {
363 info2->sps_range_extension_flag = 1;
364 info2->transformSkipRotationEnableFlag =
sps->transform_skip_rotation_enabled_flag;
365 info2->transformSkipContextEnableFlag =
sps->transform_skip_context_enabled_flag;
366 info2->implicitRdpcmEnableFlag =
sps->implicit_rdpcm_enabled_flag;
367 info2->explicitRdpcmEnableFlag =
sps->explicit_rdpcm_enabled_flag;
368 info2->extendedPrecisionProcessingFlag =
sps->extended_precision_processing_flag;
369 info2->intraSmoothingDisabledFlag =
sps->intra_smoothing_disabled_flag;
370 info2->highPrecisionOffsetsEnableFlag =
sps->high_precision_offsets_enabled_flag;
371 info2->persistentRiceAdaptationEnableFlag =
sps->persistent_rice_adaptation_enabled_flag;
372 info2->cabacBypassAlignmentEnableFlag =
sps->cabac_bypass_alignment_enabled_flag;
374 info2->sps_range_extension_flag = 0;
376 if (
pps->pps_range_extensions_flag) {
377 info2->pps_range_extension_flag = 1;
378 info2->log2MaxTransformSkipSize =
pps->log2_max_transform_skip_block_size;
379 info2->crossComponentPredictionEnableFlag =
pps->cross_component_prediction_enabled_flag;
380 info2->chromaQpAdjustmentEnableFlag =
pps->chroma_qp_offset_list_enabled_flag;
381 info2->diffCuChromaQpAdjustmentDepth =
pps->diff_cu_chroma_qp_offset_depth;
382 info2->chromaQpAdjustmentTableSize =
pps->chroma_qp_offset_list_len_minus1 + 1;
383 info2->log2SaoOffsetScaleLuma =
pps->log2_sao_offset_scale_luma;
384 info2->log2SaoOffsetScaleChroma =
pps->log2_sao_offset_scale_chroma;
385 for (ssize_t
i = 0;
i < info2->chromaQpAdjustmentTableSize;
i++)
387 info2->cb_qp_adjustment[
i] =
pps->cb_qp_offset_list[
i];
388 info2->cr_qp_adjustment[
i] =
pps->cr_qp_offset_list[
i];
392 info2->pps_range_extension_flag = 0;
439 profile = VDP_DECODER_PROFILE_HEVC_MAIN;
442 profile = VDP_DECODER_PROFILE_HEVC_MAIN_10;
445 profile = VDP_DECODER_PROFILE_HEVC_MAIN_STILL;
448 profile = VDP_DECODER_PROFILE_HEVC_MAIN_444;
458 .
name =
"hevc_vdpau",