[Scummvm-cvs-logs] SF.net SVN: scummvm:[48189] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Mar 8 11:30:23 CET 2010


Revision: 48189
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48189&view=rev
Author:   fingolfin
Date:     2010-03-08 10:30:23 +0000 (Mon, 08 Mar 2010)

Log Message:
-----------
SCALERS: Get rid of MAKE_WRAPPER; make RGBtoYUV internal

Modified Paths:
--------------
    scummvm/trunk/backends/platform/wince/CEScaler.cpp
    scummvm/trunk/graphics/scaler/2xsai.cpp
    scummvm/trunk/graphics/scaler/aspect.cpp
    scummvm/trunk/graphics/scaler/downscaler.cpp
    scummvm/trunk/graphics/scaler/hq2x.cpp
    scummvm/trunk/graphics/scaler/hq3x.cpp
    scummvm/trunk/graphics/scaler/intern.h
    scummvm/trunk/graphics/scaler.cpp

Modified: scummvm/trunk/backends/platform/wince/CEScaler.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/CEScaler.cpp	2010-03-08 10:29:52 UTC (rev 48188)
+++ scummvm/trunk/backends/platform/wince/CEScaler.cpp	2010-03-08 10:30:23 UTC (rev 48189)
@@ -51,8 +51,15 @@
 		dstPtr += dstPitch;
 	}
 }
-MAKE_WRAPPER(PocketPCPortrait)
 
+void PocketPCPortrait(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+	extern int gBitFormat;
+	if (gBitFormat == 565)
+		PocketPCPortraitTemplate<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+	else
+		PocketPCPortraitTemplate<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+}
+
 void PocketPCLandscapeAspect(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
 
 	const int redblueMasks[] = { 0x7C1F, 0xF81F };
@@ -157,7 +164,14 @@
 		}
 	}
 }
-MAKE_WRAPPER(SmartphoneLandscape)
 
+void SmartphoneLandscape(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+	extern int gBitFormat;
+	if (gBitFormat == 565)
+		SmartphoneLandscapeTemplate<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+	else
+		SmartphoneLandscapeTemplate<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+}
+
 #endif
 

Modified: scummvm/trunk/graphics/scaler/2xsai.cpp
===================================================================
--- scummvm/trunk/graphics/scaler/2xsai.cpp	2010-03-08 10:29:52 UTC (rev 48188)
+++ scummvm/trunk/graphics/scaler/2xsai.cpp	2010-03-08 10:30:23 UTC (rev 48189)
@@ -153,7 +153,13 @@
 	}
 }
 
-MAKE_WRAPPER(Super2xSaI)
+void Super2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+	extern int gBitFormat;
+	if (gBitFormat == 565)
+		Super2xSaITemplate<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+	else
+		Super2xSaITemplate<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+}
 
 template<typename ColorMask>
 void SuperEagleTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
@@ -258,8 +264,15 @@
 	}
 }
 
-MAKE_WRAPPER(SuperEagle)
 
+void SuperEagle(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+	extern int gBitFormat;
+	if (gBitFormat == 565)
+		SuperEagleTemplate<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+	else
+		SuperEagleTemplate<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+}
+
 template<typename ColorMask>
 void _2xSaITemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
 	const uint16 *bP;
@@ -394,4 +407,11 @@
 	}
 }
 
-MAKE_WRAPPER(_2xSaI)
+
+void _2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+	extern int gBitFormat;
+	if (gBitFormat == 565)
+		_2xSaITemplate<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+	else
+		_2xSaITemplate<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+}

Modified: scummvm/trunk/graphics/scaler/aspect.cpp
===================================================================
--- scummvm/trunk/graphics/scaler/aspect.cpp	2010-03-08 10:29:52 UTC (rev 48188)
+++ scummvm/trunk/graphics/scaler/aspect.cpp	2010-03-08 10:30:23 UTC (rev 48189)
@@ -176,6 +176,7 @@
 }
 
 int stretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY) {
+	extern int gBitFormat;
 	if (gBitFormat == 565)
 		return stretch200To240<Graphics::ColorMasks<565> >(buf, pitch, width, height, srcX, srcY, origSrcY);
 	else // gBitFormat == 555

Modified: scummvm/trunk/graphics/scaler/downscaler.cpp
===================================================================
--- scummvm/trunk/graphics/scaler/downscaler.cpp	2010-03-08 10:29:52 UTC (rev 48188)
+++ scummvm/trunk/graphics/scaler/downscaler.cpp	2010-03-08 10:30:23 UTC (rev 48189)
@@ -63,8 +63,15 @@
 		dstPtr += dstPitch;
 	}
 }
-MAKE_WRAPPER(DownscaleAllByHalf)
 
+void DownscaleAllByHalf(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+	extern int gBitFormat;
+	if (gBitFormat == 565)
+		DownscaleAllByHalfTemplate<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+	else
+		DownscaleAllByHalfTemplate<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+}
+
 #endif
 
 
@@ -93,4 +100,11 @@
 		dstPtr += dstPitch;
 	}
 }
-MAKE_WRAPPER(DownscaleHorizByHalf)
+
+void DownscaleHorizByHalf(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+	extern int gBitFormat;
+	if (gBitFormat == 565)
+		DownscaleHorizByHalfTemplate<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+	else
+		DownscaleHorizByHalfTemplate<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+}

