[Scummvm-cvs-logs] CVS: scummvm/common module.mk,1.15,1.16 scaler.cpp,1.56,1.57

Eugene Sandulenko sev at users.sourceforge.net
Thu May 20 19:09:06 CEST 2004


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1090/common

Modified Files:
	module.mk scaler.cpp 
Log Message:
Added assembly versions of HQ2x and HQ3x scalers.


Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/module.mk,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- module.mk	17 Apr 2004 09:57:15 -0000	1.15
+++ module.mk	21 May 2004 02:08:47 -0000	1.16
@@ -16,6 +16,12 @@
 	common/scaler/hq2x.o \
 	common/scaler/hq3x.o
 
+ifdef HAVE_NASM
+MODULE_OBJS += \
+	common/scaler/hq2x_i386.o \
+	common/scaler/hq3x_i386.o
+endif
+
 MODULE_DIRS += \
 	common \
 	common/scaler

Index: scaler.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- scaler.cpp	12 Apr 2004 21:16:32 -0000	1.56
+++ scaler.cpp	21 May 2004 02:08:47 -0000	1.57
@@ -27,7 +27,22 @@
 int gBitFormat = 565;
 
 // RGB-to-YUV lookup table
-int RGBtoYUV[65536];
+extern "C" {
+
+#ifdef USE_NASM
+// NOTE: if your compiler uses different mangled names, add another
+//       condition here
+
+#ifndef _MSC_VER
+#define RGBtoYUV _RGBtoYUV
+#define LUT16to32 _LUT16to32
+#endif
+
+#endif
+
+uint RGBtoYUV[65536];
+uint LUT16to32[65536];
+}
 
 static const uint16 dotmatrix_565[16] = {
 	0x01E0, 0x0007, 0x3800, 0x0000,
@@ -63,6 +78,10 @@
 	int Y, u, v;
 	int gInc, gShift;
 	
+	for (int i = 0; i < 65536; i++) {
+		LUT16to32[i] = ((i & 0xF800) << 8) + ((i & 0x07E0) << 5) + ((i & 0x001F) << 3);
+	}
+
 	if (BitFormat == 565) {
 		gInc = 256 >> 6;
 		gShift = 6 - 3;
@@ -76,8 +95,8 @@
 			for (b = 0; b < 256; b += 8) {
 				Y = (r + g + b) >> 2;
 				u = 128 + ((r - b) >> 2);
-				v = 128 + ((-r + 2 * g -b) >> 3);
-				RGBtoYUV[ (r << (5+gShift)) + (g << gShift) + (b >> 3) ] = (Y << 16) + (u << 8) + v;
+				v = 128 + ((-r + 2 * g - b) >> 3);
+				RGBtoYUV[ (r << (5 + gShift)) + (g << gShift) + (b >> 3) ] = (Y << 16) + (u << 8) + v;
 			}
 		}
 	}





More information about the Scummvm-git-logs mailing list