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: Krzysztof Pyrkosz via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
Cc: Krzysztof Pyrkosz <ffmpeg@szaka.eu>
Subject: Re: [FFmpeg-devel] [PATCH 2/2] swscale/aarch64/rgb2rgb_neon: Implemented {yuyv, uyvy}toyuv{420, 422}
Date: Wed, 12 Feb 2025 14:02:00 +0200 (EET)
Message-ID: <60217252-6f0-5563-bab4-4410e6cdab9@martin.st> (raw)
In-Reply-To: <20250211220642.116850-4-ffmpeg@szaka.eu>

On Tue, 11 Feb 2025, Krzysztof Pyrkosz via ffmpeg-devel wrote:

> ---
> libswscale/aarch64/rgb2rgb.c      |  16 ++
> libswscale/aarch64/rgb2rgb_neon.S | 262 ++++++++++++++++++++++++++++++
> 2 files changed, 278 insertions(+)
>
> diff --git a/libswscale/aarch64/rgb2rgb.c b/libswscale/aarch64/rgb2rgb.c
> index 7e1dba572d..f474228298 100644
> --- a/libswscale/aarch64/rgb2rgb.c
> +++ b/libswscale/aarch64/rgb2rgb.c
> @@ -67,6 +67,18 @@ void ff_shuffle_bytes_2013_neon(const uint8_t *src, uint8_t *dst, int src_size);
> void ff_shuffle_bytes_2130_neon(const uint8_t *src, uint8_t *dst, int src_size);
> void ff_shuffle_bytes_1203_neon(const uint8_t *src, uint8_t *dst, int src_size);
>
> +void ff_uyvytoyuv422_neon(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
> +                          const uint8_t *src, int width, int height,
> +                          int lumStride, int chromStride, int srcStride);
> +void ff_uyvytoyuv420_neon(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
> +                          const uint8_t *src, int width, int height,
> +                          int lumStride, int chromStride, int srcStride);
> +void ff_yuyvtoyuv420_neon(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
> +                          const uint8_t *src, int width, int height,
> +                          int lumStride, int chromStride, int srcStride);
> +void ff_yuyvtoyuv422_neon(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
> +                          const uint8_t *src, int width, int height,
> +                          int lumStride, int chromStride, int srcStride);
> av_cold void rgb2rgb_init_aarch64(void)
> {
>     int cpu_flags = av_get_cpu_flags();
> @@ -84,5 +96,9 @@ av_cold void rgb2rgb_init_aarch64(void)
>         shuffle_bytes_2013 = ff_shuffle_bytes_2013_neon;
>         shuffle_bytes_2130 = ff_shuffle_bytes_2130_neon;
>         shuffle_bytes_1203 = ff_shuffle_bytes_1203_neon;
> +        uyvytoyuv422       = ff_uyvytoyuv422_neon;
> +        uyvytoyuv420       = ff_uyvytoyuv420_neon;
> +        yuyvtoyuv422       = ff_yuyvtoyuv422_neon;
> +        yuyvtoyuv420       = ff_yuyvtoyuv420_neon;
>     }
> }
> diff --git a/libswscale/aarch64/rgb2rgb_neon.S b/libswscale/aarch64/rgb2rgb_neon.S
> index 22ecdf7ac8..9002aa028f 100644
> --- a/libswscale/aarch64/rgb2rgb_neon.S
> +++ b/libswscale/aarch64/rgb2rgb_neon.S
> @@ -427,3 +427,265 @@ neon_shuf 2013
> neon_shuf 1203
> neon_shuf 2130
> neon_shuf 3210
> +
> +/*
> +v0-v7 - two consecutive lines
> +x0 - upper Y destination
> +x1 - U destination
> +x2 - V destination
> +x3 - upper src line
> +w5 - width/iteration counter - count of line pairs for yuv420, of single lines for 422
> +x6 - lum padding
> +x7 - chrom padding
> +x8 - src padding
> +w9 - number of bytes remaining in the tail
> +x10 - lower Y destination
> +w12 - tmp
> +x13 - lower src line
> +w14 - tmp
> +w17 - set to 1 if last line has to be handled separately (odd height)
> +*/
> +
> +// one fast path iteration processes 16 uyvy tuples
> +// is_line_tail is set to 1 when final 16 tuples are being processed
> +// skip_storing_chroma is set to 1 when final line is processed and the height is odd
> +.macro fastpath_iteration src_fmt, dst_fmt, is_line_tail, skip_storing_chroma
> +        ld4             {v0.16b - v3.16b}, [x3], #64
> +.if ! \is_line_tail
> +        subs            w14, w14, #32
> +.endif
> +
> +.if ! \skip_storing_chroma
> +.if \dst_fmt == yuv420

This doesn't work as you want it to across all supported tools; .if 
conditionals are meant for pure numerical comparisons, and yuv420 isn't a 
numerical constant. In practice it does seem to work with binutils though, 
but not with Clang (or with gas-preprocessor).

You can use .ifc for string comparisons, see 
https://sourceware.org/binutils/docs/as/If.html for more references.

Also see 
https://github.com/mstorsjo/FFmpeg/actions/runs/13282469154/job/37083639139 
for the fallout from trying to build this patch with various tool setups.

Please do consider trying the aarch64 assembly testset from 
https://github.com/mstorsjo/FFmpeg/commits/gha-aarch64 on your commits.

// 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:[~2025-02-12 12:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07 19:06 [FFmpeg-devel] [PATCH] swscale/aarch64/rgb2rgb_neon: Implemented uyvytoyuv422 Krzysztof Pyrkosz via ffmpeg-devel
2025-02-10 13:15 ` Martin Storsjö
2025-02-11 21:24   ` Krzysztof Pyrkosz via ffmpeg-devel
2025-02-11 21:33   ` Krzysztof Pyrkosz via ffmpeg-devel
2025-02-11 21:53     ` Martin Storsjö
2025-02-11 22:06       ` [FFmpeg-devel] [PATCH 1/2] tests/checkasm/sw_rgb: Added {yuyv, uyvy}toyuv{420, 422} test cases Krzysztof Pyrkosz via ffmpeg-devel
2025-02-12  9:37         ` Martin Storsjö
2025-02-11 22:06       ` [FFmpeg-devel] [PATCH 2/2] swscale/aarch64/rgb2rgb_neon: Implemented {yuyv, uyvy}toyuv{420, 422} Krzysztof Pyrkosz via ffmpeg-devel
2025-02-12 12:02         ` 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=60217252-6f0-5563-bab4-4410e6cdab9@martin.st \
    --to=martin@martin.st \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=ffmpeg@szaka.eu \
    /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