From c9429bce042d24a0236afa35296e3b7d5290d600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Tue, 9 Apr 2024 19:55:21 +0200 Subject: [PATCH] vulkan/video: hevc: b-frames can be reference or not b-frames can be considered as reference, so the NAL type should refer to reference type and either RASL or TRAIL depending on the irap_pic_flag. Fixes: 72f52329c ("vulkan/video: add a nal_unit lookup for hevc") Reviewed-by: Hyunjun Ko Part-of: (cherry picked from commit 363a90d0c45cfc25fba6f8e59e6c53fb610846e8) --- .pick_status.json | 2 +- src/vulkan/runtime/vk_video.c | 16 +++++++++++----- src/vulkan/runtime/vk_video.h | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index e4d96e0160f..c09d3b74f85 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1724,7 +1724,7 @@ "description": "vulkan/video: hevc: b-frames can be reference or not", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "72f52329cd7166bf46d1544e7d93705d3ff9a7dd", "notes": null diff --git a/src/vulkan/runtime/vk_video.c b/src/vulkan/runtime/vk_video.c index cba345c3cd6..9934e1271a9 100644 --- a/src/vulkan/runtime/vk_video.c +++ b/src/vulkan/runtime/vk_video.c @@ -1314,9 +1314,9 @@ enum HEVCNALUnitType { }; unsigned -vk_video_get_h265_nal_unit(StdVideoH265PictureType pic_type, bool irap_pic_flag) +vk_video_get_h265_nal_unit(const StdVideoEncodeH265PictureInfo *pic_info) { - switch (pic_type) { + switch (pic_info->pic_type) { case STD_VIDEO_H265_PICTURE_TYPE_IDR: return HEVC_NAL_IDR_W_RADL; case STD_VIDEO_H265_PICTURE_TYPE_I: @@ -1324,10 +1324,16 @@ vk_video_get_h265_nal_unit(StdVideoH265PictureType pic_type, bool irap_pic_flag) case STD_VIDEO_H265_PICTURE_TYPE_P: return HEVC_NAL_TRAIL_R; case STD_VIDEO_H265_PICTURE_TYPE_B: - if (irap_pic_flag) - return HEVC_NAL_RASL_R; + if (pic_info->flags.IrapPicFlag) + if (pic_info->flags.is_reference) + return HEVC_NAL_RASL_R; + else + return HEVC_NAL_RASL_N; else - return HEVC_NAL_TRAIL_R; + if (pic_info->flags.is_reference) + return HEVC_NAL_TRAIL_R; + else + return HEVC_NAL_TRAIL_N; break; default: assert(0); diff --git a/src/vulkan/runtime/vk_video.h b/src/vulkan/runtime/vk_video.h index 71248537e25..b02da73ce42 100644 --- a/src/vulkan/runtime/vk_video.h +++ b/src/vulkan/runtime/vk_video.h @@ -262,7 +262,7 @@ vk_video_encode_h264_pps(StdVideoH264PictureParameterSet *pps, void *data_ptr); unsigned -vk_video_get_h265_nal_unit(StdVideoH265PictureType pic_type, bool irap_pic_flag); +vk_video_get_h265_nal_unit(const StdVideoEncodeH265PictureInfo *pic_info); void vk_video_encode_h265_vps(StdVideoH265VideoParameterSet *vps,