From patchwork Tue Aug 1 14:20:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Cheng X-Patchwork-Id: 43061 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c11f:b0:130:ccc6:6c4b with SMTP id bh31csp8277pzb; Tue, 1 Aug 2023 07:20:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlH3dvAhDDKI3UbLVA88rRYn2dyXgnVPVcRYQhgUf70BxZ/OJEZ3+z/GgEzypmk3FAaWJws0 X-Received: by 2002:aa7:cb48:0:b0:522:37ca:a51c with SMTP id w8-20020aa7cb48000000b0052237caa51cmr2275509edt.40.1690899659642; Tue, 01 Aug 2023 07:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690899659; cv=none; d=google.com; s=arc-20160816; b=vA7tlE5mRV2ahbI8xy2XYrRNobdMZT7ViXTNeK9pvyyeI9zI/livG0eNLFT7OsEyio rC8HXKwYpLCt3KpZBqHNlvgX/cwlP8jUZ/xDB+9mObQfCDyNRJHHVtDkMdg8X2RCxTnc MQUgOA8LzmjpcT+V/6YlrRg1tD60uxUvFMqKjPtmdeyMsybV293OF9qCTHZNU7v5J8iF tEQTx74QFS7fZQ0YAhqZqQS3wjMS9SwNuxvtJbvgZx60ZlSCszsh7aBjrCT+wwhs5Tid yVKRwK1gHOAmtrOEEpEI6Pgh7e9W6ky6zwUW5NfDpqkuiIiYcehSpIHXhMLHcAefOBdp 5prw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=BowCk8hS8w6/gNYV7/4vmY+gxpuxko3JnrIX26LZhwc=; fh=nIiBA5N5VLEOhrD4Hg6puXpJPA/uiw+r2g9MqSStBWs=; b=epeuMOdBObRoWcQPw/LUzKwIWAjsGvXwMB3I6ohhqT3/yb2VuxvGfXPEz8upXt3Bi+ CXhPIvLF8IUCySA0JbcochU/z6+0yasb4yvpaZHUtvoCfKPPDtH4IZYka/wztihuHJFf PTtQvKLsL1wvRCJ1/M3JNc9hTfTT0jHBk7l8E2cYxVb8Iv4Na/YYq/B+gZzDwVn9+5cC Vlf0xJmAo5e99xkiOrhbh7aBu73KrdymLtbbq4iq8YS7rlBM58EiOIsPHw07RWTjjT6x SYnvYtBnJwq9hcCaEKOYh04WfurTNK96OtebcjkLwVZWWv2cQaa8KN4voCZCMUedf8q/ OUwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@bcheng.me header.s=key1 header.b=JEvS7kGw; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bcheng.me Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m8-20020aa7c2c8000000b00522b92ae6bfsi4346921edp.504.2023.08.01.07.20.59; Tue, 01 Aug 2023 07:20:59 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@bcheng.me header.s=key1 header.b=JEvS7kGw; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bcheng.me Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BECDD68C51E; Tue, 1 Aug 2023 17:20:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out-64.mta0.migadu.com (out-64.mta0.migadu.com [91.218.175.64]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D053B68B9FF for ; Tue, 1 Aug 2023 17:20:49 +0300 (EEST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bcheng.me; s=key1; t=1690899649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=AaSqi9CYvrRbjcK25IYWEnHPvSk3T1A1rVBSqT4vnIU=; b=JEvS7kGwPc9oIgDXldy809oFs0MoWHWYMdUL7YxfVuWzwDj1DO9gtwSnu588V7nZTKxAi6 bCD5iD1lXCi0SkG7VZtsLoo2gESZKjxBtk17VyXaHNIbvECrxuSpD6log/bjRxgSIqYbBJ vURzHRf4AZSCdPisiMXa8ZKRx0IsmcRS0w+2x2dxMbVc2vffd9vfpzEcxA+kBLSnJh/Hlg E/FQjw8ySh5edMX0vyhMi8wBHKitnBzQT7fwQ5f9Sgx+T5M07VGSgXt53vBsFkBF6lUyCt s0OOwRwQywAW5FlIvddkqswCqkvIk1VE1th2c68xVylh2byjvwiysIz3ik2UJw== From: Benjamin Cheng To: ffmpeg-devel@ffmpeg.org Date: Tue, 1 Aug 2023 10:20:34 -0400 Message-ID: <20230801142034.3341-1-ben@bcheng.me> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Subject: [FFmpeg-devel] [PATCH v3] vulkan_h264: fill correct ScalingList8x8 entries X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Benjamin Cheng Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: kYbCXms31ft7 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) {