Module: Mesa Branch: main Commit: 5542b51affff464649d6b96eab945d057866ad31 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5542b51affff464649d6b96eab945d057866ad31
Author: Dave Airlie <airl...@redhat.com> Date: Tue Oct 17 11:05:25 2023 +1000 vulkan/video: add h264 level idc convertor utility This converts vulkan level to the bitstream encoding. Reviewed-by: Hyunjun Ko <zz...@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25874> --- src/vulkan/runtime/vk_video.c | 8 ++++++++ src/vulkan/runtime/vk_video.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/vulkan/runtime/vk_video.c b/src/vulkan/runtime/vk_video.c index 66a012e5076..95e6354a52c 100644 --- a/src/vulkan/runtime/vk_video.c +++ b/src/vulkan/runtime/vk_video.c @@ -1239,6 +1239,14 @@ vk_video_get_profile_alignments(const VkVideoProfileListInfoKHR *profile_list, *height_align_out = height_align; } +static const uint8_t vk_video_h264_levels[] = {10, 11, 12, 13, 20, 21, 22, 30, 31, 32, 40, 41, 42, 50, 51, 52, 60, 61, 62}; +uint8_t +vk_video_get_h264_level(StdVideoH264LevelIdc level) +{ + assert(level <= STD_VIDEO_H264_LEVEL_IDC_6_2); + return vk_video_h264_levels[level]; +} + #ifdef VK_ENABLE_BETA_EXTENSIONS const StdVideoH264SequenceParameterSet * vk_video_find_h264_enc_std_sps(const struct vk_video_session_parameters *params, diff --git a/src/vulkan/runtime/vk_video.h b/src/vulkan/runtime/vk_video.h index d0db739ec40..80573d2523b 100644 --- a/src/vulkan/runtime/vk_video.h +++ b/src/vulkan/runtime/vk_video.h @@ -231,6 +231,9 @@ void vk_video_get_profile_alignments(const VkVideoProfileListInfoKHR *profile_list, uint32_t *width_align_out, uint32_t *height_align_out); +uint8_t +vk_video_get_h264_level(StdVideoH264LevelIdc level); + #ifdef VK_ENABLE_BETA_EXTENSIONS const StdVideoH264SequenceParameterSet * vk_video_find_h264_enc_std_sps(const struct vk_video_session_parameters *params,