MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / vulkan_setup_profile

Function vulkan_setup_profile

libavcodec/vulkan_decode.c:771–857  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

769}
770
771static VkResult vulkan_setup_profile(AVCodecContext *avctx,
772 FFVulkanDecodeProfileData *prof,
773 AVVulkanDeviceContext *hwctx,
774 FFVulkanFunctions *vk,
775 const FFVulkanDecodeDescriptor *vk_desc,
776 VkVideoDecodeH264CapabilitiesKHR *h264_caps,
777 VkVideoDecodeH265CapabilitiesKHR *h265_caps,
778#if CONFIG_VP9_VULKAN_HWACCEL
779 VkVideoDecodeVP9CapabilitiesKHR *vp9_caps,
780#endif
781 VkVideoDecodeAV1CapabilitiesKHR *av1_caps,
782 VkVideoCapabilitiesKHR *caps,
783 VkVideoDecodeCapabilitiesKHR *dec_caps,
784 int cur_profile)
785{
786 VkVideoDecodeUsageInfoKHR *usage = &prof->usage;
787 VkVideoProfileInfoKHR *profile = &prof->profile;
788 VkVideoProfileListInfoKHR *profile_list = &prof->profile_list;
789
790 VkVideoDecodeH264ProfileInfoKHR *h264_profile = &prof->h264_profile;
791 VkVideoDecodeH265ProfileInfoKHR *h265_profile = &prof->h265_profile;
792#if CONFIG_VP9_VULKAN_HWACCEL
793 VkVideoDecodeVP9ProfileInfoKHR *vp9_profile = &prof->vp9_profile;
794#endif
795 VkVideoDecodeAV1ProfileInfoKHR *av1_profile = &prof->av1_profile;
796
797 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
798 if (!desc)
799 return AVERROR(EINVAL);
800
801 if (avctx->codec_id == AV_CODEC_ID_H264) {
802 dec_caps->pNext = h264_caps;
803 usage->pNext = h264_profile;
804 h264_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_INFO_KHR;
805
806 /* Vulkan transmits all the constrant_set flags, rather than wanting them
807 * merged in the profile IDC */
808 h264_profile->stdProfileIdc = cur_profile & ~(AV_PROFILE_H264_CONSTRAINED |
809 AV_PROFILE_H264_INTRA);
810
811 h264_profile->pictureLayout = avctx->field_order == AV_FIELD_UNKNOWN ||
812 avctx->field_order == AV_FIELD_PROGRESSIVE ?
813 VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR :
814 VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR;
815 } else if (avctx->codec_id == AV_CODEC_ID_H265) {
816 dec_caps->pNext = h265_caps;
817 usage->pNext = h265_profile;
818 h265_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_KHR;
819 h265_profile->stdProfileIdc = cur_profile;
820#if CONFIG_VP9_VULKAN_HWACCEL
821 } else if (avctx->codec_id == AV_CODEC_ID_VP9) {
822 dec_caps->pNext = vp9_caps;
823 usage->pNext = vp9_profile;
824 vp9_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_VP9_PROFILE_INFO_KHR;
825 vp9_profile->stdProfile = cur_profile;
826#endif
827 } else if (avctx->codec_id == AV_CODEC_ID_AV1) {
828 dec_caps->pNext = av1_caps;

Callers 1

Calls 3

av_pix_fmt_desc_getFunction · 0.85

Tested by

no test coverage detected