Commit 48f73e9288 for ffmpeg

commit 48f73e9288ad2883b385ba10d1473cc4ab02d67e
Author: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date:   Thu Dec 3 19:34:50 2026 +0100

    avfilter/vf_mpdecimate: Move ff_mpdecimate_get_sad16_fn out

    This avoids checkasm pulling in vf_mpdecimate.o
    (for ff_mpdecimate_get_sad16_fn())
    and then all of libavfilter, libavcodec, libavformat etc.
    The size of the checkasm binary decreased from 36412824B to
    12308272B here.

    Reviewed-by: Marvin Scholz <epirat07@gmail.com>
    Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>

diff --git a/libavfilter/mpdecimate.h b/libavfilter/mpdecimate.h
index d8728792ab..48afa264ac 100644
--- a/libavfilter/mpdecimate.h
+++ b/libavfilter/mpdecimate.h
@@ -19,14 +19,42 @@
 #ifndef AVFILTER_MPDECIMATE_H
 #define AVFILTER_MPDECIMATE_H

+#include "config.h"
+
+#include "libavutil/common.h"
 #include "libavutil/pixelutils.h"

+av_pixelutils_sad_fn ff_mpdecimate_get_sad16_fn_x86(void);
+
 /**
  * Get the SAD function for 8x8 blocks of 16-bit samples.
  * Strides are in bytes.
  */
-av_pixelutils_sad_fn ff_mpdecimate_get_sad16_fn(void);
+static int sad_8x8_16(const uint8_t *src1, ptrdiff_t stride1,
+                      const uint8_t *src2, ptrdiff_t stride2)
+{
+    int sum = 0;
+
+    for (int y = 0; y < 8; y++) {
+        const uint16_t *s1 = (const uint16_t *)(src1 + y * stride1);
+        const uint16_t *s2 = (const uint16_t *)(src2 + y * stride2);
+        for (int x = 0; x < 8; x++)
+            sum += FFABS(s1[x] - s2[x]);
+    }
+
+    return sum;
+}
+
+static inline av_cold av_pixelutils_sad_fn ff_mpdecimate_get_sad16_fn(void)
+{
+    av_pixelutils_sad_fn sad = NULL;
+
+#if ARCH_X86 && HAVE_X86ASM
+    sad = ff_mpdecimate_get_sad16_fn_x86();
+#endif
+
+    return sad ? sad : sad_8x8_16;
+}

-av_pixelutils_sad_fn ff_mpdecimate_get_sad16_fn_x86(void);

 #endif /* AVFILTER_MPDECIMATE_H */
diff --git a/libavfilter/vf_mpdecimate.c b/libavfilter/vf_mpdecimate.c
index 6bed7186cd..836269acb0 100644
--- a/libavfilter/vf_mpdecimate.c
+++ b/libavfilter/vf_mpdecimate.c
@@ -89,32 +89,6 @@ static const AVOption mpdecimate_options[] = {

 AVFILTER_DEFINE_CLASS(mpdecimate);

-static int sad_8x8_16(const uint8_t *src1, ptrdiff_t stride1,
-                      const uint8_t *src2, ptrdiff_t stride2)
-{
-    int sum = 0;
-
-    for (int y = 0; y < 8; y++) {
-        const uint16_t *s1 = (const uint16_t *)(src1 + y * stride1);
-        const uint16_t *s2 = (const uint16_t *)(src2 + y * stride2);
-        for (int x = 0; x < 8; x++)
-            sum += FFABS(s1[x] - s2[x]);
-    }
-
-    return sum;
-}
-
-av_pixelutils_sad_fn ff_mpdecimate_get_sad16_fn(void)
-{
-    av_pixelutils_sad_fn sad = NULL;
-
-#if ARCH_X86 && HAVE_X86ASM
-    sad = ff_mpdecimate_get_sad16_fn_x86();
-#endif
-
-    return sad ? sad : sad_8x8_16;
-}
-
 /**
  * Return 1 if the two planes are different, 0 otherwise.
  * The reason is appended to bp, which the caller prints with the frame's