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 38A8C410F6 for ; Fri, 15 Jul 2022 08:04:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E4D7668B9DF; Fri, 15 Jul 2022 11:03:14 +0300 (EEST) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C204068B9DF for ; Fri, 15 Jul 2022 11:03:08 +0300 (EEST) Received: by mail-lf1-f47.google.com with SMTP id t1so6602982lft.8 for ; Fri, 15 Jul 2022 01:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G6iEwayuwtln4UmeNbPI65lzlCz+aqtiOWl3UrR4wAo=; b=SAIkUAd/Yz28mfRH18IPbMxHcbTYYXEi++MdurP7TXsC2KCatPTKIoA47cfgPNBA/e Q/mDnxbRPOu1ClTTiSK8Rvvc06bBfswO3EwIYKZhljff5438jg8N+1NK+ea2qvmys2Y3 fiP3A+HlSugDKEhyOzvwEQylsMzZHBb1pnsyJiOry/zvpwSXntgKMwPb7pOY4YpFyhpp KJcg60dd8GVjHc4y6Dy4a2vPt8LfWDdXHuHWy+Nw6VD7PmJ86THM16ski7hf1l8vGM95 oNukaXMTnmCOeZSq5OOfhePBe8+On02bCy8cPc1t4M6cx8XASAs4LAApUhS3fNNT1q/R rImw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G6iEwayuwtln4UmeNbPI65lzlCz+aqtiOWl3UrR4wAo=; b=2g9c/zse7vdRj4PL7W3HB2aDdybIp5jh4qHEgCRUjg0zxNlriIhlGYdow7uhd88AzT maFP+/zrfsLf8Nz8GCDT7DH6kYnE1GSHQ7A+prRlxR1uTQiiDOcRcE/futDOqnC379MV sPD+r49uqwLsCWoBVHEdsPGo9SYCe+mZORIBAiUoGAy0hDsvDmurxYfWPVHuPP7LjAmQ gSgD0xUGLhCu3d3ZBUCwzh3Mx8TC/LgRjkFNQ+wDKqb3eVAYl9Nd98sqAhfZT4IEXlHl RINsfe795qZpVGvyTdIJb/Xni4j5leuQc/eKocv+sQ8OlCDR6cqUcHDRcnC88UMWkShD JDcQ== X-Gm-Message-State: AJIora+R4BOm1AXymIhp7yEZPnBBPTl7oIMBC8mPCG9sh9j2KMK4b1i0 XSpG/0hOKU1wdnv40YpQ/tpYzs8D7IsdHQ== X-Google-Smtp-Source: AGRyM1sVX3qpE/EdMv9fFtUrbxIaKF3rdfTzfrT6sr1sPssQI2p1YFcH4WcThLfZrDsdkC8KRGeAMQ== X-Received: by 2002:a05:6512:2588:b0:489:e8fe:5b91 with SMTP id bf8-20020a056512258800b00489e8fe5b91mr7280100lfb.336.1657872187833; Fri, 15 Jul 2022 01:03:07 -0700 (PDT) Received: from hum-HP-ProBook-440-G7.semihalf.net (adrf243.neoplus.adsl.tpnet.pl. [79.185.165.243]) by smtp.gmail.com with ESMTPSA id k1-20020a2eb741000000b0025d542731ffsm645548ljo.5.2022.07.15.01.03.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 01:03:07 -0700 (PDT) From: Hubert Mazur To: ffmpeg-devel@ffmpeg.org Date: Fri, 15 Jul 2022 10:02:28 +0200 Message-Id: <20220715080228.686736-6-hum@semihalf.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220715080228.686736-1-hum@semihalf.com> References: <20220715080228.686736-1-hum@semihalf.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/5] lavc/aarch64: Add neon implementation for pix_abs8 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 Cc: gjb@semihalf.com, upstream@semihalf.com, jswinney@amazon.com, Hubert Mazur , martin@martin.st, mw@semihalf.com, spop@amazon.com 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: Provide optimized implementation of pix_abs8 function for arm64. Performance comparison tests are shown below. - pix_abs_1_0_c: 105.2 - pix_abs_1_0_neon: 21.4 - sad_1_c: 107.2 - sad_1_neon: 20.9 Benchmarks and tests are run with checkasm tool on AWS Graviton 3. --- libavcodec/aarch64/me_cmp_init_aarch64.c | 4 ++ libavcodec/aarch64/me_cmp_neon.S | 53 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/libavcodec/aarch64/me_cmp_init_aarch64.c b/libavcodec/aarch64/me_cmp_init_aarch64.c index 89c817990c..7d7dc38754 100644 --- a/libavcodec/aarch64/me_cmp_init_aarch64.c +++ b/libavcodec/aarch64/me_cmp_init_aarch64.c @@ -31,6 +31,8 @@ int ff_pix_abs16_x2_neon(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t stride, int h); int ff_pix_abs16_y2_neon(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t stride, int h); +int ff_pix_abs8_neon(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, + ptrdiff_t stride, int h); int sse16_neon(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t stride, int h); @@ -48,8 +50,10 @@ av_cold void ff_me_cmp_init_aarch64(MECmpContext *c, AVCodecContext *avctx) c->pix_abs[0][1] = ff_pix_abs16_x2_neon; c->pix_abs[0][2] = ff_pix_abs16_y2_neon; c->pix_abs[0][3] = ff_pix_abs16_xy2_neon; + c->pix_abs[1][0] = ff_pix_abs8_neon; c->sad[0] = ff_pix_abs16_neon; + c->sad[1] = ff_pix_abs8_neon; c->sse[0] = sse16_neon; c->sse[1] = sse8_neon; c->sse[2] = sse4_neon; diff --git a/libavcodec/aarch64/me_cmp_neon.S b/libavcodec/aarch64/me_cmp_neon.S index c78e26df4b..383459d209 100644 --- a/libavcodec/aarch64/me_cmp_neon.S +++ b/libavcodec/aarch64/me_cmp_neon.S @@ -72,6 +72,59 @@ function ff_pix_abs16_neon, export=1 ret endfunc +function ff_pix_abs8_neon, export=1 + // x0 unused + // x1 uint8_t *pix1 + // x2 uint8_t *pix2 + // x3 ptrdiff_t stride + // x4 int h + + movi d18, #0 + cmp w4, #4 + b.lt 2f + +// make 4 iterations at once +1: + ld1 {v0.8b}, [x1], x3 + ld1 {v1.8b}, [x2], x3 + uabdl v30.8h, v0.8b, v1.8b + ld1 {v2.8b}, [x1], x3 + ld1 {v3.8b}, [x2], x3 + uabal v30.8h, v2.8b, v3.8b + ld1 {v4.8b}, [x1], x3 + ld1 {v5.8b}, [x2], x3 + uabal v30.8h, v4.8b, v5.8b + ld1 {v6.8b}, [x1], x3 + ld1 {v7.8b}, [x2], x3 + uabal v30.8h, v6.8b, v7.8b + + sub w4, w4, #4 + uaddlv s20, v30.8h + cmp w4, #4 + add d18, d18, d20 + b.ge 1b + cbnz w4, 2f + fmov w0, s18 + + ret + +// iterate by one +2: + ld1 {v0.8b}, [x1], x3 + ld1 {v1.8b}, [x2], x3 + + uabdl v16.8h, v0.8b, v1.8b + + uaddlv s17, v16.8h + add d18, d18, d17 + subs w4, w4, #1 + b.ne 2b + fmov w0, s18 + + ret + +endfunc + function ff_pix_abs16_xy2_neon, export=1 // x0 unused // x1 uint8_t *pix1 -- 2.34.1 _______________________________________________ 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".