1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

vulkan_decode: convert max level from vulkan to av for comparisons

This commit is contained in:
Lynne 2023-09-06 06:15:32 +02:00
parent 00e77fd21a
commit 398467f519
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
3 changed files with 54 additions and 2 deletions

View File

@ -837,8 +837,8 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_
return AVERROR_EXTERNAL; return AVERROR_EXTERNAL;
} }
max_level = avctx->codec_id == AV_CODEC_ID_H264 ? h264_caps.maxLevelIdc : max_level = avctx->codec_id == AV_CODEC_ID_H264 ? ff_vk_h264_level_to_av(h264_caps.maxLevelIdc) :
avctx->codec_id == AV_CODEC_ID_H265 ? h265_caps.maxLevelIdc : avctx->codec_id == AV_CODEC_ID_H265 ? ff_vk_h265_level_to_av(h265_caps.maxLevelIdc) :
avctx->codec_id == AV_CODEC_ID_AV1 ? av1_caps.maxLevelIdc : avctx->codec_id == AV_CODEC_ID_AV1 ? av1_caps.maxLevelIdc :
0; 0;

View File

@ -154,6 +154,51 @@ VkVideoComponentBitDepthFlagBitsKHR ff_vk_depth_from_av_depth(int depth)
return VK_VIDEO_COMPONENT_BIT_DEPTH_INVALID_KHR; return VK_VIDEO_COMPONENT_BIT_DEPTH_INVALID_KHR;
} }
int ff_vk_h264_level_to_av(StdVideoH264LevelIdc level)
{
switch (level) {
case STD_VIDEO_H264_LEVEL_IDC_1_0: return 10;
case STD_VIDEO_H264_LEVEL_IDC_1_1: return 11;
case STD_VIDEO_H264_LEVEL_IDC_1_2: return 12;
case STD_VIDEO_H264_LEVEL_IDC_1_3: return 13;
case STD_VIDEO_H264_LEVEL_IDC_2_0: return 20;
case STD_VIDEO_H264_LEVEL_IDC_2_1: return 21;
case STD_VIDEO_H264_LEVEL_IDC_2_2: return 22;
case STD_VIDEO_H264_LEVEL_IDC_3_0: return 30;
case STD_VIDEO_H264_LEVEL_IDC_3_1: return 31;
case STD_VIDEO_H264_LEVEL_IDC_3_2: return 32;
case STD_VIDEO_H264_LEVEL_IDC_4_0: return 40;
case STD_VIDEO_H264_LEVEL_IDC_4_1: return 41;
case STD_VIDEO_H264_LEVEL_IDC_4_2: return 42;
case STD_VIDEO_H264_LEVEL_IDC_5_0: return 50;
case STD_VIDEO_H264_LEVEL_IDC_5_1: return 51;
case STD_VIDEO_H264_LEVEL_IDC_5_2: return 52;
case STD_VIDEO_H264_LEVEL_IDC_6_0: return 60;
case STD_VIDEO_H264_LEVEL_IDC_6_1: return 61;
default:
case STD_VIDEO_H264_LEVEL_IDC_6_2: return 62;
}
}
int ff_vk_h265_level_to_av(StdVideoH265LevelIdc level)
{
switch (level) {
case STD_VIDEO_H265_LEVEL_IDC_1_0: return 10;
case STD_VIDEO_H265_LEVEL_IDC_2_0: return 20;
case STD_VIDEO_H265_LEVEL_IDC_2_1: return 21;
case STD_VIDEO_H265_LEVEL_IDC_3_0: return 30;
case STD_VIDEO_H265_LEVEL_IDC_3_1: return 31;
case STD_VIDEO_H265_LEVEL_IDC_4_0: return 40;
case STD_VIDEO_H265_LEVEL_IDC_4_1: return 41;
case STD_VIDEO_H265_LEVEL_IDC_5_0: return 50;
case STD_VIDEO_H265_LEVEL_IDC_5_1: return 51;
case STD_VIDEO_H265_LEVEL_IDC_6_0: return 60;
case STD_VIDEO_H265_LEVEL_IDC_6_1: return 61;
default:
case STD_VIDEO_H265_LEVEL_IDC_6_2: return 62;
}
}
static void free_data_buf(void *opaque, uint8_t *data) static void free_data_buf(void *opaque, uint8_t *data)
{ {
FFVulkanContext *ctx = opaque; FFVulkanContext *ctx = opaque;

View File

@ -71,6 +71,13 @@ VkVideoChromaSubsamplingFlagBitsKHR ff_vk_subsampling_from_av_desc(const AVPixFm
*/ */
VkVideoComponentBitDepthFlagBitsKHR ff_vk_depth_from_av_depth(int depth); VkVideoComponentBitDepthFlagBitsKHR ff_vk_depth_from_av_depth(int depth);
/**
* Convert level from Vulkan to AV.
*/
int ff_vk_h264_level_to_av(StdVideoH264LevelIdc level);
int ff_vk_h265_level_to_av(StdVideoH265LevelIdc level);
typedef struct FFVkVideoBuffer { typedef struct FFVkVideoBuffer {
FFVkBuffer buf; FFVkBuffer buf;
uint8_t *mem; uint8_t *mem;