Modified: scummvm/trunk/graphics/scaler/hq2x.cpp
===================================================================
--- scummvm/trunk/graphics/scaler/hq2x.cpp	2010-03-08 10:29:52 UTC (rev 48188)
+++ scummvm/trunk/graphics/scaler/hq2x.cpp	2010-03-08 10:30:23 UTC (rev 48189)
@@ -96,6 +96,7 @@
 #define PIXEL11_90	*(q+1+nextlineDst) = interpolate16_2_3_3<ColorMask >(w5, w6, w8);
 #define PIXEL11_100	*(q+1+nextlineDst) = interpolate16_14_1_1<ColorMask >(w5, w6, w8);
 
+extern "C" uint32   *RGBtoYUV;
 #define YUV(x)	RGBtoYUV[w ## x]
 
 

Modified: scummvm/trunk/graphics/scaler/hq3x.cpp
===================================================================
--- scummvm/trunk/graphics/scaler/hq3x.cpp	2010-03-08 10:29:52 UTC (rev 48188)
+++ scummvm/trunk/graphics/scaler/hq3x.cpp	2010-03-08 10:30:23 UTC (rev 48189)
@@ -99,6 +99,7 @@
 #define PIXEL22_5   *(q+2+nextlineDst2) = interpolate16_1_1<ColorMask >(w6, w8);
 #define PIXEL22_C   *(q+2+nextlineDst2) = w5;
 
+extern "C" uint32   *RGBtoYUV;
 #define YUV(x)	RGBtoYUV[w ## x]
 
 

Modified: scummvm/trunk/graphics/scaler/intern.h
===================================================================
--- scummvm/trunk/graphics/scaler/intern.h	2010-03-08 10:29:52 UTC (rev 48188)
+++ scummvm/trunk/graphics/scaler/intern.h	2010-03-08 10:30:23 UTC (rev 48189)
@@ -211,22 +211,4 @@
 */
 }
 
-/**
- * 16bit RGB to YUV conversion table. This table is setup by InitLUT().
- * Used by the hq scaler family.
- */
-extern "C" uint32   *RGBtoYUV;
-
-/** Auxiliary macro to simplify creating those template function wrappers. */
-#define MAKE_WRAPPER(FUNC) \
-	void FUNC(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { \
-		if (gBitFormat == 565) \
-			FUNC ## Template<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height); \
-		else \
-			FUNC ## Template<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height); \
-	}
-
-/** Specifies the currently active 16bit pixel format, 555 or 565. */
-extern int gBitFormat;
-
 #endif

Modified: scummvm/trunk/graphics/scaler.cpp
===================================================================
--- scummvm/trunk/graphics/scaler.cpp	2010-03-08 10:29:52 UTC (rev 48188)
+++ scummvm/trunk/graphics/scaler.cpp	2010-03-08 10:30:23 UTC (rev 48189)
@@ -59,22 +59,27 @@
 uint32 hqx_redBlueMask = 0;
 uint32 hqx_green_redBlue_Mask = 0;
 
-// FIXME/TODO: The RGBtoYUV table sucks up 256 KB. This is bad.
-// In addition we never free it...
-//
-// Note: a memory lookup table is *not* necessarily faster than computing
-// these things on the fly, because of its size. The table together with
-// the code, plus the input/output GFX data, may not fit in the cache on some
-// systems, so main memory has to be accessed, which is about the worst thing
-// that can happen to code which tries to be fast...
-//
-// So we should think about ways to get this smaller / removed. Maybe we can
-// use the same technique employed by our MPEG code to reduce the size of the
-// lookup table at the cost of some additional computations?
-//
-// Of course, the above is largely a conjecture, and the actual speed
-// differences are likely to vary a lot between different architectures and
-// CPUs.
+/**
+ * 16bit RGB to YUV conversion table. This table is setup by InitLUT().
+ * Used by the hq scaler family.
+ *
+ * FIXME/TODO: The RGBtoYUV table sucks up 256 KB. This is bad.
+ * In addition we never free it...
+ *
+ * Note: a memory lookup table is *not* necessarily faster than computing
+ * these things on the fly, because of its size. The table together with
+ * the code, plus the input/output GFX data, may not fit in the cache on some
+ * systems, so main memory has to be accessed, which is about the worst thing
+ * that can happen to code which tries to be fast...
+ *
+ * So we should think about ways to get this smaller / removed. Maybe we can
+ * use the same technique employed by our MPEG code to reduce the size of the
+ * lookup table at the cost of some additional computations?
+ *
+ * Of course, the above is largely a conjecture, and the actual speed
+ * differences are likely to vary a lot between different architectures and
+ * CPUs.
+ */
 uint32 *RGBtoYUV = 0;
 }
 
@@ -322,8 +327,14 @@
 		height -= 2;
 	}
 }
-MAKE_WRAPPER(Normal1o5x)
 
+void Normal1o5x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+	if (gBitFormat == 565)
+		Normal1o5xTemplate<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+	else
+		Normal1o5xTemplate<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+}
+
 /**
  * The Scale2x filter, also known as AdvMame2x.
  * See also http://scale2x.sourceforge.net
@@ -368,8 +379,14 @@
 		q += nextlineDst << 1;
 	}
 }
-MAKE_WRAPPER(TV2x)
 
+void TV2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+	if (gBitFormat == 565)
+		TV2xTemplate<Graphics::ColorMasks<565> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+	else
+		TV2xTemplate<Graphics::ColorMasks<555> >(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
+}
+
 static inline uint16 DOT_16(const uint16 *dotmatrix, uint16 c, int j, int i) {
 	return c - ((c >> 2) & dotmatrix[((j & 3) << 2) + (i & 3)]);
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list