Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Martin Storsjö" <martin@martin.st>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Zhao Zhili <zhilizhao@tencent.com>
Subject: Re: [FFmpeg-devel] [PATCH 2/2] swscale/aarch64: Add rgb24 to yuv implementation
Date: Mon, 3 Jun 2024 11:07:29 +0300 (EEST)
Message-ID: <43dcb452-d266-78f5-d232-228912d41a9b@martin.st> (raw)
In-Reply-To: <tencent_82EC27C52AA1D3151C4A8B96E62A9089A606@qq.com>

On Mon, 3 Jun 2024, Zhao Zhili wrote:

> diff --git a/libswscale/aarch64/input.S b/libswscale/aarch64/input.S
> new file mode 100644
> index 0000000000..0a46475723
> --- /dev/null
> +++ b/libswscale/aarch64/input.S
> @@ -0,0 +1,229 @@
> +/*
> + * Copyright (c) 2024 Zhao Zhili <quinkblack@foxmail.com>
> + *
> + * This file is part of FFmpeg.
> + *
> + * 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
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "libavutil/aarch64/asm.S"
> +
> +.macro rgb24_to_yuv_load_rgb, src
> +        ld3.16b         { v16, v17, v18 }, [\src]
> +        ushll.8h        v19, v16, #0         // v19: r
> +        ushll.8h        v20, v17, #0         // v20: g
> +        ushll.8h        v21, v18, #0         // v21: b
> +        ushll2.8h       v22, v16, #0         // v22: r
> +        ushll2.8h       v23, v17, #0         // v23: g
> +        ushll2.8h       v24, v18, #0         // v24: b

Don't use this nonstandard, Apple specific aarch64 syntax. This was used 
by Apple tools at the start, when the proper standardized aarch64 syntax 
wasn't quite settled yet, and it is still accepted. (And apparently this 
is still the preferred form to disassemble things in, for apple 
platforms.)

With this syntax, the assembly is rejected by GNU binutils and MSVC.

> +function ff_rgb24ToY_neon, export=1
> +        cmp             w4, #0                  // check width > 0
> +        b.le            4f
> +
> +        ldp             w10, w11, [x5], #8       // w10: ry, w11: gy
> +        dup             v0.8H, w10
> +        dup             v1.8H, w11
> +        ldr             w12, [x5]               // w12: by
> +        dup             v2.8H, w12

Don't use uppercase .8H for field layout configurations, we prefer to 
stick to all lowercase here - see 
184103b3105f02f1189fa0047af4269e027dfbd6. The same goes for a number of 
places in this patch.

> +        add             w9, w9, #1              // i++
> +        add             x3, x3, #6              // src += 6
> +3:
> +        cmp		w9, w5
> +        b.lt		2b
> +4:

Incorrect indentation for the cmp/b.lt instructions here.


I have set up a bunch of github actions for testing aarch64 assembly - see 
https://github.com/mstorsjo/ffmpeg/commits/gha-aarch64. If you have a 
github account, grab a copy of this branch into your repo, add your own 
commits on top, and push to your fork (and if necessary, activate running 
the actions), then you should get a wide testing of your patches.

See https://github.com/mstorsjo/FFmpeg/actions/runs/9346228714 for one 
example run of these actions with your patches.

// 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".

  reply	other threads:[~2024-06-03  8:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240603071732.52523-1-quinkblack@foxmail.com>
2024-06-03  7:17 ` Zhao Zhili
2024-06-03  8:07   ` Martin Storsjö [this message]
2024-06-03 13:11     ` Zhao Zhili
2024-06-03 14:17       ` Rémi Denis-Courmont
2024-06-03 16:14         ` Zhao Zhili
2024-06-03 17:22           ` Ronald S. Bultje

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=43dcb452-d266-78f5-d232-228912d41a9b@martin.st \
    --to=martin@martin.st \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=zhilizhao@tencent.com \
    /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