avcodec/vulkan_decode: Un-sparse extensions table
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. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
		
							parent
							
								
									f7b227bec3
								
							
						
					
					
						commit
						f9d35e78fe
					
				| @ -24,6 +24,7 @@ | |||||||
| #define MAX_TILES 256 | #define MAX_TILES 256 | ||||||
| 
 | 
 | ||||||
| const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc = { | const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc = { | ||||||
|  |     .codec_id         = AV_CODEC_ID_AV1, | ||||||
|     .decode_extension = FF_VK_EXT_VIDEO_DECODE_AV1, |     .decode_extension = FF_VK_EXT_VIDEO_DECODE_AV1, | ||||||
|     .decode_op        = 0x01000000, /* TODO fix this */ |     .decode_op        = 0x01000000, /* TODO fix this */ | ||||||
|     .ext_props = { |     .ext_props = { | ||||||
|  | |||||||
| @ -20,6 +20,7 @@ | |||||||
| #include "vulkan_video.h" | #include "vulkan_video.h" | ||||||
| #include "vulkan_decode.h" | #include "vulkan_decode.h" | ||||||
| #include "config_components.h" | #include "config_components.h" | ||||||
|  | #include "libavutil/avassert.h" | ||||||
| #include "libavutil/vulkan_loader.h" | #include "libavutil/vulkan_loader.h" | ||||||
| 
 | 
 | ||||||
| #if CONFIG_H264_VULKAN_HWACCEL | #if CONFIG_H264_VULKAN_HWACCEL | ||||||
| @ -34,19 +35,23 @@ extern const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc; | |||||||
| 
 | 
 | ||||||
| static const FFVulkanDecodeDescriptor *dec_descs[] = { | static const FFVulkanDecodeDescriptor *dec_descs[] = { | ||||||
| #if CONFIG_H264_VULKAN_HWACCEL | #if CONFIG_H264_VULKAN_HWACCEL | ||||||
|     [AV_CODEC_ID_H264] = &ff_vk_dec_h264_desc, |     &ff_vk_dec_h264_desc, | ||||||
| #endif | #endif | ||||||
| #if CONFIG_HEVC_VULKAN_HWACCEL | #if CONFIG_HEVC_VULKAN_HWACCEL | ||||||
|     [AV_CODEC_ID_HEVC] = &ff_vk_dec_hevc_desc, |     &ff_vk_dec_hevc_desc, | ||||||
| #endif | #endif | ||||||
| #if CONFIG_AV1_VULKAN_HWACCEL | #if CONFIG_AV1_VULKAN_HWACCEL | ||||||
|     [AV_CODEC_ID_AV1] = &ff_vk_dec_av1_desc, |     &ff_vk_dec_av1_desc, | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static const FFVulkanDecodeDescriptor *get_codecdesc(enum AVCodecID codec_id) | 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) | static const VkVideoProfileInfoKHR *get_video_profile(FFVulkanDecodeShared *ctx, enum AVCodecID codec_id) | ||||||
|  | |||||||
| @ -19,6 +19,7 @@ | |||||||
| #ifndef AVCODEC_VULKAN_DECODE_H | #ifndef AVCODEC_VULKAN_DECODE_H | ||||||
| #define AVCODEC_VULKAN_DECODE_H | #define AVCODEC_VULKAN_DECODE_H | ||||||
| 
 | 
 | ||||||
|  | #include "codec_id.h" | ||||||
| #include "decode.h" | #include "decode.h" | ||||||
| #include "hwaccel_internal.h" | #include "hwaccel_internal.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
| @ -26,6 +27,7 @@ | |||||||
| #include "vulkan_video.h" | #include "vulkan_video.h" | ||||||
| 
 | 
 | ||||||
| typedef struct FFVulkanDecodeDescriptor { | typedef struct FFVulkanDecodeDescriptor { | ||||||
|  |     enum AVCodecID                   codec_id; | ||||||
|     FFVulkanExtensions               decode_extension; |     FFVulkanExtensions               decode_extension; | ||||||
|     VkVideoCodecOperationFlagBitsKHR decode_op; |     VkVideoCodecOperationFlagBitsKHR decode_op; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -22,6 +22,7 @@ | |||||||
| #include "vulkan_decode.h" | #include "vulkan_decode.h" | ||||||
| 
 | 
 | ||||||
| const FFVulkanDecodeDescriptor ff_vk_dec_h264_desc = { | const FFVulkanDecodeDescriptor ff_vk_dec_h264_desc = { | ||||||
|  |     .codec_id         = AV_CODEC_ID_H264, | ||||||
|     .decode_extension = FF_VK_EXT_VIDEO_DECODE_H264, |     .decode_extension = FF_VK_EXT_VIDEO_DECODE_H264, | ||||||
|     .decode_op        = VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, |     .decode_op        = VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, | ||||||
|     .ext_props = { |     .ext_props = { | ||||||
|  | |||||||
| @ -23,6 +23,7 @@ | |||||||
| #include "vulkan_decode.h" | #include "vulkan_decode.h" | ||||||
| 
 | 
 | ||||||
| const FFVulkanDecodeDescriptor ff_vk_dec_hevc_desc = { | const FFVulkanDecodeDescriptor ff_vk_dec_hevc_desc = { | ||||||
|  |     .codec_id         = AV_CODEC_ID_HEVC, | ||||||
|     .decode_extension = FF_VK_EXT_VIDEO_DECODE_H265, |     .decode_extension = FF_VK_EXT_VIDEO_DECODE_H265, | ||||||
|     .decode_op        = VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, |     .decode_op        = VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, | ||||||
|     .ext_props = { |     .ext_props = { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user