23#include "config_components.h"
30#define DECODER_IS_SDR(codec_id) \
31 (((codec_id) == AV_CODEC_ID_FFV1) || \
32 ((codec_id) == AV_CODEC_ID_DPX) || \
33 ((codec_id) == AV_CODEC_ID_APV) || \
34 ((codec_id) == AV_CODEC_ID_PRORES_RAW) || \
35 ((codec_id) == AV_CODEC_ID_PRORES))
37#if CONFIG_H264_VULKAN_HWACCEL
40#if CONFIG_HEVC_VULKAN_HWACCEL
43#if CONFIG_VP9_VULKAN_HWACCEL
46#if CONFIG_AV1_VULKAN_HWACCEL
49#if CONFIG_FFV1_VULKAN_HWACCEL
52#if CONFIG_PRORES_RAW_VULKAN_HWACCEL
55#if CONFIG_PRORES_VULKAN_HWACCEL
58#if CONFIG_DPX_VULKAN_HWACCEL
61#if CONFIG_APV_VULKAN_HWACCEL
66#if CONFIG_H264_VULKAN_HWACCEL
69#if CONFIG_HEVC_VULKAN_HWACCEL
72#if CONFIG_VP9_VULKAN_HWACCEL
75#if CONFIG_AV1_VULKAN_HWACCEL
78#if CONFIG_FFV1_VULKAN_HWACCEL
81#if CONFIG_PRORES_RAW_VULKAN_HWACCEL
84#if CONFIG_PRORES_VULKAN_HWACCEL
87#if CONFIG_DPX_VULKAN_HWACCEL
90#if CONFIG_APV_VULKAN_HWACCEL
98#if CONFIG_VP9_VULKAN_HWACCEL
99 VkVideoDecodeVP9ProfileInfoKHR vp9_profile;
119 const VkVideoProfileListInfoKHR *profile_list;
121 VkStructureType profile_struct_type =
124#if CONFIG_VP9_VULKAN_HWACCEL
128 VK_STRUCTURE_TYPE_MAX_ENUM;
129 if (profile_struct_type == VK_STRUCTURE_TYPE_MAX_ENUM)
133 VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR);
137 for (
int i = 0;
i < profile_list->profileCount;
i++)
139 return &profile_list->pProfiles[
i];
174 vkpic->
view.
ref = VK_NULL_HANDLE;
175 vkpic->
view.
out = VK_NULL_HANDLE;
201 if (
ctx->common.layered_dpb && alloc_dpb) {
204 }
else if (alloc_dpb) {
214 if (!alloc_dpb || is_current) {
222 VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR |
223 (hwfc->
usage & VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR),
240 const uint8_t *
data,
size_t size,
int add_startcode,
241 uint32_t *nb_slices,
const uint32_t **
offsets)
246 static const uint8_t startcode_prefix[3] = { 0x0, 0x0, 0x1 };
247 const size_t startcode_len = add_startcode ?
sizeof(startcode_prefix) : 0;
248 const int nb = nb_slices ? *nb_slices : 0;
254 ctx->caps.minBitstreamBufferSizeAlignment;
255 new_size =
FFALIGN(new_size,
ctx->caps.minBitstreamBufferSizeAlignment);
256 if (new_size > INT32_MAX)
261 (nb + 1)*
sizeof(*slice_off));
271 if (!vkbuf || vkbuf->
size < new_size) {
276 size_t buf_size =
FFMAX(new_size, 1024*1024);
280 buf_size = 2ULL <<
av_log2(buf_size);
286 void *buf_pnext =
ctx->s.hwfc->create_pnext;
287 if (
ctx->s.hwfc->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT)
289 VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR);
292 (VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
293 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT) :
294 VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR;
297 buf_usage, buf_pnext, buf_size,
298 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
299 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
302 buf_usage, buf_pnext, buf_size,
303 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
319 memcpy(slices + vp->
slices_size, startcode_prefix, startcode_len);
334 VkVideoSessionParametersKHR *empty_session_params)
339 VkVideoDecodeH264SessionParametersCreateInfoKHR h264_params = {
340 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_CREATE_INFO_KHR,
342 VkVideoDecodeH265SessionParametersCreateInfoKHR h265_params = {
343 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_CREATE_INFO_KHR,
345 StdVideoAV1SequenceHeader av1_empty_seq = { 0 };
346 VkVideoDecodeAV1SessionParametersCreateInfoKHR av1_params = {
347 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_CREATE_INFO_KHR,
348 .pStdSequenceHeader = &av1_empty_seq,
350 VkVideoSessionParametersCreateInfoKHR session_params_create = {
351 .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
356 .videoSession =
ctx->common.session,
362 ret = vk->CreateVideoSessionParametersKHR(
s->hwctx->act_dev, &session_params_create,
363 s->hwctx->alloc, empty_session_params);
364 if (
ret != VK_SUCCESS) {
365 av_log(avctx,
AV_LOG_ERROR,
"Unable to create empty Vulkan video session parameters: %s!\n",
379 VkVideoBeginCodingInfoKHR decode_start = {
380 .sType = VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR,
381 .videoSession =
ctx->common.session,
386 &decode_start.videoSessionParameters);
391 VkVideoCodingControlInfoKHR decode_ctrl = {
392 .sType = VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR,
393 .flags = VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR,
396 .sType = VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR,
404 vk->CmdBeginVideoCodingKHR(exec->
buf, &decode_start);
405 vk->CmdControlVideoCodingKHR(exec->
buf, &decode_ctrl);
410 if (decode_start.videoSessionParameters) {
415 vk->DestroyVideoSessionParametersKHR(
s->hwctx->act_dev,
416 decode_start.videoSessionParameters,
433 VkCommandBuffer cmd_buf;
444 const int layered_dpb =
ctx->common.layered_dpb;
446 VkVideoBeginCodingInfoKHR decode_start = {
447 .sType = VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR,
448 .videoSession =
ctx->common.session,
451 .referenceSlotCount = vp->
decode_info.referenceSlotCount,
452 .pReferenceSlots = vp->
decode_info.pReferenceSlots,
455 .sType = VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR,
458 VkImageMemoryBarrier2 img_bar[38];
462 ctx->caps.minBitstreamBufferSizeAlignment);
470 for (
int i = 0;
i < decode_start.referenceSlotCount;
i++)
471 cur_bound |= decode_start.pReferenceSlots[
i].slotIndex == vp->
ref_slot.slotIndex;
473 VkVideoReferenceSlotInfoKHR *cur_vk_ref;
474 cur_vk_ref = (
void *)&decode_start.pReferenceSlots[decode_start.referenceSlotCount];
476 cur_vk_ref[0].slotIndex = -1;
477 decode_start.referenceSlotCount++;
483 if (!(sd_buf->
flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) {
484 VkMappedMemoryRange flush_buf = {
485 .sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
486 .memory = sd_buf->
mem,
489 ctx->s.props.properties.limits.nonCoherentAtomSize),
492 ret = vk->FlushMappedMemoryRanges(
ctx->s.hwctx->act_dev, 1, &flush_buf);
493 if (
ret != VK_SUCCESS) {
518 VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
519 VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR);
530 img_bar[nb_img_bar] = (VkImageMemoryBarrier2) {
531 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2,
533 .srcStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
534 .dstStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
535 .srcAccessMask = VK_ACCESS_2_NONE,
536 .dstAccessMask = VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
537 .oldLayout = vkf->
layout[0],
538 .newLayout = (layered_dpb || vp->
dpb_img) ?
539 VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR :
540 VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR,
542 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
543 .image = vkf->
img[0],
544 .subresourceRange = (VkImageSubresourceRange) {
551 &img_bar[nb_img_bar], &nb_img_bar);
557 if (di->
layout != VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR) {
558 img_bar[nb_img_bar] = (VkImageMemoryBarrier2) {
559 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2,
560 .srcStageMask = VK_PIPELINE_STAGE_2_NONE,
561 .dstStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
562 .srcAccessMask = VK_ACCESS_2_NONE,
563 .dstAccessMask = VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR |
564 VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
566 .newLayout = VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR,
567 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
568 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
570 .subresourceRange = (VkImageSubresourceRange) {
571 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
577 di->
layout = VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR;
589 VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
590 VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR);
604 img_bar[nb_img_bar] = (VkImageMemoryBarrier2) {
605 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2,
607 .srcStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
608 .dstStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
609 .srcAccessMask = VK_ACCESS_2_NONE,
610 .dstAccessMask = VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR |
611 VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
612 .oldLayout = rvkf->
layout[0],
613 .newLayout = VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR,
615 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
616 .image = rvkf->
img[0],
617 .subresourceRange = (VkImageSubresourceRange) {
624 &img_bar[nb_img_bar], &nb_img_bar);
633 VkMemoryBarrier2 mem_bar = {
634 .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER_2,
635 .srcStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
636 .srcAccessMask = VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
637 .dstStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
638 .dstAccessMask = VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR |
639 VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
643 vk->CmdPipelineBarrier2(cmd_buf, &(VkDependencyInfo) {
644 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
645 .dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT,
646 .pMemoryBarriers = &mem_bar,
647 .memoryBarrierCount =
ctx->common.dpb ? 1 : 0,
648 .pImageMemoryBarriers = img_bar,
649 .imageMemoryBarrierCount = nb_img_bar,
653 vk->CmdBeginVideoCodingKHR(cmd_buf, &decode_start);
655 vk->CmdEndVideoCodingKHR(cmd_buf, &
decode_end);
687 if (
ctx->sd_ctx_free)
716 if (vk_desc->
queue_flags & VK_QUEUE_VIDEO_DECODE_BIT_KHR) {
719 VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME);
739 VkVideoCapabilitiesKHR *caps,
740 VkVideoDecodeCapabilitiesKHR *dec_caps,
743 VkVideoDecodeUsageInfoKHR *
usage = &prof->
usage;
745 VkVideoProfileListInfoKHR *profile_list = &prof->
profile_list;
747 VkVideoDecodeH264ProfileInfoKHR *h264_profile = &prof->
h264_profile;
748 VkVideoDecodeH265ProfileInfoKHR *h265_profile = &prof->
h265_profile;
749#if CONFIG_VP9_VULKAN_HWACCEL
750 VkVideoDecodeVP9ProfileInfoKHR *vp9_profile = &prof->vp9_profile;
752 VkVideoDecodeAV1ProfileInfoKHR *av1_profile = &prof->
av1_profile;
759 usage->pNext = h264_profile;
760 h264_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_INFO_KHR;
767 h264_profile->pictureLayout =
768 VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR;
770 if (
h &&
h->ps.sps && !
h->ps.sps->frame_mbs_only_flag)
771 h264_profile->pictureLayout =
772 VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR;
774 usage->pNext = h265_profile;
775 h265_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_KHR;
776 h265_profile->stdProfileIdc = cur_profile;
777#if CONFIG_VP9_VULKAN_HWACCEL
779 usage->pNext = vp9_profile;
780 vp9_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_VP9_PROFILE_INFO_KHR;
781 vp9_profile->stdProfile = cur_profile;
784 usage->pNext = av1_profile;
785 av1_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_KHR;
786 av1_profile->stdProfile = cur_profile;
789 usage->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_USAGE_INFO_KHR;
790 usage->videoUsageHints = VK_VIDEO_DECODE_USAGE_DEFAULT_KHR;
792 profile->sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_INFO_KHR;
801 if (
profile->chromaSubsampling == VK_VIDEO_CHROMA_SUBSAMPLING_INVALID_KHR ||
802 profile->lumaBitDepth == VK_VIDEO_COMPONENT_BIT_DEPTH_INVALID_KHR)
803 return VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR;
805 profile_list->sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR;
806 profile_list->profileCount = 1;
807 profile_list->pProfiles =
profile;
810 caps->sType = VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR;
811 caps->pNext = dec_caps;
812 dec_caps->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_CAPABILITIES_KHR;
815 return vk->GetPhysicalDeviceVideoCapabilitiesKHR(hwctx->
phys_dev,
profile,
821 return ret == VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR ||
822 ret == VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
836 int max_level, base_profile, cur_profile;
849 VkVideoCapabilitiesKHR *caps = &
ctx->caps;
850 VkVideoDecodeCapabilitiesKHR *dec_caps = &
ctx->dec_caps;
852 VkVideoDecodeH264CapabilitiesKHR h264_caps = {
853 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_KHR,
855 VkVideoDecodeH265CapabilitiesKHR h265_caps = {
856 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_KHR,
858#if CONFIG_VP9_VULKAN_HWACCEL
859 VkVideoDecodeVP9CapabilitiesKHR vp9_caps = {
860 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_VP9_CAPABILITIES_KHR,
863 VkVideoDecodeAV1CapabilitiesKHR av1_caps = {
864 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_CAPABILITIES_KHR,
867 VkPhysicalDeviceVideoFormatInfoKHR fmt_info = {
868 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_FORMAT_INFO_KHR,
871 VkVideoFormatPropertiesKHR *ret_info;
872 uint32_t nb_out_fmts = 0;
883#if CONFIG_VP9_VULKAN_HWACCEL
890 dec_caps->pNext = &h264_caps;
892 dec_caps->pNext = &h265_caps;
893#if CONFIG_VP9_VULKAN_HWACCEL
895 dec_caps->pNext = &vp9_caps;
898 dec_caps->pNext = &av1_caps;
912 "attempting again without filmGrainSupport\n",
917 dec_caps, cur_profile) != VK_SUCCESS) {
919 }
else if (
s->raw_seq->film_grain_params_present) {
921 "grain; set export_side_data to film_grain to export it as "
922 "side data instead\n");
931 avctx->
profile != base_profile) {
933 "again with profile %s\n",
937 cur_profile = base_profile;
939 dec_caps, cur_profile);
944 "%s profile \"%s\" not supported!\n",
948 }
else if (
ret == VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR) {
951 "pictureLayout %#x not supported!\n",
955 "pictureLayout not supported!\n");
957 }
else if (
ret == VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR) {
959 "format (%s) not supported!\n",
962 }
else if (
ret == VK_ERROR_FEATURE_NOT_PRESENT ||
963 ret == VK_ERROR_FORMAT_NOT_SUPPORTED) {
965 }
else if (
ret != VK_SUCCESS) {
971#if CONFIG_VP9_VULKAN_HWACCEL
981 max_level, avctx->
level);
983 caps->minCodedExtent.width, caps->maxCodedExtent.width);
985 caps->minCodedExtent.height, caps->maxCodedExtent.height);
987 caps->pictureAccessGranularity.width);
989 caps->pictureAccessGranularity.height);
991 caps->minBitstreamBufferOffsetAlignment);
993 caps->minBitstreamBufferSizeAlignment);
997 caps->maxActiveReferencePictures);
999 caps->stdHeaderVersion.extensionName,
1001 av_log(avctx,
AV_LOG_VERBOSE,
" Codec header version: %i.%i.%i (driver), %i.%i.%i (compiled)\n",
1002 CODEC_VER(caps->stdHeaderVersion.specVersion),
1005 dec_caps->flags ?
"" :
1007 dec_caps->flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR ?
1008 " reuse_dst_dpb" :
"",
1009 dec_caps->flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR ?
1010 " dedicated_dpb" :
"");
1014 caps->flags & VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR ?
1016 caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR ?
1017 " separate_references" :
"");
1020 if (avctx->
coded_width < caps->minCodedExtent.width ||
1022 avctx->
coded_width > caps->maxCodedExtent.width ||
1027 avctx->
level > max_level)
1031 if (!(dec_caps->flags & (VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR |
1032 VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR))) {
1034 "VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR nor "
1035 "VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR are set!\n");
1037 }
else if ((dec_caps->flags & (VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR |
1038 VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR)) ==
1039 VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR &&
1040 !(caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR)) {
1042 "COINCIDE-only decode without SEPARATE_REFERENCE_IMAGES "
1043 "(layered DPB capability); continuing\n");
1046 dec->
dedicated_dpb = !!(dec_caps->flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR);
1048 !(caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR);
1051 fmt_info.imageUsage = VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
1053 fmt_info.imageUsage = VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR |
1054 VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR |
1055 VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
1056 VK_IMAGE_USAGE_SAMPLED_BIT;
1060 fmt_info.imageUsage |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR;
1064 ret = vk->GetPhysicalDeviceVideoFormatPropertiesKHR(hwctx->
phys_dev,
1066 &nb_out_fmts,
NULL);
1067 if (
ret == VK_ERROR_FORMAT_NOT_SUPPORTED ||
1068 (!nb_out_fmts &&
ret == VK_SUCCESS)) {
1070 }
else if (
ret != VK_SUCCESS) {
1076 ret_info =
av_mallocz(
sizeof(*ret_info)*nb_out_fmts);
1080 for (
int i = 0;
i < nb_out_fmts;
i++)
1081 ret_info[
i].sType = VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR;
1083 ret = vk->GetPhysicalDeviceVideoFormatPropertiesKHR(hwctx->
phys_dev,
1085 &nb_out_fmts, ret_info);
1086 if (
ret == VK_ERROR_FORMAT_NOT_SUPPORTED ||
1087 (!nb_out_fmts &&
ret == VK_SUCCESS)) {
1090 }
else if (
ret != VK_SUCCESS) {
1099 *vk_fmt = best_vkfmt = VK_FORMAT_UNDEFINED;
1102 av_log(avctx,
AV_LOG_DEBUG,
"Choosing best pixel format for decoding from %i:\n", nb_out_fmts);
1103 for (
int i = 0;
i < nb_out_fmts;
i++) {
1111 if (
tmp == best_format)
1112 best_vkfmt = ret_info[
i].format;
1122 av_log(avctx,
AV_LOG_ERROR,
"No valid/compatible pixel format found for decoding!\n");
1130 *vk_fmt = best_vkfmt;
1144 int err, dedicated_dpb;
1167 prof, &dedicated_dpb);
1181 hwfc->
format[0] = VK_FORMAT_UNDEFINED;
1206 hwfc->
format[3] = VK_FORMAT_R16_UNORM;
1212 hwfc->
format[0] = VK_FORMAT_R16_UNORM;
1213 hwfc->
format[1] = VK_FORMAT_R16_UNORM;
1214 hwfc->
format[2] = VK_FORMAT_R16_UNORM;
1221 if (hwfc->
tiling != VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT)
1222 hwfc->
tiling = VK_IMAGE_TILING_OPTIMAL;
1224 hwfc->
usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
1225 VK_IMAGE_USAGE_STORAGE_BIT |
1226 VK_IMAGE_USAGE_SAMPLED_BIT;
1231 hwfc->
usage |= VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR;
1233 hwfc->
usage |= VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
1238 hwfc->
usage |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR;
1248 VkVideoSessionParametersKHR *par =
obj;
1249 vk->DestroyVideoSessionParametersKHR(
ctx->s.hwctx->act_dev, *par,
1250 ctx->s.hwctx->alloc);
1254 const VkVideoSessionParametersCreateInfoKHR *session_params_create)
1256 VkVideoSessionParametersKHR *par;
1265 ret = vk->CreateVideoSessionParametersKHR(
ctx->s.hwctx->act_dev, session_params_create,
1266 ctx->s.hwctx->alloc, par);
1267 if (
ret != VK_SUCCESS) {
1268 av_log(logctx,
AV_LOG_ERROR,
"Unable to create Vulkan video session parameters: %s!\n",
1270 *par = VK_NULL_HANDLE;
1297 const VkVideoProfileInfoKHR *
profile;
1300 VkVideoSessionCreateInfoKHR session_create = {
1301 .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_CREATE_INFO_KHR,
1325 const VkVideoDecodeAV1ProfileInfoKHR *av1_profile =
1327 VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_KHR);
1328 dec->
external_fg = !av1_profile->filmGrainSupport;
1340 session_create.queueFamilyIndex =
ctx->qf->idx;
1341 session_create.maxCodedExtent =
ctx->caps.maxCodedExtent;
1342 session_create.maxDpbSlots =
ctx->caps.maxDpbSlots;
1343 session_create.maxActiveReferencePictures =
ctx->caps.maxActiveReferencePictures;
1344 session_create.pictureFormat =
s->hwfc->format[0];
1345 session_create.referencePictureFormat = session_create.pictureFormat;
1346 session_create.pStdHeaderVersion = &vk_desc->
ext_props;
1347 session_create.pVideoProfile =
profile;
1348#ifdef VK_KHR_video_maintenance2
1350 session_create.flags = VK_VIDEO_SESSION_CREATE_INLINE_SESSION_PARAMETERS_BIT_KHR;
1362 async_depth, 0, 0, 0,
profile);
1374 VkImageTiling tiling = VK_IMAGE_TILING_OPTIMAL;
1376 VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR);
1380 VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT);
1381 if (drm_create_pnext &&
1382 !(
ctx->dec_caps.flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR)) {
1383 create_pnext = drm_create_pnext;
1384 tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
1389 VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR,
1390 tiling, create_pnext,
1391 s->frames->width,
s->frames->height,
1392 ctx->common.layered_dpb ?
1393 ctx->caps.maxDpbSlots : 1);
1397 if (
ctx->common.layered_dpb) {
1400 VkImageMemoryBarrier2 img_bar;
1403 if (!
ctx->common.layered_img) {
1408 ctx->common.layered_view =
ctx->common.layered_img->view;
1409 ctx->common.layered_aspect =
ctx->common.layered_img->aspect;
1418 img_bar = (VkImageMemoryBarrier2) {
1419 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2,
1420 .srcStageMask = VK_PIPELINE_STAGE_2_NONE,
1421 .dstStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
1422 .srcAccessMask = VK_ACCESS_2_NONE,
1423 .dstAccessMask = VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR |
1424 VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
1425 .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
1426 .newLayout = VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR,
1427 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
1428 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
1429 .image =
ctx->common.layered_img->img,
1430 .subresourceRange = (VkImageSubresourceRange) {
1431 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
1432 .layerCount = VK_REMAINING_ARRAY_LAYERS,
1436 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
1437 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
1438 .pImageMemoryBarriers = &img_bar,
1439 .imageMemoryBarrierCount = 1,
1446 ctx->common.layered_img->layout = VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR;
1460 const VkPhysicalDeviceDriverProperties *driver_props;
1462 if (driver_props->driverID == VK_DRIVER_ID_NVIDIA_PROPRIETARY &&
1463 driver_props->conformanceVersion.major == 1 &&
1464 driver_props->conformanceVersion.minor == 3 &&
1465 driver_props->conformanceVersion.subminor == 8 &&
1466 driver_props->conformanceVersion.patch < 3)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static const char *const format[]
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define i(width, name, range_min, range_max)
int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx, enum AVHWDeviceType dev_type)
Make sure avctx.hw_frames_ctx is set.
#define AV_PROFILE_H264_CONSTRAINED
#define AV_PROFILE_HEVC_MAIN
#define AV_PROFILE_H264_INTRA
#define AV_PROFILE_H264_CONSTRAINED_BASELINE
static enum AVPixelFormat pix_fmt
const char * avcodec_profile_name(enum AVCodecID codec_id, int profile)
Return a name for the specified profile, if available.
#define AV_CODEC_EXPORT_DATA_FILM_GRAIN
Decoding only.
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
#define AV_HWACCEL_FLAG_IGNORE_LEVEL
Hardware acceleration should be used for decoding even if the codec level used is unknown or higher t...
#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH
Hardware acceleration should still be attempted for decoding when the codec profile does not match th...
#define AVERROR_EXTERNAL
Generic error in an external library.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
H.264 / AVC / MPEG-4 part10 codec.
static const int offsets[]
static const FFHWAccel * ffhwaccel(const AVHWAccel *codec)
#define HWACCEL_CAP_THREAD_SAFE
@ AV_HWDEVICE_TYPE_VULKAN
static av_cold int decode_end(AVCodecContext *avctx)
Macro definitions for various function/variable attributes.
void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool)
int ff_vk_exec_pool_init(FFVulkanContext *s, AVVulkanDeviceQueueFamily *qf, FFVkExecPool *pool, int nb_contexts, int nb_queries, VkQueryType query_type, int query_64bit, const void *query_create_pnext)
Allocates/frees an execution pool.
void ff_vk_exec_wait(FFVulkanContext *s, FFVkExecContext *e)
void ff_vk_uninit(FFVulkanContext *s)
Frees main context.
const char * ff_vk_ret2str(VkResult res)
Converts Vulkan return values to strings.
int ff_vk_init(FFVulkanContext *s, void *log_parent, AVBufferRef *device_ref, AVBufferRef *frames_ref)
Initializes the AVClass, in case this context is not used as the main user's context.
int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e)
Start/submit/wait an execution.
FFVkImageViews * ff_vk_imageviews_alloc(FFVulkanContext *s, int nb_views)
Allocate a reference-counted set of image views, zero-initialized for the caller to create.
void ff_vk_exec_update_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f, VkImageMemoryBarrier2 *bar, uint32_t *nb_img_bar)
FFVkExecContext * ff_vk_exec_get(FFVulkanContext *s, FFVkExecPool *pool)
Retrieve an execution pool.
int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e)
void ff_vk_exec_move_dep_refstruct(FFVulkanContext *s, FFVkExecContext *e, void *obj)
AVVulkanDeviceQueueFamily * ff_vk_qf_find(FFVulkanContext *s, VkQueueFlagBits dev_family, VkVideoCodecOperationFlagBitsKHR vid_ops)
Chooses an appropriate QF.
void ff_vk_exec_add_dep_refstruct(FFVulkanContext *s, FFVkExecContext *e, void *obj)
Execution dependency management.
int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVRefStructPool **buf_pool, FFVkBuffer **buf, VkBufferUsageFlags usage, void *create_pNext, size_t size, VkMemoryPropertyFlagBits mem_props)
Initialize a pool and create AVBufferRefs containing FFVkBuffer.
void ff_vk_exec_discard(FFVulkanContext *s, FFVkExecContext *e)
int ff_vk_exec_add_dep_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f, VkPipelineStageFlagBits2 wait_stage, VkPipelineStageFlagBits2 signal_stage)
Memory handling functions.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
Compute what kind of losses will occur when converting from one specific pixel format to another.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_RGBA64
#define AV_PIX_FMT_YUVA422P10
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
#define AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_X2BGR10
#define AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUV444P10
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
void av_refstruct_replace(void *dstp, const void *src)
Ensure *dstp refers to the same object as src.
void * av_refstruct_pool_get(AVRefStructPool *pool)
Get an object from the pool, reusing an old one from the pool when available.
static void av_refstruct_pool_uninit(AVRefStructPool **poolp)
Mark the pool as being available for freeing.
static void * av_refstruct_alloc_ext(size_t size, unsigned flags, void *opaque, void(*free_cb)(AVRefStructOpaque opaque, void *obj))
A wrapper around av_refstruct_alloc_ext_c() for the common case of a non-const qualified opaque.
#define FF_ARRAY_ELEMS(a)
A reference to a data buffer.
uint8_t * data
The data buffer.
main external API structure.
int hwaccel_flags
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active).
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
int level
Encoding level descriptor.
int export_side_data
Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of metadata exported in frame,...
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
int coded_width
Bitstream width / height, may be different from width/height e.g.
struct AVCodecInternal * internal
Private context used for internal data.
void * hwaccel_priv_data
hwaccel-specific private data
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
This struct describes a set or pool of "hardware" frames (i.e.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
void * user_opaque
Arbitrary user data, to be used e.g.
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int width
The allocated dimensions of the frames in this pool.
void(* free)(struct AVHWFramesContext *ctx)
This field may be set by the caller before calling av_hwframe_ctx_init().
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
VkImageLayout layout[AV_NUM_DATA_POINTERS]
uint32_t queue_family[AV_NUM_DATA_POINTERS]
Queue family of the images.
VkImage img[AV_NUM_DATA_POINTERS]
Vulkan images to which the memory is bound to.
Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
VkPhysicalDevice phys_dev
Physical device.
const char *const * enabled_dev_extensions
Enabled device extensions.
int nb_enabled_dev_extensions
Allocated as AVHWFramesContext.hwctx, used to set pool-specific options.
void * create_pnext
Extension data for image creation.
VkImageTiling tiling
Controls the tiling of allocated frames.
VkImageUsageFlagBits usage
Defines extra usage of output frames.
VkFormat format[AV_NUM_DATA_POINTERS]
Vulkan format for each image.
int caps_internal
Internal hwaccel capabilities.
VkMemoryPropertyFlagBits flags
VkImageView views[AV_NUM_DATA_POINTERS]
VkImageAspectFlags aspect
VkPhysicalDeviceDriverProperties driver_props
VkVideoSessionParametersKHR * session_params
FFVulkanDecodeShared * shared_ctx
struct HEVCHeaderSet * hevc_headers
unsigned int slice_off_max
FFVulkanExtensions decode_extension
VkVideoCodecOperationFlagBitsKHR decode_op
VkQueueFlagBits queue_flags
VkExtensionProperties ext_props
struct FFVulkanDecodePicture::@321376256110110067000314232201030232256240036361 view
VkVideoReferenceSlotInfoKHR ref_slot
VkImageAspectFlags aspect_ref
VkVideoDecodeInfoKHR decode_info
FFVkVideoDPBImage * dpb_img
PFN_vkInvalidateMappedMemoryRanges invalidate_memory_ranges
VkImageAspectFlags aspect
FFVkImageViews * out_views
VkVideoDecodeAV1ProfileInfoKHR av1_profile
VkVideoProfileListInfoKHR profile_list
VkVideoDecodeUsageInfoKHR usage
VkVideoDecodeH265ProfileInfoKHR h265_profile
VkVideoDecodeH264ProfileInfoKHR h264_profile
VkVideoProfileInfoKHR profile
RefStruct is an API for creating reference-counted objects with minimal overhead.
#define FF_VK_DEFAULT_EXEC_CONTEXTS
static const void * ff_vk_find_struct(const void *chain, VkStructureType stype)
const FFVulkanDecodeDescriptor ff_vk_dec_apv_desc
const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc
int ff_vk_decode_frame(AVCodecContext *avctx, AVFrame *pic, FFVulkanDecodePicture *vp, AVFrame *rpic[], FFVulkanDecodePicture *rvkp[])
Decode a frame.
int ff_vk_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
Synchronize the contexts between 2 threads.
static const VkVideoProfileInfoKHR * get_video_profile(FFVulkanDecodeShared *ctx, enum AVCodecID codec_id)
int ff_vk_decode_init(AVCodecContext *avctx)
Initialize decoder.
int ff_vk_decode_create_params(VkVideoSessionParametersKHR **par_ref, void *logctx, FFVulkanDecodeShared *ctx, const VkVideoSessionParametersCreateInfoKHR *session_params_create)
Create VkVideoSessionParametersKHR wrapped in an AVBufferRef.
static void free_common(AVRefStructOpaque unused, void *obj)
int ff_vk_params_invalidate(AVCodecContext *avctx, int t, const uint8_t *b, uint32_t s)
Removes current session parameters to recreate them.
static int profile_unsupported(VkResult ret)
static const FFVulkanDecodeDescriptor * dec_descs[]
int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Initialize hw_frames_ctx with the parameters needed to decode the stream using the parameters from av...
int ff_vk_decode_add_slice(AVCodecContext *avctx, FFVulkanDecodePicture *vp, const uint8_t *data, size_t size, int add_startcode, uint32_t *nb_slices, const uint32_t **offsets)
Add slice data to frame.
#define DECODER_IS_SDR(codec_id)
static int create_empty_session_parameters(AVCodecContext *avctx, FFVulkanDecodeShared *ctx, VkVideoSessionParametersKHR *empty_session_params)
static int vulkan_decode_bootstrap(AVCodecContext *avctx, AVBufferRef *frames_ref)
static int decode_reset(AVCodecContext *avctx, FFVulkanDecodeShared *ctx)
static VkResult vulkan_setup_profile(AVCodecContext *avctx, FFVulkanDecodeProfileData *prof, AVVulkanDeviceContext *hwctx, FFVulkanFunctions *vk, const FFVulkanDecodeDescriptor *vk_desc, VkVideoCapabilitiesKHR *caps, VkVideoDecodeCapabilitiesKHR *dec_caps, int cur_profile)
void ff_vk_decode_free_frame(AVHWDeviceContext *dev_ctx, FFVulkanDecodePicture *vp)
Free a frame and its state.
static const FFVulkanDecodeDescriptor * get_codecdesc(enum AVCodecID codec_id)
static void init_frame(FFVulkanDecodeContext *dec, FFVulkanDecodePicture *vkpic)
static void free_profile_data(AVHWFramesContext *hwfc)
int ff_vk_decode_uninit(AVCodecContext *avctx)
Free decoder.
static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ref, enum AVPixelFormat *pix_fmt, VkFormat *vk_fmt, FFVulkanDecodeProfileData *prof, int *dpb_dedicate)
static void vk_decode_free_params(AVRefStructOpaque opaque, void *obj)
int ff_vk_decode_prepare_frame(FFVulkanDecodeContext *dec, AVFrame *pic, FFVulkanDecodePicture *vkpic, int is_current, int alloc_dpb)
Prepare a frame, creates the image view, and sets up the dpb fields.
static const char * profile_name(enum AVCodecID codec_id, int profile)
const FFVulkanDecodeDescriptor ff_vk_dec_dpx_desc
const FFVulkanDecodeDescriptor ff_vk_dec_ffv1_desc
#define FF_VK_EXT_VIDEO_MAINTENANCE_1
#define FF_VK_EXT_VIDEO_ENCODE_QUEUE
#define FF_VK_EXT_VIDEO_DECODE_QUEUE
#define FF_VK_EXT_VIDEO_MAINTENANCE_2
const FFVulkanDecodeDescriptor ff_vk_dec_h264_desc
const FFVulkanDecodeDescriptor ff_vk_dec_hevc_desc
static uint64_t ff_vk_extensions_to_mask(const char *const *extensions, int nb_extensions)
static int ff_vk_load_functions(AVHWDeviceContext *ctx, FFVulkanFunctions *vk, uint64_t extensions_mask, int has_inst, int has_dev)
Function loader.
const FFVulkanDecodeDescriptor ff_vk_dec_prores_desc
const FFVulkanDecodeDescriptor ff_vk_dec_prores_raw_desc
VkVideoComponentBitDepthFlagBitsKHR ff_vk_depth_from_av_depth(int depth)
Get Vulkan's bit depth from an [8:12] integer.
VkVideoChromaSubsamplingFlagBitsKHR ff_vk_subsampling_from_av_desc(const AVPixFmtDescriptor *desc)
Get Vulkan's chroma subsampling from a pixfmt descriptor.
int ff_vk_h265_level_to_av(StdVideoH265LevelIdc level)
int ff_vk_create_view(FFVulkanContext *s, VkImageView *view, VkImageAspectFlags *aspect, VkImage img, VkFormat vkf, VkImageUsageFlags usage, int layered)
Creates image views for video frames.
int ff_vk_h264_level_to_av(StdVideoH264LevelIdc level)
Convert level from Vulkan to AV.
av_cold void ff_vk_video_common_uninit(FFVulkanContext *s, FFVkVideoCommon *common)
Free video session and required resources.
av_cold int ff_vk_video_dpb_init(FFVulkanContext *s, FFVkVideoCommon *common, VkFormat format, VkImageUsageFlags usage, VkImageTiling tiling, void *create_pnext, int width, int height, int nb_layers)
Initialize the internal DPB image pool.
enum AVPixelFormat ff_vk_pix_fmt_from_vkfmt(VkFormat vkf)
Get pixfmt from a Vulkan format.
av_cold int ff_vk_video_common_init(AVCodecContext *avctx, FFVulkanContext *s, FFVkVideoCommon *common, VkVideoSessionCreateInfoKHR *session_create)
Initialize video session, allocating and binding necessary memory.
const FFVulkanDecodeDescriptor ff_vk_dec_vp9_desc
static int ref_frame(VVCFrame *dst, const VVCFrame *src)