[FFmpeg-devel] [PATCH] swscale: Return swScale_*() for RUNTIME_CPUDETECT depending on HAVE_* flags.

Eric Appleman erappleman
Thu Feb 3 21:18:45 CET 2011


This is based on a patch by ramiro from back in 2009. I've found it essential in
my builds for compiling ffmpeg with cpudetect on mingw32.

diff --git a/swscale.c b/swscale.c
index 375171f..50f81be 100644
--- a/swscale.c
+++ b/swscale.c
@@ -1262,16 +1262,25 @@ SwsFunc ff_getSwsFunc(SwsContext *c)
 
 #if ARCH_X86
     // ordered per speed fastest first
-    if (flags & SWS_CPU_CAPS_MMX2) {
+#if HAVE_MMX2
+      if (flags & SWS_CPU_CAPS_MMX2) {
         sws_init_swScale_MMX2(c);
         return swScale_MMX2;
-    } else if (flags & SWS_CPU_CAPS_3DNOW) {
+    } else
+#endif
+#if HAVE_AMD3DNOW
+      if (flags & SWS_CPU_CAPS_3DNOW) {
         sws_init_swScale_3DNow(c);
         return swScale_3DNow;
-    } else if (flags & SWS_CPU_CAPS_MMX) {
+    } else 
+#endif
+#if HAVE_MMX
+      if (flags & SWS_CPU_CAPS_MMX) {
         sws_init_swScale_MMX(c);
         return swScale_MMX;
-    } else {
+    } else 
+#endif
+    {
         sws_init_swScale_C(c);
         return swScale_C;
     }





More information about the ffmpeg-devel mailing list