Patchwork =?utf-8?q?=5BPATCH=5D_swscale=3A_Return_swScale=5F?= =?utf-8?q?*=28=29_for_RUNTIME=5FCPUDETECT_depending_on_HAVE=5F*_fl?= =?utf-8?q?ags=2E?=

login
register
mail settings
Submitter Eric Appleman
Date Feb. 3, 2011, 8:18 p.m.
Message ID <loom.20110203T205553-635@post.gmane.org>
Download mbox | patch
Permalink /patch/844/
State New
Headers show

Comments

Eric Appleman - Feb. 3, 2011, 8:18 p.m.
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.
Ronald Bultje - Feb. 4, 2011, 2:07 p.m.
Hi,

On Thu, Feb 3, 2011 at 3:18 PM, Eric Appleman <erappleman@gmail.com> wrote:
> 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_... && flags & SWS_CPU_CAPS_...) {

I'll commit that variant shortly.

Ronald

Patch

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;
     }