Only three of the 226 (== AV_CODEC_ID_AV1) entries have been used. Unsparsing this table is especially important given that this array lives in .data.rel.ro.
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- libavcodec/vulkan_av1.c | 1 + libavcodec/vulkan_decode.c | 13 +++++++++---- libavcodec/vulkan_decode.h | 2 ++ libavcodec/vulkan_h264.c | 1 + libavcodec/vulkan_hevc.c | 1 + 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c index 03ae553ff8..5afd5353cc 100644 --- a/libavcodec/vulkan_av1.c +++ b/libavcodec/vulkan_av1.c @@ -24,6 +24,7 @@ #define MAX_TILES 256 const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc = { + .codec_id = AV_CODEC_ID_AV1, .decode_extension = FF_VK_EXT_VIDEO_DECODE_AV1, .decode_op = 0x01000000, /* TODO fix this */ .ext_props = { diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index 6777aa5887..233b5792d8 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -20,6 +20,7 @@ #include "vulkan_video.h" #include "vulkan_decode.h" #include "config_components.h" +#include "libavutil/avassert.h" #include "libavutil/vulkan_loader.h" #if CONFIG_H264_VULKAN_HWACCEL @@ -34,19 +35,23 @@ extern const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc; static const FFVulkanDecodeDescriptor *dec_descs[] = { #if CONFIG_H264_VULKAN_HWACCEL - [AV_CODEC_ID_H264] = &ff_vk_dec_h264_desc, + &ff_vk_dec_h264_desc, #endif #if CONFIG_HEVC_VULKAN_HWACCEL - [AV_CODEC_ID_HEVC] = &ff_vk_dec_hevc_desc, + &ff_vk_dec_hevc_desc, #endif #if CONFIG_AV1_VULKAN_HWACCEL - [AV_CODEC_ID_AV1] = &ff_vk_dec_av1_desc, + &ff_vk_dec_av1_desc, #endif }; static const FFVulkanDecodeDescriptor *get_codecdesc(enum AVCodecID codec_id) { - return dec_descs[codec_id]; + for (size_t i = 0; i < FF_ARRAY_ELEMS(dec_descs); i++) + if (dec_descs[i]->codec_id == codec_id) + return dec_descs[i]; + av_assert1(!"no codec descriptor"); + return NULL; } static const VkVideoProfileInfoKHR *get_video_profile(FFVulkanDecodeShared *ctx, enum AVCodecID codec_id) diff --git a/libavcodec/vulkan_decode.h b/libavcodec/vulkan_decode.h index 3e7cd38774..a43e328d73 100644 --- a/libavcodec/vulkan_decode.h +++ b/libavcodec/vulkan_decode.h @@ -19,6 +19,7 @@ #ifndef AVCODEC_VULKAN_DECODE_H #define AVCODEC_VULKAN_DECODE_H +#include "codec_id.h" #include "decode.h" #include "hwaccel_internal.h" #include "internal.h" @@ -26,6 +27,7 @@ #include "vulkan_video.h" typedef struct FFVulkanDecodeDescriptor { + enum AVCodecID codec_id; FFVulkanExtensions decode_extension; VkVideoCodecOperationFlagBitsKHR decode_op; diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c index 695b986a7c..0b296b3cc3 100644 --- a/libavcodec/vulkan_h264.c +++ b/libavcodec/vulkan_h264.c @@ -22,6 +22,7 @@ #include "vulkan_decode.h" const FFVulkanDecodeDescriptor ff_vk_dec_h264_desc = { + .codec_id = AV_CODEC_ID_H264, .decode_extension = FF_VK_EXT_VIDEO_DECODE_H264, .decode_op = VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, .ext_props = { diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c index e3a1319958..e2acc35612 100644 --- a/libavcodec/vulkan_hevc.c +++ b/libavcodec/vulkan_hevc.c @@ -23,6 +23,7 @@ #include "vulkan_decode.h" const FFVulkanDecodeDescriptor ff_vk_dec_hevc_desc = { + .codec_id = AV_CODEC_ID_HEVC, .decode_extension = FF_VK_EXT_VIDEO_DECODE_H265, .decode_op = VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, .ext_props = { -- 2.40.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".