Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Benjamin Cheng <ben@bcheng.me>
To: ffmpeg-devel@ffmpeg.org
Cc: Benjamin Cheng <ben@bcheng.me>
Subject: [FFmpeg-devel] [PATCH] vulkan_h264: fill correct ScalingList8x8 entries
Date: Mon, 31 Jul 2023 18:53:14 -0400
Message-ID: <20230731225314.9407-1-ben@bcheng.me> (raw)

The Vulkan spec wants ScalingList8x8 as defined by ITU spec. The latter
only defines ScalingList8x8[0] and ScalingList8x8[1] when
chroma_format_idc != 3.
---
 libavcodec/vulkan_h264.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c
index 84bcef7933..0d81ae8a3c 100644
--- a/libavcodec/vulkan_h264.c
+++ b/libavcodec/vulkan_h264.c
@@ -146,9 +146,17 @@ static void set_sps(const SPS *sps,
         memcpy(vksps_scaling->ScalingList4x4[i], sps->scaling_matrix4[i],
                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++)
-        memcpy(vksps_scaling->ScalingList8x8[i], sps->scaling_matrix8[i],
+    if (sps->chroma_format_idc == 3 /* yuv444 */) {
+        for (int i = 0; i < STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS; i++)
+            memcpy(vksps_scaling->ScalingList8x8[i], sps->scaling_matrix8[i],
+                   STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS * sizeof(**sps->scaling_matrix8));
+    } else {
+        /* All other chroma formats have only 2 scaling 8x8 matrices. */
+        memcpy(vksps_scaling->ScalingList8x8[0], sps->scaling_matrix8[0],
                STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS * sizeof(**sps->scaling_matrix8));
+        memcpy(vksps_scaling->ScalingList8x8[1], sps->scaling_matrix8[3],
+               STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS * sizeof(**sps->scaling_matrix8));
+    }
 
     *vksps_vui_header = (StdVideoH264HrdParameters) {
         .cpb_cnt_minus1 = sps->cpb_cnt - 1,
@@ -251,9 +259,17 @@ static void set_pps(const PPS *pps, const SPS *sps,
         memcpy(vkpps_scaling->ScalingList4x4[i], pps->scaling_matrix4[i],
                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++)
-        memcpy(vkpps_scaling->ScalingList8x8[i], pps->scaling_matrix8[i],
+    if (sps->chroma_format_idc == 3 /* yuv444 */) {
+        for (int i = 0; i < STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS; i++)
+            memcpy(vkpps_scaling->ScalingList8x8[i], pps->scaling_matrix8[i],
+                   STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS * sizeof(**pps->scaling_matrix8));
+    } else {
+        /* All other chroma formats have only 2 scaling 8x8 matrices. */
+        memcpy(vkpps_scaling->ScalingList8x8[0], pps->scaling_matrix8[0],
                STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS * sizeof(**pps->scaling_matrix8));
+        memcpy(vkpps_scaling->ScalingList8x8[1], pps->scaling_matrix8[3],
+               STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS * sizeof(**pps->scaling_matrix8));
+    }
 
     *vkpps = (StdVideoH264PictureParameterSet) {
         .seq_parameter_set_id = pps->sps_id,
-- 
2.41.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

                 reply	other threads:[~2023-07-31 23:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230731225314.9407-1-ben@bcheng.me \
    --to=ben@bcheng.me \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git