From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id C8B5749B82 for ; Wed, 3 Apr 2024 06:43:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7CEF568D0C5; Wed, 3 Apr 2024 09:43:40 +0300 (EEST) Received: from riki.gfrh.net (riki.gfrh.net [52.40.11.205]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4DC4668D097 for ; Wed, 3 Apr 2024 09:43:34 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geoffhill.org; s=20220510; t=1712126610; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E2GKZNAO8la7iiY4Da7sAuF0niLf5S/vHmPHM5fqPhM=; b=oDFVKN6PGYz9mA1G5P4UwMqOUklsTaDCywa2nj8DL/KFYWdGfndF3X09m7bJXHkzgsFcvX ryOxk1MbFFBt7QOG0Dw8YyIAzrxu5oM0sgJWBbVSSmXdJJTnyjQu3/jC4PrEWoRhrhbUxm yPILUvB5VzhHVcDivCyPPWIPLyLMzw0= Received: by riki.gfrh.net (OpenSMTPD) with ESMTPSA id 933aff2b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Wed, 3 Apr 2024 06:43:30 +0000 (UTC) Message-ID: <9c17becb-dbec-40cd-9def-84d956bf397f@geoffhill.org> Date: Tue, 2 Apr 2024 23:43:30 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Geoff Hill To: ffmpeg-devel@ffmpeg.org Content-Language: en-US Subject: [FFmpeg-devel] [PATCH v3 3/5] avcodec/ac3: Implement ac3_extract_exponents for aarch64 NEON 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: Geoff Hill --- libavcodec/aarch64/ac3dsp_init_aarch64.c | 2 ++ libavcodec/aarch64/ac3dsp_neon.S | 15 ++++++++++ tests/checkasm/ac3dsp.c | 36 ++++++++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/libavcodec/aarch64/ac3dsp_init_aarch64.c b/libavcodec/aarch64/ac3dsp_init_aarch64.c index 8874b41393..1bdc215b51 100644 --- a/libavcodec/aarch64/ac3dsp_init_aarch64.c +++ b/libavcodec/aarch64/ac3dsp_init_aarch64.c @@ -26,6 +26,7 @@ #include "config.h" void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int nb_coefs); +void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs); void ff_float_to_fixed24_neon(int32_t *dst, const float *src, size_t len); av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c) @@ -34,5 +35,6 @@ av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c) if (!have_neon(cpu_flags)) return; c->ac3_exponent_min = ff_ac3_exponent_min_neon; + c->extract_exponents = ff_ac3_extract_exponents_neon; c->float_to_fixed24 = ff_float_to_fixed24_neon; } diff --git a/libavcodec/aarch64/ac3dsp_neon.S b/libavcodec/aarch64/ac3dsp_neon.S index c8bdbb1bd3..b26f71a3f6 100644 --- a/libavcodec/aarch64/ac3dsp_neon.S +++ b/libavcodec/aarch64/ac3dsp_neon.S @@ -36,6 +36,21 @@ function ff_ac3_exponent_min_neon, export=1 2: ret endfunc +function ff_ac3_extract_exponents_neon, export=1 + cbz w2, 1f + movi v1.4s, #8 +0: ld1 {v0.4s}, [x1], #16 + abs v0.4s, v0.4s + clz v0.4s, v0.4s + sub v0.4s, v0.4s, v1.4s + xtn v0.4h, v0.4s + xtn v0.8b, v0.8h + st1 {v0.s}[0], [x0], #4 + subs w2, w2, #4 + b.gt 0b +1: ret +endfunc + function ff_float_to_fixed24_neon, export=1 0: ld1 {v0.4s, v1.4s}, [x1], #32 fcvtzs v0.4s, v0.4s, #24 diff --git a/tests/checkasm/ac3dsp.c b/tests/checkasm/ac3dsp.c index acb00b6fe1..a8a20349f9 100644 --- a/tests/checkasm/ac3dsp.c +++ b/tests/checkasm/ac3dsp.c @@ -18,6 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include #include #include "libavutil/mem.h" @@ -35,6 +36,14 @@ } \ } while (0) \ +#define randomize_i24(buf, len) \ + do { \ + int i; \ + for (i = 0; i < len; i++) { \ + buf[i] = (int32_t)rnd() & 0xFFFFFF; \ + } \ + } while (0) \ + #define randomize_float(buf, len) \ do { \ int i; \ @@ -76,6 +85,32 @@ static void check_ac3_exponent_min(AC3DSPContext *c) { report("ac3_exponent_min"); } +static void check_ac3_extract_exponents(AC3DSPContext *c) { +#define MAX_EXPS 3072 + LOCAL_ALIGNED_16(int32_t, src, [MAX_EXPS]); + LOCAL_ALIGNED_16(uint8_t, v1, [MAX_EXPS]); + LOCAL_ALIGNED_16(uint8_t, v2, [MAX_EXPS]); + int n; + + declare_func(void, uint8_t *, int32_t *, int); + + for (n = 512; n <= MAX_EXPS; n += 256) { + if (check_func(c->extract_exponents, "ac3_extract_exponents_n%d", n)) { + randomize_i24(src, n); + + call_ref(v1, src, n); + call_new(v2, src, n); + + if (memcmp(v1, v2, n) != 0) + fail(); + + bench_new(v1, src, n); + } + } + + report("ac3_extract_exponents"); +} + static void check_float_to_fixed24(AC3DSPContext *c) { #define BUF_SIZE 1024 LOCAL_ALIGNED_32(float, src, [BUF_SIZE]); @@ -107,5 +142,6 @@ void checkasm_check_ac3dsp(void) ff_ac3dsp_init(&c); check_ac3_exponent_min(&c); + check_ac3_extract_exponents(&c); check_float_to_fixed24(&c); } -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".