vk/video: add a common function to get block alignments for profiles

This is to be used by drivers for internal image alignments.

This just adds a common profile to alignment helper.

Cc: mesa-stable
Reviewed-by: Lynne <dev@lynne.ee>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23227>
This commit is contained in:
Dave Airlie
2023-05-30 10:59:07 +10:00
committed by Marge Bot
parent b9d208bd1f
commit 45a92f14b2
2 changed files with 28 additions and 0 deletions
+19
View File
@@ -817,3 +817,22 @@ vk_video_parse_h265_slice_header(const struct VkVideoDecodeInfoKHR *frame_info,
unsigned header_bits = (slice_size * 8 - 24 /* start code */) - vl_vlc_bits_left(&rbsp.nal);
params->slice_data_bytes_offset = (header_bits + 8) / 8;
}
void
vk_video_get_profile_alignments(const VkVideoProfileListInfoKHR *profile_list,
uint32_t *width_align_out, uint32_t *height_align_out)
{
uint32_t width_align = 1, height_align = 1;
for (unsigned i = 0; i < profile_list->profileCount; i++) {
if (profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR) {
width_align = MAX2(width_align, VK_VIDEO_H264_MACROBLOCK_WIDTH);
height_align = MAX2(height_align, VK_VIDEO_H264_MACROBLOCK_HEIGHT);
}
if (profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR) {
width_align = MAX2(width_align, VK_VIDEO_H265_CTU_MAX_WIDTH);
height_align = MAX2(height_align, VK_VIDEO_H265_CTU_MAX_HEIGHT);
}
}
*width_align_out = width_align;
*height_align_out = height_align;
}
+9
View File
@@ -178,6 +178,15 @@ void vk_fill_video_h265_reference_info(const VkVideoDecodeInfoKHR *frame_info,
const struct vk_video_h265_slice_params *slice_params,
struct vk_video_h265_reference ref_slots[][8]);
#define VK_VIDEO_H264_MACROBLOCK_WIDTH 16
#define VK_VIDEO_H264_MACROBLOCK_HEIGHT 16
#define VK_VIDEO_H265_CTU_MAX_WIDTH 64
#define VK_VIDEO_H265_CTU_MAX_HEIGHT 64
void
vk_video_get_profile_alignments(const VkVideoProfileListInfoKHR *profile_list,
uint32_t *width_align_out, uint32_t *height_align_out);
#ifdef __cplusplus
}
#endif