[Scummvm-cvs-logs] SF.net SVN: scummvm:[48198] scummvm/trunk/backends/platform/wince

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Mar 8 21:11:45 CET 2010


Revision: 48198
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48198&view=rev
Author:   fingolfin
Date:     2010-03-08 20:11:44 +0000 (Mon, 08 Mar 2010)

Log Message:
-----------
WINCE: Rewrote SmartphoneLandscape scaler C version to match what the ARM assembler version does (untested)

Modified Paths:
--------------
    scummvm/trunk/backends/platform/wince/CEScaler.cpp
    scummvm/trunk/backends/platform/wince/CEScaler.h

Modified: scummvm/trunk/backends/platform/wince/CEScaler.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/CEScaler.cpp	2010-03-08 19:16:50 UTC (rev 48197)
+++ scummvm/trunk/backends/platform/wince/CEScaler.cpp	2010-03-08 20:11:44 UTC (rev 48198)
@@ -41,26 +41,36 @@
 
 template<typename ColorMask>
 void SmartphoneLandscapeTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
-	uint8 *work;
 	int line = 0;
 
+	assert((width % 16) == 0);
+
 	while (height--) {
-		work = dstPtr;
+		uint16 *d = (uint16 *)dstPtr;
 
-		for (int i = 0; i < width; i += 3) {
-			// Filter 2/3
-			uint16 color1 = *(((const uint16 *)srcPtr) + i);
-			uint16 color2 = *(((const uint16 *)srcPtr) + (i + 1));
-			uint16 color3 = *(((const uint16 *)srcPtr) + (i + 2));
+		const uint16 *s = (const uint16 *)srcPtr;
+		for (int i = 0; i < width; i += 16) {
+			// Downscale horizontally to 11/16.
+			// See smartLandScale.s for an explanation of the scale pattern.
+			*d++ = interpolate32_3_1<ColorMask>(s[0], s[1]);
+			*d++ = interpolate32_1_1<ColorMask>(s[1], s[2]);
+			*d++ = interpolate32_3_1<ColorMask>(s[3], s[2]);
+			*d++ = interpolate32_1_1<ColorMask>(s[4], s[5]);
+			*d++ = interpolate32_3_1<ColorMask>(s[6], s[7]);
+			*d++ = interpolate32_1_1<ColorMask>(s[7], s[8]);
+			*d++ = interpolate32_3_1<ColorMask>(s[9], s[8]);
+			*d++ = interpolate32_1_1<ColorMask>(s[10], s[11]);
+			*d++ = interpolate32_3_1<ColorMask>(s[12], s[13]);
+			*d++ = interpolate32_1_1<ColorMask>(s[13], s[14]);
+			*d++ = interpolate32_3_1<ColorMask>(s[15], s[14]);
 
-			*(((uint16 *)work) + 0) = interpolate32_3_1<ColorMask>(color1, color2);
-			*(((uint16 *)work) + 1) = interpolate32_3_1<ColorMask>(color3, color2);
-
-			work += 2 * sizeof(uint16);
+			s += 16;
 		}
 		srcPtr += srcPitch;
 		dstPtr += dstPitch;
 		line++;
+
+		// Skip every 8th row
 		if (line == 7) {
 			line = 0;
 			srcPtr += srcPitch;

Modified: scummvm/trunk/backends/platform/wince/CEScaler.h
===================================================================
--- scummvm/trunk/backends/platform/wince/CEScaler.h	2010-03-08 19:16:50 UTC (rev 48197)
+++ scummvm/trunk/backends/platform/wince/CEScaler.h	2010-03-08 20:11:44 UTC (rev 48198)
@@ -32,11 +32,8 @@
 #include "graphics/scaler/intern.h"
 
 /**
- * This filter (down)scales the source image horizontally by a factor of 2/3
- * and vertically by 7/8. For example, a 320x200 image is scaled to 213x175.
- *
- * @note The ARM asm version seems to work differently ?!? It apparently scales
- * horizontally by 11/16. Thus a 320x200 image is scaled to 220x175.
+ * This filter (down)scales the source image horizontally by a factor of 11/16
+ * and vertically by 7/8. For example, a 320x200 image is scaled to 220x175.
  */
 DECLARE_SCALER(SmartphoneLandscape);
 


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