History

vulkan_decode: add ifdefs around VP9 definitions and privatize profile struct

The struct is not referenced anywhere else.

Lynne committed 1 year ago

Commit eb9e0001 parent f7a51282 files · +31 −10Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/vulkan_decode.c +31 −0
  2. libavcodec/vulkan_decode.h +0 −10
libavcodec/vulkan_decode.c+31−0
@@ -68,6 +68,19 @@ static const FFVulkanDecodeDescriptor *dec_descs[] = { · 67 unmodified lines
6868 #endif
6969 };
7070
71+typedef struct FFVulkanDecodeProfileData {
72+ VkVideoDecodeH264ProfileInfoKHR h264_profile;
73+ VkVideoDecodeH265ProfileInfoKHR h265_profile;
74+#if CONFIG_VP9_VULKAN_HWACCEL
75+ VkVideoDecodeVP9ProfileInfoKHR vp9_profile;
76+#endif
77+ VkVideoDecodeAV1ProfileInfoKHR av1_profile;
78+
79+ VkVideoDecodeUsageInfoKHR usage;
80+ VkVideoProfileInfoKHR profile;
81+ VkVideoProfileListInfoKHR profile_list;
82+} FFVulkanDecodeProfileData;
83+
7184 static const FFVulkanDecodeDescriptor *get_codecdesc(enum AVCodecID codec_id)
7285 {
7386 for (size_t i = 0; i < FF_ARRAY_ELEMS(dec_descs); i++)
@@ -84,7 +97,9 @@ static const VkVideoProfileInfoKHR *get_video_profile(FFVulkanDecodeShared *ctx, · 10 unmodified lines
8497 VkStructureType profile_struct_type =
8598 codec_id == AV_CODEC_ID_H264 ? VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_INFO_KHR :
8699 codec_id == AV_CODEC_ID_HEVC ? VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_KHR :
100+#if CONFIG_VP9_VULKAN_HWACCEL
87101 codec_id == AV_CODEC_ID_VP9 ? VK_STRUCTURE_TYPE_VIDEO_DECODE_VP9_PROFILE_INFO_KHR :
102+#endif
88103 codec_id == AV_CODEC_ID_AV1 ? VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_KHR :
89104 VK_STRUCTURE_TYPE_MAX_ENUM;
90105 if (profile_struct_type == VK_STRUCTURE_TYPE_MAX_ENUM)
@@ -694,7 +709,9 @@ static VkResult vulkan_setup_profile(AVCodecContext *avctx, · 603 unmodified lines
694709 const FFVulkanDecodeDescriptor *vk_desc,
695710 VkVideoDecodeH264CapabilitiesKHR *h264_caps,
696711 VkVideoDecodeH265CapabilitiesKHR *h265_caps,
712+#if CONFIG_VP9_VULKAN_HWACCEL
697713 VkVideoDecodeVP9CapabilitiesKHR *vp9_caps,
714+#endif
698715 VkVideoDecodeAV1CapabilitiesKHR *av1_caps,
699716 VkVideoCapabilitiesKHR *caps,
700717 VkVideoDecodeCapabilitiesKHR *dec_caps,
@@ -706,7 +723,9 @@ static VkResult vulkan_setup_profile(AVCodecContext *avctx, · 5 unmodified lines
706723
707724 VkVideoDecodeH264ProfileInfoKHR *h264_profile = &prof->h264_profile;
708725 VkVideoDecodeH265ProfileInfoKHR *h265_profile = &prof->h265_profile;
726+#if CONFIG_VP9_VULKAN_HWACCEL
709727 VkVideoDecodeVP9ProfileInfoKHR *vp9_profile = &prof->vp9_profile;
728+#endif
710729 VkVideoDecodeAV1ProfileInfoKHR *av1_profile = &prof->av1_profile;
711730
712731 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
@@ -732,11 +751,13 @@ static VkResult vulkan_setup_profile(AVCodecContext *avctx, · 19 unmodified lines
732751 usage->pNext = h265_profile;
733752 h265_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_KHR;
734753 h265_profile->stdProfileIdc = cur_profile;
754+#if CONFIG_VP9_VULKAN_HWACCEL
735755 } else if (avctx->codec_id == AV_CODEC_ID_VP9) {
736756 dec_caps->pNext = vp9_caps;
737757 usage->pNext = vp9_profile;
738758 vp9_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_VP9_PROFILE_INFO_KHR;
739759 vp9_profile->stdProfile = cur_profile;
760+#endif
740761 } else if (avctx->codec_id == AV_CODEC_ID_AV1) {
741762 dec_caps->pNext = av1_caps;
742763 usage->pNext = av1_profile;
@@ -797,9 +818,11 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ · 54 unmodified lines
797818 VkVideoDecodeH265CapabilitiesKHR h265_caps = {
798819 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_KHR,
799820 };
821+#if CONFIG_VP9_VULKAN_HWACCEL
800822 VkVideoDecodeVP9CapabilitiesKHR vp9_caps = {
801823 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_VP9_CAPABILITIES_KHR,
802824 };
825+#endif
803826 VkVideoDecodeAV1CapabilitiesKHR av1_caps = {
804827 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_CAPABILITIES_KHR,
805828 };
@@ -820,14 +843,18 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ · 14 unmodified lines
820843 cur_profile = avctx->profile;
821844 base_profile = avctx->codec_id == AV_CODEC_ID_H264 ? AV_PROFILE_H264_CONSTRAINED_BASELINE :
822845 avctx->codec_id == AV_CODEC_ID_H265 ? AV_PROFILE_HEVC_MAIN :
846+#if CONFIG_VP9_VULKAN_HWACCEL
823847 avctx->codec_id == AV_CODEC_ID_VP9 ? STD_VIDEO_VP9_PROFILE_0 :
848+#endif
824849 avctx->codec_id == AV_CODEC_ID_AV1 ? STD_VIDEO_AV1_PROFILE_MAIN :
825850 0;
826851
827852 ret = vulkan_setup_profile(avctx, prof, hwctx, vk, vk_desc,
828853 &h264_caps,
829854 &h265_caps,
855+#if CONFIG_VP9_VULKAN_HWACCEL
830856 &vp9_caps,
857+#endif
831858 &av1_caps,
832859 caps,
833860 dec_caps,
@@ -844,7 +871,9 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ · 10 unmodified lines
844871 ret = vulkan_setup_profile(avctx, prof, hwctx, vk, vk_desc,
845872 &h264_caps,
846873 &h265_caps,
874+#if CONFIG_VP9_VULKAN_HWACCEL
847875 &vp9_caps,
876+#endif
848877 &av1_caps,
849878 caps,
850879 dec_caps,
@@ -871,7 +900,9 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ · 20 unmodified lines
871900
872901 max_level = avctx->codec_id == AV_CODEC_ID_H264 ? ff_vk_h264_level_to_av(h264_caps.maxLevelIdc) :
873902 avctx->codec_id == AV_CODEC_ID_H265 ? ff_vk_h265_level_to_av(h265_caps.maxLevelIdc) :
903+#if CONFIG_VP9_VULKAN_HWACCEL
874904 avctx->codec_id == AV_CODEC_ID_VP9 ? vp9_caps.maxLevel :
905+#endif
875906 avctx->codec_id == AV_CODEC_ID_AV1 ? av1_caps.maxLevel :
876907 0;
877908
libavcodec/vulkan_decode.h+0−10
@@ -35,16 +35,6 @@ typedef struct FFVulkanDecodeDescriptor { · 34 unmodified lines
3535 VkExtensionProperties ext_props;
3636 } FFVulkanDecodeDescriptor;
3737
38−typedef struct FFVulkanDecodeProfileData {
39− VkVideoDecodeH264ProfileInfoKHR h264_profile;
40− VkVideoDecodeH265ProfileInfoKHR h265_profile;
41− VkVideoDecodeVP9ProfileInfoKHR vp9_profile;
42− VkVideoDecodeAV1ProfileInfoKHR av1_profile;
43− VkVideoDecodeUsageInfoKHR usage;
44− VkVideoProfileInfoKHR profile;
45− VkVideoProfileListInfoKHR profile_list;
46−} FFVulkanDecodeProfileData;
47−
4838 typedef struct FFVulkanDecodeShared {
4939 FFVulkanContext s;
5040 FFVkVideoCommon common;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t