From: Ramiro Polla Date: Wed, 8 Sep 2010 13:16:15 +0000 (+0000) Subject: rgb2rgb: build SSE2 codepath X-Git-Tag: v0.7b1~2293 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=539ff40c2d685508c62f040693df0f0facda39ff;p=platform%2Fupstream%2Flibav.git rgb2rgb: build SSE2 codepath Originally committed as revision 32068 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale --- diff --git a/libswscale/options.c b/libswscale/options.c index 75564cb..10c077d 100644 --- a/libswscale/options.c +++ b/libswscale/options.c @@ -49,6 +49,7 @@ static const AVOption options[] = { { "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" }, diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index f92e165..3eab9d8 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -175,11 +175,20 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL; #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 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL; 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(); diff --git a/libswscale/swscale.h b/libswscale/swscale.h index 5a9f97c..4e11c9a 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -92,6 +92,7 @@ const char *swscale_license(void); #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