This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit e114c6323479b881b0ed7a81524a6b4cda89a160
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Wed Mar 4 19:43:35 2026 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Mon Mar 9 10:17:26 2026 +0100

    avutil/x86/pixelutils: Avoid near-empty header
    
    lavu/x86/pixelutils.h only declares exactly one function,
    namely the arch-specific init function. Such declarations
    are usually contained in the ordinary header providing
    the generic init function, yet the latter is public in this case.
    
    Given that said function is called from exactly one callsite,
    the header can be made more useful by moving the actual x86-init
    function to it (as a static inline function) and removing
    pixelutils_init.c.
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavutil/x86/Makefile          |  2 +-
 libavutil/x86/pixelutils.h      | 65 ++++++++++++++++++++++++++++++++--
 libavutil/x86/pixelutils_init.c | 77 -----------------------------------------
 3 files changed, 64 insertions(+), 80 deletions(-)

diff --git a/libavutil/x86/Makefile b/libavutil/x86/Makefile
index 901298b6cb..bc3c63fe78 100644
--- a/libavutil/x86/Makefile
+++ b/libavutil/x86/Makefile
@@ -12,4 +12,4 @@ X86ASM-OBJS += x86/aes.o x86/aes_init.o                       
          \
                x86/lls.o x86/lls_init.o                                 \
                x86/tx_float.o x86/tx_float_init.o                       \
 
-X86ASM-OBJS-$(CONFIG_PIXELUTILS) += x86/pixelutils.o x86/pixelutils_init.o
+X86ASM-OBJS-$(CONFIG_PIXELUTILS) += x86/pixelutils.o
diff --git a/libavutil/x86/pixelutils.h b/libavutil/x86/pixelutils.h
index 876cf46053..20a675f667 100644
--- a/libavutil/x86/pixelutils.h
+++ b/libavutil/x86/pixelutils.h
@@ -19,8 +19,69 @@
 #ifndef AVUTIL_X86_PIXELUTILS_H
 #define AVUTIL_X86_PIXELUTILS_H
 
+#include <stddef.h>
+#include <stdint.h>
+
+#include "config.h"
+
+#include "cpu.h"
+#include "libavutil/attributes.h"
 #include "libavutil/pixelutils.h"
 
