vulkan_h264: fill correct ScalingList8x8 entries

The Vulkan spec wants ScalingList8x8 as defined by ITU spec, which is in
a different order from how ffmpeg parses it.
This commit is contained in:
Benjamin Cheng 2023-08-01 10:20:34 -04:00 committed by Lynne
parent f6d8464590
commit c0709706dd
1 changed files with 4 additions and 2 deletions

View File

@ -43,6 +43,8 @@ typedef struct H264VulkanDecodePicture {
VkVideoDecodeH264PictureInfoKHR h264_pic_info; VkVideoDecodeH264PictureInfoKHR h264_pic_info;
} H264VulkanDecodePicture; } H264VulkanDecodePicture;
const static int h264_scaling_list8_order[] = { 0, 3, 1, 4, 2, 5 };
static int vk_h264_fill_pict(AVCodecContext *avctx, H264Picture **ref_src, static int vk_h264_fill_pict(AVCodecContext *avctx, H264Picture **ref_src,
VkVideoReferenceSlotInfoKHR *ref_slot, /* Main structure */ VkVideoReferenceSlotInfoKHR *ref_slot, /* Main structure */
VkVideoPictureResourceInfoKHR *ref, /* Goes in ^ */ VkVideoPictureResourceInfoKHR *ref, /* Goes in ^ */
@ -147,7 +149,7 @@ static void set_sps(const SPS *sps,
STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS * sizeof(**sps->scaling_matrix4)); STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS * sizeof(**sps->scaling_matrix4));
for (int i = 0; i < STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS; i++) for (int i = 0; i < STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS; i++)
memcpy(vksps_scaling->ScalingList8x8[i], sps->scaling_matrix8[i], memcpy(vksps_scaling->ScalingList8x8[i], sps->scaling_matrix8[h264_scaling_list8_order[i]],
STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS * sizeof(**sps->scaling_matrix8)); STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS * sizeof(**sps->scaling_matrix8));
*vksps_vui_header = (StdVideoH264HrdParameters) { *vksps_vui_header = (StdVideoH264HrdParameters) {
@ -252,7 +254,7 @@ static void set_pps(const PPS *pps, const SPS *sps,
STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS * sizeof(**pps->scaling_matrix4)); STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS * sizeof(**pps->scaling_matrix4));
for (int i = 0; i < STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS; i++) for (int i = 0; i < STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS; i++)
memcpy(vkpps_scaling->ScalingList8x8[i], pps->scaling_matrix8[i], memcpy(vkpps_scaling->ScalingList8x8[i], pps->scaling_matrix8[h264_scaling_list8_order[i]],
STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS * sizeof(**pps->scaling_matrix8)); STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS * sizeof(**pps->scaling_matrix8));
*vkpps = (StdVideoH264PictureParameterSet) { *vkpps = (StdVideoH264PictureParameterSet) {