aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/wince
diff options
context:
space:
mode:
authorMax Horn2010-03-08 20:11:44 +0000
committerMax Horn2010-03-08 20:11:44 +0000
commitc554c8541e6b30fc4cf9bf858184cac8a5c8df1b (patch)
tree477297553f598b99773d9416bfa926cf648c5ed9 /backends/platform/wince
parent56bd4a6e18b8bf6a3a91ee07fc881493e7819816 (diff)
downloadscummvm-rg350-c554c8541e6b30fc4cf9bf858184cac8a5c8df1b.tar.gz
scummvm-rg350-c554c8541e6b30fc4cf9bf858184cac8a5c8df1b.tar.bz2
scummvm-rg350-c554c8541e6b30fc4cf9bf858184cac8a5c8df1b.zip
WINCE: Rewrote SmartphoneLandscape scaler C version to match what the ARM assembler version does (untested)
svn-id: r48198
Diffstat (limited to 'backends/platform/wince')
-rw-r--r--backends/platform/wince/CEScaler.cpp32
-rw-r--r--backends/platform/wince/CEScaler.h7
2 files changed, 23 insertions, 16 deletions
diff --git a/backends/platform/wince/CEScaler.cpp b/backends/platform/wince/CEScaler.cpp
index cb97907497..a8f5931e79 100644
--- a/backends/platform/wince/CEScaler.cpp
+++ b/backends/platform/wince/CEScaler.cpp
@@ -41,26 +41,36 @@ void SmartphoneLandscape(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, ui
template<typename ColorMask>
void SmartphoneLandscapeTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
- uint8 *work;
int line = 0;
- while (height--) {
- work = dstPtr;
+ assert((width % 16) == 0);
- 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));
+ while (height--) {
+ uint16 *d = (uint16 *)dstPtr;
- *(((uint16 *)work) + 0) = interpolate32_3_1<ColorMask>(color1, color2);
- *(((uint16 *)work) + 1) = interpolate32_3_1<ColorMask>(color3, color2);
+ 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]);
- work += 2 * sizeof(uint16);
+ s += 16;
}
srcPtr += srcPitch;
dstPtr += dstPitch;
line++;
+
+ // Skip every 8th row
if (line == 7) {
line = 0;
srcPtr += srcPitch;
diff --git a/backends/platform/wince/CEScaler.h b/backends/platform/wince/CEScaler.h
index a51cd5528c..c93e1c66ca 100644
--- a/backends/platform/wince/CEScaler.h
+++ b/backends/platform/wince/CEScaler.h
@@ -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);