From patchwork Wed Apr 3 06:43:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Hill X-Patchwork-Id: 47747 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp213876pzb; Tue, 2 Apr 2024 23:44:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVqzYR5E5MT9Z8FNuQV2eZysVxUkvR2KwUwjjJwrMaqY6Hbas+zfR3mCkxOPLrXOdSrMXxRnw9Um+GUP8f9cZzV+7riRcKYyabLPA== X-Google-Smtp-Source: AGHT+IEafuKhzIZe5Y2d0WZSLTEB1pp5ZQz1Ah/bBK88RI5jpRvg9xpdYQ+7d96rgyjIUJCVKdV/ X-Received: by 2002:a17:907:86a2:b0:a4e:6bf6:eab2 with SMTP id qa34-20020a17090786a200b00a4e6bf6eab2mr5928919ejc.4.1712126657722; Tue, 02 Apr 2024 23:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712126657; cv=none; d=google.com; s=arc-20160816; b=hqEN6wG4R0yxSwrZhKv6kznXvdz5o800/vDegqYRDz1SN9BQqVOi4HvnE9qPcVh0lW VejoBPJEe29sgpbWkQXFuseBRD3f1yFOU+0UrTBAdqi6gfKdckQeL9iC4uN7cqTyvw9Q 2oaWVsZ8wcTw4Dw/ZvKjYYfK4/fkKQQhUuWQEIVZrlfSSqyxO+ENCHxFlueJAAyhG7KT 9du/WLdyZAmHCrmK/183Rbr9JVMKYpBhB2XxCSY4KvjqlgnU/Zr1y/s6Cl8/1pMLKkXc 3fPx6K2a3G9J4EUXNRKlfT8UrjWWHfmqLIFeYGvRYAJFFy9Mn9z/XTZb59EGP2gph5ZY 3oSQ== 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:content-language:to:from:user-agent:mime-version :date:message-id:dkim-signature:delivered-to; bh=Tz8ESM2/OdnrAtNfKEe5ETplTovvtbG41KMGxEF2bLA=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=ijXevjo9RTN/DrgDM+4BDXnybLQcxYIvCv/xNESgS0mzzrgyFv0J1RD04/nWbNszM9 W3mBBydjys+oa7P2OdyEbtPgAQ2cddsavY75aXJyuca1aKl1ytMncV2qSeJOboyRDc/l Fw6y0O+LX5asY7mt1Rf5rCCZJJRiWwLq9Ixka39yL3/wCOtnbxUMd/m8EcOelJFRat0d oqacBP0aSCKSHXoW9c5dOgdPeE0H0psDqVwRASQP25o8w24ugU3BHCB+bDrApKRD8wvY PPN8V/PysdAUf9ogCfdU6KPy6Z5ToS2J4WwYIN/0FK1LGLWgyIr001j0RyTdjzkFTmVq M9qg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@geoffhill.org header.s=20220510 header.b=wIyNgMCU; 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=geoffhill.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sa5-20020a1709076d0500b00a4df3e5e6b1si6649501ejc.802.2024.04.02.23.44.17; Tue, 02 Apr 2024 23:44:17 -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=@geoffhill.org header.s=20220510 header.b=wIyNgMCU; 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=geoffhill.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CFE3A68CDB6; Wed, 3 Apr 2024 09:43:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from riki.gfrh.net (riki.gfrh.net [52.40.11.205]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5EB1468D092 for ; Wed, 3 Apr 2024 09:43:40 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geoffhill.org; s=20220510; t=1712126618; 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=y45i7Go/icCMPmWwzPzH4JLpNuWWVa171PgGc6I58K4=; b=wIyNgMCUnYmol0IS0ua9K7XhTK8wmjLiwwmOYMrF2utzyV6PF+JSAA+cZvvfaZrCIrdCYR sJjJqB1/QkVsBKPBT6AbPA8GufXpxGPUinhefRDzwUMfuZ8/XntPvt/BebrSQeIb7h8nji EQrb/lB9kkS1IgeIZjCQHJUl+6lwPZs= Received: by riki.gfrh.net (OpenSMTPD) with ESMTPSA id 5e9a9490 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Wed, 3 Apr 2024 06:43:38 +0000 (UTC) Message-ID: <18a55da1-45a2-43ee-b918-9eb67c5bf741@geoffhill.org> Date: Tue, 2 Apr 2024 23:43:38 -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 5/5] avcodec/ac3: Implement sum_square_butterfly_float 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ZAJq9fmlcodT Signed-off-by: Geoff Hill --- libavcodec/aarch64/ac3dsp_init_aarch64.c | 5 ++++ libavcodec/aarch64/ac3dsp_neon.S | 35 ++++++++++++++++++++++++ tests/checkasm/ac3dsp.c | 26 ++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/libavcodec/aarch64/ac3dsp_init_aarch64.c b/libavcodec/aarch64/ac3dsp_init_aarch64.c index e95436c651..e367353e11 100644 --- a/libavcodec/aarch64/ac3dsp_init_aarch64.c +++ b/libavcodec/aarch64/ac3dsp_init_aarch64.c @@ -32,6 +32,10 @@ void ff_ac3_sum_square_butterfly_int32_neon(int64_t sum[4], const int32_t *coef0, const int32_t *coef1, int len); +void ff_ac3_sum_square_butterfly_float_neon(float sum[4], + const float *coef0, + const float *coef1, + int len); av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c) { @@ -42,4 +46,5 @@ av_cold void ff_ac3dsp_init_aarch64(AC3DSPContext *c) c->extract_exponents = ff_ac3_extract_exponents_neon; c->float_to_fixed24 = ff_float_to_fixed24_neon; c->sum_square_butterfly_int32 = ff_ac3_sum_square_butterfly_int32_neon; + c->sum_square_butterfly_float = ff_ac3_sum_square_butterfly_float_neon; } diff --git a/libavcodec/aarch64/ac3dsp_neon.S b/libavcodec/aarch64/ac3dsp_neon.S index fa8fcf2e47..4a78ec0b2a 100644 --- a/libavcodec/aarch64/ac3dsp_neon.S +++ b/libavcodec/aarch64/ac3dsp_neon.S @@ -88,3 +88,38 @@ function ff_ac3_sum_square_butterfly_int32_neon, export=1 st1 {v0.1d-v3.1d}, [x0] 1: ret endfunc + +function ff_ac3_sum_square_butterfly_float_neon, export=1 + cbz w3, 1f + movi v0.4s, #0 + movi v1.4s, #0 + movi v2.4s, #0 + movi v3.4s, #0 +0: ld1 {v30.4s}, [x1], #16 + ld1 {v31.4s}, [x2], #16 + fadd v16.4s, v30.4s, v31.4s + fsub v17.4s, v30.4s, v31.4s + fmul v30.4s, v30.4s, v30.4s + fadd v0.4s, v0.4s, v30.4s + fmul v31.4s, v31.4s, v31.4s + fadd v1.4s, v1.4s, v31.4s + fmul v16.4s, v16.4s, v16.4s + fadd v2.4s, v2.4s, v16.4s + fmul v17.4s, v17.4s, v17.4s + fadd v3.4s, v3.4s, v17.4s + subs w3, w3, #4 + b.gt 0b + faddp v0.4s, v0.4s, v0.4s + faddp v0.2s, v0.2s, v0.2s + st1 {v0.s}[0], [x0], #4 + faddp v1.4s, v1.4s, v1.4s + faddp v1.2s, v1.2s, v1.2s + st1 {v1.s}[0], [x0], #4 + faddp v2.4s, v2.4s, v2.4s + faddp v2.2s, v2.2s, v2.2s + st1 {v2.s}[0], [x0], #4 + faddp v3.4s, v3.4s, v3.4s + faddp v3.2s, v3.2s, v3.2s + st1 {v3.s}[0], [x0] +1: ret +endfunc diff --git a/tests/checkasm/ac3dsp.c b/tests/checkasm/ac3dsp.c index c920dc9eb0..ef5186cfc1 100644 --- a/tests/checkasm/ac3dsp.c +++ b/tests/checkasm/ac3dsp.c @@ -162,6 +162,31 @@ static void check_ac3_sum_square_butterfly_int32(AC3DSPContext *c) { report("ac3_sum_square_butterfly_int32"); } +static void check_ac3_sum_square_butterfly_float(AC3DSPContext *c) { + LOCAL_ALIGNED_32(float, lt, [ELEMS]); + LOCAL_ALIGNED_32(float, rt, [ELEMS]); + LOCAL_ALIGNED_16(float, v1, [4]); + LOCAL_ALIGNED_16(float, v2, [4]); + + declare_func(void, float[4], const float *, const float *, int); + + randomize_float(lt, ELEMS); + randomize_float(rt, ELEMS); + + if (check_func(c->sum_square_butterfly_float, + "ac3_sum_square_bufferfly_float")) { + call_ref(v1, lt, rt, ELEMS); + call_new(v2, lt, rt, ELEMS); + + if (!float_near_ulp_array(v1, v2, 10, 4)) + fail(); + + bench_new(v2, lt, rt, ELEMS); + } + + report("ac3_sum_square_butterfly_float"); +} + void checkasm_check_ac3dsp(void) { AC3DSPContext c; @@ -171,4 +196,5 @@ void checkasm_check_ac3dsp(void) check_ac3_extract_exponents(&c); check_float_to_fixed24(&c); check_ac3_sum_square_butterfly_int32(&c); + check_ac3_sum_square_butterfly_float(&c); }