changeset 31968:5c9310a4d2e9

swscale: also update flags on sws_getCachedContext()
author ramiro
date Mon, 06 Sep 2010 14:42:25 +0000
parents 45e6a4af3006
children b2fb8e656eca
files libswscale/utils.c
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/utils.c	Mon Sep 06 02:02:53 2010 +0000
+++ b/libswscale/utils.c	Mon Sep 06 14:42:25 2010 +0000
@@ -720,6 +720,15 @@
     }
 }
 
+static int update_flags_cpu(int flags)
+{
+#if !CONFIG_RUNTIME_CPUDETECT //ensure that the flags match the compiled variant if cpudetect is off
+    flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN);
+    flags |= ff_hardcodedcpuflags();
+#endif /* CONFIG_RUNTIME_CPUDETECT */
+    return flags;
+}
+
 SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
                            int dstW, int dstH, enum PixelFormat dstFormat, int flags,
                            SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
@@ -735,10 +744,7 @@
         __asm__ volatile("emms\n\t"::: "memory");
 #endif
 
-#if !CONFIG_RUNTIME_CPUDETECT //ensure that the flags match the compiled variant if cpudetect is off
-    flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN);
-    flags |= ff_hardcodedcpuflags();
-#endif /* CONFIG_RUNTIME_CPUDETECT */
+    flags = update_flags_cpu(flags);
     if (!rgb15to16) sws_rgb2rgb_init(flags);
 
     unscaled = (srcW == dstW && srcH == dstH);
@@ -1509,6 +1515,8 @@
     if (!param)
         param = default_param;
 
+    flags = update_flags_cpu(flags);
+
     if (context &&
         (context->srcW      != srcW      ||
          context->srcH      != srcH      ||