From: "Martin Storsjö" <martin@martin.st>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 1/3] lavc/aarch64: add clip N macro
Date: Wed, 22 Mar 2023 10:38:32 +0200 (EET)
Message-ID: <a5ee6193-3752-33cf-dc42-7c27e7917b3a@martin.st> (raw)
In-Reply-To: <20230322000710.47513-1-jdek@itanimul.li>
On Wed, 22 Mar 2023, J. Dekker wrote:
> Signed-off-by: J. Dekker <jdek@itanimul.li>
> ---
> libavcodec/aarch64/hevcdsp_idct_neon.S | 19 +++++--------------
> libavcodec/aarch64/neon.S | 11 +++++++++++
> 2 files changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/libavcodec/aarch64/hevcdsp_idct_neon.S b/libavcodec/aarch64/hevcdsp_idct_neon.S
> index 467cb0f48a..3e59dd20bb 100644
> --- a/libavcodec/aarch64/hevcdsp_idct_neon.S
> +++ b/libavcodec/aarch64/hevcdsp_idct_neon.S
> @@ -5,7 +5,7 @@
> *
> * Ported from arm/hevcdsp_idct_neon.S by
> * Copyright (c) 2020 Reimar Döffinger
> - * Copyright (c) 2020 J. Dekker
> + * Copyright (c) 2023 J. Dekker <jdek@itanimul.li>
> *
> * This file is part of FFmpeg.
> *
> @@ -38,13 +38,6 @@ const trans, align=4
> .short 31, 22, 13, 4
> endconst
>
> -.macro clip2 in1, in2, min, max
> - smax \in1, \in1, \min
> - smax \in2, \in2, \min
> - smin \in1, \in1, \max
> - smin \in2, \in2, \max
> -.endm
> -
> function ff_hevc_add_residual_4x4_8_neon, export=1
> ld1 {v0.8h-v1.8h}, [x1]
> ld1 {v2.s}[0], [x0], x2
> @@ -182,7 +175,7 @@ function hevc_add_residual_4x4_16_neon, export=0
> ld1 {v3.d}[1], [x12], x2
> movi v4.8h, #0
> sqadd v1.8h, v1.8h, v3.8h
> - clip2 v0.8h, v1.8h, v4.8h, v21.8h
> + clip v4.8h, v21.8h, v0.8h, v1.8h
> st1 {v0.d}[0], [x0], x2
> st1 {v0.d}[1], [x0], x2
> st1 {v1.d}[0], [x0], x2
> @@ -201,7 +194,7 @@ function hevc_add_residual_8x8_16_neon, export=0
> sqadd v0.8h, v0.8h, v2.8h
> ld1 {v3.8h}, [x12]
> sqadd v1.8h, v1.8h, v3.8h
> - clip2 v0.8h, v1.8h, v4.8h, v21.8h
> + clip v4.8h, v21.8h, v0.8h, v1.8h
> st1 {v0.8h}, [x0], x2
> st1 {v1.8h}, [x12], x2
> bne 1b
> @@ -221,8 +214,7 @@ function hevc_add_residual_16x16_16_neon, export=0
> sqadd v1.8h, v1.8h, v17.8h
> sqadd v2.8h, v2.8h, v18.8h
> sqadd v3.8h, v3.8h, v19.8h
> - clip2 v0.8h, v1.8h, v20.8h, v21.8h
> - clip2 v2.8h, v3.8h, v20.8h, v21.8h
> + clip v20.8h, v21.8h, v0.8h, v1.8h, v2.8h, v3.8h
> st1 {v0.8h-v1.8h}, [x0], x2
> st1 {v2.8h-v3.8h}, [x12], x2
> bne 1b
> @@ -239,8 +231,7 @@ function hevc_add_residual_32x32_16_neon, export=0
> sqadd v1.8h, v1.8h, v17.8h
> sqadd v2.8h, v2.8h, v18.8h
> sqadd v3.8h, v3.8h, v19.8h
> - clip2 v0.8h, v1.8h, v20.8h, v21.8h
> - clip2 v2.8h, v3.8h, v20.8h, v21.8h
> + clip v20.8h, v21.8h, v0.8h, v1.8h, v2.8h, v3.8h
> st1 {v0.8h-v3.8h}, [x0], x2
> bne 1b
> ret
> diff --git a/libavcodec/aarch64/neon.S b/libavcodec/aarch64/neon.S
> index 1ad32c359d..bc105e4861 100644
> --- a/libavcodec/aarch64/neon.S
> +++ b/libavcodec/aarch64/neon.S
> @@ -1,6 +1,8 @@
> /*
> * This file is part of FFmpeg.
> *
> + * Copyright (c) 2023 J. Dekker <jdek@itanimul.li>
> + *
> * 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
> @@ -16,6 +18,15 @@
> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> */
>
> +.macro clip min, max, regs:vararg
> +.irp x, \regs
> + smax \x, \x, \min
> +.endr
> +.irp x, \regs
> + smin \x, \x, \max
> +.endr
> +.endm
> +
LGTM, the vararg argument handling looks neat here.
// Martin
_______________________________________________
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".
prev parent reply other threads:[~2023-03-22 8:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 18:35 [FFmpeg-devel] [PATCH 1/2] checkasm: add hevc_deblock chroma test J. Dekker
2023-03-21 18:35 ` [FFmpeg-devel] [PATCH v2 2/2] lavc/aarch64: add hevc deblock chroma 8-12bit J. Dekker
2023-03-21 20:30 ` Martin Storsjö
2023-03-22 0:07 ` [FFmpeg-devel] [PATCH 1/3] lavc/aarch64: add clip N macro J. Dekker
2023-03-22 0:07 ` [FFmpeg-devel] [PATCH v3 2/3] checkasm: add hevc_deblock chroma test J. Dekker
2023-03-22 9:04 ` Martin Storsjö
2023-03-22 0:07 ` [FFmpeg-devel] [PATCH v3 3/3] lavc/aarch64: add hevc deblock chroma 8-12bit J. Dekker
2023-03-22 9:26 ` Martin Storsjö
2023-03-22 8:38 ` Martin Storsjö [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a5ee6193-3752-33cf-dc42-7c27e7917b3a@martin.st \
--to=martin@martin.st \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git