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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Mar 26 12:09:39 CET 2008

Revision: 31241
Author:   fingolfin
Date:     2008-03-26 04:09:38 -0700 (Wed, 26 Mar 2008)

Log Message:
Added note on how the WinCE scalers are wasting valuable cycles, and how to fix that

Modified Paths:

Modified: scummvm/trunk/backends/platform/wince/CEScaler.cpp
--- scummvm/trunk/backends/platform/wince/CEScaler.cpp	2008-03-26 04:07:32 UTC (rev 31240)
+++ scummvm/trunk/backends/platform/wince/CEScaler.cpp	2008-03-26 11:09:38 UTC (rev 31241)
@@ -37,6 +37,16 @@
 		maskUsed = 1;
+// FIXME: Fingolfin says: The following interpolation code is a lot slower than it needs
+// to be. The reason: Using the value of a global variable to index two global arrays is
+// extremly difficult if not impossible for the compiler to optimize. At the very least,
+// the two arrays should be 'static const', but even then, memory access is required.
+// To avoid this, one could use the techniques used by our other scalers. See also the
+// interpolate functions in graphics/scaler/intern.h.
+// Even if those can't be used directly for some reasons (e.g. the compiler has problems
+// with templates), then still the *techniques* could and should be used. I would exepct
+// that this way, even the C version of PocketPCPortrait() should get a big speed boost.
 static inline uint16 CEinterpolate16_4(uint16 p1, uint16 p2, uint16 p3, uint16 p4)
         return ((((p1 & redblueMasks[maskUsed]) + (p2 & redblueMasks[maskUsed]) + (p3 & redblueMasks[maskUsed]) + (p4 & redblueMasks[maskUsed])) / 4) & redblueMasks[maskUsed]) |
@@ -74,6 +84,10 @@
+// FIXME: Fingolfin says: Please document this function. What does it compute? How
+// does it differ from the code in aspect.cpp ? It would be nice to speed up this function
+// here using the ideas and tracks from aspect.cpp and the comment above, as right now, it
+// is rather hard for the compiler to optimize this code properly.
 void PocketPCLandscapeAspect(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
 #define RB(x) ((x & redblueMasks[maskUsed])<<8)

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