| 857 | } |
| 858 | |
| 859 | static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ref, |
| 860 | enum AVPixelFormat *pix_fmt, VkFormat *vk_fmt, |
| 861 | FFVulkanDecodeProfileData *prof, |
| 862 | int *dpb_dedicate) |
| 863 | { |
| 864 | VkResult ret; |
| 865 | int max_level, base_profile, cur_profile; |
| 866 | const FFVulkanDecodeDescriptor *vk_desc = get_codecdesc(avctx->codec_id); |
| 867 | AVHWFramesContext *frames = (AVHWFramesContext *)frames_ref->data; |
| 868 | AVHWDeviceContext *device = (AVHWDeviceContext *)frames->device_ref->data; |
| 869 | AVVulkanDeviceContext *hwctx = device->hwctx; |
| 870 | enum AVPixelFormat source_format; |
| 871 | enum AVPixelFormat best_format; |
| 872 | VkFormat best_vkfmt; |
| 873 | |
| 874 | FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data; |
| 875 | FFVulkanDecodeShared *ctx = dec->shared_ctx; |
| 876 | FFVulkanFunctions *vk = &ctx->s.vkfn; |
| 877 | |
| 878 | VkVideoCapabilitiesKHR *caps = &ctx->caps; |
| 879 | VkVideoDecodeCapabilitiesKHR *dec_caps = &ctx->dec_caps; |
| 880 | |
| 881 | VkVideoDecodeH264CapabilitiesKHR h264_caps = { |
| 882 | .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_KHR, |
| 883 | }; |
| 884 | VkVideoDecodeH265CapabilitiesKHR h265_caps = { |
| 885 | .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_KHR, |
| 886 | }; |
| 887 | #if CONFIG_VP9_VULKAN_HWACCEL |
| 888 | VkVideoDecodeVP9CapabilitiesKHR vp9_caps = { |
| 889 | .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_VP9_CAPABILITIES_KHR, |
| 890 | }; |
| 891 | #endif |
| 892 | VkVideoDecodeAV1CapabilitiesKHR av1_caps = { |
| 893 | .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_CAPABILITIES_KHR, |
| 894 | }; |
| 895 | |
| 896 | VkPhysicalDeviceVideoFormatInfoKHR fmt_info = { |
| 897 | .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_FORMAT_INFO_KHR, |
| 898 | .pNext = &prof->profile_list, |
| 899 | }; |
| 900 | VkVideoFormatPropertiesKHR *ret_info; |
| 901 | uint32_t nb_out_fmts = 0; |
| 902 | |
| 903 | if (!(vk_desc->decode_extension & ctx->s.extensions)) { |
| 904 | av_log(avctx, AV_LOG_ERROR, "Device does not support decoding %s!\n", |
| 905 | avcodec_get_name(avctx->codec_id)); |
| 906 | return AVERROR(ENOSYS); |
| 907 | } |
| 908 | |
| 909 | cur_profile = avctx->profile; |
| 910 | base_profile = avctx->codec_id == AV_CODEC_ID_H264 ? AV_PROFILE_H264_CONSTRAINED_BASELINE : |
| 911 | avctx->codec_id == AV_CODEC_ID_H265 ? AV_PROFILE_HEVC_MAIN : |
| 912 | #if CONFIG_VP9_VULKAN_HWACCEL |
| 913 | avctx->codec_id == AV_CODEC_ID_VP9 ? STD_VIDEO_VP9_PROFILE_0 : |
| 914 | #endif |
| 915 | avctx->codec_id == AV_CODEC_ID_AV1 ? STD_VIDEO_AV1_PROFILE_MAIN : |
| 916 | 0; |
no test coverage detected