[FFmpeg-devel] [PATCH] swscale: aarch64: Simplify the assignment of lumToYV12

Martin Storsjö martin at martin.st
Tue Mar 4 10:31:25 EET 2025


We normally don't need else statements here; the common pattern
is to assign lower level SIMD implementations first, then
conditionally reassign higher level ones afterwards, if supported.

---
Sorry, I didn't notice this while reviewing the patch, until after
pushing it.
---
 libswscale/aarch64/swscale.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libswscale/aarch64/swscale.c b/libswscale/aarch64/swscale.c
index 18746b1b19..6e5a721c1f 100644
--- a/libswscale/aarch64/swscale.c
+++ b/libswscale/aarch64/swscale.c
@@ -300,13 +300,12 @@ av_cold void ff_sws_init_swscale_aarch64(SwsInternal *c)
                 c->chrToYV12 = ff_bgr24ToUV_neon;
             break;
         case AV_PIX_FMT_BGRA:
+            c->lumToYV12 = ff_bgra32ToY_neon;
 #if HAVE_DOTPROD
             if (have_dotprod(cpu_flags)) {
                 c->lumToYV12 = ff_bgra32ToY_neon_dotprod;
             }
-            else
 #endif
-            c->lumToYV12 = ff_bgra32ToY_neon;
             if (c->chrSrcHSubSample)
                 c->chrToYV12 = ff_bgra32ToUV_half_neon;
             else
@@ -320,13 +319,12 @@ av_cold void ff_sws_init_swscale_aarch64(SwsInternal *c)
                 c->chrToYV12 = ff_rgb24ToUV_neon;
             break;
         case AV_PIX_FMT_RGBA:
+            c->lumToYV12 = ff_rgba32ToY_neon;
 #if HAVE_DOTPROD
             if (have_dotprod(cpu_flags)) {
                 c->lumToYV12 = ff_rgba32ToY_neon_dotprod;
             }
-            else
 #endif
-            c->lumToYV12 = ff_rgba32ToY_neon;
             if (c->chrSrcHSubSample)
                 c->chrToYV12 = ff_rgba32ToUV_half_neon;
             else
-- 
2.39.5 (Apple Git-154)



More information about the ffmpeg-devel mailing list