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 <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28657>
(cherry picked from commit 363a90d0c4)
This commit is contained in:
Stéphane Cerveau 2024-04-09 19:55:21 +02:00 committed by Eric Engestrom
parent 68343412ff
commit c9429bce04
3 changed files with 13 additions and 7 deletions

View file

@ -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

View file

@ -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);

View file

@ -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,