From patchwork Thu Jun 22 12:56:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Bouron X-Patchwork-Id: 4080 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.22.4 with SMTP id 4csp46428vsw; Thu, 22 Jun 2017 05:57:05 -0700 (PDT) X-Received: by 10.223.161.204 with SMTP id v12mr2014114wrv.125.1498136225445; Thu, 22 Jun 2017 05:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498136225; cv=none; d=google.com; s=arc-20160816; b=TP8CTryEU5e/BqfRFEhC7psXYYtXvju/WczUuAzbwgAEzM7ia2tBHcxpzhjHJdUPAl egtHEMil6eusKAJbHI803Cx2RI5/VllsQXnk1sx5JX9tv6FtdWcyXPAAymmqrUJKWqkz CK/XQ3XP209uq7/c4ya13v+cI1hTORjMsute+nqB2VUZSc0W0VEkvUiXreu3i3vwsEmH z+egJPWVKtnnIYoZRP3UGzk+YgSV+u4r3p6CcxGxVLRgbmjw/qg3NM1GnsREeAIxqGup Nf8Wbm22RzfaERcvbVXosGepSAru9l2+EBqG60k9ANKLjb9XXE0S4JFTQo3PfFcBzvsG pTKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=5kz81tJtiQU+ZRkRdhW227QvXdIFUGo1uXk6DN9oiR8=; b=M10vnDKUay/Hwb5iBo5+Y3HwCSz4etg+x58nvPboVBa4oLeRIwpuxV7G/fyv5ufPgk paaqr8B5hNrY3fobS3Si3JbhYzjHAM0D8G0BBKDPzhaEC3yZYQg+Gw/lsR2YcLilCeAw Y8s3ojt05puA/qLpJ6iScTBbjG7lm0MVNBwkjenbWZxCqQfknArhDuIHzGsPjF3lV4yS 4qP4OHY7Zl2l+xwAi8FdPFCRnPhGnKHsrR5i4lshZazDpPW4MMOOmJT9Ec/L6x8fpiLj 1d6woxcc1Efco5GH7Tg7L1oVqYq6w6tSlRB8KfxTzmAr/qxke0yKBnNIgEnOMVuzXz1X IhFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=WF4Ht9Yu; 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=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 13si1463590wrb.329.2017.06.22.05.57.04; Thu, 22 Jun 2017 05:57:05 -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=@gmail.com header.b=WF4Ht9Yu; 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=NONE 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 ADDDE68A3B6; Thu, 22 Jun 2017 15:56:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 411D868A363 for ; Thu, 22 Jun 2017 15:56:47 +0300 (EEST) Received: by mail-wr0-f195.google.com with SMTP id k67so4471239wrc.1 for ; Thu, 22 Jun 2017 05:56:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bEcQd7E8sdWlHh6S2T1sZFvszT9O0s/FGiEb0lMp5mc=; b=WF4Ht9Yuu/I16o9RerhpRxQbeCUbLDVrnqZi5ewtqJ3x3D6V2ohpVA8RhHoaDwzezy jJPeMkZU9pX5cdxGAfEaOd8CFV+czTtho53j6zXNXs5q1foa2X/nu0pieLjkzmfpxDRr psnbiUmTahp6D/yhqYApAHresTijY8giTiZh6UkdxRyPtD+Jpec5KVVSUO2v4bdzngnj xoT7+mZs85VomSglaybM9J1WCtHS+GNYvWSA8OA/p8kEtcEaMukj7062G7LnBkjpTM5k WC6e4i+Ax3rHmHDzaospdA3BnZdb1nApy0YUaM/2o6+yRwHTDDGe/JgNjRbs4A7OtFCA oSqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bEcQd7E8sdWlHh6S2T1sZFvszT9O0s/FGiEb0lMp5mc=; b=KDmZTuTD1sg8MWcEaHr9yIsv9rLpdRCk0FKavtcgBHW1LMjllt6+zhO77iignZBAk2 qP4m3ngjHNGItDYaBJbYF0koQI+/XvoRnpKxfTT/1yDXymzsarqA/s3IJPIb2sWYoJnK ygcdlP6CFXS7lUV5Y8mrC/6P1+jtNUQ2Q3ep4g0Bzaa7EKemLLjRPQqZ12IIvukv416G S4uDAl3CeHfQ3zqnGV8eFr+RpC4od7y6uZwp7Llj4SPPF5mDHjWCfergolQ8fQWC9yso eL8fZFIrQqefuBN/f2hkzt2aCG8lWJdxL5kiNt0fJzFcvwgP9zU02U7I0DTqFqwsfovc 17iQ== X-Gm-Message-State: AKS2vOwMtmV00vN04woy6jMpSuJ6xxeb65xobrTMSgf2Sz/wX11Lc2TZ 9hSn7mpErLjMEg9J X-Received: by 10.223.170.75 with SMTP id q11mr2049638wrd.72.1498136206293; Thu, 22 Jun 2017 05:56:46 -0700 (PDT) Received: from boken.gopro.lcl (73.136-14-84.ripe.coltfrance.com. [84.14.136.73]) by smtp.gmail.com with ESMTPSA id 6sm1176384wrg.61.2017.06.22.05.56.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jun 2017 05:56:45 -0700 (PDT) From: Matthieu Bouron To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Jun 2017 14:56:28 +0200 Message-Id: <20170622125628.24516-2-matthieu.bouron@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170622125628.24516-1-matthieu.bouron@gmail.com> References: <20170622125628.24516-1-matthieu.bouron@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/2] lavc/aarch64: add sbrdsp neon implementation 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 Cc: Matthieu Bouron MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" tests/checkasm/checkasm --bench --test=sbrdsp (git)-[aarch64a checkasm: using random seed 4108020750 MMX implied by specified flags MMX implied by specified flags NEON: - sbrdsp.sum64x5 [OK] - sbrdsp.sum_square [OK] - sbrdsp.neg_odd_64 [OK] - sbrdsp.qmf_pre_shuffle [OK] - sbrdsp.qmf_post_shuffle [OK] - sbrdsp.qmf_deint_neg [OK] - sbrdsp.qmf_deint_bfly [OK] - sbrdsp.autocorrelate [OK] - sbrdsp.hf_gen [OK] - sbrdsp.hf_g_filt [OK] - sbrdsp.hf_apply_noise [OK] checkasm: all 14 tests passed nop: 10.0 autocorrelate_c: 644.0 autocorrelate_neon: 420.0 hf_apply_noise_0_c: 1688.5 hf_apply_noise_0_neon: 1498.6 hf_apply_noise_1_c: 1691.2 hf_apply_noise_1_neon: 1500.6 hf_apply_noise_2_c: 1688.1 hf_apply_noise_2_neon: 1500.3 hf_apply_noise_3_c: 1696.6 hf_apply_noise_3_neon: 1502.2 hf_g_filt_c: 2117.8 hf_g_filt_neon: 1218.7 hf_gen_c: 4573.4 hf_gen_neon: 2461.0 neg_odd_64_c: 72.0 neg_odd_64_neon: 64.7 qmf_deint_bfly_c: 1107.6 qmf_deint_bfly_neon: 291.6 qmf_deint_neg_c: 210.4 qmf_deint_neg_neon: 107.4 qmf_post_shuffle_c: 163.0 qmf_post_shuffle_neon: 107.7 qmf_pre_shuffle_c: 120.5 qmf_pre_shuffle_neon: 110.7 sum64x5_c: 1361.6 sum64x5_neon: 435.4 sum_square_c: 1686.4 sum_square_neon: 787.2 --- libavcodec/aarch64/Makefile | 4 +- libavcodec/aarch64/sbrdsp_init_aarch64.c | 71 +++++++ libavcodec/aarch64/sbrdsp_neon.S | 327 +++++++++++++++++++++++++++++++ libavcodec/sbrdsp.h | 1 + libavcodec/sbrdsp_template.c | 2 + 5 files changed, 404 insertions(+), 1 deletion(-) create mode 100644 libavcodec/aarch64/sbrdsp_init_aarch64.c create mode 100644 libavcodec/aarch64/sbrdsp_neon.S diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile index d440b1b18a..72080c2dbb 100644 --- a/libavcodec/aarch64/Makefile +++ b/libavcodec/aarch64/Makefile @@ -11,7 +11,8 @@ OBJS-$(CONFIG_NEON_CLOBBER_TEST) += aarch64/neontest.o OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o # decoders/encoders -OBJS-$(CONFIG_AAC_DECODER) += aarch64/aacpsdsp_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_RV40_DECODER) += aarch64/rv40dsp_init_aarch64.o OBJS-$(CONFIG_VC1DSP) += aarch64/vc1dsp_init_aarch64.o @@ -28,6 +29,7 @@ ARMV8-OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp.o # NEON optimizations # subsystems +NEON-OBJS-$(CONFIG_AAC_DECODER) += aarch64/sbrdsp_neon.o NEON-OBJS-$(CONFIG_FFT) += aarch64/fft_neon.o NEON-OBJS-$(CONFIG_FMTCONVERT) += aarch64/fmtconvert_neon.o NEON-OBJS-$(CONFIG_H264CHROMA) += aarch64/h264cmc_neon.o diff --git a/libavcodec/aarch64/sbrdsp_init_aarch64.c b/libavcodec/aarch64/sbrdsp_init_aarch64.c new file mode 100644 index 0000000000..998bdb8095 --- /dev/null +++ b/libavcodec/aarch64/sbrdsp_init_aarch64.c @@ -0,0 +1,71 @@ +/* + * + * 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 "config.h" +#include "libavutil/aarch64/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/sbrdsp.h" + +void ff_sbr_sum64x5_neon(float *z); +float ff_sbr_sum_square_neon(float (*x)[2], int n); +void ff_sbr_neg_odd_64_neon(float *x); +void ff_sbr_qmf_pre_shuffle_neon(float *z); +void ff_sbr_qmf_post_shuffle_neon(float W[32][2], const float *z); +void ff_sbr_qmf_deint_neg_neon(float *v, const float *src); +void ff_sbr_qmf_deint_bfly_neon(float *v, const float *src0, const float *src1); +void ff_sbr_hf_g_filt_neon(float (*Y)[2], const float (*X_high)[40][2], + const float *g_filt, int m_max, intptr_t ixh); +void ff_sbr_hf_gen_neon(float (*X_high)[2], const float (*X_low)[2], + const float alpha0[2], const float alpha1[2], + float bw, int start, int end); +void ff_sbr_autocorrelate_neon(const float x[40][2], float phi[3][2][2]); +void ff_sbr_hf_apply_noise_0_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_1_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_2_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); +void ff_sbr_hf_apply_noise_3_neon(float Y[64][2], const float *s_m, + const float *q_filt, int noise, + int kx, int m_max); + +av_cold void ff_sbrdsp_init_aarch64(SBRDSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + s->sum64x5 = ff_sbr_sum64x5_neon; + s->sum_square = ff_sbr_sum_square_neon; + s->neg_odd_64 = ff_sbr_neg_odd_64_neon; + s->qmf_pre_shuffle = ff_sbr_qmf_pre_shuffle_neon; + s->qmf_post_shuffle = ff_sbr_qmf_post_shuffle_neon; + s->qmf_deint_neg = ff_sbr_qmf_deint_neg_neon; + s->qmf_deint_bfly = ff_sbr_qmf_deint_bfly_neon; + s->hf_g_filt = ff_sbr_hf_g_filt_neon; + s->hf_gen = ff_sbr_hf_gen_neon; + s->autocorrelate = ff_sbr_autocorrelate_neon; + s->hf_apply_noise[0] = ff_sbr_hf_apply_noise_0_neon; + s->hf_apply_noise[1] = ff_sbr_hf_apply_noise_1_neon; + s->hf_apply_noise[2] = ff_sbr_hf_apply_noise_2_neon; + s->hf_apply_noise[3] = ff_sbr_hf_apply_noise_3_neon; + } +} diff --git a/libavcodec/aarch64/sbrdsp_neon.S b/libavcodec/aarch64/sbrdsp_neon.S new file mode 100644 index 0000000000..d1d79b749c --- /dev/null +++ b/libavcodec/aarch64/sbrdsp_neon.S @@ -0,0 +1,327 @@ +/* + * 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" + +const factors, align=4 + .float 1.0, -1.0, 1.0, -1.0 +endconst + +const phi_noise_0, align=4 + .float 1.0, 0.0, 1.0, 0.0 +endconst + +const phi_noise_1, align=4 + .float 0.0, 1.0, 0.0, -1.0 + .float 0.0, -1.0, 0.0, 1.0 +endconst + +const phi_noise_2, align=4 + .float -1.0, 0.0, -1.0, 0.0 +endconst + +const phi_noise_3, align=4 + .float 0.0, -1.0, 0.0, 1.0 + .float 0.0, 1.0, 0.0, -1.0 +endconst + +function ff_sbr_sum64x5_neon, export=1 + add x1, x0, #64*4 + add x2, x0, #128*4 + add x3, x0, #192*4 + add x4, x0, #256*4 + mov x5, #64 +1: ld1 {v0.4S}, [x0] + ld1 {v1.4S}, [x1], #16 + fadd v0.4S, v0.4S, v1.4S + ld1 {v2.4S}, [x2], #16 + fadd v0.4S, v0.4S, v2.4S + ld1 {v3.4S}, [x3], #16 + fadd v0.4S, v0.4S, v3.4S + ld1 {v4.4S}, [x4], #16 + fadd v0.4S, v0.4S, v4.4S + st1 {v0.4S}, [x0], #16 + subs x5, x5, #4 + b.gt 1b + ret +endfunc + +function ff_sbr_sum_square_neon, export=1 + movi v0.4S, #0 +1: ld1 {v1.4S}, [x0], #16 + fmla v0.4S, v1.4S, v1.4S + subs w1, w1, #2 + b.gt 1b + faddp v0.4S, v0.4S, v0.4S + faddp v0.4S, v0.4S, v0.4S + ret +endfunc + +function ff_sbr_neg_odd_64_neon, export=1 + mov x1, x0 + movi v5.4S, #1<<7, lsl #24 + ld2 {v0.4S, v1.4S}, [x0], #32 + eor v1.16B, v1.16B, v5.16B + ld2 {v2.4S, v3.4S}, [x0], #32 +.rept 3 + st2 {v0.4S, v1.4S}, [x1], #32 + eor v3.16B, v3.16B, v5.16B + ld2 {v0.4S, v1.4S}, [x0], #32 + st2 {v2.4S, v3.4S}, [x1], #32 + eor v1.16B, v1.16B, v5.16B + ld2 {v2.4S, v3.4S}, [x0], #32 +.endr + eor v3.16B, v3.16B, v5.16B + st2 {v0.4S, v1.4S}, [x1], #32 + st2 {v2.4S, v3.4S}, [x1], #32 + ret +endfunc + +function ff_sbr_qmf_pre_shuffle_neon, export=1 + add x1, x0, #60*4 + add x2, x0, #64*4 + mov x3, #-16 + mov x4, #-4 + movi v6.4S, #1<<7, lsl #24 + ld1 {v0.2S}, [x0], #8 + st1 {v0.2S}, [x2], #8 +.rept 7 + ld1 {v1.4S}, [x1], x3 + ld1 {v2.4S}, [x0], #16 + eor v1.16B, v1.16B, v6.16B + rev64 v1.4S, v1.4S + ext v1.16B, v1.16B, v1.16B, #8 + st2 {v1.4S, v2.4S}, [x2], #32 +.endr + add x1, x1, #8 + ld1 {v1.2S}, [x1], x4 + ld1 {v2.2S}, [x0], #8 + ld1 {v1.S}[3], [x1] + ld1 {v2.S}[2], [x0] + eor v1.16B, v1.16B, v6.16B + rev64 v1.4S, v1.4S + st2 {v1.2S, v2.2S}, [x2], #16 + st2 {v1.S, v2.S}[2], [x2] + ret +endfunc + +function ff_sbr_qmf_post_shuffle_neon, export=1 + add x2, x1, #60*4 + mov x3, #-16 + mov x4, #32 + movi v6.4S, #1<<7, lsl #24 +1: ld1 {v0.4S}, [x2], x3 + ld1 {v1.4S}, [x1], #16 + eor v0.16B, v0.16B, v6.16B + rev64 v0.4S, v0.4S + ext v0.16B, v0.16B, v0.16B, #8 + st2 {v0.4S, v1.4S}, [x0], #32 + subs x4, x4, #4 + b.gt 1b + ret +endfunc + +function ff_sbr_qmf_deint_neg_neon, export=1 + add x1, x1, #56*4 + add x2, x0, #60*4 + mov x3, #-32 + mov x4, #32 + movi v2.4S, #1<<7, lsl #24 +1: ld2 {v0.4S, v1.4S}, [x1], x3 + eor v0.16B, v0.16B, v2.16B + rev64 v1.4S, v1.4S + ext v1.16B, v1.16B, v1.16B, #8 + st1 {v0.4S}, [x2] + st1 {v1.4S}, [x0], #16 + sub x2, x2, #16 + subs x4, x4, #4 + b.gt 1b + ret +endfunc + +function ff_sbr_qmf_deint_bfly_neon, export=1 + add x2, x2, #60*4 + add x3, x0, #124*4 + mov x4, #64 + mov x5, #-16 +1: ld1 {v0.4S}, [x1], #16 + ld1 {v1.4S}, [x2], x5 + rev64 v2.4S, v0.4S + ext v2.16B, v2.16B, v2.16B, #8 + rev64 v3.4S, v1.4S + ext v3.16B, v3.16B, v3.16B, #8 + fadd v1.4S, v1.4S, v2.4S + fsub v0.4S, v0.4S, v3.4S + st1 {v0.4S}, [x0], #16 + st1 {v1.4S}, [x3], x5 + subs x4, x4, #4 + b.gt 1b + ret +endfunc + +function ff_sbr_hf_gen_neon, export=1 + sxtw x4, w4 + sxtw x5, w5 + movrel x6, factors + ld1 {v7.4S}, [x6] + dup v1.4S, v0.S[0] + mov v2.8B, v1.8B + mov v2.S[2], v7.S[0] + mov v2.S[3], v7.S[0] + fmul v1.4S, v1.4S, v2.4S + ld1 {v0.D}[0], [x3] + ld1 {v0.D}[1], [x2] + fmul v0.4S, v0.4S, v1.4S + fmul v1.4S, v0.4S, v7.4S + rev64 v0.4S, v0.4S + sub x7, x5, x4 + add x0, x0, x4, lsl #3 + add x1, x1, x4, lsl #3 + sub x1, x1, #16 +1: ld1 {v2.4S}, [x1], #16 + ld1 {v3.2S}, [x1] + fmul v4.4S, v2.4S, v1.4S + fmul v5.4S, v2.4S, v0.4S + faddp v4.4S, v4.4S, v4.4S + faddp v5.4S, v5.4S, v5.4S + faddp v4.4S, v4.4S, v4.4S + faddp v5.4S, v5.4S, v5.4S + mov v4.S[1], v5.S[0] + fadd v4.2S, v4.2S, v3.2S + st1 {v4.2S}, [x0], #8 + sub x1, x1, #8 + subs x7, x7, #1 + b.gt 1b + ret +endfunc + +function ff_sbr_hf_g_filt_neon, export=1 + sxtw x3, w3 + sxtw x4, w4 + mov x5, #40*2*4 + add x1, x1, x4, lsl #3 +1: ld1 {v0.2S}, [x1], x5 + ld1 {v1.S}[0], [x2], #4 + fmul v2.4S, v0.4S, v1.S[0] + st1 {v2.2S}, [x0], #8 + subs x3, x3, #1 + b.gt 1b + ret +endfunc + +function ff_sbr_autocorrelate_neon, export=1 + mov x2, #38 + movrel x3, factors + ld1 {v0.4S}, [x3] + movi v1.4S, #0 + movi v2.4S, #0 + movi v3.4S, #0 + ld1 {v4.2S}, [x0], #8 + ld1 {v5.2S}, [x0], #8 + fmul v16.2S, v4.2S, v4.2S + fmul v17.2S, v5.2S, v4.S[0] + fmul v18.2S, v5.2S, v4.S[1] +1: ld1 {v5.D}[1], [x0], #8 + fmla v1.2S, v4.2S, v4.2S + fmla v2.4S, v5.4S, v4.S[0] + fmla v3.4S, v5.4S, v4.S[1] + mov v4.D[0], v5.D[0] + mov v5.D[0], v5.D[1] + subs x2, x2, #1 + b.gt 1b + fmul v19.2S, v4.2S, v4.2S + fmul v20.2S, v5.2S, v4.S[0] + fmul v21.2S, v5.2S, v4.S[1] + fadd v22.4S, v2.4S, v20.4S + fsub v22.4S, v22.4S, v17.4S + fadd v23.4S, v3.4S, v21.4S + fsub v23.4S, v23.4S, v18.4S + rev64 v23.4S, v23.4S + fmul v23.4S, v23.4S, v0.4S + fadd v22.4S, v22.4S, v23.4S + st1 {v22.4S}, [x1], #16 + fadd v23.2S, v1.2S, v19.2S + fsub v23.2S, v23.2S, v16.2S + faddp v23.2S, v23.2S, v23.2S + st1 {v23.S}[0], [x1] + add x1, x1, #8 + rev64 v3.2S, v3.2S + fmul v3.2S, v3.2S, v0.2S + fadd v2.2S, v2.2S, v3.2S + st1 {v2.2S}, [x1] + add x1, x1, #16 + faddp v1.2S, v1.2S, v1.2S + st1 {v1.S}[0], [x1] + ret +endfunc + +.macro apply_noise_common + sxtw x3, w3 + sxtw x5, w5 + movrel x7, X(ff_sbr_noise_table) + add x3, x3, #1 +1: and x3, x3, #0x1ff + add x8, x7, x3, lsl #3 + add x3, x3, #2 + ld1 {v2.4S}, [x0] + ld1 {v3.2S}, [x1], #8 + ld1 {v4.2S}, [x2], #8 + ld1 {v5.4S}, [x8] + mov v6.16B, v2.16B + zip1 v3.4S, v3.4S, v3.4S + zip1 v4.4S, v4.4S, v4.4S + fmla v6.4S, v1.4S, v3.4S + fmla v2.4S, v5.4S, v4.4S + fcmeq v7.4S, v3.4S, #0.0 + bif v2.16B, v6.16B, v7.16B + st1 {v2.4S}, [x0], #16 + subs x5, x5, #2 + b.gt 1b +.endm + +function ff_sbr_hf_apply_noise_0_neon, export=1 + movrel x9, phi_noise_0 + ld1 {v1.4S}, [x9] + apply_noise_common + ret +endfunc + +function ff_sbr_hf_apply_noise_1_neon, export=1 + movrel x9, phi_noise_1 + and x4, x4, #1 + add x9, x9, x4, lsl #4 + ld1 {v1.4S}, [x9] + apply_noise_common + ret +endfunc + +function ff_sbr_hf_apply_noise_2_neon, export=1 + movrel x9, phi_noise_2 + ld1 {v1.4S}, [x9] + apply_noise_common + ret +endfunc + +function ff_sbr_hf_apply_noise_3_neon, export=1 + movrel x9, phi_noise_3 + and x4, x4, #1 + add x9, x9, x4, lsl #4 + ld1 {v1.4S}, [x9] + apply_noise_common + ret +endfunc diff --git a/libavcodec/sbrdsp.h b/libavcodec/sbrdsp.h index 66852de618..e6fd76d8ed 100644 --- a/libavcodec/sbrdsp.h +++ b/libavcodec/sbrdsp.h @@ -48,6 +48,7 @@ extern const INTFLOAT AAC_RENAME(ff_sbr_noise_table)[][2]; void AAC_RENAME(ff_sbrdsp_init)(SBRDSPContext *s); void ff_sbrdsp_init_arm(SBRDSPContext *s); +void ff_sbrdsp_init_aarch64(SBRDSPContext *s); void ff_sbrdsp_init_x86(SBRDSPContext *s); void ff_sbrdsp_init_mips(SBRDSPContext *s); diff --git a/libavcodec/sbrdsp_template.c b/libavcodec/sbrdsp_template.c index 897a3bbffb..37a3365b97 100644 --- a/libavcodec/sbrdsp_template.c +++ b/libavcodec/sbrdsp_template.c @@ -94,6 +94,8 @@ av_cold void AAC_RENAME(ff_sbrdsp_init)(SBRDSPContext *s) #if !USE_FIXED if (ARCH_ARM) ff_sbrdsp_init_arm(s); + if (ARCH_AARCH64) + ff_sbrdsp_init_aarch64(s); if (ARCH_X86) ff_sbrdsp_init_x86(s); if (ARCH_MIPS)