changeset 31984:2aa88c36f9fc

rgb2rgb: build SSE2 codepath
author ramiro
date Wed, 08 Sep 2010 13:16:15 +0000
parents 33ff3fdad741
children 09cd33b66ceb
files libswscale/options.c libswscale/rgb2rgb.c libswscale/swscale.h
diffstat 3 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/options.c	Wed Sep 08 09:53:24 2010 +0000
+++ b/libswscale/options.c	Wed Sep 08 13:16:15 2010 +0000
@@ -49,6 +49,7 @@
     { "accurate_rnd", "accurate rounding", 0, FF_OPT_TYPE_CONST, SWS_ACCURATE_RND, INT_MIN, INT_MAX, VE, "sws_flags" },
     { "mmx", "MMX SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_MMX, INT_MIN, INT_MAX, VE, "sws_flags" },
     { "mmx2", "MMX2 SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_MMX2, INT_MIN, INT_MAX, VE, "sws_flags" },
+    { "sse2", "SSE2 SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_SSE2, INT_MIN, INT_MAX, VE, "sws_flags" },
     { "3dnow", "3DNOW SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_3DNOW, INT_MIN, INT_MAX, VE, "sws_flags" },
     { "altivec", "AltiVec SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_ALTIVEC, INT_MIN, INT_MAX, VE, "sws_flags" },
     { "bfin", "Blackfin SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_BFIN, INT_MIN, INT_MAX, VE, "sws_flags" },
--- a/libswscale/rgb2rgb.c	Wed Sep 08 09:53:24 2010 +0000
+++ b/libswscale/rgb2rgb.c	Wed Sep 08 13:16:15 2010 +0000
@@ -175,11 +175,20 @@
 #define RENAME(a) a ## _MMX2
 #include "rgb2rgb_template.c"
 
+//SSE2 versions
+#undef RENAME
+#undef HAVE_SSE2
+#define HAVE_SSE2 1
+#define RENAME(a) a ## _SSE2
+#include "rgb2rgb_template.c"
+
 //3DNOW versions
 #undef RENAME
 #undef HAVE_MMX2
+#undef HAVE_SSE2
 #undef HAVE_AMD3DNOW
 #define HAVE_MMX2 0
+#define HAVE_SSE2 0
 #define HAVE_AMD3DNOW 1
 #define RENAME(a) a ## _3DNOW
 #include "rgb2rgb_template.c"
@@ -196,7 +205,9 @@
 void sws_rgb2rgb_init(int flags)
 {
 #if HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX
-    if (flags & SWS_CPU_CAPS_MMX2)
+    if (flags & SWS_CPU_CAPS_SSE2)
+        rgb2rgb_init_SSE2();
+    else if (flags & SWS_CPU_CAPS_MMX2)
         rgb2rgb_init_MMX2();
     else if (flags & SWS_CPU_CAPS_3DNOW)
         rgb2rgb_init_3DNOW();
--- a/libswscale/swscale.h	Wed Sep 08 09:53:24 2010 +0000
+++ b/libswscale/swscale.h	Wed Sep 08 13:16:15 2010 +0000
@@ -92,6 +92,7 @@
 #define SWS_CPU_CAPS_3DNOW    0x40000000
 #define SWS_CPU_CAPS_ALTIVEC  0x10000000
 #define SWS_CPU_CAPS_BFIN     0x01000000
+#define SWS_CPU_CAPS_SSE2     0x02000000
 
 #define SWS_MAX_REDUCE_CUTOFF 0.002