[FFmpeg-devel] [PATCH] swscale/output: Implement neon intrinsics for yuv2planeX_10_c_template()

Martin Storsjö martin at martin.st
Mon May 26 12:05:35 EEST 2025


On Thu, 22 May 2025, Harshitha Sarangu Suresh wrote:

> This optimization provides 5x improvement for the module. The boost in performance was calculated by adding C timers inside the C function and the optimized neon intrinsic function.
>
>
> From 904144c2db9e5e72d56360c4c2eb38d426852901 Mon Sep 17 00:00:00 2001
> From: Harshitha Suresh <harshitha at multicorewareinc.com>
> Date: Thu, 22 May 2025 10:23:55 +0530
> Subject: [PATCH] swscale/output: Implement neon intrinsics for
> yuv2planeX_10_c_template()
>
> ---
> libswscale/output.c | 76 ++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 75 insertions(+), 1 deletion(-)
>
> diff --git a/libswscale/output.c b/libswscale/output.c
> index c37649e7ce..345df5ce59 100644
> --- a/libswscale/output.c
> +++ b/libswscale/output.c
> @@ -22,7 +22,9 @@
> #include <stddef.h>
> #include <stdint.h>
> #include <string.h>
> -
> +#if defined (__aarch64__)
> +#include <arm_neon.h>
> +#endif
> #include "libavutil/attributes.h"
> #include "libavutil/avutil.h"
> #include "libavutil/avassert.h"
> @@ -337,6 +339,77 @@ yuv2plane1_10_c_template(const int16_t *src, uint16_t *dest, int dstW,
>     }
> }
>
> +
> +#if defined (__aarch64__) && !defined(__APPLE__)

Why is Apple excluded here?

In any case; this is not the right way to add arch specific optimizations.

1. We don't add unconditional cases in the main arch independent code. We 
add them with runtime detection in arch specific files, see 
libswscale/aarch64/*. In the case of aarch64 and neon, things are easier 
as this extension is available in the compiler baseline and doesn't, 
strictly, need runtime detection, but nevertheless, the code should be 
arranged that way.

2. We don't use intrinsics for aarch64, we use standalone assembly files.

// Martin



More information about the ffmpeg-devel mailing list