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 8DB494369D for ; Tue, 20 Sep 2022 11:02:37 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F25B668BA08; Tue, 20 Sep 2022 14:02:22 +0300 (EEST) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9F72C68B9C5 for ; Tue, 20 Sep 2022 14:02:16 +0300 (EEST) Received: by mail-lj1-f178.google.com with SMTP id z20so2545946ljq.3 for ; Tue, 20 Sep 2022 04:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=SKD+LkvGvSwxBZ3iz+uldiDa316RN866K3okk7enPpg=; b=nh6S0KghyNepi7Bw1EfohN06GuYRyBNwvMXTrxBDMDk2P9JVPN30RvH+L4OGPOKUL1 J5J3vf19fx6uD7Gd+0sfyrE2QHxZxY9cc0P03YNPeTpEbloZ52d+SdOi9DXZvK+CJreU E19jnn5QVbjl7qu/qOMFXgmwExtr9tOrJRSKdIKKm6s+AdO1aMOU5fQdjC2m8okHLQPW t9NYvgIVXDuJ7V1l+SdlmcXj6Ee7BATbxTPt5t69kiuAwcZB5eYIKdRnWwZsrzkdvdPb R13vP9r4hgbr/hBoz47KJIV3ceQ+gfmr2GaDBg0RAEo8yiZu/XcDbvu01T1vWxARuyvK cFgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=SKD+LkvGvSwxBZ3iz+uldiDa316RN866K3okk7enPpg=; b=IENEc5oz0w/cleQYAXra/gAokvVWB24XfyN9Ls/X6aMWQqxHl30iKdvj2VrJ8HC9wo SVWsr4gATcNfTiRmFm/fZCgwXkwcYbsHnnqZjj3/pO7ELKXwyglS4d6Pm2qiBByfpfyU Dh6t9MUKtaUJV1R2RF/SwRPDcy5ScJpJFlyRy/USIWPSSdZA2Nl0DzZtRkMmjYFk0JIp gHGWZpVvBYh3SZ5BLXLuH6/I5oqFZSXitg/HHoAbGmc/7eVJMFldDqnPTijVipsyvRRp hEoaDrHwlzpG1T6Adf7UukjU7O0jqunSe+Gau4S4mghJd4AC3P/ZjmnbPB6m/s5S/qe/ xlWQ== X-Gm-Message-State: ACrzQf2WmSeSK6rvp1MohuyqXrHX59Xbv+1ImbacbTbBH/T24Ez809NJ xrjEhVD1PfMYZVh8PG76M0CvAjqxxsabAQ== X-Google-Smtp-Source: AMsMyM7ObI/49A6joLhOoiepkX2RcW0yiBo9GsTeMl8eI77UNbmTfmrHU2U2D0MEHJDMKKg0DrD+Hw== X-Received: by 2002:a2e:a4b1:0:b0:26c:521:76b5 with SMTP id g17-20020a2ea4b1000000b0026c052176b5mr6793783ljm.258.1663671735606; Tue, 20 Sep 2022 04:02:15 -0700 (PDT) Received: from hum-HP-ProBook-440-G7.office.semihalf.net ([83.142.187.84]) by smtp.gmail.com with ESMTPSA id d3-20020a19f243000000b00492f5ad0ae7sm265220lfk.43.2022.09.20.04.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 04:02:15 -0700 (PDT) From: Hubert Mazur To: ffmpeg-devel@ffmpeg.org Date: Tue, 20 Sep 2022 13:01:57 +0200 Message-Id: <20220920110158.15384-3-hum@semihalf.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920110158.15384-1-hum@semihalf.com> References: <20220920110158.15384-1-hum@semihalf.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] lavc/aarch64: Add neon implementation for vsad8_intra 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 for vsad8_intra function. Performance comparison tests are shown below. - vsad_5_c: 94.7 - vsad_5_neon: 20.7 Benchmarks and tests run with checkasm tool on AWS Graviton 3. Signed-off-by: Hubert Mazur --- libavcodec/aarch64/me_cmp_init_aarch64.c | 3 ++ libavcodec/aarch64/me_cmp_neon.S | 42 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/libavcodec/aarch64/me_cmp_init_aarch64.c b/libavcodec/aarch64/me_cmp_init_aarch64.c index fb51a833be..d3fa047a86 100644 --- a/libavcodec/aarch64/me_cmp_init_aarch64.c +++ b/libavcodec/aarch64/me_cmp_init_aarch64.c @@ -45,6 +45,8 @@ int vsad16_neon(MpegEncContext *c, const uint8_t *s1, const uint8_t *s2, ptrdiff_t stride, int h); int vsad_intra16_neon(MpegEncContext *c, const uint8_t *s, const uint8_t *dummy, ptrdiff_t stride, int h) ; +int vsad_intra8_neon(MpegEncContext *c, const uint8_t *s, const uint8_t *dummy, + ptrdiff_t stride, int h) ; int vsse16_neon(MpegEncContext *c, const uint8_t *s1, const uint8_t *s2, ptrdiff_t stride, int h); int vsse_intra16_neon(MpegEncContext *c, const uint8_t *s, const uint8_t *dummy, @@ -75,6 +77,7 @@ av_cold void ff_me_cmp_init_aarch64(MECmpContext *c, AVCodecContext *avctx) c->vsad[0] = vsad16_neon; c->vsad[4] = vsad_intra16_neon; + c->vsad[5] = vsad_intra8_neon; c->vsse[0] = vsse16_neon; c->vsse[4] = vsse_intra16_neon; diff --git a/libavcodec/aarch64/me_cmp_neon.S b/libavcodec/aarch64/me_cmp_neon.S index 1e08d04869..1587f2ea43 100644 --- a/libavcodec/aarch64/me_cmp_neon.S +++ b/libavcodec/aarch64/me_cmp_neon.S @@ -1047,3 +1047,45 @@ function pix_median_abs16_neon, export=1 ret endfunc + +function vsad_intra8_neon, export=1 + // x0 unused + // x1 uint8_t *pix1 + // x2 uint8_t *dummy + // x3 ptrdiff_t stride + // w4 int h + + ld1 {v0.8b}, [x1], x3 + sub w4, w4, #1 // we need to make h-1 iterations + cmp w4, #3 + movi v16.8h, #0 + b.lt 2f + +1: + // v = abs( pix1[0] - pix1[0 + stride] ) + // score = sum(v) + ld1 {v1.8b}, [x1], x3 + sub w4, w4, #3 + ld1 {v2.8b}, [x1], x3 + uabal v16.8h, v0.8b, v1.8b + ld1 {v3.8b}, [x1], x3 + uabal v16.8h, v1.8b, v2.8b + cmp w4, #3 + mov v0.8b, v3.8b + uabal v16.8h, v2.8b, v3.8b + b.ge 1b + cbz w4, 3f + +2: + ld1 {v1.8b}, [x1], x3 + subs w4, w4, #1 + uabal v16.8h, v0.8b, v1.8b + mov v0.8b, v1.8b + cbnz w4, 2b + +3: + uaddlv s17, v16.8h + fmov w0, s17 + + ret +endfunc -- 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".