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>
This commit is contained in:
Stéphane Cerveau 2024-04-09 19:55:21 +02:00 committed by Marge Bot
parent eb4dbe59b3
commit 363a90d0c4
3 changed files with 13 additions and 7 deletions

View file

@ -923,7 +923,7 @@ radv_enc_slice_header_hevc(struct radv_cmd_buffer *cmd_buffer, const VkVideoEnco
struct radv_device *device = radv_cmd_buffer_device(cmd_buffer);
const struct radv_physical_device *pdev = radv_device_physical(device);
struct radeon_cmdbuf *cs = cmd_buffer->cs;
unsigned nal_unit_type = vk_video_get_h265_nal_unit(pic->pic_type, pic->flags.IrapPicFlag);
unsigned nal_unit_type = vk_video_get_h265_nal_unit(pic);
ENC_BEGIN;
radeon_emit(cs, pdev->vcn_enc_cmds.slice_header);

View file

@ -1476,9 +1476,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:
@ -1486,10 +1486,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

@ -322,7 +322,7 @@ vk_video_encode_h264_pps(const 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(const StdVideoH265VideoParameterSet *vps,