From patchwork Thu Jan 7 12:10:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Dekker X-Patchwork-Id: 24829 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 2F97944AF79 for ; Thu, 7 Jan 2021 14:10:36 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 14BBB689DF4; Thu, 7 Jan 2021 14:10:36 +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 6DC93688288 for ; Thu, 7 Jan 2021 14:10:28 +0200 (EET) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id DA9F21796 for ; Thu, 7 Jan 2021 07:10:26 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 07 Jan 2021 07:10:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=MtdnGxb/avBV2 CPGiB4DtV/53ODqjPj4yA/DcIab5h8=; b=FPd6LsEhhR4pOvTZCVV3EX3yNd1gz 9ghcEJ90JWGZKwJcvfk1C1tvl8JjPwfA0pvSUVnkPJKUE/+ESZSMCKJm8Rr124yM UhzdIrOhNB14cadoyn17ZhbAP2Sbcsb5goV/1YEpI8ww5H9hdTPMKtaEaHM2asu1 mit0VHWR15ipJ1qRiUVpbNNTrRVdVGrb4eMlXSbgGZ3m+RdZFlg2Gi4lCDHf+Ero YjLJg3VScz0/kTHXZs1IoWpX+qQgSgnXRJz5VzpPRetxJJ3OZndJnxNBGoG4E/TR Nj5pyxTuyvbfkxpDtqt3BQFun4diHPBDfWJ45vO3Vkqu+p2wMTPT8OLNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=MtdnGxb/avBV2CPGiB4DtV/53ODqjPj4yA/DcIab5h8=; b=MvOBdbra ZwkHBPUZA9aNeyuyjQFPDAc8vW+K4w+zjBzd9Q9CFDHGRHL9Eg/f3stf+sUOz8CF szvL0EPg6FVUwYCh1zm4NaOAjS0GXfnu3+JOmVyB0HO032XlPQsHTcxLleCYSX8z wrCWbCPf9nOhlOnQjyouXtEcwZCYx8HPQASqgXcqAN107nY6enjSavXYXg44YhyL Y47mWyrKs+lvQEuPgZwnJDL9EZYwBZsZZTX2jXsfEKe55RliO1HrbkROojHfXEKs huhnNoJflQa0ej+eB/Q34L/n2Z/bBOrDcyf19bYkZKzawc7RPC7HlY45tjTNZ9In 9CNreWCBjfcJEQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdegvddgfeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheplfhoshhhucffvghkkhgvrhcuoehjohhshhesihhtrghnihhm uhhlrdhliheqnecuggftrfgrthhtvghrnhepgeduieeltdeltedugfegffehfefgudduhe ehgfejgeeuiedukedvtdejiefgheeunecuffhomhgrihhnpehnvghonhdrshgsnecukfhp peekkedrudeftddrgeekrddufeejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepjhhoshhhsehithgrnhhimhhulhdrlhhi 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 1A985240066 for ; Thu, 7 Jan 2021 07:10:26 -0500 (EST) From: Josh Dekker To: ffmpeg-devel@ffmpeg.org Date: Thu, 7 Jan 2021 13:10:18 +0100 Message-Id: <20210107121020.86179-3-josh@itanimul.li> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20210107121020.86179-1-josh@itanimul.li> References: <20210107121020.86179-1-josh@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] lavc/aarch64: add HEVC idct_dc 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 --- libavcodec/aarch64/Makefile | 3 +- libavcodec/aarch64/hevcdsp_idct_neon.S | 74 ++++++++++++++++++++++++++ libavcodec/aarch64/hevcdsp_init.c | 19 +++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 libavcodec/aarch64/hevcdsp_idct_neon.S diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile index 4bdd554e7e..42d80bf74c 100644 --- a/libavcodec/aarch64/Makefile +++ b/libavcodec/aarch64/Makefile @@ -54,7 +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 +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_idct_neon.S b/libavcodec/aarch64/hevcdsp_idct_neon.S new file mode 100644 index 0000000000..cd886bb6dc --- /dev/null +++ b/libavcodec/aarch64/hevcdsp_idct_neon.S @@ -0,0 +1,74 @@ +/* -*-arm64-*- + * + * 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" + +.macro idct_dc size bitdepth +function ff_hevc_idct_\size\()x\size\()_dc_\bitdepth\()_neon, export=1 + ldrsh w1, [x0] + mov w2, #(1 << (13 - \bitdepth)) + add w1, w1, #1 + asr w1, w1, #1 + add w1, w1, w2 + asr w1, w1, #(14 - \bitdepth) + dup v0.8h, w1 + dup v1.8h, w1 +.if \size > 4 + dup v2.8h, w1 + dup v3.8h, w1 +.if \size > 16 /* dc 32x32 */ + mov x2, #4 +1: + subs x2, x2, #1 +.endif +.if \size > 8 /* dc 16x16 */ + st1 {v0.8h-v3.8h}, [x0], #64 + st1 {v0.8h-v3.8h}, [x0], #64 + st1 {v0.8h-v3.8h}, [x0], #64 + st1 {v0.8h-v3.8h}, [x0], #64 + st1 {v0.8h-v3.8h}, [x0], #64 + st1 {v0.8h-v3.8h}, [x0], #64 +.endif /* dc 8x8 */ + st1 {v0.8h-v3.8h}, [x0], #64 + st1 {v0.8h-v3.8h}, [x0], #64 +.if \size > 16 /* dc 32x32 */ + bne 1b +.endif +.else /* dc 4x4 */ + st1 {v0.8h-v1.8h}, [x0] +.endif + ret +endfunc +.endm + +idct_dc 4 8 +idct_dc 4 10 + +idct_dc 8 8 +idct_dc 8 10 + +idct_dc 16 8 +idct_dc 16 10 + +idct_dc 32 8 +idct_dc 32 10 diff --git a/libavcodec/aarch64/hevcdsp_init.c b/libavcodec/aarch64/hevcdsp_init.c index f0a617ab39..2cd7ef3a6c 100644 --- a/libavcodec/aarch64/hevcdsp_init.c +++ b/libavcodec/aarch64/hevcdsp_init.c @@ -23,6 +23,15 @@ #include "libavcodec/hevcdsp.h" #include "libavcodec/avcodec.h" +void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs); +void ff_hevc_idct_4x4_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_8x8_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_16x16_dc_10_neon(int16_t *coeffs); +void ff_hevc_idct_32x32_dc_10_neon(int16_t *coeffs); + 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, @@ -48,6 +57,11 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) 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; + + c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_neon; + c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_neon; + c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon; + c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon; } if (have_neon(cpu_flags) && bit_depth == 10) { @@ -55,5 +69,10 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) 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; + + c->idct_dc[0] = ff_hevc_idct_4x4_dc_10_neon; + c->idct_dc[1] = ff_hevc_idct_8x8_dc_10_neon; + c->idct_dc[2] = ff_hevc_idct_16x16_dc_10_neon; + c->idct_dc[3] = ff_hevc_idct_32x32_dc_10_neon; } }