23 #include <vdpau/vdpau.h>
42 VdpPictureInfoHEVC *
info = &pic_ctx->
info.hevc;
43 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
44 VdpPictureInfoHEVC444 *info2 = &pic_ctx->
info.hevc_444;
51 &
pps->scaling_list : &
sps->scaling_list;
56 info->chroma_format_idc =
sps->chroma_format_idc;
57 info->separate_colour_plane_flag =
sps->separate_colour_plane;
58 info->pic_width_in_luma_samples =
sps->width;
59 info->pic_height_in_luma_samples =
sps->height;
60 info->bit_depth_luma_minus8 =
sps->bit_depth - 8;
61 info->bit_depth_chroma_minus8 =
sps->bit_depth - 8;
62 info->log2_max_pic_order_cnt_lsb_minus4 =
sps->log2_max_poc_lsb - 4;
65 info->sps_max_dec_pic_buffering_minus1 =
sps->temporal_layer[
sps->max_sub_layers - 1].max_dec_pic_buffering - 1;
66 info->log2_min_luma_coding_block_size_minus3 =
sps->log2_min_cb_size - 3;
67 info->log2_diff_max_min_luma_coding_block_size =
sps->log2_diff_max_min_coding_block_size;
68 info->log2_min_transform_block_size_minus2 =
sps->log2_min_tb_size - 2;
69 info->log2_diff_max_min_transform_block_size =
sps->log2_max_trafo_size -
sps->log2_min_tb_size;
70 info->max_transform_hierarchy_depth_inter =
sps->max_transform_hierarchy_depth_inter;
71 info->max_transform_hierarchy_depth_intra =
sps->max_transform_hierarchy_depth_intra;
72 info->scaling_list_enabled_flag =
sps->scaling_list_enabled;
74 for (
size_t i = 0;
i < 6;
i++) {
75 for (
size_t j = 0; j < 16; j++) {
81 for (
size_t j = 0; j < 64; j++) {
92 info->ScalingList32x32[
i][j] = sl->
sl[3][
i * 3][
pos];
101 info->ScalingListDCCoeff32x32[
i] = sl->
sl_dc[1][
i * 3];
104 info->amp_enabled_flag =
sps->amp_enabled;
105 info->sample_adaptive_offset_enabled_flag =
sps->sao_enabled;
106 info->pcm_enabled_flag =
sps->pcm_enabled;
107 if (
info->pcm_enabled_flag) {
109 info->pcm_sample_bit_depth_luma_minus1 =
sps->pcm.bit_depth - 1;
111 info->pcm_sample_bit_depth_chroma_minus1 =
sps->pcm.bit_depth_chroma - 1;
113 info->log2_min_pcm_luma_coding_block_size_minus3 =
sps->pcm.log2_min_pcm_cb_size - 3;
115 info->log2_diff_max_min_pcm_luma_coding_block_size =
sps->pcm.log2_max_pcm_cb_size -
sps->pcm.log2_min_pcm_cb_size;
117 info->pcm_loop_filter_disabled_flag =
sps->pcm_loop_filter_disabled;
121 info->num_short_term_ref_pic_sets =
sps->nb_st_rps;
122 info->long_term_ref_pics_present_flag =
sps->long_term_ref_pics_present;
125 info->num_long_term_ref_pics_sps =
sps->num_long_term_ref_pics_sps;
126 info->sps_temporal_mvp_enabled_flag =
sps->temporal_mvp_enabled;
127 info->strong_intra_smoothing_enabled_flag =
sps->strong_intra_smoothing_enabled;
130 info->dependent_slice_segments_enabled_flag =
pps->dependent_slice_segments_enabled_flag;
131 info->output_flag_present_flag =
pps->output_flag_present_flag;
132 info->num_extra_slice_header_bits =
pps->num_extra_slice_header_bits;
133 info->sign_data_hiding_enabled_flag =
pps->sign_data_hiding_flag;
134 info->cabac_init_present_flag =
pps->cabac_init_present_flag;
135 info->num_ref_idx_l0_default_active_minus1 =
pps->num_ref_idx_l0_default_active - 1;
136 info->num_ref_idx_l1_default_active_minus1 =
pps->num_ref_idx_l1_default_active - 1;
137 info->init_qp_minus26 =
pps->pic_init_qp_minus26;
138 info->constrained_intra_pred_flag =
pps->constrained_intra_pred_flag;
139 info->transform_skip_enabled_flag =
pps->transform_skip_enabled_flag;
140 info->cu_qp_delta_enabled_flag =
pps->cu_qp_delta_enabled_flag;
142 info->diff_cu_qp_delta_depth =
pps->diff_cu_qp_delta_depth;
143 info->pps_cb_qp_offset =
pps->cb_qp_offset;
144 info->pps_cr_qp_offset =
pps->cr_qp_offset;
145 info->pps_slice_chroma_qp_offsets_present_flag =
pps->pic_slice_level_chroma_qp_offsets_present_flag;
146 info->weighted_pred_flag =
pps->weighted_pred_flag;
147 info->weighted_bipred_flag =
pps->weighted_bipred_flag;
148 info->transquant_bypass_enabled_flag =
pps->transquant_bypass_enable_flag;
149 info->tiles_enabled_flag =
pps->tiles_enabled_flag;
150 info->entropy_coding_sync_enabled_flag =
pps->entropy_coding_sync_enabled_flag;
151 if (
info->tiles_enabled_flag) {
153 info->num_tile_columns_minus1 =
pps->num_tile_columns - 1;
155 info->num_tile_rows_minus1 =
pps->num_tile_rows - 1;
157 info->uniform_spacing_flag =
pps->uniform_spacing_flag;
161 for (ssize_t
i = 0;
i <
pps->num_tile_columns;
i++) {
162 info->column_width_minus1[
i] =
pps->column_width[
i] - 1;
167 for (ssize_t
i = 0;
i <
pps->num_tile_rows;
i++) {
168 info->row_height_minus1[
i] =
pps->row_height[
i] - 1;
172 info->loop_filter_across_tiles_enabled_flag =
pps->loop_filter_across_tiles_enabled_flag;
174 info->pps_loop_filter_across_slices_enabled_flag =
pps->seq_loop_filter_across_slices_enabled_flag;
175 info->deblocking_filter_control_present_flag =
pps->deblocking_filter_control_present_flag;
178 info->deblocking_filter_override_enabled_flag =
pps->deblocking_filter_override_enabled_flag;
181 info->pps_deblocking_filter_disabled_flag =
pps->disable_dbf;
184 info->pps_beta_offset_div2 =
pps->beta_offset / 2;
187 info->pps_tc_offset_div2 =
pps->tc_offset / 2;
188 info->lists_modification_present_flag =
pps->lists_modification_present_flag;
189 info->log2_parallel_merge_level_minus2 =
pps->log2_parallel_merge_level - 2;
190 info->slice_segment_header_extension_present_flag =
pps->slice_header_extension_present_flag;
199 info->CurrRpsIdx =
sps->nb_st_rps;
201 for (
size_t i = 0;
i <
sps->nb_st_rps;
i++) {
203 info->CurrRpsIdx =
i;
232 info->CurrPicOrderCntVal =
h->poc;
235 for (
size_t i = 0;
i < 16;
i++) {
236 info->RefPics[
i] = VDP_INVALID_HANDLE;
237 info->PicOrderCntVal[
i] = 0;
238 info->IsLongTerm[
i] = 0;
246 "VDPAU only supports up to 16 references in the DPB. "
247 "This frame may not be decoded correctly.\n");
262 info->IsLongTerm[j] = 0;
269 if (
info->NumPocStCurrBefore > 8) {
271 "VDPAU only supports up to 8 references in StCurrBefore. "
272 "This frame may not be decoded correctly.\n");
273 info->NumPocStCurrBefore = 8;
278 if (
info->NumPocStCurrAfter > 8) {
280 "VDPAU only supports up to 8 references in StCurrAfter. "
281 "This frame may not be decoded correctly.\n");
282 info->NumPocStCurrAfter = 8;
287 if (
info->NumPocLtCurr > 8) {
289 "VDPAU only supports up to 8 references in LtCurr. "
290 "This frame may not be decoded correctly.\n");
291 info->NumPocLtCurr = 8;
300 for (
size_t k = 0; k < 16; k++) {
301 if (
id ==
info->RefPics[k]) {
302 info->RefPicSetStCurrBefore[j] = k;
323 for (
size_t k = 0; k < 16; k++) {
324 if (
id ==
info->RefPics[k]) {
325 info->RefPicSetStCurrAfter[j] = k;
341 for (ssize_t
i = 0, j = 0;
i <
h->rps[
LT_CURR].nb_refs;
i++) {
346 for (
size_t k = 0; k < 16; k++) {
347 if (
id ==
info->RefPics[k]) {
348 info->RefPicSetLtCurr[j] = k;
363 #ifdef VDP_YCBCR_FORMAT_Y_U_V_444
364 if (
sps->range_extension) {
365 info2->sps_range_extension_flag = 1;
366 info2->transformSkipRotationEnableFlag =
sps->transform_skip_rotation_enabled;
367 info2->transformSkipContextEnableFlag =
sps->transform_skip_context_enabled;
368 info2->implicitRdpcmEnableFlag =
sps->implicit_rdpcm_enabled;
369 info2->explicitRdpcmEnableFlag =
sps->explicit_rdpcm_enabled;
370 info2->extendedPrecisionProcessingFlag =
sps->extended_precision_processing;
371 info2->intraSmoothingDisabledFlag =
sps->intra_smoothing_disabled;
372 info2->highPrecisionOffsetsEnableFlag =
sps->high_precision_offsets_enabled;
373 info2->persistentRiceAdaptationEnableFlag =
sps->persistent_rice_adaptation_enabled;
374 info2->cabacBypassAlignmentEnableFlag =
sps->cabac_bypass_alignment_enabled;
376 info2->sps_range_extension_flag = 0;
378 if (
pps->pps_range_extensions_flag) {
379 info2->pps_range_extension_flag = 1;
380 info2->log2MaxTransformSkipSize =
pps->log2_max_transform_skip_block_size;
381 info2->crossComponentPredictionEnableFlag =
pps->cross_component_prediction_enabled_flag;
382 info2->chromaQpAdjustmentEnableFlag =
pps->chroma_qp_offset_list_enabled_flag;
383 info2->diffCuChromaQpAdjustmentDepth =
pps->diff_cu_chroma_qp_offset_depth;
384 info2->chromaQpAdjustmentTableSize =
pps->chroma_qp_offset_list_len_minus1 + 1;
385 info2->log2SaoOffsetScaleLuma =
pps->log2_sao_offset_scale_luma;
386 info2->log2SaoOffsetScaleChroma =
pps->log2_sao_offset_scale_chroma;
387 for (ssize_t
i = 0;
i < info2->chromaQpAdjustmentTableSize;
i++)
389 info2->cb_qp_adjustment[
i] =
pps->cb_qp_offset_list[
i];
390 info2->cr_qp_adjustment[
i] =
pps->cr_qp_offset_list[
i];
394 info2->pps_range_extension_flag = 0;
445 #define copy_field(name) h265_raw_ptl->general_ ## name = general_ptl->name
487 *vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN;
493 if (!strcmp(
profile->name,
"Main 12") ||
494 !strcmp(
profile->name,
"Main 12 Intra"))
495 *vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_12;
496 #ifdef VDP_DECODER_PROFILE_HEVC_MAIN_444
497 else if (!strcmp(
profile->name,
"Main 4:4:4") ||
498 !strcmp(
profile->name,
"Main 4:4:4 Intra"))
499 *vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_444;
501 #ifdef VDP_DECODER_PROFILE_HEVC_MAIN_444_10
502 else if (!strcmp(
profile->name,
"Main 4:4:4 10") ||
503 !strcmp(
profile->name,
"Main 4:4:4 10 Intra"))
504 *vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_444_10;
505 else if (!strcmp(
profile->name,
"Main 4:4:4 12") ||
506 !strcmp(
profile->name,
"Main 4:4:4 12 Intra"))
507 *vdp_profile = VDP_DECODER_PROFILE_HEVC_MAIN_444_12;
524 profile = VDP_DECODER_PROFILE_HEVC_MAIN;
527 profile = VDP_DECODER_PROFILE_HEVC_MAIN_10;
530 profile = VDP_DECODER_PROFILE_HEVC_MAIN_STILL;
545 .
p.
name =
"hevc_vdpau",