[Scummvm-cvs-logs] CVS: scummvm/common/scaler hq2x.cpp,1.2,1.3 hq3x.cpp,1.2,1.3 intern.h,1.2,1.3

Max Horn fingolfin at users.sourceforge.net
Mon Sep 29 16:36:04 CEST 2003


Update of /cvsroot/scummvm/scummvm/common/scaler
In directory sc8-pr-cvs1:/tmp/cvs-serv13262/scaler

Modified Files:
	hq2x.cpp hq3x.cpp intern.h 
Log Message:
synced hq2x with upstream changes; some performance tweaks to hq2x/hq3x (I think for bigger speed improvement we'd have to use ASM (with C++ fallback of course)...

Index: hq2x.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler/hq2x.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- hq2x.cpp	29 Sep 2003 18:38:51 -0000	1.2
+++ hq2x.cpp	29 Sep 2003 23:34:42 -0000	1.3
@@ -22,49 +22,59 @@
 
 #include "common/scaler/intern.h"
 
-#define PIXEL00_0   *(q) = w[5];
-#define PIXEL00_10  *(q) = interpolate16_2<bitFormat,3,1>(w[5], w[1]);
-#define PIXEL00_11  *(q) = interpolate16_2<bitFormat,3,1>(w[5], w[4]);
-#define PIXEL00_12  *(q) = interpolate16_2<bitFormat,3,1>(w[5], w[2]);
-#define PIXEL00_20  *(q) = interpolate16_3<bitFormat,2,1,1>(w[5], w[4], w[2]);
-#define PIXEL00_30  *(q) = interpolate16_3<bitFormat,6,1,1>(w[5], w[4], w[2]);
-#define PIXEL00_40  *(q) = interpolate16_3<bitFormat,14,1,1>(w[5], w[4], w[2]);
-#define PIXEL00_50  *(q) = interpolate16_3<bitFormat,5,2,1>(w[5], w[2], w[4]);
[...2303 lines suppressed...]
 				} else {
-					PIXEL01_40
+					PIXEL01_100
 				}
-				if (diffYUV(yuv[8], yuv[4])) {
+				if (diffYUV(YUV(8), YUV(4))) {
 					PIXEL10_0
 				} else {
-					PIXEL10_40
+					PIXEL10_100
 				}
-				if (diffYUV(yuv[6], yuv[8])) {
+				if (diffYUV(YUV(6), YUV(8))) {
 					PIXEL11_0
 				} else {
-					PIXEL11_40
+					PIXEL11_100
 				}
 				break;
 			}

Index: hq3x.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler/hq3x.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- hq3x.cpp	29 Sep 2003 18:38:51 -0000	1.2
+++ hq3x.cpp	29 Sep 2003 23:34:42 -0000	1.3
@@ -77,6 +77,8 @@
 #define PIXEL22_5   *(q+2+nextlineDst2) = interpolate16_2<bitFormat,1,1>(w[6], w[8]);
 #define PIXEL22_C   *(q+2+nextlineDst2) = w[5];
 
+#define YUV(x)	RGBtoYUV[w[x]]
+
 /**
  * The HQ3x high quality 3x graphics filter.
  * Original author Maxim Stepin (see http://www.hiend3d.com/hq3x.html).
@@ -85,7 +87,6 @@
 template<int bitFormat>
 void HQ3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
[...1575 lines suppressed...]
+				if (diffYUV(YUV(2), YUV(6))) {
 					PIXEL02_C
 				} else {
 					PIXEL02_2
@@ -2907,13 +2907,13 @@
 				PIXEL10_C
 				PIXEL11
 				PIXEL12_C
-				if (diffYUV(yuv[8], yuv[4])) {
+				if (diffYUV(YUV(8), YUV(4))) {
 					PIXEL20_C
 				} else {
 					PIXEL20_2
 				}
 				PIXEL21_C
-				if (diffYUV(yuv[6], yuv[8])) {
+				if (diffYUV(YUV(6), YUV(8))) {
 					PIXEL22_C
 				} else {
 					PIXEL22_2

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scaler/intern.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- intern.h	29 Sep 2003 18:38:51 -0000	1.2
+++ intern.h	29 Sep 2003 23:34:43 -0000	1.3
@@ -95,11 +95,28 @@
 	static const int trY   = 0x00300000;
 	static const int trU   = 0x00000700;
 	static const int trV   = 0x00000006;
+	
+	int diff;
+	
+	diff = ((yuv1 & Ymask) - (yuv2 & Ymask));
+	if (diff < 0) diff = - diff;
+	if (diff > trY) return true;
 
+	diff = ((yuv1 & Umask) - (yuv2 & Umask));
+	if (diff < 0) diff = - diff;
+	if (diff > trU) return true;
+
+	diff = ((yuv1 & Vmask) - (yuv2 & Vmask));
+	if (diff < 0) diff = - diff;
+	if (diff > trV) return true;
+
+	return false;
+/*
 	return
 	  ( ( ABS((yuv1 & Ymask) - (yuv2 & Ymask)) > trY ) ||
 	    ( ABS((yuv1 & Umask) - (yuv2 & Umask)) > trU ) ||
 	    ( ABS((yuv1 & Vmask) - (yuv2 & Vmask)) > trV ) );
+*/
 }
 
 /**





More information about the Scummvm-git-logs mailing list