From patchwork Tue Aug 16 12:12:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 37307 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3d0d:b0:8d:a68e:8a0e with SMTP id y13csp1824500pzi; Tue, 16 Aug 2022 05:12:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR5wRxITvmIcgSTtFrKg2p9G1TTsDzIqRFctqucXAtA9m4ODB44mfGWr9dK5Gl39Qh0bfrJ4 X-Received: by 2002:a17:907:842:b0:731:3310:4187 with SMTP id ww2-20020a170907084200b0073133104187mr12644731ejb.578.1660651945699; Tue, 16 Aug 2022 05:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660651945; cv=none; d=google.com; s=arc-20160816; b=Z0XvEzDxSlwhbCZAnd+egYmFHWIqlmKJ8H3gBUZGpgkyTOT8buphRzFYWrEx6tR83C tGJwZY/WBXvv6tHm4Ao2EwusXubnXxkmRp75hmmOtVMMWV6Fdr+4rEXEu1/Zz0svddpD wOrVBKW90VrVOEPO/6QqM6al56X1JDjWBTv7fRhN7QYcoKRVINbX7mB3ITRY22dq57vC AygsAdAUJA9BfWf01DXPuuIyyveuCLCGL15vFPwHLTSMSlbN/OJDgJzKog5CpizAUORR Du4x3Z+QXTCvGJiCBTTGgVIE8Vy0y7nkiCdPifMT1ANt0rb6IBPNHZ0q+IXH3qApfgw1 uM7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=rRT3RziW/F5X17LT9zLc7nLbDcXH6iK4CrS5/5W3bQY=; b=yRU8+Y8E3+2XFr0UVBxsYlWP3G09TjrN8r9Pq7pzhgPk4+Zz70BxXYTAc7NGevQU+E 49igAZJ2YRHcLcv7rxu7X1EFthT6qhqBcRIOJV79A/mNy0R27jKGsQkufDRZD8i6CLIe GcyJp2FbKjd82V8WKwto/Fnd66oUVJ2bLHquPvWpoXdKtuhbl+HLOMwL2drasn5CsnHB X/jLm5wyzC37BqX2CKE8Cr5O5ciTuC7XvuA5oV2nNmwd8EdtDI74GCIXQtmNyNdK28HR FCWigx3UhjgmBOyzVUzvN01k8iVf7jlAkj99ithQuJfovHsjCfFIzG8X6YhAzVGtoeGC T3lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b=NmApDxlF; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b=NCsFOXcc; 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 q15-20020a50cc8f000000b0043ade0b9a7fsi9710293edi.195.2022.08.16.05.12.24; Tue, 16 Aug 2022 05:12:25 -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=@itanimul.li header.s=fm2 header.b=NmApDxlF; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b=NCsFOXcc; 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 4F25068B810; Tue, 16 Aug 2022 15:12:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from wout1-smtp.messagingengine.com (unknown [64.147.123.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E7B868AFBA for ; Tue, 16 Aug 2022 15:12:13 +0300 (EEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 8EF49320015C for ; Tue, 16 Aug 2022 08:12:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 16 Aug 2022 08:12:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1660651930; x=1660738330; bh=Hi wZVUdzjH8j46gXspcNWCS/QodObfOWWzGg9ThMuXk=; b=NmApDxlFRF7DhlZvzv fwM1XA/nIYJo09bJDhRnDdUFtbAwU7WhHczvREd00wYTbLBq01R8uzcd6nIb0LLY iql8A153Ux5kNo+OYihJ+YLA2OxZe9I8Mr0WBFbpUVbahp/jW13VDt6Yoe95wXDL JOMMkoUQndkfhxuZcvx2x7Jys/fWQx7F4ZWyq7GNIEqmWDWqdByFwLk5lPH1PnO6 wXCcq+I+Qp5Gqy/ZmhYbBxV0NdWwg4k3SWO/KGBNPanleObu/xrVr/8BMRU2QFQF NzQBBKOEjlfuYv76qZkVLeg01TMYkVUsWJiwuZF4ZfnX3pwmzi5Lk1Gsi3X25U+a +baw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1660651930; x=1660738330; bh=HiwZVUdzjH8j4 6gXspcNWCS/QodObfOWWzGg9ThMuXk=; b=NCsFOXcciiCX64QrVqnGOvkHwKsZ7 ZvvICsYaqaKls5L0np1a86z/RYTKSpfgMGosWb0hDu6g7XJRANs3WoZUI3Sin9cT Uo5GQw+2e/j22xzS/DUfBBWoGYsIRxmfkqL5vNAHfLQ7z1icO8AwACFVd6XVudIa MyLmlkFio/VeOBr4aMk2n3MByzIly6J//VHquSSCrqFMEAFbjzHhc4VVqjLRNuZD PpPlswWP1wjhCy8ApFv5IyBo2p6oHuzqsqBMaMVmK7iUAT7/7VKvtATaVnq1/SnP e+OlqxmUMYbPrt2824U6KY1QrUOqbR7cK4CSe4hR615G/yDkocO4ZHtFA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdehgedggeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepfdflrdcuffgvkhhkvghrfdcuoehjuggvkhesihhtrghnihhm uhhlrdhliheqnecuggftrfgrthhtvghrnhephfdvfeejffegffefieefvefgheeuudelhe fhffevtddthfehudeitdetfeehieetnecuffhomhgrihhnpehnvghonhdrshgsnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhguvghksehith grnhhimhhulhdrlhhi X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 16 Aug 2022 08:12:09 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Tue, 16 Aug 2022 14:12:06 +0200 Message-Id: <20220816121206.18448-1-jdek@itanimul.li> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <1d56db3e-e76b-7472-47-5b7ce1f0aac2@martin.st> References: <1d56db3e-e76b-7472-47-5b7ce1f0aac2@martin.st> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3] lavc/aarch64: hevc_add_res add 12bit variants 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Gr8zWLmo4N7x hevc_add_res_4x4_12_c: 46.0 hevc_add_res_4x4_12_neon: 18.7 hevc_add_res_8x8_12_c: 194.7 hevc_add_res_8x8_12_neon: 25.2 hevc_add_res_16x16_12_c: 716.0 hevc_add_res_16x16_12_neon: 69.7 hevc_add_res_32x32_12_c: 3820.7 hevc_add_res_32x32_12_neon: 261.0 Signed-off-by: J. Dekker --- libavcodec/aarch64/hevcdsp_idct_neon.S | 156 ++++++++++++---------- libavcodec/aarch64/hevcdsp_init_aarch64.c | 34 ++--- 2 files changed, 105 insertions(+), 85 deletions(-) diff --git a/libavcodec/aarch64/hevcdsp_idct_neon.S b/libavcodec/aarch64/hevcdsp_idct_neon.S index 484eea8437..97c51e06e3 100644 --- a/libavcodec/aarch64/hevcdsp_idct_neon.S +++ b/libavcodec/aarch64/hevcdsp_idct_neon.S @@ -37,11 +37,11 @@ const trans, align=4 .short 31, 22, 13, 4 endconst -.macro clip10 in1, in2, c1, c2 - smax \in1, \in1, \c1 - smax \in2, \in2, \c1 - smin \in1, \in1, \c2 - smin \in2, \in2, \c2 +.macro clip2 in1, in2, min, max + smax \in1, \in1, \min + smax \in2, \in2, \min + smin \in1, \in1, \max + smin \in2, \in2, \max .endm function ff_hevc_add_residual_4x4_8_neon, export=1 @@ -64,25 +64,6 @@ function ff_hevc_add_residual_4x4_8_neon, export=1 ret endfunc -function ff_hevc_add_residual_4x4_10_neon, export=1 - mov x12, x0 - ld1 {v0.8h-v1.8h}, [x1] - ld1 {v2.d}[0], [x12], x2 - ld1 {v2.d}[1], [x12], x2 - ld1 {v3.d}[0], [x12], x2 - sqadd v0.8h, v0.8h, v2.8h - ld1 {v3.d}[1], [x12], x2 - movi v4.8h, #0 - sqadd v1.8h, v1.8h, v3.8h - mvni v5.8h, #0xFC, lsl #8 // movi #0x3FF - clip10 v0.8h, v1.8h, v4.8h, v5.8h - st1 {v0.d}[0], [x0], x2 - st1 {v0.d}[1], [x0], x2 - st1 {v1.d}[0], [x0], x2 - st1 {v1.d}[1], [x0], x2 - ret -endfunc - function ff_hevc_add_residual_8x8_8_neon, export=1 add x12, x0, x2 add x2, x2, x2 @@ -103,25 +84,6 @@ function ff_hevc_add_residual_8x8_8_neon, export=1 ret endfunc -function ff_hevc_add_residual_8x8_10_neon, export=1 - add x12, x0, x2 - add x2, x2, x2 - mov x3, #8 - movi v4.8h, #0 - mvni v5.8h, #0xFC, lsl #8 // movi #0x3FF -1: subs x3, x3, #2 - ld1 {v0.8h-v1.8h}, [x1], #32 - ld1 {v2.8h}, [x0] - sqadd v0.8h, v0.8h, v2.8h - ld1 {v3.8h}, [x12] - sqadd v1.8h, v1.8h, v3.8h - clip10 v0.8h, v1.8h, v4.8h, v5.8h - st1 {v0.8h}, [x0], x2 - st1 {v1.8h}, [x12], x2 - bne 1b - ret -endfunc - function ff_hevc_add_residual_16x16_8_neon, export=1 mov x3, #16 add x12, x0, x2 @@ -148,28 +110,6 @@ function ff_hevc_add_residual_16x16_8_neon, export=1 ret endfunc -function ff_hevc_add_residual_16x16_10_neon, export=1 - mov x3, #16 - movi v20.8h, #0 - mvni v21.8h, #0xFC, lsl #8 // movi #0x3FF - add x12, x0, x2 - add x2, x2, x2 -1: subs x3, x3, #2 - ld1 {v16.8h-v17.8h}, [x0] - ld1 {v0.8h-v3.8h}, [x1], #64 - sqadd v0.8h, v0.8h, v16.8h - ld1 {v18.8h-v19.8h}, [x12] - sqadd v1.8h, v1.8h, v17.8h - sqadd v2.8h, v2.8h, v18.8h - sqadd v3.8h, v3.8h, v19.8h - clip10 v0.8h, v1.8h, v20.8h, v21.8h - clip10 v2.8h, v3.8h, v20.8h, v21.8h - st1 {v0.8h-v1.8h}, [x0], x2 - st1 {v2.8h-v3.8h}, [x12], x2 - bne 1b - ret -endfunc - function ff_hevc_add_residual_32x32_8_neon, export=1 add x12, x0, x2 add x2, x2, x2 @@ -209,10 +149,88 @@ function ff_hevc_add_residual_32x32_8_neon, export=1 ret endfunc -function ff_hevc_add_residual_32x32_10_neon, export=1 +.macro add_res bitdepth +function ff_hevc_add_residual_4x4_\bitdepth\()_neon, export=1 + mvni v21.8h, #((0xFF << (\bitdepth - 8)) & 0xFF), lsl #8 + b hevc_add_residual_4x4_16_neon +endfunc +function ff_hevc_add_residual_8x8_\bitdepth\()_neon, export=1 + mvni v21.8h, #((0xFF << (\bitdepth - 8)) & 0xFF), lsl #8 + b hevc_add_residual_8x8_16_neon +endfunc +function ff_hevc_add_residual_16x16_\bitdepth\()_neon, export=1 + mvni v21.8h, #((0xFF << (\bitdepth - 8)) & 0xFF), lsl #8 + b hevc_add_residual_16x16_16_neon +endfunc +function ff_hevc_add_residual_32x32_\bitdepth\()_neon, export=1 + mvni v21.8h, #((0xFF << (\bitdepth - 8)) & 0xFF), lsl #8 + b hevc_add_residual_32x32_16_neon +endfunc +.endm + +add_res 10 +add_res 12 + +function hevc_add_residual_4x4_16_neon, export=0 + mov x12, x0 + ld1 {v0.8h-v1.8h}, [x1] + ld1 {v2.d}[0], [x12], x2 + ld1 {v2.d}[1], [x12], x2 + ld1 {v3.d}[0], [x12], x2 + sqadd v0.8h, v0.8h, v2.8h + ld1 {v3.d}[1], [x12], x2 + movi v4.8h, #0 + sqadd v1.8h, v1.8h, v3.8h + clip2 v0.8h, v1.8h, v4.8h, v21.8h + st1 {v0.d}[0], [x0], x2 + st1 {v0.d}[1], [x0], x2 + st1 {v1.d}[0], [x0], x2 + st1 {v1.d}[1], [x0], x2 + ret +endfunc + +function hevc_add_residual_8x8_16_neon, export=0 + add x12, x0, x2 + add x2, x2, x2 + mov x3, #8 + movi v4.8h, #0 +1: subs x3, x3, #2 + ld1 {v0.8h-v1.8h}, [x1], #32 + ld1 {v2.8h}, [x0] + sqadd v0.8h, v0.8h, v2.8h + ld1 {v3.8h}, [x12] + sqadd v1.8h, v1.8h, v3.8h + clip2 v0.8h, v1.8h, v4.8h, v21.8h + st1 {v0.8h}, [x0], x2 + st1 {v1.8h}, [x12], x2 + bne 1b + ret +endfunc + +function hevc_add_residual_16x16_16_neon, export=0 + mov x3, #16 + movi v20.8h, #0 + add x12, x0, x2 + add x2, x2, x2 +1: subs x3, x3, #2 + ld1 {v16.8h-v17.8h}, [x0] + ld1 {v0.8h-v3.8h}, [x1], #64 + sqadd v0.8h, v0.8h, v16.8h + ld1 {v18.8h-v19.8h}, [x12] + sqadd v1.8h, v1.8h, v17.8h + sqadd v2.8h, v2.8h, v18.8h + sqadd v3.8h, v3.8h, v19.8h + clip2 v0.8h, v1.8h, v20.8h, v21.8h + clip2 v2.8h, v3.8h, v20.8h, v21.8h + st1 {v0.8h-v1.8h}, [x0], x2 + st1 {v2.8h-v3.8h}, [x12], x2 + bne 1b + ret +endfunc + +function hevc_add_residual_32x32_16_neon, export=0 mov x3, #32 movi v20.8h, #0 - mvni v21.8h, #0xFC, lsl #8 // movi #0x3FF 1: subs x3, x3, #1 ld1 {v0.8h -v3.8h}, [x1], #64 ld1 {v16.8h-v19.8h}, [x0] @@ -220,8 +238,8 @@ function ff_hevc_add_residual_32x32_10_neon, export=1 sqadd v1.8h, v1.8h, v17.8h sqadd v2.8h, v2.8h, v18.8h sqadd v3.8h, v3.8h, v19.8h - clip10 v0.8h, v1.8h, v20.8h, v21.8h - clip10 v2.8h, v3.8h, v20.8h, v21.8h + clip2 v0.8h, v1.8h, v20.8h, v21.8h + clip2 v2.8h, v3.8h, v20.8h, v21.8h st1 {v0.8h-v3.8h}, [x0], x2 bne 1b ret diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c index 9cbe983870..b6d5efb77f 100644 --- a/libavcodec/aarch64/hevcdsp_init_aarch64.c +++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c @@ -25,22 +25,18 @@ #include "libavutil/aarch64/cpu.h" #include "libavcodec/hevcdsp.h" -void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, const int16_t *coeffs, - ptrdiff_t stride); -void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, const int16_t *coeffs, - ptrdiff_t stride); -void ff_hevc_add_residual_8x8_8_neon(uint8_t *_dst, const int16_t *coeffs, - ptrdiff_t stride); -void ff_hevc_add_residual_8x8_10_neon(uint8_t *_dst, const int16_t *coeffs, - ptrdiff_t stride); -void ff_hevc_add_residual_16x16_8_neon(uint8_t *_dst, const int16_t *coeffs, - ptrdiff_t stride); -void ff_hevc_add_residual_16x16_10_neon(uint8_t *_dst, const int16_t *coeffs, - ptrdiff_t stride); -void ff_hevc_add_residual_32x32_8_neon(uint8_t *_dst, const int16_t *coeffs, - ptrdiff_t stride); -void ff_hevc_add_residual_32x32_10_neon(uint8_t *_dst, const int16_t *coeffs, - ptrdiff_t stride); +void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); +void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); +void ff_hevc_add_residual_4x4_12_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); +void ff_hevc_add_residual_8x8_8_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); +void ff_hevc_add_residual_8x8_10_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); +void ff_hevc_add_residual_8x8_12_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); +void ff_hevc_add_residual_16x16_8_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); +void ff_hevc_add_residual_16x16_10_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); +void ff_hevc_add_residual_16x16_12_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); +void ff_hevc_add_residual_32x32_8_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); +void ff_hevc_add_residual_32x32_10_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); +void ff_hevc_add_residual_32x32_12_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit); void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit); void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit); @@ -100,4 +96,10 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) c->idct_dc[2] = ff_hevc_idct_16x16_dc_10_neon; c->idct_dc[3] = ff_hevc_idct_32x32_dc_10_neon; } + if (bit_depth == 12) { + c->add_residual[0] = ff_hevc_add_residual_4x4_12_neon; + c->add_residual[1] = ff_hevc_add_residual_8x8_12_neon; + c->add_residual[2] = ff_hevc_add_residual_16x16_12_neon; + c->add_residual[3] = ff_hevc_add_residual_32x32_12_neon; + } }