Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v3] vulkan_h264: fill correct ScalingList8x8 entries
@ 2023-08-01 14:20 Benjamin Cheng
  2023-08-08  6:31 ` Lynne
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Cheng @ 2023-08-01 14:20 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Benjamin Cheng

The Vulkan spec wants ScalingList8x8 as defined by ITU spec, which is in
a different order from how ffmpeg parses it.

v2: generalize for 444 case
v3: fix whitespace
---
 libavcodec/vulkan_h264.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c
index 84bcef7933..20e03dd26a 100644
--- a/libavcodec/vulkan_h264.c
+++ b/libavcodec/vulkan_h264.c
@@ -43,6 +43,8 @@ typedef struct H264VulkanDecodePicture {
     VkVideoDecodeH264PictureInfoKHR h264_pic_info;
 } 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,
                              VkVideoReferenceSlotInfoKHR *ref_slot,       /* Main structure */
                              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));
 
     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));
 
     *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));
 
     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));
 
     *vkpps = (StdVideoH264PictureParameterSet) {
-- 
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3] vulkan_h264: fill correct ScalingList8x8 entries
  2023-08-01 14:20 [FFmpeg-devel] [PATCH v3] vulkan_h264: fill correct ScalingList8x8 entries Benjamin Cheng
@ 2023-08-08  6:31 ` Lynne
  0 siblings, 0 replies; 2+ messages in thread
From: Lynne @ 2023-08-08  6:31 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Aug 1, 2023, 16:21 by ben@bcheng.me:

> The Vulkan spec wants ScalingList8x8 as defined by ITU spec, which is in
> a different order from how ffmpeg parses it.
>
> v2: generalize for 444 case
> v3: fix whitespace
> ---
>  libavcodec/vulkan_h264.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c
> index 84bcef7933..20e03dd26a 100644
> --- a/libavcodec/vulkan_h264.c
> +++ b/libavcodec/vulkan_h264.c
> @@ -43,6 +43,8 @@ typedef struct H264VulkanDecodePicture {
>  VkVideoDecodeH264PictureInfoKHR h264_pic_info;
>  } 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,
>  VkVideoReferenceSlotInfoKHR *ref_slot,       /* Main structure */
>  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));
>  
>  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));
>  
>  *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));
>  
>  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));
>  
>  *vkpps = (StdVideoH264PictureParameterSet) {
> -- 
> 2.41.0
>

Thanks, pushed
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-08  6:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-01 14:20 [FFmpeg-devel] [PATCH v3] vulkan_h264: fill correct ScalingList8x8 entries Benjamin Cheng
2023-08-08  6:31 ` Lynne

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