changeset 19333:4f5e2e0529b1

Do not assemble MMX, MMX2 or 3DNOW code unconditionally on X86 and X86_64.
author diego
date Sat, 05 Aug 2006 10:00:54 +0000
parents a28ef75c9fe7
children c95db0988ded
files libswscale/rgb2rgb.c libswscale/swscale.c libswscale/yuv2rgb.c
diffstat 3 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/rgb2rgb.c	Sat Aug 05 09:24:07 2006 +0000
+++ b/libswscale/rgb2rgb.c	Sat Aug 05 10:00:54 2006 +0000
@@ -72,9 +72,11 @@
 			long srcStride1, long srcStride2,
 			long srcStride3, long dstStride);
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if defined(HAVE_MMX)
 static const uint64_t mmx_null  __attribute__((aligned(8))) = 0x0000000000000000ULL;
 static const uint64_t mmx_one   __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL;
+#endif
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
 static const uint64_t mask32b  attribute_used __attribute__((aligned(8))) = 0x000000FF000000FFULL;
 static const uint64_t mask32g  attribute_used __attribute__((aligned(8))) = 0x0000FF000000FF00ULL;
 static const uint64_t mask32r  attribute_used __attribute__((aligned(8))) = 0x00FF000000FF0000ULL;
@@ -195,7 +197,7 @@
 */
 
 void sws_rgb2rgb_init(int flags){
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if defined(HAVE_MMX2) || defined(HAVE_3DNOW) || defined(HAVE_MMX)
 	if(flags & SWS_CPU_CAPS_MMX2){
 		rgb15to16= rgb15to16_MMX2;
 		rgb15to24= rgb15to24_MMX2;
@@ -287,7 +289,7 @@
 		vu9_to_vu12= vu9_to_vu12_MMX;
 		yvu9_to_yuy2= yvu9_to_yuy2_MMX;
 	}else
-#endif /* defined(ARCH_X86) || defined(ARCH_X86_64) */
+#endif /* defined(HAVE_MMX2) || defined(HAVE_3DNOW) || defined(HAVE_MMX) */
 	{
 		rgb15to16= rgb15to16_C;
 		rgb15to24= rgb15to24_C;
--- a/libswscale/swscale.c	Sat Aug 05 09:24:07 2006 +0000
+++ b/libswscale/swscale.c	Sat Aug 05 10:00:54 2006 +0000
@@ -1240,7 +1240,7 @@
         return 0;
 }
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#ifdef HAVE_MMX2
 static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *filter, int32_t *filterPos, int numSplits)
 {
 	uint8_t *fragmentA;
@@ -1411,7 +1411,7 @@
 	}
 	filterPos[i/2]= xpos>>16; // needed to jump to the next part
 }
-#endif // ARCH_X86 || ARCH_X86_64
+#endif /* HAVE_MMX2 */
 
 static void globalInit(void){
     // generating tables:
@@ -2114,11 +2114,11 @@
 				 (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
 				 srcFilter->chrH, dstFilter->chrH, c->param);
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#define MAX_FUNNY_CODE_SIZE 10000
+#if defined(HAVE_MMX2)
 // can't downscale !!!
 		if(c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR))
 		{
-#define MAX_FUNNY_CODE_SIZE 10000
 #ifdef MAP_ANONYMOUS
 			c->funnyYCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
 			c->funnyUVCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
@@ -2135,7 +2135,7 @@
 			initMMX2HScaler(      dstW, c->lumXInc, c->funnyYCode , c->lumMmx2Filter, c->lumMmx2FilterPos, 8);
 			initMMX2HScaler(c->chrDstW, c->chrXInc, c->funnyUVCode, c->chrMmx2Filter, c->chrMmx2FilterPos, 4);
 		}
-#endif /* defined(ARCH_X86) || defined(ARCH_X86_64) */
+#endif /* defined(HAVE_MMX2) */
 	} // Init Horizontal stuff
 
 
--- a/libswscale/yuv2rgb.c	Sat Aug 05 09:24:07 2006 +0000
+++ b/libswscale/yuv2rgb.c	Sat Aug 05 10:00:54 2006 +0000
@@ -154,7 +154,7 @@
 };
 #endif
 
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#ifdef HAVE_MMX
 
 /* hope these constant values are cache line aligned */
 uint64_t attribute_used __attribute__((aligned(8))) mmx_00ffw = 0x00ff00ff00ff00ffULL;
@@ -578,7 +578,7 @@
 
 SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
 {
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if defined(HAVE_MMX2) || defined(HAVE_MMX)
     if(c->flags & SWS_CPU_CAPS_MMX2){
 	switch(c->dstFormat){
 	case IMGFMT_BGR32: return yuv420_rgb32_MMX2;