[FFmpeg-devel] [PATCH] vulkan_h264: send scaling lists in zig-zag order
Benjamin Cheng
ben at bcheng.me
Mon Aug 21 17:05:03 EEST 2023
h264_ps turns the scaling lists into matrices with a raster scan order,
but Vulkan wants the scaling lists as originally defined.
---
libavcodec/vulkan_h264.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c
index f38bb9057b..9fe0d194f5 100644
--- a/libavcodec/vulkan_h264.c
+++ b/libavcodec/vulkan_h264.c
@@ -145,12 +145,13 @@ static void set_sps(const SPS *sps,
};
for (int i = 0; i < STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS; i++)
- memcpy(vksps_scaling->ScalingList4x4[i], sps->scaling_matrix4[i],
- STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS * sizeof(**sps->scaling_matrix4));
+ for (int j = 0; j < STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS; j++)
+ vksps_scaling->ScalingList4x4[i][j] = sps->scaling_matrix4[i][ff_zigzag_scan[j]];
for (int i = 0; i < STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS; 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));
+ for (int j = 0; j < STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS; j++)
+ vksps_scaling->ScalingList8x8[i][j] =
+ sps->scaling_matrix8[h264_scaling_list8_order[i]][ff_zigzag_direct[j]];
*vksps_vui_header = (StdVideoH264HrdParameters) {
.cpb_cnt_minus1 = sps->cpb_cnt - 1,
@@ -250,12 +251,13 @@ static void set_pps(const PPS *pps, const SPS *sps,
};
for (int i = 0; i < STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS; i++)
- memcpy(vkpps_scaling->ScalingList4x4[i], pps->scaling_matrix4[i],
- STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS * sizeof(**pps->scaling_matrix4));
+ for (int j = 0; j < STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS; j++)
+ vkpps_scaling->ScalingList4x4[i][j] = pps->scaling_matrix4[i][ff_zigzag_scan[j]];
for (int i = 0; i < STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS; 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));
+ for (int j = 0; j < STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS; j++)
+ vkpps_scaling->ScalingList8x8[i][j] =
+ pps->scaling_matrix8[h264_scaling_list8_order[i]][ff_zigzag_direct[j]];
*vkpps = (StdVideoH264PictureParameterSet) {
.seq_parameter_set_id = pps->sps_id,
--
2.41.0
More information about the ffmpeg-devel
mailing list