From patchwork Thu Jul 25 13:35:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 50728 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc0a:0:b0:482:c625:d099 with SMTP id h10csp565455vqv; Thu, 25 Jul 2024 07:01:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWLw7akNBwdyo80/zblHtT82CtCVPyFVYMJ8DpfN6fVwJV5UKR20+w4I9tjWdMOn/Fr5BCyPF5nS6WvYQl4PIU9VqbdBkRKfOwxjQ== X-Google-Smtp-Source: AGHT+IHosTNpKEgwOeh+7FsXaDSt4GvYG/eIFvrLb3fcUB9tav0FtodgkuseZeNWYnlNPtcHghdY X-Received: by 2002:a2e:8e6b:0:b0:2ee:8d04:7689 with SMTP id 38308e7fff4ca-2f03db7e170mr13169701fa.20.1721916116720; Thu, 25 Jul 2024 07:01:56 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2f03d1a7594si4227261fa.651.2024.07.25.07.01.55; Thu, 25 Jul 2024 07:01:56 -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=@outlook.com header.s=selector1 header.b=Ke2YIRzo; arc=fail (body hash mismatch); 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AE33F68D6C8; Thu, 25 Jul 2024 16:52:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2012.outbound.protection.outlook.com [40.92.53.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6465C68D694 for ; Thu, 25 Jul 2024 16:52:01 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OaBbwhUeJhd8JnaIVISCSTfUM8myp8KIxdJPB1zTbxGi/1GWQMLga/WvdepYTSgcKzlxXzVSHHCvvOjaMNYpk28DCZh0m++74urxYS+lnTpPrqO8BPACYzFA6qqWYVbQj+NvNE9uUYN5kS1Xo8fSs0uXnouHvELo1+zzZEru5IAQ0dk2flz2YOuVBen/qLZudktFIDy5J9KiktSERGUueBPlGRG7+Wtv0WBuo4RlZFtIUmVYDObl9G0CyqV5KdTeLJeOblZXv5gOlFzj9DJxWRgL7eQJ1dDbRjR0lMdmdN3PYYKtGq9tCU/akhVaYMImCbdMvvCYfGlsNxUSp7HtKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NNPIwCkdlf9BfNiXFYgTK0JHMAMINrHItnibn9wtErA=; b=ccwUfhxZj5igJ7e42kBoiD5Ivdg/F70X8nvphD4le5be06c6nc34QoUWgqO+Y+qpt4cAZ3mxZWJbiX8q5E3jSfHO1jbd1rtTguJEgVgaKbNIk56k06xtuME5lLb3yUJ0PvJM6Daho8YHHnDgePG8e+exIYf8ygrGs9qUPicOTI42pTD9osNPPsRorDjNQ+gNlt3EK8lIVAGad/jMFD18TbzWVYAA2bZYoldRMohBbwuzCbYfztTTbZ/ywngTH5NwEN0s9QyFkzugvsf+CS1tzOCW6MXstHbmlL//Lgr3gSSUq1JDMZ4Spt8p/lrhie7ber/ZJpIet1gPxB1ilqM+nw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NNPIwCkdlf9BfNiXFYgTK0JHMAMINrHItnibn9wtErA=; b=Ke2YIRzoqMNjdZYIoikBlGcUVcPkx8dsjVtVtDrpiaJVpO6ch2htPkeP6lhJqXRztUaDOQsGZGBU/eTi5EAPZiPgd4KSQfrNzCSwfoGUJa3trY79Ze5R+9wf6bDAcTZmaA1RaXz8vhOAghhDwJH89uAa7fDtCGidDqQTbL8+7Bwm+jPZZ8BGgbDfEWGFzonCrcXF1JGDHjONrV32V3R6tbqbxqwpjkEFHnaxEQZ4ZQioLbpUlaz4u7dqJJ1mIk6ZhjJ82tkZcqjtuxWO0g5EZFLyPcluRJneqDKpbC40Jf6gnHRXoFeDSCeNgTA/pGv0fR3/dSrJFVj6candXbncaw== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by TYZPR06MB5027.apcprd06.prod.outlook.com (2603:1096:400:1c9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Thu, 25 Jul 2024 13:36:06 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::81f7:9125:583a:1cca]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::81f7:9125:583a:1cca%3]) with mapi id 15.20.7784.020; Thu, 25 Jul 2024 13:36:06 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Jul 2024 21:35:44 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [2RShEL/KPTZty83/vV8KIAhdjPNNmUz0] X-ClientProxiedBy: TYCP286CA0224.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c5::8) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240725133546.19125-1-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|TYZPR06MB5027:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c492936-eec2-4ca7-cdf6-08dcacaebc29 X-Microsoft-Antispam: BCL:0; ARA:14566002|5072599006|19110799003|8060799006|461199028|440099028|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: RM6i7uMkFS5f8GwPnQrfAtm0Vwmri/k3Jys7hzwMJgwlJrdsGubP72yuPI9ybIw3VPC6Sse/hYcHGW9mO7f6BCoG5b7x4ciLRIxCjyABJNN2NTKJPSYoHjPuNmHHkr/i8avXZ2nORAsep2xoaLKzjNNhdCVCkPcnnYlF0aa6hYqSWbkUpRReRGsEj6qng8L7B/C9Pu7oN7KpktOiT8LqsmjKwd/dTrRtcoRKTEDJcMKQvValnPwoltpDpoj2f2cqEuN5od1zFUI14yvJ2kFWJfRGr/lubuW0b+1pcZQf9y/uQGqPAfM5lCqKN4R+AJPcKgGNBioFAvRIgE//DkRF4lpupqxvMqh5g5e4/a5u7Of0RTeBhJj8o43CMdnSpy8yBhd3mS0UgTsyNgm5k84v+sL66CPLQ/hxiqQ1FkFjAbPcUUgVH1ib47JpAw+MorFh+ZTnsbrvIhYWnMUEsz2/fmNl6PzytGSghi4uXcWUTdANImRjy2OWZgojK//1SxW7iwSKtwTG5tHFIS7xSCGkEhEWNYwopIHCi1Nd5lOHsdDqQJE/JMmD+RVNTAdl/kbChbmbUtLEKg4+5Tf5gAamsALBuCeEBo8nVYt3Jn0B5jJcBE7R+023xdqJkhexmrynAkVQ9jVcRCDeoVZE6UYortdMXR30vJy3qUaG8Ja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huLaxgHG2o2enS7mSq9O+vYn9Od83oLtfhHvo0Xl32syvmZu+lVmxnC2mgbQXEJ3p7E27zEuD+cRrgiGPM/cuToUuL38l74duo0qro7+D9g1BWNrM12wklgD6zpOfy+qiDlipoKnaJt78JscYt7eAuN/LW/yuTbnty+OQBMWE6rueVZNtFEuWJWX1XiDXD9F7L9H350FqjIBa1bw6jLS0goDjNugG4qVvX/idKxmisKoStP0imxpbkT0tfu9zWCk8qXxJk01ccL8b2hn8bcudm3+Qsvcgy+lTxsEajtDcFoBcbOe6TSBIWUtaimXX9DhKD2pZi19pLBucA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c492936-eec2-4ca7-cdf6-08dcacaebc29 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2024 13:36:06.4719 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5027 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/vvcdec: Use av_image_copy_plane for DMVR 10-bit integer pixels 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: Nuo Mi Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6i8uBjqYAjdI It's no need to shift and interpolate for 10-bit integer pixels, av_image_copy_plane is enough --- libavcodec/vvc/inter_template.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/vvc/inter_template.c b/libavcodec/vvc/inter_template.c index 89effffb8f..afcee2e360 100644 --- a/libavcodec/vvc/inter_template.c +++ b/libavcodec/vvc/inter_template.c @@ -21,6 +21,7 @@ */ #include "libavcodec/h26x/h2656_inter_template.c" +#include "libavutil/imgutils.h" #define TMP_STRIDE EDGE_EMU_BUFFER_STRIDE static void av_always_inline FUNC(put_scaled)(uint8_t *_dst, const ptrdiff_t _dst_stride, @@ -483,6 +484,7 @@ static void FUNC(apply_bdof)(uint8_t *_dst, const ptrdiff_t _dst_stride, int16_t static void FUNC(dmvr)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, const int height, const intptr_t mx, const intptr_t my, const int width) { +#if BIT_DEPTH != 10 const pixel *src = (const pixel *)_src; const ptrdiff_t src_stride = _src_stride / sizeof(pixel); #if BIT_DEPTH > 10 @@ -491,7 +493,7 @@ static void FUNC(dmvr)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_s #define DMVR_SHIFT(s) (((s) + offset4) >> shift4) #else #define DMVR_SHIFT(s) ((s) << (10 - BIT_DEPTH)) -#endif +#endif // BIT_DEPTH > 10 for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) @@ -500,6 +502,10 @@ static void FUNC(dmvr)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_s dst += MAX_PB_SIZE; } #undef DMVR_SHIFT +#else + av_image_copy_plane((uint8_t*)dst, sizeof(int16_t) * MAX_PB_SIZE, _src, _src_stride, + width * sizeof(pixel), height); +#endif // BIT_DEPTH != 10 } //8.5.3.2.2 Luma sample bilinear interpolation process