23#include "config_components.h"
29#define DECODER_IS_SDR(codec_id) \
30 (((codec_id) == AV_CODEC_ID_FFV1) || \
31 ((codec_id) == AV_CODEC_ID_DPX) || \
32 ((codec_id) == AV_CODEC_ID_APV) || \
33 ((codec_id) == AV_CODEC_ID_PRORES_RAW) || \
34 ((codec_id) == AV_CODEC_ID_PRORES))
36#if CONFIG_H264_VULKAN_HWACCEL
39#if CONFIG_HEVC_VULKAN_HWACCEL
42#if CONFIG_VP9_VULKAN_HWACCEL
45#if CONFIG_AV1_VULKAN_HWACCEL
48#if CONFIG_FFV1_VULKAN_HWACCEL
51#if CONFIG_PRORES_RAW_VULKAN_HWACCEL
54#if CONFIG_PRORES_VULKAN_HWACCEL
57#if CONFIG_DPX_VULKAN_HWACCEL
60#if CONFIG_APV_VULKAN_HWACCEL
65#if CONFIG_H264_VULKAN_HWACCEL
68#if CONFIG_HEVC_VULKAN_HWACCEL
71#if CONFIG_VP9_VULKAN_HWACCEL
74#if CONFIG_AV1_VULKAN_HWACCEL
77#if CONFIG_FFV1_VULKAN_HWACCEL
80#if CONFIG_PRORES_RAW_VULKAN_HWACCEL
83#if CONFIG_PRORES_VULKAN_HWACCEL
86#if CONFIG_DPX_VULKAN_HWACCEL
89#if CONFIG_APV_VULKAN_HWACCEL
97#if CONFIG_VP9_VULKAN_HWACCEL
98 VkVideoDecodeVP9ProfileInfoKHR vp9_profile;
118 const VkVideoProfileListInfoKHR *profile_list;
120 VkStructureType profile_struct_type =
123#if CONFIG_VP9_VULKAN_HWACCEL
127 VK_STRUCTURE_TYPE_MAX_ENUM;
128 if (profile_struct_type == VK_STRUCTURE_TYPE_MAX_ENUM)
132 VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR);
136 for (
int i = 0;
i < profile_list->profileCount;
i++)
138 return &profile_list->pProfiles[
i];
173 vkpic->
view.
ref = VK_NULL_HANDLE;
174 vkpic->
view.
out = VK_NULL_HANDLE;
200 if (
ctx->common.layered_dpb && alloc_dpb) {
203 }
else if (alloc_dpb) {
213 if (!alloc_dpb || is_current) {
221 VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR |
222 (hwfc->
usage & VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR),
239 const uint8_t *
data,
size_t size,
int add_startcode,
240 uint32_t *nb_slices,
const uint32_t **
offsets)
245 static const uint8_t startcode_prefix[3] = { 0x0, 0x0, 0x1 };
246 const size_t startcode_len = add_startcode ?
sizeof(startcode_prefix) : 0;
247 const int nb = nb_slices ? *nb_slices : 0;
253 ctx->caps.minBitstreamBufferSizeAlignment;
254 new_size =
FFALIGN(new_size,
ctx->caps.minBitstreamBufferSizeAlignment);
258 (nb + 1)*
sizeof(slice_off));
268 if (!vkbuf || vkbuf->
size < new_size) {
273 size_t buf_size =
FFMAX(new_size, 1024*1024);
277 buf_size = 2 <<
av_log2(buf_size);
283 void *buf_pnext =
ctx->s.hwfc->create_pnext;
284 if (
ctx->s.hwfc->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT)
286 VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR);
289 (VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
290 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT) :
291 VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR;
294 buf_usage, buf_pnext, buf_size,
295 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
296 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
299 buf_usage, buf_pnext, buf_size,
300 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
316 memcpy(slices + vp->
slices_size, startcode_prefix, startcode_len);
331 VkVideoSessionParametersKHR *empty_session_params)
336 VkVideoDecodeH264SessionParametersCreateInfoKHR h264_params = {
337 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_CREATE_INFO_KHR,
339 VkVideoDecodeH265SessionParametersCreateInfoKHR h265_params = {
340 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_CREATE_INFO_KHR,
342 StdVideoAV1SequenceHeader av1_empty_seq = { 0 };
343 VkVideoDecodeAV1SessionParametersCreateInfoKHR av1_params = {
344 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_CREATE_INFO_KHR,
345 .pStdSequenceHeader = &av1_empty_seq,
347 VkVideoSessionParametersCreateInfoKHR session_params_create = {
348 .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
353 .videoSession =
ctx->common.session,
359 ret = vk->CreateVideoSessionParametersKHR(
s->hwctx->act_dev, &session_params_create,
360 s->hwctx->alloc, empty_session_params);
361 if (ret != VK_SUCCESS) {
362 av_log(avctx,
AV_LOG_ERROR,
"Unable to create empty Vulkan video session parameters: %s!\n",
376 VkVideoBeginCodingInfoKHR decode_start = {
377 .sType = VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR,
378 .videoSession =
ctx->common.session,
383 &decode_start.videoSessionParameters);
388 VkVideoCodingControlInfoKHR decode_ctrl = {
389 .sType = VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR,
390 .flags = VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR,
393 .sType = VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR,
401 vk->CmdBeginVideoCodingKHR(exec->
buf, &decode_start);
402 vk->CmdControlVideoCodingKHR(exec->
buf, &decode_ctrl);
407 if (decode_start.videoSessionParameters) {
412 vk->DestroyVideoSessionParametersKHR(
s->hwctx->act_dev,
413 decode_start.videoSessionParameters,
430 VkCommandBuffer cmd_buf;
441 const int layered_dpb =
ctx->common.layered_dpb;
443 VkVideoBeginCodingInfoKHR decode_start = {
444 .sType = VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR,
445 .videoSession =
ctx->common.session,
448 .referenceSlotCount = vp->
decode_info.referenceSlotCount,
449 .pReferenceSlots = vp->
decode_info.pReferenceSlots,
452 .sType = VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR,
455 VkImageMemoryBarrier2 img_bar[38];
459 ctx->caps.minBitstreamBufferSizeAlignment);
464 VkVideoReferenceSlotInfoKHR *cur_vk_ref;
465 cur_vk_ref = (
void *)&decode_start.pReferenceSlots[decode_start.referenceSlotCount];
467 cur_vk_ref[0].slotIndex = -1;
468 decode_start.referenceSlotCount++;
473 if (!(sd_buf->
flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) {
474 VkMappedMemoryRange flush_buf = {
475 .sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
476 .memory = sd_buf->
mem,
479 ctx->s.props.properties.limits.nonCoherentAtomSize),
482 ret = vk->FlushMappedMemoryRanges(
ctx->s.hwctx->act_dev, 1, &flush_buf);
483 if (ret != VK_SUCCESS) {
508 VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
509 VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR);
520 img_bar[nb_img_bar] = (VkImageMemoryBarrier2) {
521 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2,
523 .srcStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
524 .dstStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
525 .srcAccessMask = VK_ACCESS_2_NONE,
526 .dstAccessMask = VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
527 .oldLayout = vkf->
layout[0],
528 .newLayout = (layered_dpb || vp->
dpb_img) ?
529 VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR :
530 VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR,
532 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
533 .image = vkf->
img[0],
534 .subresourceRange = (VkImageSubresourceRange) {
541 &img_bar[nb_img_bar], &nb_img_bar);
547 if (di->
layout != VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR) {
548 img_bar[nb_img_bar] = (VkImageMemoryBarrier2) {
549 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2,
550 .srcStageMask = VK_PIPELINE_STAGE_2_NONE,
551 .dstStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
552 .srcAccessMask = VK_ACCESS_2_NONE,
553 .dstAccessMask = VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR |
554 VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
556 .newLayout = VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR,
557 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
558 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
560 .subresourceRange = (VkImageSubresourceRange) {
561 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
567 di->
layout = VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR;
579 VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
580 VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR);
594 img_bar[nb_img_bar] = (VkImageMemoryBarrier2) {
595 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2,
597 .srcStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
598 .dstStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
599 .srcAccessMask = VK_ACCESS_2_NONE,
600 .dstAccessMask = VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR |
601 VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
602 .oldLayout = rvkf->
layout[0],
603 .newLayout = VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR,
605 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
606 .image = rvkf->
img[0],
607 .subresourceRange = (VkImageSubresourceRange) {
614 &img_bar[nb_img_bar], &nb_img_bar);
623 VkMemoryBarrier2 mem_bar = {
624 .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER_2,
625 .srcStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
626 .srcAccessMask = VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
627 .dstStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
628 .dstAccessMask = VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR |
629 VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
633 vk->CmdPipelineBarrier2(cmd_buf, &(VkDependencyInfo) {
634 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
635 .dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT,
636 .pMemoryBarriers = &mem_bar,
637 .memoryBarrierCount =
ctx->common.dpb ? 1 : 0,
638 .pImageMemoryBarriers = img_bar,
639 .imageMemoryBarrierCount = nb_img_bar,
643 vk->CmdBeginVideoCodingKHR(cmd_buf, &decode_start);
645 vk->CmdEndVideoCodingKHR(cmd_buf, &
decode_end);
677 if (
ctx->sd_ctx_free)
706 if (vk_desc->
queue_flags & VK_QUEUE_VIDEO_DECODE_BIT_KHR) {
709 VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME);
729 VkVideoDecodeH264CapabilitiesKHR *h264_caps,
730 VkVideoDecodeH265CapabilitiesKHR *h265_caps,
731#
if CONFIG_VP9_VULKAN_HWACCEL
732 VkVideoDecodeVP9CapabilitiesKHR *vp9_caps,
734 VkVideoDecodeAV1CapabilitiesKHR *av1_caps,
735 VkVideoCapabilitiesKHR *caps,
736 VkVideoDecodeCapabilitiesKHR *dec_caps,
739 VkVideoDecodeUsageInfoKHR *
usage = &prof->
usage;
741 VkVideoProfileListInfoKHR *profile_list = &prof->
profile_list;
743 VkVideoDecodeH264ProfileInfoKHR *h264_profile = &prof->
h264_profile;
744 VkVideoDecodeH265ProfileInfoKHR *h265_profile = &prof->
h265_profile;
745#if CONFIG_VP9_VULKAN_HWACCEL
746 VkVideoDecodeVP9ProfileInfoKHR *vp9_profile = &prof->vp9_profile;
748 VkVideoDecodeAV1ProfileInfoKHR *av1_profile = &prof->
av1_profile;
755 dec_caps->pNext = h264_caps;
756 usage->pNext = h264_profile;
757 h264_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_INFO_KHR;
764 h264_profile->pictureLayout =
765 VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR;
767 if (
h &&
h->ps.sps && !
h->ps.sps->frame_mbs_only_flag)
768 h264_profile->pictureLayout =
769 VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR;
771 dec_caps->pNext = h265_caps;
772 usage->pNext = h265_profile;
773 h265_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_KHR;
774 h265_profile->stdProfileIdc = cur_profile;
775#if CONFIG_VP9_VULKAN_HWACCEL
777 dec_caps->pNext = vp9_caps;
778 usage->pNext = vp9_profile;
779 vp9_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_VP9_PROFILE_INFO_KHR;
780 vp9_profile->stdProfile = cur_profile;
783 dec_caps->pNext = av1_caps;
784 usage->pNext = av1_profile;
785 av1_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_KHR;
786 av1_profile->stdProfile = cur_profile;
790 usage->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_USAGE_INFO_KHR;
791 usage->videoUsageHints = VK_VIDEO_DECODE_USAGE_DEFAULT_KHR;
793 profile->sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_INFO_KHR;
800 profile_list->sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR;
801 profile_list->profileCount = 1;
802 profile_list->pProfiles =
profile;
805 caps->sType = VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR;
806 caps->pNext = dec_caps;
807 dec_caps->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_CAPABILITIES_KHR;
810 return vk->GetPhysicalDeviceVideoCapabilitiesKHR(hwctx->
phys_dev,
profile,
820 int max_level, base_profile, cur_profile;
833 VkVideoCapabilitiesKHR *caps = &
ctx->caps;
834 VkVideoDecodeCapabilitiesKHR *dec_caps = &
ctx->dec_caps;
836 VkVideoDecodeH264CapabilitiesKHR h264_caps = {
837 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_KHR,
839 VkVideoDecodeH265CapabilitiesKHR h265_caps = {
840 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_KHR,
842#if CONFIG_VP9_VULKAN_HWACCEL
843 VkVideoDecodeVP9CapabilitiesKHR vp9_caps = {
844 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_VP9_CAPABILITIES_KHR,
847 VkVideoDecodeAV1CapabilitiesKHR av1_caps = {
848 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_CAPABILITIES_KHR,
851 VkPhysicalDeviceVideoFormatInfoKHR fmt_info = {
852 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_FORMAT_INFO_KHR,
855 VkVideoFormatPropertiesKHR *ret_info;
856 uint32_t nb_out_fmts = 0;
867#if CONFIG_VP9_VULKAN_HWACCEL
876#
if CONFIG_VP9_VULKAN_HWACCEL
883 if (ret == VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR &&
885 avctx->
profile != base_profile) {
887 "again with profile %s\n",
891 cur_profile = base_profile;
895#
if CONFIG_VP9_VULKAN_HWACCEL
904 if (ret == VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR) {
906 "%s profile \"%s\" not supported!\n",
910 }
else if (ret == VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR) {
913 "pictureLayout %#x not supported!\n",
917 "pictureLayout not supported!\n");
919 }
else if (ret == VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR) {
921 "format (%s) not supported!\n",
924 }
else if (ret == VK_ERROR_FEATURE_NOT_PRESENT ||
925 ret == VK_ERROR_FORMAT_NOT_SUPPORTED) {
927 }
else if (ret != VK_SUCCESS) {
933#if CONFIG_VP9_VULKAN_HWACCEL
943 max_level, avctx->
level);
945 caps->minCodedExtent.width, caps->maxCodedExtent.width);
947 caps->minCodedExtent.height, caps->maxCodedExtent.height);
949 caps->pictureAccessGranularity.width);
951 caps->pictureAccessGranularity.height);
953 caps->minBitstreamBufferOffsetAlignment);
955 caps->minBitstreamBufferSizeAlignment);
959 caps->maxActiveReferencePictures);
961 caps->stdHeaderVersion.extensionName,
963 av_log(avctx,
AV_LOG_VERBOSE,
" Codec header version: %i.%i.%i (driver), %i.%i.%i (compiled)\n",
964 CODEC_VER(caps->stdHeaderVersion.specVersion),
967 dec_caps->flags ?
"" :
969 dec_caps->flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR ?
970 " reuse_dst_dpb" :
"",
971 dec_caps->flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR ?
972 " dedicated_dpb" :
"");
976 caps->flags & VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR ?
978 caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR ?
979 " separate_references" :
"");
982 if (avctx->
coded_width < caps->minCodedExtent.width ||
989 avctx->
level > max_level)
993 if (!(dec_caps->flags & (VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR |
994 VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR))) {
996 "VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR nor "
997 "VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR are set!\n");
999 }
else if ((dec_caps->flags & (VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR |
1000 VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR)) ==
1001 VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR &&
1002 !(caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR)) {
1003 av_log(avctx,
AV_LOG_ERROR,
"Cannot initialize Vulkan decoding session, buggy driver: "
1004 "VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR set "
1005 "but VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR is unset!\n");
1009 dec->
dedicated_dpb = !!(dec_caps->flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR);
1011 !(caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR);
1014 fmt_info.imageUsage = VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
1016 fmt_info.imageUsage = VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR |
1017 VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR |
1018 VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
1019 VK_IMAGE_USAGE_SAMPLED_BIT;
1023 fmt_info.imageUsage |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR;
1027 ret = vk->GetPhysicalDeviceVideoFormatPropertiesKHR(hwctx->
phys_dev,
1029 &nb_out_fmts,
NULL);
1030 if (ret == VK_ERROR_FORMAT_NOT_SUPPORTED ||
1031 (!nb_out_fmts && ret == VK_SUCCESS)) {
1033 }
else if (ret != VK_SUCCESS) {
1039 ret_info =
av_mallocz(
sizeof(*ret_info)*nb_out_fmts);
1043 for (
int i = 0;
i < nb_out_fmts;
i++)
1044 ret_info[
i].sType = VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR;
1046 ret = vk->GetPhysicalDeviceVideoFormatPropertiesKHR(hwctx->
phys_dev,
1048 &nb_out_fmts, ret_info);
1049 if (ret == VK_ERROR_FORMAT_NOT_SUPPORTED ||
1050 (!nb_out_fmts && ret == VK_SUCCESS)) {
1053 }
else if (ret != VK_SUCCESS) {
1062 *vk_fmt = best_vkfmt = VK_FORMAT_UNDEFINED;
1065 av_log(avctx,
AV_LOG_DEBUG,
"Choosing best pixel format for decoding from %i:\n", nb_out_fmts);
1066 for (
int i = 0;
i < nb_out_fmts;
i++) {
1074 if (
tmp == best_format)
1075 best_vkfmt = ret_info[
i].format;
1085 av_log(avctx,
AV_LOG_ERROR,
"No valid/compatible pixel format found for decoding!\n");
1093 *vk_fmt = best_vkfmt;
1107 int err, dedicated_dpb;
1130 prof, &dedicated_dpb);
1144 hwfc->
format[0] = VK_FORMAT_UNDEFINED;
1169 hwfc->
format[3] = VK_FORMAT_R16_UNORM;
1175 hwfc->
format[0] = VK_FORMAT_R16_UNORM;
1176 hwfc->
format[1] = VK_FORMAT_R16_UNORM;
1177 hwfc->
format[2] = VK_FORMAT_R16_UNORM;
1184 if (hwfc->
tiling != VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT)
1185 hwfc->
tiling = VK_IMAGE_TILING_OPTIMAL;
1187 hwfc->
usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
1188 VK_IMAGE_USAGE_STORAGE_BIT |
1189 VK_IMAGE_USAGE_SAMPLED_BIT;
1194 hwfc->
usage |= VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR;
1196 hwfc->
usage |= VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
1201 hwfc->
usage |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR;
1211 VkVideoSessionParametersKHR *par = obj;
1212 vk->DestroyVideoSessionParametersKHR(
ctx->s.hwctx->act_dev, *par,
1213 ctx->s.hwctx->alloc);
1217 const VkVideoSessionParametersCreateInfoKHR *session_params_create)
1219 VkVideoSessionParametersKHR *par;
1228 ret = vk->CreateVideoSessionParametersKHR(
ctx->s.hwctx->act_dev, session_params_create,
1229 ctx->s.hwctx->alloc, par);
1230 if (ret != VK_SUCCESS) {
1231 av_log(logctx,
AV_LOG_ERROR,
"Unable to create Vulkan video session parameters: %s!\n",
1233 *par = VK_NULL_HANDLE;
1260 const VkVideoProfileInfoKHR *
profile;
1263 VkVideoSessionCreateInfoKHR session_create = {
1264 .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_CREATE_INFO_KHR,
1296 session_create.queueFamilyIndex =
ctx->qf->idx;
1297 session_create.maxCodedExtent =
ctx->caps.maxCodedExtent;
1298 session_create.maxDpbSlots =
ctx->caps.maxDpbSlots;
1299 session_create.maxActiveReferencePictures =
ctx->caps.maxActiveReferencePictures;
1300 session_create.pictureFormat =
s->hwfc->format[0];
1301 session_create.referencePictureFormat = session_create.pictureFormat;
1302 session_create.pStdHeaderVersion = &vk_desc->
ext_props;
1303 session_create.pVideoProfile =
profile;
1304#ifdef VK_KHR_video_maintenance2
1306 session_create.flags = VK_VIDEO_SESSION_CREATE_INLINE_SESSION_PARAMETERS_BIT_KHR;
1318 async_depth, 0, 0, 0,
profile);
1330 VkImageTiling tiling = VK_IMAGE_TILING_OPTIMAL;
1332 VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR);
1337 VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT);
1338 if (drm_create_pnext) {
1339 create_pnext = drm_create_pnext;
1340 tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
1345 VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR,
1346 tiling, create_pnext,
1347 s->frames->width,
s->frames->height,
1348 ctx->common.layered_dpb ?
1349 ctx->caps.maxDpbSlots : 1);
1353 if (
ctx->common.layered_dpb) {
1356 VkImageMemoryBarrier2 img_bar;
1359 if (!
ctx->common.layered_img) {
1364 ctx->common.layered_view =
ctx->common.layered_img->view;
1365 ctx->common.layered_aspect =
ctx->common.layered_img->aspect;
1374 img_bar = (VkImageMemoryBarrier2) {
1375 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2,
1376 .srcStageMask = VK_PIPELINE_STAGE_2_NONE,
1377 .dstStageMask = VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
1378 .srcAccessMask = VK_ACCESS_2_NONE,
1379 .dstAccessMask = VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR |
1380 VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR,
1381 .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
1382 .newLayout = VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR,
1383 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
1384 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
1385 .image =
ctx->common.layered_img->img,
1386 .subresourceRange = (VkImageSubresourceRange) {
1387 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
1388 .layerCount = VK_REMAINING_ARRAY_LAYERS,
1392 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
1393 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
1394 .pImageMemoryBarriers = &img_bar,
1395 .imageMemoryBarrierCount = 1,
1402 ctx->common.layered_img->layout = VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR;
1416 const VkPhysicalDeviceDriverProperties *driver_props;
1418 if (driver_props->driverID == VK_DRIVER_ID_NVIDIA_PROPRIETARY &&
1419 driver_props->conformanceVersion.major == 1 &&
1420 driver_props->conformanceVersion.minor == 3 &&
1421 driver_props->conformanceVersion.subminor == 8 &&
1422 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.
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 flags
AV_CODEC_FLAG_*.
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 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)
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 VkResult vulkan_setup_profile(AVCodecContext *avctx, FFVulkanDecodeProfileData *prof, AVVulkanDeviceContext *hwctx, FFVulkanFunctions *vk, const FFVulkanDecodeDescriptor *vk_desc, VkVideoDecodeH264CapabilitiesKHR *h264_caps, VkVideoDecodeH265CapabilitiesKHR *h265_caps, VkVideoDecodeAV1CapabilitiesKHR *av1_caps, VkVideoCapabilitiesKHR *caps, VkVideoDecodeCapabilitiesKHR *dec_caps, int cur_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)