From 78046dadc3145a7afd16034ab1178033a053a03e Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 24 May 2011 18:28:40 -0400 Subject: [PATCH] rgb2rgb: remove duplicate mmx/mmx2/3dnow/sse2 functions. Many functions have such a prefix, but do not actually use any instructions or features from that set, thus giving the false impression that swscale is highly optimized for a particular system, whereas in reality it is not. --- libswscale/x86/rgb2rgb.c | 2 +- libswscale/x86/rgb2rgb_template.c | 74 +++++++++++++++++-------------- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c index 81b29f32ff..78b804e367 100644 --- a/libswscale/x86/rgb2rgb.c +++ b/libswscale/x86/rgb2rgb.c @@ -111,7 +111,7 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL; #undef COMPILE_TEMPLATE_SSE2 #undef COMPILE_TEMPLATE_AMD3DNOW #define COMPILE_TEMPLATE_MMX2 0 -#define COMPILE_TEMPLATE_SSE2 1 +#define COMPILE_TEMPLATE_SSE2 0 #define COMPILE_TEMPLATE_AMD3DNOW 1 #define RENAME(a) a ## _3DNOW #include "rgb2rgb_template.c" diff --git a/libswscale/x86/rgb2rgb_template.c b/libswscale/x86/rgb2rgb_template.c index 8e6ce8586a..c4245afb34 100644 --- a/libswscale/x86/rgb2rgb_template.c +++ b/libswscale/x86/rgb2rgb_template.c @@ -30,15 +30,8 @@ #undef MOVNTQ #undef EMMS #undef SFENCE -#undef MMREG_SIZE #undef PAVGB -#if COMPILE_TEMPLATE_SSE2 -#define MMREG_SIZE 16 -#else -#define MMREG_SIZE 8 -#endif - #if COMPILE_TEMPLATE_AMD3DNOW #define PREFETCH "prefetch" #define PAVGB "pavgusb" @@ -64,6 +57,10 @@ #define SFENCE " # nop" #endif +#if !COMPILE_TEMPLATE_SSE2 + +#if !COMPILE_TEMPLATE_AMD3DNOW + static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size) { uint8_t *dest = dst; @@ -1513,7 +1510,9 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t SFENCE" \n\t" :::"memory"); } +#endif /* !COMPILE_TEMPLATE_AMD3DNOW */ +#if COMPILE_TEMPLATE_MMX2 || COMPILE_TEMPLATE_AMD3DNOW static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWidth, long srcHeight, long srcStride, long dstStride) { long x,y; @@ -1530,7 +1529,6 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi dst+= dstStride; for (y=1; y>2; - dst[dstStride]= ( src[0] + 3*src[srcStride])>>2; -#endif for (x=mmxSize-1; x>2; @@ -1605,7 +1590,6 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi } // last line -#if 1 dst[0]= src[0]; for (x=0; x>2; } dst[2*srcWidth-1]= src[srcWidth-1]; -#else - for (x=0; x