From patchwork Mon Aug 21 14:05:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Cheng X-Patchwork-Id: 43279 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:47ca:b0:130:ccc6:6c4b with SMTP id ey10csp1457692pzb; Mon, 21 Aug 2023 07:06:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGGMUUzHK/MlS2LsNCFznmtOO4HSuzJ6IOlfqceFSMLTbBRlaGdiCPueWS41XV9mCnjc1u X-Received: by 2002:a17:907:72c2:b0:9a1:9e1a:4e99 with SMTP id du2-20020a17090772c200b009a19e1a4e99mr1845257ejc.23.1692626772680; Mon, 21 Aug 2023 07:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692626772; cv=none; d=google.com; s=arc-20160816; b=dkHQnbYa1XGQg0CQ4KGOuSrB0bFVIk1+9J3tla7UIoPnocuSNlb0T/g3XsGRPOqeNB HBZ7Ct2WvYs3A9unGRWnE62jmcqVbwsUuU3v+aSdzEiNAFDql7Bme5YIGae1gXUuVnmu hN0HpdLqqsNjQsdKPpvc6Cc5XzriPzTALW3oIWl8I+b9SPQibkGXWaJjcT103bhVxw1q Z93SzHV5IjYDDVtHEiSIx+llRvHc8P4PBzROf22uKoT4KdiEiy2vCL8BKywzb8fNOOjK m0IzbE4sVTx1KZ+AdhnNmPIsmSbaDne6oLyxNDAg/uXWW3nB6XKBb7PalwiVLXK9slcy DdwQ== 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:from :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to :delivered-to; bh=s1GURyPGDutHVq+zyYOBlE6z1GPWS2y+dSmJ2DfEMNI=; fh=7Kgvd9OKf4EH/S3j2NwRLYcRcmqTW6Epo5bNDBvSZdo=; b=Xp8jw7M31aBAQGKZloFITrDMzq9cv3hIjcwxFm9puDJn5Ri9JJL5hcUWIOVQJUIY+f h21rKqO1B3lKNeVvLc76Rioo5d5WFAX6dFi4LAeLCDU/7gxu2z8mvtjLSz7PF6IEdEqY 5FfPOoWp3iY6XlWzsIoLgitLDhO451Aobps91pq4+Gyg/YYQf5tbpj3klJHFpRJoySjF eHh+QP2QrSMXgA1lqd2kDbPsPwLUiwaabITSIaxgPlw6B3RgAXBLm9pZ42s4p4NmxwSx 38Ppqj5mUe2FBJTTTbqJah52dEhcPd9R01vi/MtJMMXDJ/AzOQMOOCPqTVdtnFgJy+x2 muKg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bj14-20020a170906b04e00b009924806cd01si6014294ejb.386.2023.08.21.07.05.55; Mon, 21 Aug 2023 07:06:12 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AB97C68C40B; Mon, 21 Aug 2023 17:05:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out-58.mta1.migadu.com (out-58.mta1.migadu.com [95.215.58.58]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B5DAE689E65 for ; Mon, 21 Aug 2023 17:05:44 +0300 (EEST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Aug 2023 10:05:03 -0400 Message-ID: <20230821140503.25173-1-ben@bcheng.me> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Subject: [FFmpeg-devel] [PATCH] vulkan_h264: send scaling lists in zig-zag order 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: , X-Patchwork-Original-From: Benjamin Cheng via ffmpeg-devel From: Benjamin Cheng Reply-To: FFmpeg development discussions and patches Cc: Benjamin Cheng Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: QVlFYqUIuzdk 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,