diff src/video/SDL_blit.h @ 3035:ff602fdfdedc

Removed Rafal Bursig's MMX RLE code, at his request.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 13 Jan 2009 07:20:55 +0000
parents a0c837a16e4c
children 8d93bfecb9dc
line wrap: on
line diff
--- a/src/video/SDL_blit.h	Tue Jan 13 03:53:22 2009 +0000
+++ b/src/video/SDL_blit.h	Tue Jan 13 07:20:55 2009 +0000
@@ -476,48 +476,7 @@
 	case 3:		pixel_copy_increment;				\
 	case 2:		pixel_copy_increment;				\
 	case 1:		pixel_copy_increment;				\
-		} while ( --n > 0 );					\
-	}								\
-}
-
-/* 2 - times unrolled loop */
-#define DUFFS_LOOP_DOUBLE2(pixel_copy_increment,			\
-				double_pixel_copy_increment, width)	\
-{ int n, w = width;							\
-	if( w & 1 ) {							\
-	    pixel_copy_increment;					\
-	    w--;							\
-	}								\
-	if ( w > 0 )	{						\
-	    n = ( w + 2) / 4;						\
-	    switch( w & 2 ) {						\
-	    case 0: do {	double_pixel_copy_increment;		\
-	    case 2:		double_pixel_copy_increment;		\
-		    } while ( --n > 0 );					\
-	    }								\
-	}								\
-}
-
-/* 2 - times unrolled loop 4 pixels */
-#define DUFFS_LOOP_QUATRO2(pixel_copy_increment,			\
-				double_pixel_copy_increment,		\
-				quatro_pixel_copy_increment, width)	\
-{ int n, w = width;								\
-        if(w & 1) {							\
-	  pixel_copy_increment;						\
-	  w--;								\
-	}								\
-	if(w & 2) {							\
-	  double_pixel_copy_increment;					\
-	  w -= 2;							\
-	}								\
-	if ( w > 0 ) {							\
-	    n = ( w + 7 ) / 8;						\
-	    switch( w & 4 ) {						\
-	    case 0: do {	quatro_pixel_copy_increment;		\
-	    case 4:		quatro_pixel_copy_increment;		\
-		    } while ( --n > 0 );					\
-	    }								\
+		} while (--n > 0);					\
 	}								\
 }
 
@@ -525,40 +484,28 @@
 #define DUFFS_LOOP(pixel_copy_increment, width)				\
 	DUFFS_LOOP8(pixel_copy_increment, width)
 
-#else
-
-/* Don't use Duff's device to unroll loops */
-#define DUFFS_LOOP_DOUBLE2(pixel_copy_increment,			\
-			 double_pixel_copy_increment, width)		\
-{ int n = width;								\
-    if( n & 1 ) {							\
-	pixel_copy_increment;						\
-	n--;								\
-    }									\
-    n=n>>1;								\
-    for(; n > 0; --n) {   						\
-	double_pixel_copy_increment;					\
-    }									\
+/* Special version of Duff's device for even more optimization */
+#define DUFFS_LOOP_124(pixel_copy_increment1,				\
+                       pixel_copy_increment2,				\
+                       pixel_copy_increment4, width)			\
+{ int n = width;							\
+	if (n & 1) {							\
+		pixel_copy_increment1; n -= 1;				\
+	}								\
+	if (n & 2) {							\
+		pixel_copy_increment2; n -= 2;				\
+	}								\
+	if (n) {							\
+		n = (n+7)/ 8;						\
+		switch (n & 4) {					\
+		case 0: do {	pixel_copy_increment4;			\
+		case 4:		pixel_copy_increment4;			\
+			} while (--n > 0);				\
+		}							\
+	}								\
 }
 
-/* Don't use Duff's device to unroll loops */
-#define DUFFS_LOOP_QUATRO2(pixel_copy_increment,			\
-				double_pixel_copy_increment,		\
-				quatro_pixel_copy_increment, width)	\
-{ int n = width;								\
-        if(n & 1) {							\
-	  pixel_copy_increment;						\
-	  n--;								\
-	}								\
-	if(n & 2) {							\
-	  double_pixel_copy_increment;					\
-	  n -= 2;							\
-	}								\
-	n=n>>2;								\
-	for(; n > 0; --n) {   						\
-	  quatro_pixel_copy_increment;					\
-        }								\
-}
+#else
 
 /* Don't use Duff's device to unroll loops */
 #define DUFFS_LOOP(pixel_copy_increment, width)				\
@@ -571,6 +518,10 @@
 	DUFFS_LOOP(pixel_copy_increment, width)
 #define DUFFS_LOOP4(pixel_copy_increment, width)			\
 	DUFFS_LOOP(pixel_copy_increment, width)
+#define DUFFS_LOOP_124(pixel_copy_increment1,				\
+                       pixel_copy_increment2,				\
+                       pixel_copy_increment4, width)			\
+	DUFFS_LOOP(pixel_copy_increment1, width)
 
 #endif /* USE_DUFFS_LOOP */