From patchwork Thu Jan 7 11:26:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Dekker X-Patchwork-Id: 24826 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id B988C44BAE0 for ; Thu, 7 Jan 2021 13:26:26 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8C3B1689FB4; Thu, 7 Jan 2021 13:26:26 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 79117688131 for ; Thu, 7 Jan 2021 13:26:19 +0200 (EET) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id B3E9F176E for ; Thu, 7 Jan 2021 06:26:16 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 07 Jan 2021 06:26:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= from:to:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=co/mWYe5kJsbxMyYfsvAmFe44w hKjUux3/TBiWwpYTs=; b=VXHYlifML1TmzJTexBlfS/R3MICS9D89NDyhmEstIM wXpDNS6zcMra+l1nAXC6iLg1oMMo6CSt9trHF2vftGuEXdsLlAYLy47HY3MIbULF n2vuIt1nGVwADIWNSr4FfZdVbhtj3tDwQqCMGJtOKnl6x2RuKwnKuDqvW41de4tu L2BlbZc92onGqOiUdZSmVG8C2A73EF036cj6qPf7mNiXMJqsqZlJBvbgzCGH6EPd rVkHhca/ZT0EwYcELA4ZsDHKKbrl3R541jFLDac/665t+Kvnv6w4KoW7UIyIZQXM U+EwoyLCVfACsv4qgrpkT6V/SYeM/ywnvCGJwe9+5tmQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=co/mWYe5kJsbxMyYf svAmFe44whKjUux3/TBiWwpYTs=; b=hftzPm5Z2VMrgnZJSrM2GNWDvX+W5Ddhs BtitCnhulVFHwHNWwWMSLMp4htc39olfMq1/eFb9+W5VJAdYWz7NyaSUKCiaZsez mcL9KEft7Yfqz0IQZ9Kv+eW+tIaY8RJUgmtT/4FWTdpw6bLI4RLP15A/Klu46gpT Mfq8bKDwUkU72Ilw2KVYlP6OUcsm+utJAzYxEr2Kiqh5kH+E81FOO3G6RNHWo18L uNa94I6H53esJhXbNHdQeeGeOdQ+eTitOxI94Pp5NBtvElkb0zpYu55aKFrcTK8M qOthFPkk/MSiAoq5sIImVzV8RA8E6KY0a5FawVlnyJ4Fblg///cAA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdegvddgvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdekredtre dttdenucfhrhhomheplfhoshhhucffvghkkhgvrhcuoehjohhshhesihhtrghnihhmuhhl rdhliheqnecuggftrfgrthhtvghrnhepuddttdetieelgfelgefffeevtefgheekudehvd ffjedtleeiveeifeelgedvhfeinecuffhomhgrihhnpehnvghonhdrshgsnecukfhppeek kedrudeftddrgeekrddufeejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepjhhoshhhsehithgrnhhimhhulhdrlhhi X-ME-Proxy: Received: from localhost.localdomain (mue-88-130-48-137.dsl.tropolys.de [88.130.48.137]) by mail.messagingengine.com (Postfix) with ESMTPA id 74F30108005B for ; Thu, 7 Jan 2021 06:26:15 -0500 (EST) From: Josh Dekker To: ffmpeg-devel@ffmpeg.org Date: Thu, 7 Jan 2021 12:26:14 +0100 Message-Id: <20210107112614.81949-1-josh@itanimul.li> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/aarch64: add HEVC add_residual NEON X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Signed-off-by: Josh Dekker --- checkasm: all 648 tests passed hevc_add_res_4x4_8_c: 49.7 hevc_add_res_4x4_8_neon: 20.5 hevc_add_res_4x4_10_c: 46.0 hevc_add_res_4x4_10_neon: 19.0 hevc_add_res_8x8_8_c: 209.0 hevc_add_res_8x8_8_neon: 24.5 hevc_add_res_8x8_10_c: 192.7 hevc_add_res_8x8_10_neon: 27.0 hevc_add_res_16x16_8_c: 791.5 hevc_add_res_16x16_8_neon: 79.0 hevc_add_res_16x16_10_c: 711.0 hevc_add_res_16x16_10_neon: 77.7 hevc_add_res_32x32_8_c: 3431.2 hevc_add_res_32x32_8_neon: 306.5 hevc_add_res_32x32_10_c: 3825.0 hevc_add_res_32x32_10_neon: 299.5 libavcodec/aarch64/Makefile | 3 + libavcodec/aarch64/hevcdsp_add_res_neon.S | 298 ++++++++++++++++++++++ libavcodec/aarch64/hevcdsp_idct_neon.S | 24 ++ libavcodec/aarch64/hevcdsp_init.c | 59 +++++ libavcodec/hevcdsp.c | 2 + libavcodec/hevcdsp.h | 1 + 6 files changed, 387 insertions(+) create mode 100644 libavcodec/aarch64/hevcdsp_add_res_neon.S create mode 100644 libavcodec/aarch64/hevcdsp_idct_neon.S create mode 100644 libavcodec/aarch64/hevcdsp_init.c diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile index f6434e40da..0eaafce74b 100644 --- a/libavcodec/aarch64/Makefile +++ b/libavcodec/aarch64/Makefile @@ -17,6 +17,7 @@ OBJS-$(CONFIG_VP8DSP) += aarch64/vp8dsp_init_aarch64.o OBJS-$(CONFIG_AAC_DECODER) += aarch64/aacpsdsp_init_aarch64.o \ aarch64/sbrdsp_init_aarch64.o OBJS-$(CONFIG_DCA_DECODER) += aarch64/synth_filter_init.o +OBJS-$(CONFIG_HEVC_DECODER) += aarch64/hevcdsp_init.o OBJS-$(CONFIG_OPUS_DECODER) += aarch64/opusdsp_init.o OBJS-$(CONFIG_RV40_DECODER) += aarch64/rv40dsp_init_aarch64.o OBJS-$(CONFIG_VC1DSP) += aarch64/vc1dsp_init_aarch64.o @@ -53,6 +54,8 @@ NEON-OBJS-$(CONFIG_VP8DSP) += aarch64/vp8dsp_neon.o # decoders/encoders NEON-OBJS-$(CONFIG_AAC_DECODER) += aarch64/aacpsdsp_neon.o NEON-OBJS-$(CONFIG_DCA_DECODER) += aarch64/synth_filter_neon.o +NEON-OBJS-$(CONFIG_HEVC_DECODER) += aarch64/hevcdsp_add_res_neon.o \ + aarch64/hevcdsp_idct_neon.o NEON-OBJS-$(CONFIG_OPUS_DECODER) += aarch64/opusdsp_neon.o NEON-OBJS-$(CONFIG_VORBIS_DECODER) += aarch64/vorbisdsp_neon.o NEON-OBJS-$(CONFIG_VP9_DECODER) += aarch64/vp9itxfm_16bpp_neon.o \ diff --git a/libavcodec/aarch64/hevcdsp_add_res_neon.S b/libavcodec/aarch64/hevcdsp_add_res_neon.S new file mode 100644 index 0000000000..dc7e8127b9 --- /dev/null +++ b/libavcodec/aarch64/hevcdsp_add_res_neon.S @@ -0,0 +1,298 @@ +/* -*-armv8-*- + * + * AArch64 NEON optimised add residual functions for HEVC decoding + * + * Copyright (c) 2020 Josh Dekker + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/aarch64/asm.S" + +.macro clip10 in1, in2, c1, c2 + smax \in1, \in1, \c1 + smax \in2, \in2, \c1 + smin \in1, \in1, \c2 + smin \in2, \in2, \c2 +.endm + +function ff_hevc_add_residual_4x4_8_neon, export=1 + mov x3, x0 + ld1 {v0.S}[0], [x3], x2 + ld1 {v0.S}[1], [x3], x2 + ld1 {v1.S}[0], [x3], x2 + ld1 {v1.S}[1], [x3], x2 + ld1 { v2.8H-v3.8H}, [x1] + ushll v4.8H, v0.8B, #0 + ushll v5.8H, v1.8B, #0 + add v6.8H, v4.8H, v2.8H + add v7.8H, v5.8H, v3.8H + sqxtun v0.8B, v6.8H + sqxtun v1.8B, v7.8H + st1 {v0.S}[0], [x0], x2 + st1 {v0.S}[1], [x0], x2 + st1 {v1.S}[0], [x0], x2 + st1 {v1.S}[1], [x0], x2 + ret +endfunc + +function ff_hevc_add_residual_4x4_10_neon, export=1 + mov x3, x0 + movi v4.8H, #0 + mvni v5.8H, #0xFC, lsl #8 + ld1 {v0.D}[0], [x3], x2 + ld1 {v0.D}[1], [x3], x2 + ld1 {v1.D}[0], [x3], x2 + ld1 {v1.D}[1], [x3], x2 + ld1 { v2.8H-v3.8H}, [x1] + add v2.8H, v0.8H, v2.8H + add v3.8H, v1.8H, v3.8H + clip10 v2.8H, v3.8H, v4.8H, v5.8H + st1 {v2.D}[0], [x0], x2 + st1 {v2.D}[1], [x0], x2 + st1 {v3.D}[0], [x0], x2 + st1 {v3.D}[1], [x0], x2 + ret +endfunc + +function ff_hevc_add_residual_8x8_8_neon, export=1 + mov x3, x0 + ld1 {v0.8B}, [x3], x2 + ld1 {v1.8B}, [x3], x2 + ld1 {v2.8B}, [x3], x2 + ld1 {v3.8B}, [x3], x2 + ld1 {v4.8B}, [x3], x2 + ld1 {v5.8B}, [x3], x2 + ld1 {v6.8B}, [x3], x2 + ld1 {v7.8B}, [x3], x2 + ld1 { v16.8H-v19.8H}, [x1], #64 + ld1 { v20.8H-v23.8H}, [x1] + ushll v24.8H, v0.8B, #0 + ushll v25.8H, v1.8B, #0 + ushll v26.8H, v2.8B, #0 + ushll v27.8H, v3.8B, #0 + ushll v28.8H, v4.8B, #0 + ushll v29.8H, v5.8B, #0 + ushll v30.8H, v6.8B, #0 + ushll v31.8H, v7.8B, #0 + add v0.8H, v24.8H, v16.8H + add v1.8H, v25.8H, v17.8H + add v2.8H, v26.8H, v18.8H + add v3.8H, v27.8H, v19.8H + add v4.8H, v28.8H, v20.8H + add v5.8H, v29.8H, v21.8H + add v6.8H, v30.8H, v22.8H + add v7.8H, v31.8H, v23.8H + sqxtun v24.8B, v0.8H + sqxtun v25.8B, v1.8H + sqxtun v26.8B, v2.8H + sqxtun v27.8B, v3.8H + sqxtun v28.8B, v4.8H + sqxtun v29.8B, v5.8H + sqxtun v30.8B, v6.8H + sqxtun v31.8B, v7.8H + st1 {v24.8B}, [x0], x2 + st1 {v25.8B}, [x0], x2 + st1 {v26.8B}, [x0], x2 + st1 {v27.8B}, [x0], x2 + st1 {v28.8B}, [x0], x2 + st1 {v29.8B}, [x0], x2 + st1 {v30.8B}, [x0], x2 + st1 {v31.8B}, [x0], x2 + ret +endfunc + +function ff_hevc_add_residual_8x8_10_neon, export=1 + mov x3, x0 + movi v0.8H, #0 + mvni v1.8H, #0xFC, lsl #8 + ld1 {v24.8H}, [x3], x2 + ld1 {v25.8H}, [x3], x2 + ld1 {v26.8H}, [x3], x2 + ld1 {v27.8H}, [x3], x2 + ld1 {v28.8H}, [x3], x2 + ld1 {v29.8H}, [x3], x2 + ld1 {v30.8H}, [x3], x2 + ld1 {v31.8H}, [x3], x2 + ld1 {v16.8H-v19.8H}, [x1], #64 + ld1 {v20.8H-v23.8H}, [x1] + add v16.8H, v16.8H, v24.8H + add v17.8H, v17.8H, v25.8H + clip10 v16.8H, v17.8H, v0.8H, v1.8H + add v18.8H, v18.8H, v26.8H + add v19.8H, v19.8H, v27.8H + clip10 v18.8H, v19.8H, v0.8H, v1.8H + add v20.8H, v20.8H, v28.8H + add v21.8H, v21.8H, v29.8H + clip10 v20.8H, v21.8H, v0.8H, v1.8H + add v22.8H, v22.8H, v30.8H + add v23.8H, v23.8H, v31.8H + clip10 v22.8H, v23.8H, v0.8H, v1.8H + st1 {v16.8H}, [x0], x2 + st1 {v17.8H}, [x0], x2 + st1 {v18.8H}, [x0], x2 + st1 {v19.8H}, [x0], x2 + st1 {v20.8H}, [x0], x2 + st1 {v21.8H}, [x0], x2 + st1 {v22.8H}, [x0], x2 + st1 {v23.8H}, [x0], x2 + ret +endfunc + +function ff_hevc_add_residual_16x16_8_neon, export=1 + mov x3, x0 + mov x4, #4 +1: + subs x4, x4, #1 + ld1 { v0.8B- v1.8B}, [x3], x2 + ld1 { v2.8B- v3.8B}, [x3], x2 + ld1 { v4.8B- v5.8B}, [x3], x2 + ld1 { v6.8B- v7.8B}, [x3], x2 + ld1 {v16.8H-v19.8H}, [x1], #64 + ld1 {v20.8H-v23.8H}, [x1], #64 + ushll v24.8H, v0.8B, #0 + ushll v25.8H, v1.8B, #0 + ushll v26.8H, v2.8B, #0 + ushll v27.8H, v3.8B, #0 + ushll v28.8H, v4.8B, #0 + ushll v29.8H, v5.8B, #0 + ushll v30.8H, v6.8B, #0 + ushll v31.8H, v7.8B, #0 + add v0.8H, v24.8H, v16.8H + add v1.8H, v25.8H, v17.8H + add v2.8H, v26.8H, v18.8H + add v3.8H, v27.8H, v19.8H + add v4.8H, v28.8H, v20.8H + add v5.8H, v29.8H, v21.8H + add v6.8H, v30.8H, v22.8H + add v7.8H, v31.8H, v23.8H + sqxtun v24.8B, v0.8H + sqxtun v25.8B, v1.8H + sqxtun v26.8B, v2.8H + sqxtun v27.8B, v3.8H + sqxtun v28.8B, v4.8H + sqxtun v29.8B, v5.8H + sqxtun v30.8B, v6.8H + sqxtun v31.8B, v7.8H + st1 {v24.8B-v25.8B}, [x0], x2 + st1 {v26.8B-v27.8B}, [x0], x2 + st1 {v28.8B-v29.8B}, [x0], x2 + st1 {v30.8B-v31.8B}, [x0], x2 + b.ne 1b + ret +endfunc + +function ff_hevc_add_residual_16x16_10_neon, export=1 + mov x3, x0 + mov x4, #4 + movi v0.8H, #0 + mvni v1.8H, #0xFC, lsl #8 +1: + subs x4, x4, #1 + ld1 {v16.8H-v17.8H}, [x3], x2 + ld1 {v18.8H-v19.8H}, [x3], x2 + ld1 {v20.8H-v21.8H}, [x3], x2 + ld1 {v22.8H-v23.8H}, [x3], x2 + ld1 {v24.8H-v27.8H}, [x1], #64 + ld1 {v28.8H-v31.8H}, [x1], #64 + add v16.8H, v16.8H, v24.8H + add v17.8H, v17.8H, v25.8H + clip10 v16.8H, v17.8H, v0.8H, v1.8H + add v18.8H, v18.8H, v26.8H + add v19.8H, v19.8H, v27.8H + clip10 v18.8H, v19.8H, v0.8H, v1.8H + add v20.8H, v20.8H, v28.8H + add v21.8H, v21.8H, v29.8H + clip10 v20.8H, v21.8H, v0.8H, v1.8H + add v22.8H, v22.8H, v30.8H + add v23.8H, v23.8H, v31.8H + clip10 v22.8H, v23.8H, v0.8H, v1.8H + st1 {v16.8H-v17.8H}, [x0], x2 + st1 {v18.8H-v19.8H}, [x0], x2 + st1 {v20.8H-v21.8H}, [x0], x2 + st1 {v22.8H-v23.8H}, [x0], x2 + b.ne 1b + ret +endfunc + +function ff_hevc_add_residual_32x32_8_neon, export=1 + mov x3, x0 + mov x4, #16 +1: + subs x4, x4, #1 + ld1 { v0.8B- v3.8B}, [x3], x2 + ld1 { v4.8B- v7.8B}, [x3], x2 + ld1 {v16.8H-v19.8H}, [x1], #64 + ld1 {v20.8H-v23.8H}, [x1], #64 + ushll v24.8H, v0.8B, #0 + ushll v25.8H, v1.8B, #0 + ushll v26.8H, v2.8B, #0 + ushll v27.8H, v3.8B, #0 + ushll v28.8H, v4.8B, #0 + ushll v29.8H, v5.8B, #0 + ushll v30.8H, v6.8B, #0 + ushll v31.8H, v7.8B, #0 + add v0.8H, v24.8H, v16.8H + add v1.8H, v25.8H, v17.8H + add v2.8H, v26.8H, v18.8H + add v3.8H, v27.8H, v19.8H + add v4.8H, v28.8H, v20.8H + add v5.8H, v29.8H, v21.8H + add v6.8H, v30.8H, v22.8H + add v7.8H, v31.8H, v23.8H + sqxtun v24.8B, v0.8H + sqxtun v25.8B, v1.8H + sqxtun v26.8B, v2.8H + sqxtun v27.8B, v3.8H + sqxtun v28.8B, v4.8H + sqxtun v29.8B, v5.8H + sqxtun v30.8B, v6.8H + sqxtun v31.8B, v7.8H + st1 {v24.8B-v27.8B}, [x0], x2 + st1 {v28.8B-v31.8B}, [x0], x2 + b.ne 1b + ret +endfunc + +function ff_hevc_add_residual_32x32_10_neon, export=1 + mov x3, x0 + mov x4, #16 + movi v0.8H, #0 + mvni v1.8H, #0xFC, lsl #8 +1: + subs x4, x4, #1 + ld1 {v16.8H-v19.8H}, [x3], x2 + ld1 {v20.8H-v23.8H}, [x3], x2 + ld1 {v24.8H-v27.8H}, [x1], #64 + ld1 {v28.8H-v31.8H}, [x1], #64 + add v16.8H, v16.8H, v24.8H + add v17.8H, v17.8H, v25.8H + clip10 v16.8H, v17.8H, v0.8H, v1.8H + add v18.8H, v18.8H, v26.8H + add v19.8H, v19.8H, v27.8H + clip10 v18.8H, v19.8H, v0.8H, v1.8H + add v20.8H, v20.8H, v28.8H + add v21.8H, v21.8H, v29.8H + clip10 v20.8H, v21.8H, v0.8H, v1.8H + add v22.8H, v22.8H, v30.8H + add v23.8H, v23.8H, v31.8H + clip10 v22.8H, v23.8H, v0.8H, v1.8H + st1 {v16.8H-v19.8H}, [x0], x2 + st1 {v20.8H-v23.8H}, [x0], x2 + b.ne 1b + ret +endfunc diff --git a/libavcodec/aarch64/hevcdsp_idct_neon.S b/libavcodec/aarch64/hevcdsp_idct_neon.S new file mode 100644 index 0000000000..970c69c0c1 --- /dev/null +++ b/libavcodec/aarch64/hevcdsp_idct_neon.S @@ -0,0 +1,24 @@ +/* -*-armv8-*- + * + * AArch64 NEON optimised IDCT functions for HEVC decoding + * + * Copyright (c) 2020 Josh Dekker + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/aarch64/asm.S" diff --git a/libavcodec/aarch64/hevcdsp_init.c b/libavcodec/aarch64/hevcdsp_init.c new file mode 100644 index 0000000000..f0a617ab39 --- /dev/null +++ b/libavcodec/aarch64/hevcdsp_init.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2014 Seppo Tomperi + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/attributes.h" +#include "libavutil/aarch64/cpu.h" +#include "libavcodec/hevcdsp.h" +#include "libavcodec/avcodec.h" + +void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_8x8_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_8x8_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_16x16_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_16x16_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_32x32_8_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); +void ff_hevc_add_residual_32x32_10_neon(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride); + +av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) +{ + int cpu_flags = av_get_cpu_flags(); + if (have_neon(cpu_flags) && bit_depth == 8) { + c->add_residual[0] = ff_hevc_add_residual_4x4_8_neon; + c->add_residual[1] = ff_hevc_add_residual_8x8_8_neon; + c->add_residual[2] = ff_hevc_add_residual_16x16_8_neon; + c->add_residual[3] = ff_hevc_add_residual_32x32_8_neon; + } + + if (have_neon(cpu_flags) && bit_depth == 10) { + c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon; + c->add_residual[1] = ff_hevc_add_residual_8x8_10_neon; + c->add_residual[2] = ff_hevc_add_residual_16x16_10_neon; + c->add_residual[3] = ff_hevc_add_residual_32x32_10_neon; + } +} diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c index 957e40d5ff..fe272ac1ce 100644 --- a/libavcodec/hevcdsp.c +++ b/libavcodec/hevcdsp.c @@ -257,6 +257,8 @@ int i = 0; break; } + if (ARCH_AARCH64) + ff_hevc_dsp_init_aarch64(hevcdsp, bit_depth); if (ARCH_ARM) ff_hevc_dsp_init_arm(hevcdsp, bit_depth); if (ARCH_PPC) diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h index c605a343d6..0e013a8328 100644 --- a/libavcodec/hevcdsp.h +++ b/libavcodec/hevcdsp.h @@ -129,6 +129,7 @@ void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth); extern const int8_t ff_hevc_epel_filters[7][4]; extern const int8_t ff_hevc_qpel_filters[3][16]; +void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth); void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth); void ff_hevc_dsp_init_ppc(HEVCDSPContext *c, const int bit_depth); void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth);