45 .encode_op = VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR,
47 .extensionName = VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME,
48 .specVersion = VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION,
54 0x03, 0xfd, 0xf2, 0x0a, 0x5d, 0x4c, 0x05, 0x48,
55 0x20, 0x98, 0xca, 0x6b, 0x0c, 0x95, 0x30, 0x1c,
74 VkVideoEncodeH264NaluSliceInfoKHR
vkslice;
100 VkVideoEncodeH264CapabilitiesKHR
caps;
117 VkVideoEncodeRateControlInfoKHR *rc_info,
118 VkVideoEncodeRateControlLayerInfoKHR *rc_layer)
124 hp->
vkrc_info = (VkVideoEncodeH264RateControlInfoKHR) {
125 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_INFO_KHR,
126 .flags = VK_VIDEO_ENCODE_H264_RATE_CONTROL_REFERENCE_PATTERN_FLAT_BIT_KHR |
127 VK_VIDEO_ENCODE_H264_RATE_CONTROL_REGULAR_GOP_BIT_KHR,
128 .idrPeriod =
ctx->base.gop_size,
129 .gopFrameCount =
ctx->base.gop_size,
130 .consecutiveBFrameCount =
FFMAX(
ctx->base.b_per_p - 1, 0),
131 .temporalLayerCount = 0,
135 if (rc_info->rateControlMode > VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR) {
140 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_KHR,
142 .useMinQp = avctx->
qmin > 0,
143 .minQp.qpI = avctx->
qmin > 0 ? avctx->
qmin : 0,
144 .minQp.qpP = avctx->
qmin > 0 ? avctx->
qmin : 0,
145 .minQp.qpB = avctx->
qmin > 0 ? avctx->
qmin : 0,
147 .useMaxQp = avctx->
qmax > 0,
148 .maxQp.qpI = avctx->
qmax > 0 ? avctx->
qmax : 0,
149 .maxQp.qpP = avctx->
qmax > 0 ? avctx->
qmax : 0,
150 .maxQp.qpB = avctx->
qmax > 0 ? avctx->
qmax : 0,
152 .useMaxFrameSize = 0,
220 .exact_match_flag = 1,
221 .broken_link_flag =
ctx->base.b_per_p > 0,
229 size_t sei_a53cc_len;
252 hp->
slice_wt = (StdVideoEncodeH264WeightTable) {
253 .flags = (StdVideoEncodeH264WeightTableFlags) {
254 .luma_weight_l0_flag = 0,
255 .chroma_weight_l0_flag = 0,
256 .luma_weight_l1_flag = 0,
257 .chroma_weight_l1_flag = 0,
259 .luma_log2_weight_denom = 0,
260 .chroma_log2_weight_denom = 0,
261 .luma_weight_l0 = { 0 },
262 .luma_offset_l0 = { 0 },
263 .chroma_weight_l0 = { { 0 } },
264 .chroma_offset_l0 = { { 0 } },
265 .luma_weight_l1 = { 0 },
266 .luma_offset_l1 = { 0 },
267 .chroma_weight_l1 = { { 0 } },
268 .chroma_offset_l1 = { { 0 } },
271 hp->
slice_hdr = (StdVideoEncodeH264SliceHeader) {
272 .flags = (StdVideoEncodeH264SliceHeaderFlags) {
273 .direct_spatial_mv_pred_flag = 1,
275 .num_ref_idx_active_override_flag =
279 .first_mb_in_slice = 1,
281 .slice_alpha_c0_offset_div2 = 0,
282 .slice_beta_offset_div2 = 0,
286 .disable_deblocking_filter_idc = 0,
287 .pWeightTable =
NULL,
290 hp->
vkslice = (VkVideoEncodeH264NaluSliceInfoKHR) {
291 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_NALU_SLICE_INFO_KHR,
299 if (enc->
common.
opts.
rc_mode != VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR)
328 for (j = n; j > 0; j--) {
333 rpl0[j] = rpl0[j - 1];
335 rpl0[j] = prev->
dpb[
i];
338 for (j = n; j > 0; j--) {
349 rpl0[j] = rpl0[j - 1];
351 rpl0[j] = prev->
dpb[
i];
353 for (j = n; j > 0; j--) {
364 rpl1[j] = rpl1[j - 1];
366 rpl1[j] = prev->
dpb[
i];
373 for (
i = 0;
i < n;
i++) {
374 if (rpl0[
i] != rpl1[
i])
385 for (
i = 0;
i < n;
i++) {
388 hn->frame_num,
hn->pic_order_cnt);
395 for (
i = 0;
i < n;
i++) {
398 hn->frame_num,
hn->pic_order_cnt);
408 VkVideoEncodeInfoKHR *encode_info)
418 .flags = (StdVideoEncodeH264ReferenceListsInfoFlags) {
419 .ref_pic_list_modification_flag_l0 = 0,
420 .ref_pic_list_modification_flag_l1 = 0,
424 .num_ref_idx_l0_active_minus1 = pic->
nb_refs[0] - 1,
425 .num_ref_idx_l1_active_minus1 = pic->
nb_refs[1] - 1,
429 .pRefList0ModOperations =
NULL,
430 .refList0ModOpCount = 0,
431 .pRefList1ModOperations =
NULL,
432 .refList1ModOpCount = 0,
433 .pRefPicMarkingOperations =
NULL,
434 .refPicMarkingOpCount = 0,
437 for (
i = 0;
i < STD_VIDEO_H264_MAX_NUM_LIST_REF;
i++)
442 VkVideoReferenceSlotInfoKHR *slot_info;
443 slot_info = (VkVideoReferenceSlotInfoKHR *)&encode_info->pReferenceSlots[
i];
449 VkVideoReferenceSlotInfoKHR *slot_info;
450 slot_info = (VkVideoReferenceSlotInfoKHR *)&encode_info->pReferenceSlots[pic->
nb_refs[0] +
i];
458 int discard = 0, keep = 0;
464 if (prev->
dpb[
i] == pic->
dpb[j])
468 discard_list[discard] = prev->
dpb[
i];
477 hp->
h264pic_info.flags.adaptive_ref_pic_marking_mode_flag = 0;
479 hp->
h264pic_info.flags.adaptive_ref_pic_marking_mode_flag = 1;
480 for (
i = 0;
i < discard;
i++) {
483 hp->
mmco[
i] = (StdVideoEncodeH264RefPicMarkingEntry) {
484 .memory_management_control_operation = 1,
488 hp->
mmco[
i] = (StdVideoEncodeH264RefPicMarkingEntry) {
489 .memory_management_control_operation = 0,
512 hp->
ref_list_info.flags.ref_pic_list_modification_flag_l0 = need_rplm;
519 hp->
mods[0][
i] = (StdVideoEncodeH264RefListModEntry) {
520 .modification_of_pic_nums_idc = 0,
521 .abs_diff_pic_num_minus1 = pic_num - href->
frame_num - 1,
524 hp->
mods[0][
i] = (StdVideoEncodeH264RefListModEntry) {
525 .modification_of_pic_nums_idc = 1,
526 .abs_diff_pic_num_minus1 = href->
frame_num - pic_num - 1,
535 int need_rplm_l0 = 0, need_rplm_l1 = 0;
555 hp->
ref_list_info.flags.ref_pic_list_modification_flag_l0 = need_rplm_l0;
562 hp->
mods[0][j] = (StdVideoEncodeH264RefListModEntry) {
563 .modification_of_pic_nums_idc = 0,
564 .abs_diff_pic_num_minus1 = pic_num - href->
frame_num - 1,
567 hp->
mods[0][j] = (StdVideoEncodeH264RefListModEntry) {
568 .modification_of_pic_nums_idc = 1,
569 .abs_diff_pic_num_minus1 = href->
frame_num - pic_num - 1,
579 hp->
ref_list_info.flags.ref_pic_list_modification_flag_l1 = need_rplm_l1;
586 hp->
mods[1][j] = (StdVideoEncodeH264RefListModEntry) {
587 .modification_of_pic_nums_idc = 0,
588 .abs_diff_pic_num_minus1 = pic_num - href->
frame_num - 1,
591 hp->
mods[1][j] = (StdVideoEncodeH264RefListModEntry) {
592 .modification_of_pic_nums_idc = 1,
593 .abs_diff_pic_num_minus1 = href->
frame_num - pic_num - 1,
606 VkVideoEncodeInfoKHR *encode_info)
611 VkVideoReferenceSlotInfoKHR *ref_slot;
618 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PICTURE_INFO_KHR,
620 .pNaluSliceEntries =
NULL,
621 .naluSliceEntryCount = 0,
626 .flags = (StdVideoEncodeH264PictureInfoFlags) {
629 .no_output_of_prior_pics_flag = 0,
630 .long_term_reference_flag = 0,
631 .adaptive_ref_pic_marking_mode_flag = 0,
634 .seq_parameter_set_id = 0,
635 .pic_parameter_set_id = 0,
640 STD_VIDEO_H264_PICTURE_TYPE_IDR,
650 .flags = (StdVideoEncodeH264ReferenceInfoFlags) {
651 .used_for_long_term_reference = 0,
657 .long_term_pic_num = 0,
658 .long_term_frame_idx = 0,
662 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_DPB_SLOT_INFO_KHR,
668 ref_slot = (VkVideoReferenceSlotInfoKHR *)encode_info->pSetupReferenceSlot;
679 VkVideoProfileInfoKHR *
profile,
void *pnext)
686 VkVideoEncodeH264CapabilitiesKHR h264_caps = {
687 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_CAPABILITIES_KHR,
689 VkVideoEncodeCapabilitiesKHR enc_caps = {
690 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_CAPABILITIES_KHR,
693 VkVideoCapabilitiesKHR caps = {
694 .sType = VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR,
700 static const int known_profiles[] = {
712 if (
desc->comp[0].depth == 8)
715 enc->
profile = (VkVideoEncodeH264ProfileInfoKHR) {
716 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PROFILE_INFO_KHR,
731 for (
int i = 0;
i < nb_profiles;
i++) {
733 ret = vk->GetPhysicalDeviceVideoCapabilitiesKHR(
s->hwctx->phys_dev,
736 if (
ret == VK_SUCCESS) {
739 last_supported = known_profiles[
i];
751 avctx->
profile = last_supported;
771 "must have initial buffer size (%d) <= "
772 "buffer size (%"PRId64
").\n",
781 if (enc->
common.
opts.
rc_mode == VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR) {
802 "%d / %d / %d for IDR- / P- / B-frames.\n",
837 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_SCALING_MATRIX_PRESENT_FLAG_SET_BIT_KHR);
839 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_SCALING_MATRIX_PRESENT_FLAG_SET_BIT_KHR);
841 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_TRANSFORM_8X8_MODE_FLAG_SET_BIT_KHR);
847 StdVideoH264SequenceParameterSet
vksps;
852 StdVideoH264PictureParameterSet
vkpps;
865 StdVideoH264ScalingLists *vksps_scaling = &vk_units->
vksps_scaling;
867 StdVideoH264SequenceParameterSetVui *vksps_vui = &vk_units->
vksps_vui;
868 StdVideoH264SequenceParameterSet *vksps = &vk_units->
vksps;
871 StdVideoH264ScalingLists *vkpps_scaling = &vk_units->
vkpps_scaling;
872 StdVideoH264PictureParameterSet *vkpps = &vk_units->
vkpps;
874 *vksps_scaling = (StdVideoH264ScalingLists) {
875 .scaling_list_present_mask = 0x0,
876 .use_default_scaling_matrix_mask = 1,
879 *vksps_vui_header = (StdVideoH264HrdParameters) {
894 vksps_vui_header->cbr_flag[
i] = hrd->
cbr_flag[
i];
897 *vksps_vui = (StdVideoH264SequenceParameterSetVui) {
898 .flags = (StdVideoH264SpsVuiFlags) {
899 .aspect_ratio_info_present_flag =
sps->vui.aspect_ratio_info_present_flag,
900 .overscan_info_present_flag =
sps->vui.overscan_info_present_flag,
901 .overscan_appropriate_flag =
sps->vui.overscan_appropriate_flag,
902 .video_signal_type_present_flag =
sps->vui.video_signal_type_present_flag,
903 .video_full_range_flag =
sps->vui.video_full_range_flag,
904 .color_description_present_flag =
sps->vui.colour_description_present_flag,
905 .chroma_loc_info_present_flag =
sps->vui.chroma_loc_info_present_flag,
906 .timing_info_present_flag =
sps->vui.timing_info_present_flag,
907 .fixed_frame_rate_flag =
sps->vui.fixed_frame_rate_flag,
908 .bitstream_restriction_flag =
sps->vui.bitstream_restriction_flag,
909 .nal_hrd_parameters_present_flag =
sps->vui.nal_hrd_parameters_present_flag,
910 .vcl_hrd_parameters_present_flag =
sps->vui.vcl_hrd_parameters_present_flag,
912 .aspect_ratio_idc =
sps->vui.aspect_ratio_idc,
913 .sar_width =
sps->vui.sar_width,
914 .sar_height =
sps->vui.sar_height,
915 .video_format =
sps->vui.video_format,
916 .colour_primaries =
sps->vui.colour_primaries,
917 .transfer_characteristics =
sps->vui.transfer_characteristics,
918 .matrix_coefficients =
sps->vui.matrix_coefficients,
919 .num_units_in_tick =
sps->vui.num_units_in_tick,
920 .time_scale =
sps->vui.time_scale,
921 .max_num_reorder_frames =
sps->vui.max_num_reorder_frames,
922 .max_dec_frame_buffering =
sps->vui.max_dec_frame_buffering,
923 .chroma_sample_loc_type_top_field =
sps->vui.chroma_sample_loc_type_top_field,
924 .chroma_sample_loc_type_bottom_field =
sps->vui.chroma_sample_loc_type_bottom_field,
926 .pHrdParameters = vksps_vui_header,
929 *vksps = (StdVideoH264SequenceParameterSet) {
930 .flags = (StdVideoH264SpsFlags) {
931 .constraint_set0_flag =
sps->constraint_set0_flag,
932 .constraint_set1_flag =
sps->constraint_set1_flag,
933 .constraint_set2_flag =
sps->constraint_set2_flag,
934 .constraint_set3_flag =
sps->constraint_set3_flag,
935 .constraint_set4_flag =
sps->constraint_set4_flag,
936 .constraint_set5_flag =
sps->constraint_set5_flag,
937 .direct_8x8_inference_flag =
sps->direct_8x8_inference_flag,
938 .mb_adaptive_frame_field_flag =
sps->mb_adaptive_frame_field_flag,
939 .frame_mbs_only_flag =
sps->frame_mbs_only_flag,
940 .delta_pic_order_always_zero_flag =
sps->delta_pic_order_always_zero_flag,
941 .separate_colour_plane_flag =
sps->separate_colour_plane_flag,
942 .gaps_in_frame_num_value_allowed_flag =
sps->gaps_in_frame_num_allowed_flag,
943 .qpprime_y_zero_transform_bypass_flag =
sps->qpprime_y_zero_transform_bypass_flag,
944 .frame_cropping_flag =
sps->frame_cropping_flag,
945 .seq_scaling_matrix_present_flag =
sps->seq_scaling_matrix_present_flag,
946 .vui_parameters_present_flag =
sps->vui_parameters_present_flag,
950 .chroma_format_idc =
sps->chroma_format_idc,
951 .seq_parameter_set_id =
sps->seq_parameter_set_id,
952 .bit_depth_luma_minus8 =
sps->bit_depth_luma_minus8,
953 .bit_depth_chroma_minus8 =
sps->bit_depth_chroma_minus8,
954 .log2_max_frame_num_minus4 =
sps->log2_max_frame_num_minus4,
955 .pic_order_cnt_type =
sps->pic_order_cnt_type,
956 .offset_for_non_ref_pic =
sps->offset_for_non_ref_pic,
957 .offset_for_top_to_bottom_field =
sps->offset_for_top_to_bottom_field,
958 .log2_max_pic_order_cnt_lsb_minus4 =
sps->log2_max_pic_order_cnt_lsb_minus4,
959 .num_ref_frames_in_pic_order_cnt_cycle =
sps->num_ref_frames_in_pic_order_cnt_cycle,
960 .max_num_ref_frames =
sps->max_num_ref_frames,
962 .pic_width_in_mbs_minus1 =
sps->pic_width_in_mbs_minus1,
963 .pic_height_in_map_units_minus1 =
sps->pic_height_in_map_units_minus1,
964 .frame_crop_left_offset =
sps->frame_crop_left_offset,
965 .frame_crop_right_offset =
sps->frame_crop_right_offset,
966 .frame_crop_top_offset =
sps->frame_crop_top_offset,
967 .frame_crop_bottom_offset =
sps->frame_crop_bottom_offset,
969 .pOffsetForRefFrame =
sps->offset_for_ref_frame,
970 .pScalingLists = vksps_scaling,
971 .pSequenceParameterSetVui = vksps_vui,
974 *vkpps_scaling = (StdVideoH264ScalingLists) {
975 .scaling_list_present_mask = 0x0,
976 .use_default_scaling_matrix_mask = 1,
979 *vkpps = (StdVideoH264PictureParameterSet) {
980 .flags = (StdVideoH264PpsFlags) {
981 .transform_8x8_mode_flag =
pps->transform_8x8_mode_flag,
982 .redundant_pic_cnt_present_flag =
pps->redundant_pic_cnt_present_flag,
983 .constrained_intra_pred_flag =
pps->constrained_intra_pred_flag,
984 .deblocking_filter_control_present_flag =
pps->deblocking_filter_control_present_flag,
985 .weighted_pred_flag =
pps->weighted_pred_flag,
986 .bottom_field_pic_order_in_frame_present_flag =
pps->bottom_field_pic_order_in_frame_present_flag,
987 .entropy_coding_mode_flag =
pps->entropy_coding_mode_flag,
988 .pic_scaling_matrix_present_flag =
pps->pic_scaling_matrix_present_flag,
990 .seq_parameter_set_id =
pps->seq_parameter_set_id,
991 .pic_parameter_set_id =
pps->pic_parameter_set_id,
992 .num_ref_idx_l0_default_active_minus1 =
pps->num_ref_idx_l0_default_active_minus1,
993 .num_ref_idx_l1_default_active_minus1 =
pps->num_ref_idx_l1_default_active_minus1,
994 .weighted_bipred_idc =
pps->weighted_bipred_idc,
995 .pic_init_qp_minus26 =
pps->pic_init_qp_minus26,
996 .pic_init_qs_minus26 =
pps->pic_init_qs_minus26,
997 .chroma_qp_index_offset =
pps->chroma_qp_index_offset,
998 .second_chroma_qp_index_offset =
pps->second_chroma_qp_index_offset,
999 .pScalingLists = vkpps_scaling,
1015 VkVideoEncodeH264SessionParametersAddInfoKHR h264_params_info;
1016 VkVideoEncodeH264SessionParametersCreateInfoKHR h264_params;
1027 if (
ctx->session_params)
1028 vk->DestroyVideoSessionParametersKHR(
s->hwctx->act_dev,
1029 ctx->session_params,
1032 h264_params_info = (VkVideoEncodeH264SessionParametersAddInfoKHR) {
1033 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_ADD_INFO_KHR,
1034 .pStdSPSs = &vk_units.
vksps,
1036 .pStdPPSs = &vk_units.
vkpps,
1039 h264_params = (VkVideoEncodeH264SessionParametersCreateInfoKHR) {
1040 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_CREATE_INFO_KHR,
1041 .maxStdSPSCount = 1,
1042 .maxStdPPSCount = 1,
1043 .pParametersAddInfo = &h264_params_info,
1051 int sps_override,
int pps_override)
1096 VkVideoEncodeH264SessionParametersGetInfoKHR h264_params_info;
1097 VkVideoEncodeSessionParametersGetInfoKHR params_info;
1098 VkVideoEncodeH264SessionParametersFeedbackInfoKHR h264_params_feedback;
1099 VkVideoEncodeSessionParametersFeedbackInfoKHR params_feedback;
1102 size_t data_size = 0;
1117 h264_params_info = (VkVideoEncodeH264SessionParametersGetInfoKHR) {
1118 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_GET_INFO_KHR,
1124 params_info = (VkVideoEncodeSessionParametersGetInfoKHR) {
1125 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_SESSION_PARAMETERS_GET_INFO_KHR,
1126 .pNext = &h264_params_info,
1127 .videoSessionParameters =
ctx->session_params,
1130 h264_params_feedback = (VkVideoEncodeH264SessionParametersFeedbackInfoKHR) {
1131 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_FEEDBACK_INFO_KHR,
1133 params_feedback = (VkVideoEncodeSessionParametersFeedbackInfoKHR) {
1134 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_SESSION_PARAMETERS_FEEDBACK_INFO_KHR,
1135 .pNext = &h264_params_feedback,
1138 ret = vk->GetEncodedVideoSessionParametersKHR(
s->hwctx->act_dev, ¶ms_info,
1141 if (
ret == VK_INCOMPLETE ||
1142 (
ret == VK_SUCCESS) && (data_size > 0)) {
1147 av_log(avctx,
AV_LOG_ERROR,
"Unable to get feedback for H.264 units = %lu\n", data_size);
1151 ret = vk->GetEncodedVideoSessionParametersKHR(
s->hwctx->act_dev, ¶ms_info,
1154 if (
ret != VK_SUCCESS) {
1160 params_feedback.hasOverrides,
1161 h264_params_feedback.hasStdSPSOverrides,
1162 h264_params_feedback.hasStdPPSOverrides);
1164 params_feedback.hasOverrides = 1;
1165 h264_params_feedback.hasStdPPSOverrides = 1;
1168 if (!params_feedback.hasOverrides)
1173 h264_params_feedback.hasStdSPSOverrides,
1174 h264_params_feedback.hasStdPPSOverrides);
1196 "type = %d.\n",
header->nal_unit_type);
1202 uint8_t *
data,
size_t *data_len,
1213 if (*data_len < au->data_size) {
1227 uint8_t *
data,
size_t *data_len)
1256 uint8_t *
data,
size_t *data_len)
1322 uint8_t *
data,
size_t *data_len)
1350 .filler_header_size = 6,
1361 int err, ref_l0, ref_l1;
1371 enc->
caps = (VkVideoEncodeH264CapabilitiesKHR) {
1372 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_CAPABILITIES_KHR,
1375 enc->
quality_props = (VkVideoEncodeH264QualityLevelPropertiesKHR) {
1376 .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_QUALITY_LEVEL_PROPERTIES_KHR,
1388 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_SEPARATE_COLOR_PLANE_FLAG_SET_BIT_KHR));
1390 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG_SET_BIT_KHR));
1392 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_SCALING_MATRIX_PRESENT_FLAG_SET_BIT_KHR));
1394 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_CHROMA_QP_INDEX_OFFSET_BIT_KHR));
1396 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_SECOND_CHROMA_QP_INDEX_OFFSET_BIT_KHR));
1398 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_PIC_INIT_QP_MINUS26_BIT_KHR));
1400 enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_WEIGHTED_PRED_FLAG_SET_BIT_KHR ?
1402 enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_WEIGHTED_BIPRED_IDC_EXPLICIT_BIT_KHR ?
1403 " bipred_explicit" :
"",
1404 enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_WEIGHTED_BIPRED_IDC_IMPLICIT_BIT_KHR ?
1405 " bipred_implicit" :
"");
1407 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_TRANSFORM_8X8_MODE_FLAG_SET_BIT_KHR));
1409 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_DIRECT_SPATIAL_MV_PRED_FLAG_UNSET_BIT_KHR));
1411 enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_ENTROPY_CODING_MODE_FLAG_UNSET_BIT_KHR ?
1413 enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_ENTROPY_CODING_MODE_FLAG_SET_BIT_KHR ?
1416 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_DIRECT_8X8_INFERENCE_FLAG_UNSET_BIT_KHR));
1418 !!(enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_CONSTRAINED_INTRA_PRED_FLAG_SET_BIT_KHR));
1420 enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_DEBLOCKING_FILTER_DISABLED_BIT_KHR ?
1421 " filter_disabling" :
"",
1422 enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_DEBLOCKING_FILTER_ENABLED_BIT_KHR ?
1423 " filter_enabling" :
"",
1424 enc->
caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H264_STD_DEBLOCKING_FILTER_PARTIAL_BIT_KHR ?
1425 " filter_partial" :
"");
1429 !!(enc->
caps.flags & VK_VIDEO_ENCODE_H264_CAPABILITY_HRD_COMPLIANCE_BIT_KHR));
1431 !!(enc->
caps.flags & VK_VIDEO_ENCODE_H264_CAPABILITY_PREDICTION_WEIGHT_TABLE_GENERATED_BIT_KHR));
1433 !!(enc->
caps.flags & VK_VIDEO_ENCODE_H264_CAPABILITY_ROW_UNALIGNED_SLICE_BIT_KHR));
1435 !!(enc->
caps.flags & VK_VIDEO_ENCODE_H264_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_KHR));
1437 !!(enc->
caps.flags & VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L0_LIST_BIT_KHR));
1439 !!(enc->
caps.flags & VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_KHR));
1441 !!(enc->
caps.flags & VK_VIDEO_ENCODE_H264_CAPABILITY_PER_PICTURE_TYPE_MIN_MAX_QP_BIT_KHR));
1443 !!(enc->
caps.flags & VK_VIDEO_ENCODE_H264_CAPABILITY_PER_SLICE_CONSTANT_QP_BIT_KHR));
1445 !!(enc->
caps.flags & VK_VIDEO_ENCODE_H264_CAPABILITY_GENERATE_PREFIX_NALU_BIT_KHR));
1449 enc->
caps.maxLevelIdc);
1451 enc->
caps.maxSliceCount);
1453 enc->
caps.maxPPictureL0ReferenceCount,
1454 enc->
caps.maxBPictureL0ReferenceCount);
1456 enc->
caps.maxL1ReferenceCount);
1458 enc->
caps.maxTemporalLayerCount);
1460 enc->
caps.expectDyadicTemporalLayerPattern);
1464 enc->
caps.prefersGopRemainingFrames);
1466 enc->
caps.requiresGopRemainingFrames);
1473 if (!enc->
caps.maxPPictureL0ReferenceCount &&
1474 !enc->
caps.maxBPictureL0ReferenceCount &&
1475 !enc->
caps.maxL1ReferenceCount) {
1478 ref_l0 = ref_l1 = 0;
1479 }
else if (!enc->
caps.maxPPictureL0ReferenceCount) {
1482 ref_l0 = enc->
caps.maxBPictureL0ReferenceCount;
1483 ref_l1 = enc->
caps.maxL1ReferenceCount;
1484 }
else if (!enc->
caps.maxBPictureL0ReferenceCount &&
1485 !enc->
caps.maxL1ReferenceCount) {
1488 ref_l0 = enc->
caps.maxPPictureL0ReferenceCount;
1492 ref_l0 =
FFMIN(enc->
caps.maxPPictureL0ReferenceCount,
1493 enc->
caps.maxBPictureL0ReferenceCount);
1494 ref_l1 = enc->
caps.maxL1ReferenceCount;
1514 "%s / Vulkan video %i.%i.%i / %s %i.%i.%i / %s",
1517 s->driver_props.driverName,
1518 CODEC_VER(
s->props.properties.driverVersion),
1519 s->props.properties.deviceName);
1527 "%s / Vulkan video %i.%i.%i / %s %i.%i.%i / %s",
1530 s->driver_props.driverName,
1531 CODEC_VER(
s->props.properties.driverVersion),
1532 s->props.properties.deviceName);
1564 #define OFFSET(x) offsetof(VulkanEncodeH264Context, x)
1565 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
1570 {
"profile",
"Set profile (profile_idc and constraint_set*_flag)",
1574 #define PROFILE(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
1575 { .i64 = value }, 0, 0, FLAGS, .unit = "profile"
1582 {
"level",
"Set level (level_idc)",
1586 #define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
1587 { .i64 = value }, 0, 0, FLAGS, .unit = "level"
1589 {
LEVEL(
"1.1", 11) },
1590 {
LEVEL(
"1.2", 12) },
1591 {
LEVEL(
"1.3", 13) },
1593 {
LEVEL(
"2.1", 21) },
1594 {
LEVEL(
"2.2", 22) },
1596 {
LEVEL(
"3.1", 31) },
1597 {
LEVEL(
"3.2", 32) },
1599 {
LEVEL(
"4.1", 41) },
1600 {
LEVEL(
"4.2", 42) },
1602 {
LEVEL(
"5.1", 51) },
1603 {
LEVEL(
"5.2", 52) },
1605 {
LEVEL(
"6.1", 61) },
1606 {
LEVEL(
"6.2", 62) },
1627 {
"i_qfactor",
"1" },
1628 {
"i_qoffset",
"0" },
1629 {
"b_qfactor",
"1" },
1630 {
"b_qoffset",
"0" },
1644 .
p.
name =
"h264_vulkan",
1665 .p.wrapper_name =
"vulkan",