[FFmpeg-cvslog] vulkan_h264: send scaling lists in zig-zag order

Benjamin Cheng git at videolan.org
Fri Aug 25 05:59:32 EEST 2023


ffmpeg | branch: master | Benjamin Cheng <ben at bcheng.me> | Mon Aug 21 10:05:03 2023 -0400| [b4f0701358604df5283b6e2942dfbc9421cb19d4] | committer: Lynne

vulkan_h264: send scaling lists in zig-zag order

h264_ps turns the scaling lists into matrices with a raster scan order,
but Vulkan wants the scaling lists as originally defined.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b4f0701358604df5283b6e2942dfbc9421cb19d4
---

 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,



More information about the ffmpeg-cvslog mailing list