-void ff_pixelutils_sad_init_x86(av_pixelutils_sad_fn *sad, int aligned);
+int ff_pixelutils_sad_8x8_mmxext(const uint8_t *src1, ptrdiff_t stride1,
+                                 const uint8_t *src2, ptrdiff_t stride2);
+
+int ff_pixelutils_sad_16x16_sse2(const uint8_t *src1, ptrdiff_t stride1,
+                                 const uint8_t *src2, ptrdiff_t stride2);
+int ff_pixelutils_sad_a_16x16_sse2(const uint8_t *src1, ptrdiff_t stride1,
+                                   const uint8_t *src2, ptrdiff_t stride2);
+int ff_pixelutils_sad_u_16x16_sse2(const uint8_t *src1, ptrdiff_t stride1,
+                                   const uint8_t *src2, ptrdiff_t stride2);
+
+int ff_pixelutils_sad_32x32_sse2(const uint8_t *src1, ptrdiff_t stride1,
+                                 const uint8_t *src2, ptrdiff_t stride2);
+int ff_pixelutils_sad_a_32x32_sse2(const uint8_t *src1, ptrdiff_t stride1,
+                                   const uint8_t *src2, ptrdiff_t stride2);
+int ff_pixelutils_sad_u_32x32_sse2(const uint8_t *src1, ptrdiff_t stride1,
+                                   const uint8_t *src2, ptrdiff_t stride2);
+
+int ff_pixelutils_sad_32x32_avx2(const uint8_t *src1, ptrdiff_t stride1,
+                                 const uint8_t *src2, ptrdiff_t stride2);
+
+static inline av_cold void ff_pixelutils_sad_init_x86(av_pixelutils_sad_fn 
*sad, int aligned)
+{
+    int cpu_flags = av_get_cpu_flags();
+
+    // The best way to use SSE2 would be to do 2 SADs in parallel,
+    // but we'd have to modify the pixelutils API to return SIMD functions.
+
+    // It's probably not faster to shuffle data around
+    // to get two lines of 8 pixels into a single 16byte register,
+    // so just use the MMX 8x8 version even when SSE2 is available.
+    if (EXTERNAL_MMXEXT(cpu_flags)) {
+        sad[2] = ff_pixelutils_sad_8x8_mmxext;
+    }
+
+    if (EXTERNAL_SSE2(cpu_flags)) {
+        switch (aligned) {
+        case 0: sad[3] = ff_pixelutils_sad_16x16_sse2;   break; // src1 
unaligned, src2 unaligned
+        case 1: sad[3] = ff_pixelutils_sad_u_16x16_sse2; break; // src1   
aligned, src2 unaligned
+        case 2: sad[3] = ff_pixelutils_sad_a_16x16_sse2; break; // src1   
aligned, src2   aligned
+        }
+    }
+
+    if (EXTERNAL_SSE2(cpu_flags)) {
+        switch (aligned) {
+        case 0: sad[4] = ff_pixelutils_sad_32x32_sse2;   break; // src1 
unaligned, src2 unaligned
+        case 1: sad[4] = ff_pixelutils_sad_u_32x32_sse2; break; // src1   
aligned, src2 unaligned
+        case 2: sad[4] = ff_pixelutils_sad_a_32x32_sse2; break; // src1   
aligned, src2   aligned
+        }
+    }
 
-#endif /* AVUTIL_X86_PIXELUTILS_H */
+#if HAVE_AVX2_EXTERNAL
+    if (EXTERNAL_AVX2_FAST(cpu_flags)) {
+        sad[4] = ff_pixelutils_sad_32x32_avx2;
+    }
+#endif
+}
+#endif
diff --git a/libavutil/x86/pixelutils_init.c b/libavutil/x86/pixelutils_init.c
deleted file mode 100644
index 57bdeb8cdb..0000000000
--- a/libavutil/x86/pixelutils_init.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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 "config.h"
-
-#include "pixelutils.h"
-#include "cpu.h"
-
-int ff_pixelutils_sad_8x8_mmxext(const uint8_t *src1, ptrdiff_t stride1,
-                                 const uint8_t *src2, ptrdiff_t stride2);
-
-int ff_pixelutils_sad_16x16_sse2(const uint8_t *src1, ptrdiff_t stride1,
-                                 const uint8_t *src2, ptrdiff_t stride2);
-int ff_pixelutils_sad_a_16x16_sse2(const uint8_t *src1, ptrdiff_t stride1,
-                                   const uint8_t *src2, ptrdiff_t stride2);
-int ff_pixelutils_sad_u_16x16_sse2(const uint8_t *src1, ptrdiff_t stride1,
-                                   const uint8_t *src2, ptrdiff_t stride2);
-
-int ff_pixelutils_sad_32x32_sse2(const uint8_t *src1, ptrdiff_t stride1,
-                                 const uint8_t *src2, ptrdiff_t stride2);
-int ff_pixelutils_sad_a_32x32_sse2(const uint8_t *src1, ptrdiff_t stride1,
-                                   const uint8_t *src2, ptrdiff_t stride2);
-int ff_pixelutils_sad_u_32x32_sse2(const uint8_t *src1, ptrdiff_t stride1,
-                                   const uint8_t *src2, ptrdiff_t stride2);
-
-int ff_pixelutils_sad_32x32_avx2(const uint8_t *src1, ptrdiff_t stride1,
-                                 const uint8_t *src2, ptrdiff_t stride2);
-
-void ff_pixelutils_sad_init_x86(av_pixelutils_sad_fn *sad, int aligned)
-{
-    int cpu_flags = av_get_cpu_flags();
-
-    // The best way to use SSE2 would be to do 2 SADs in parallel,
-    // but we'd have to modify the pixelutils API to return SIMD functions.
-
-    // It's probably not faster to shuffle data around
-    // to get two lines of 8 pixels into a single 16byte register,
-    // so just use the MMX 8x8 version even when SSE2 is available.
-    if (EXTERNAL_MMXEXT(cpu_flags)) {
-        sad[2] = ff_pixelutils_sad_8x8_mmxext;
-    }
-
-    if (EXTERNAL_SSE2(cpu_flags)) {
-        switch (aligned) {
-        case 0: sad[3] = ff_pixelutils_sad_16x16_sse2;   break; // src1 
unaligned, src2 unaligned
-        case 1: sad[3] = ff_pixelutils_sad_u_16x16_sse2; break; // src1   
aligned, src2 unaligned
-        case 2: sad[3] = ff_pixelutils_sad_a_16x16_sse2; break; // src1   
aligned, src2   aligned
-        }
-    }
-
-    if (EXTERNAL_SSE2(cpu_flags)) {
-        switch (aligned) {
-        case 0: sad[4] = ff_pixelutils_sad_32x32_sse2;   break; // src1 
unaligned, src2 unaligned
-        case 1: sad[4] = ff_pixelutils_sad_u_32x32_sse2; break; // src1   
aligned, src2 unaligned
-        case 2: sad[4] = ff_pixelutils_sad_a_32x32_sse2; break; // src1   
aligned, src2   aligned
-        }
-    }
-
-    if (EXTERNAL_AVX2_FAST(cpu_flags)) {
-        sad[4] = ff_pixelutils_sad_32x32_avx2;
-    }
-}

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to