mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 07:53:12 +00:00
New ARM code blending Smartphone landscale scaler for WinCE port. Seems to work
in my mockup - I don't have a smartphone resolution device to test it. svn-id: r42516
This commit is contained in:
parent
249b4eb4c3
commit
caae53a25a
@ -53,6 +53,15 @@ void PocketPCPortraitTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPt
|
||||
}
|
||||
MAKE_WRAPPER(PocketPCPortrait)
|
||||
|
||||
void PocketPCRawPortrait(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
|
||||
while (height--) {
|
||||
memcpy(dstPtr, srcPtr, width*sizeof(uint16_t));
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch;
|
||||
}
|
||||
}
|
||||
|
||||
// Our version of an aspect scaler. Main difference is the out-of-place
|
||||
// operation, omitting a straight blit step the sdl backend does. Also,
|
||||
// tests show unaligned access errors with the stock aspect scaler.
|
||||
@ -117,6 +126,7 @@ void PocketPCLandscapeAspect(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr
|
||||
#ifdef ARM
|
||||
extern "C" {
|
||||
void PocketPCHalfARM(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height, int mask, int round);
|
||||
void SmartphoneLandscapeARM(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height, int mask);
|
||||
// Rounding constants and masks used for different pixel formats
|
||||
int roundingconstants[] = { 0x00200802, 0x00201002 };
|
||||
int redbluegreenMasks[] = { 0x03E07C1F, 0x07E0F81F };
|
||||
@ -156,7 +166,7 @@ void PocketPCHalf(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 ds
|
||||
if (gBitFormat == 565)
|
||||
PocketPCHalfTemplate<565>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
else
|
||||
PocketPCHalfTemplate<565>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
PocketPCHalfTemplate<555>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -217,4 +227,15 @@ void SmartphoneLandscapeTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *ds
|
||||
}
|
||||
}
|
||||
}
|
||||
MAKE_WRAPPER(SmartphoneLandscape)
|
||||
|
||||
void SmartphoneLandscape(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
#ifdef ARM
|
||||
int maskUsed = (gBitFormat == 565);
|
||||
SmartphoneLandscapeARM(srcPtr, srcPitch, dstPtr, dstPitch, width, height, redbluegreenMasks[maskUsed]);
|
||||
#else
|
||||
if (gBitFormat == 565)
|
||||
SmartphoneLandscape<565>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
else
|
||||
SmartphoneLandscape<555>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
#endif
|
||||
}
|
||||
|
@ -186,6 +186,7 @@ OBJS += $(srcdir)/gui/Actions.o $(srcdir)/gui/Key.o $(srcdir)/gui/KeysDialog.o
|
||||
OBJS += ../sdl/sdl.o ../sdl/graphics.o ../sdl/events.o ../sdl/hardwarekeys.o
|
||||
OBJS += missing/missing.o
|
||||
OBJS += ARMscaler.o
|
||||
OBJS += smartLandScale.o
|
||||
ifndef DYNAMIC_MODULES
|
||||
OBJS += PocketSCUMM.o
|
||||
endif
|
||||
|
187
backends/platform/wince/smartLandScale.s
Executable file
187
backends/platform/wince/smartLandScale.s
Executable file
@ -0,0 +1,187 @@
|
||||
@ ScummVM Scumm Interpreter
|
||||
@ Copyright (C) 2009 The ScummVM project
|
||||
@
|
||||
@ This program is free software; you can redistribute it and/or
|
||||
@ modify it under the terms of the GNU General Public License
|
||||
@ as published by the Free Software Foundation; either version 2
|
||||
@ of the License, or (at your option) any later version.
|
||||
@
|
||||
@ This program is distributed in the hope that it will be useful,
|
||||
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@ GNU General Public License for more details.
|
||||
@
|
||||
@ You should have received a copy of the GNU General Public License
|
||||
@ along with this program; if not, write to the Free Software
|
||||
@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
@
|
||||
@ $URL$
|
||||
@ $Id$
|
||||
@
|
||||
@ @author Robin Watts (robin@wss.co.uk)
|
||||
|
||||
@ For 16 source pixels 0123456789ABCDEF, we want to produce 11 output
|
||||
@ pixels.
|
||||
|
||||
@0000000000011111111111222222222223333333333344444444444555555555
|
||||
@<------||------><------||------><------||------><------||------>
|
||||
|
||||
@5566666666666777777777778888888888899999999999AAAAAAAAAAABBBBBBB
|
||||
@<------||------><------||------><------||------><------||------>
|
||||
|
||||
@BBBBCCCCCCCCCCCDDDDDDDDDDDEEEEEEEEEEEFFFFFFFFFFF
|
||||
@<------||------><------||------><------||------>
|
||||
|
||||
@ So, use the following weights (approximately right)
|
||||
|
||||
@ d0 = (3*s0 + 1*s1)>>2 Every source pixel constitutes
|
||||
@ d1 = (2*s1 + 2*s2)>>2 3/4 of a destination pixel,
|
||||
@ d2 = (1*s2 + 3*s3)>>2 except for s4,s5,sA and sB which
|
||||
@ d3 = (2*s4 + 2*s5)>>2 constitute 1/2 each.
|
||||
@ d4 = (3*s6 + 1*s7)>>2
|
||||
@ d5 = (2*s7 + 2*s8)>>2
|
||||
@ d6 = (1*s8 + 3*s9)>>2
|
||||
@ d7 = (2*sA + 2*sB)>>2
|
||||
@ d8 = (3*sC + 1*sD)>>2
|
||||
@ d9 = (2*sD + 2*sE)>>2
|
||||
@ dA = (1*sE + 3*sF)>>2
|
||||
|
||||
.text
|
||||
|
||||
.global SmartphoneLandscapeARM
|
||||
|
||||
@ scales a width x height block of 16bpp pixels from srcPtr to dstPtr,
|
||||
@ scaling each scanline down by 11/16ths. Every 8th scanline is dropped
|
||||
@ srcPitch and dstPitch identify how to reach subsequent lines.
|
||||
@ mask allows for one routine to do both 565 and 565 formats.
|
||||
|
||||
SmartphoneLandscapeARM:
|
||||
@ r0 = srcPtr
|
||||
@ r1 = srcSpan
|
||||
@ r2 = dstPtr
|
||||
@ r3 = dstSpan
|
||||
@ <> = width
|
||||
@ <> = height
|
||||
@ <> = mask
|
||||
MOV r12,r13
|
||||
STMFD r13!,{r4-r11,r14}
|
||||
LDMFD r12,{r4,r5,r11} @ r4 = width
|
||||
@ r5 = height
|
||||
@ r11= mask
|
||||
MOV r7, #7 @ r7 = line
|
||||
SUB r8, r1, r4, LSL #1 @ r8 = srcSpan - width*2
|
||||
y_loop:
|
||||
MOV r6, r4 @ r6 = i
|
||||
MOV r9, r2 @ r9 = dstPtr
|
||||
x_loop:
|
||||
LDRH r14,[r0],#2 @ r14 = s0
|
||||
LDRH r12,[r0],#2 @ r12 = s1
|
||||
LDRH r10,[r0],#2 @ r10 = s2
|
||||
ORR r14,r14,r14,LSL #16 @ r14 = s0s0
|
||||
ORR r12,r12,r12,LSL #16 @ r12 = s1s1
|
||||
AND r14,r14,r11 @ r14 = s0 as g_b_r
|
||||
AND r12,r12,r11 @ r12 = s1 as g_b_r
|
||||
ADD r14,r14,r14,LSL #1 @ r14 = s0*3 as g_b_r
|
||||
ORR r10,r10,r10,LSL #16 @ r10 = s2s2
|
||||
ADD r14,r14,r12 @ r14 = (s0*3 + s1) as g_b_r
|
||||
AND r10,r10,r11 @ r10 = s2 as g_b_r
|
||||
AND r14,r11,r14,LSR #2 @ r14 = d0 as g_b_r
|
||||
ORR r14,r14,r14,LSR #16 @ r14 = d0
|
||||
STRH r14,[r9],#2 @ store d0
|
||||
ADD r12,r12,r10 @ r12 = (s1 + s2) as g_b_r
|
||||
LDRH r14,[r0],#2 @ r14 = s3
|
||||
AND r12,r11,r12,LSR #1 @ r12 = d1 as g_b_r
|
||||
ORR r12,r12,r12,LSR #16 @ r12 = d1
|
||||
STRH r12,[r9],#2 @ store d1
|
||||
ORR r14,r14,r14,LSL #16 @ r14 = s3s3
|
||||
AND r14,r14,r11 @ r14 = s3 as g_b_r
|
||||
ADD r10,r10,r14 @ r10 = (s2 + s3) as g_b_r
|
||||
ADD r10,r10,r14,LSL #1 @ r10 = (s2 + s3*3) as g_b_r
|
||||
LDRH r14,[r0],#2 @ r14 = s4
|
||||
LDRH r12,[r0],#2 @ r12 = s5
|
||||
AND r10,r11,r10,LSR #2 @ r10 = d2 as g_b_r
|
||||
ORR r10,r10,r10,LSR #16 @ r10 = d2
|
||||
STRH r10,[r9],#2 @ store d2
|
||||
ORR r14,r14,r14,LSL #16 @ r14 = s4s4
|
||||
ORR r12,r12,r12,LSL #16 @ r12 = s5s5
|
||||
AND r14,r14,r11 @ r14 = s4 as g_b_r
|
||||
AND r12,r12,r11 @ r12 = s5 as g_b_r
|
||||
ADD r14,r14,r12 @ r14 = (s4 + s5) as g_b_r
|
||||
LDRH r12,[r0],#2 @ r12 = s6
|
||||
LDRH r10,[r0],#2 @ r10 = s7
|
||||
AND r14,r11,r14,LSR #1 @ r14 = d3 as g_b_r
|
||||
ORR r14,r14,r14,LSR #16 @ r14 = d3
|
||||
STRH r14,[r9],#2 @ store d3
|
||||
ORR r12,r12,r12,LSL #16 @ r12 = s6s6
|
||||
ORR r10,r10,r10,LSL #16 @ r10 = s7s7
|
||||
LDRH r14,[r0],#2 @ r14 = s8
|
||||
AND r12,r12,r11 @ r12 = s6 as g_b_r
|
||||
AND r10,r10,r11 @ r10 = s7 as g_b_r
|
||||
ORR r14,r14,r14,LSL #16 @ r14 = s8s8
|
||||
ADD r12,r12,r12,LSL #1 @ r12 = 3*s6 as g_b_r
|
||||
AND r14,r14,r11 @ r14 = s8 as g_b_r
|
||||
ADD r12,r12,r10 @ r12 = (3*s6+s7) as g_b_r
|
||||
AND r12,r11,r12,LSR #2 @ r12 = d4 as g_b_r
|
||||
ORR r12,r12,r12,LSR #16 @ r12 = d4
|
||||
STRH r12,[r9],#2 @ store d4
|
||||
ADD r10,r10,r14 @ r10 = (s7+s8) as g_b_r
|
||||
AND r10,r11,r10,LSR #1 @ r10 = d5 as g_b_r
|
||||
LDRH r12,[r0],#2 @ r12 = s9
|
||||
ORR r10,r10,r10,LSR #16 @ r10 = d5
|
||||
STRH r10,[r9],#2 @ store d5
|
||||
ORR r12,r12,r12,LSL #16 @ r12 = s9s9
|
||||
AND r12,r12,r11 @ r12 = s9 as g_b_r
|
||||
ADD r12,r12,r12,LSL #1 @ r12 = s9*3 as g_b_r
|
||||
ADD r12,r12,r14 @ r12 = (s8+s9*3) as g_b_r
|
||||
AND r12,r11,r12,LSR #2 @ r12 = d6 as g_b_r
|
||||
LDRH r14,[r0],#2 @ r14 = sA
|
||||
LDRH r10,[r0],#2 @ r10 = sB
|
||||
ORR r12,r12,r12,LSR #16 @ r12 = d6
|
||||
STRH r12,[r9],#2 @ store d6
|
||||
ORR r14,r14,r14,LSL #16 @ r14 = sAsA
|
||||
ORR r10,r10,r10,LSL #16 @ r10 = sBsB
|
||||
LDRH r12,[r0],#2 @ r12 = sC
|
||||
AND r14,r14,r11 @ r14 = sA as g_b_r
|
||||
AND r10,r10,r11 @ r10 = sB as g_b_r
|
||||
ORR r12,r12,r12,LSL #16 @ r12 = sCsC
|
||||
ADD r14,r14,r10 @ r14 = (sA + sB) as g_b_r
|
||||
LDRH r10,[r0],#2 @ r10 = sD
|
||||
AND r14,r11,r14,LSR #1 @ r14 = d7 as g_b_r
|
||||
AND r12,r12,r11 @ r12 = sC as g_b_r
|
||||
ORR r14,r14,r14,LSR #16 @ r14 = d7
|
||||
ORR r10,r10,r10,LSL #16 @ r10 = sDsD
|
||||
STRH r14,[r9],#2 @ store d7
|
||||
AND r10,r10,r11 @ r10 = sD as g_b_r
|
||||
ADD r12,r12,r12,LSL #1 @ r12 = 3*sC as g_b_r
|
||||
LDRH r14,[r0],#2 @ r14 = sE
|
||||
ADD r12,r12,r10 @ r12 = (3*sC+sD) as g_b_r
|
||||
AND r12,r11,r12,LSR #2 @ r12 = d8 as g_b_r
|
||||
ORR r14,r14,r14,LSL #16 @ r14 = sEsE
|
||||
ORR r12,r12,r12,LSR #16 @ r12 = d8
|
||||
AND r14,r14,r11 @ r14 = sE as g_b_r
|
||||
STRH r12,[r9],#2 @ store d8
|
||||
ADD r10,r10,r14 @ r10 = (sD+sE) as g_b_r
|
||||
LDRH r12,[r0],#2 @ r12 = sF
|
||||
AND r10,r11,r10,LSR #1 @ r10 = d9 as g_b_r
|
||||
ORR r10,r10,r10,LSR #16 @ r10 = d9
|
||||
STRH r10,[r9],#2 @ store d9
|
||||
ORR r12,r12,r12,LSL #16 @ r12 = sFsF
|
||||
AND r12,r12,r11 @ r12 = sF as g_b_r
|
||||
ADD r12,r12,r12,LSL #1 @ r12 = 3*sF as g_b_r
|
||||
ADD r12,r12,r14 @ r12 = (sE+3*sF) as g_b_r
|
||||
AND r12,r11,r12,LSR #2 @ r12 = dA as g_b_r
|
||||
ORR r12,r12,r12,LSR #16 @ r12 = dA
|
||||
SUBS r6,r6,#16 @ width -= 16
|
||||
STRH r12,[r9],#2 @ store dA
|
||||
BGT x_loop
|
||||
|
||||
ADD r0, r0, r8 @ srcPtr += srcSpan
|
||||
ADD r2, r2, r3 @ dstPtr += dstSpan
|
||||
SUBS r7, r7, #1
|
||||
ADDEQ r0, r0, r1
|
||||
MOVEQ r7, #7
|
||||
SUBEQ r5, r5, #1
|
||||
SUBS r5, r5, #1
|
||||
BGT y_loop
|
||||
|
||||
LDMFD r13!,{r4-r11,PC}
|
@ -1209,8 +1209,13 @@ bool OSystem_WINCE3::update_scalers() {
|
||||
if (CEDevice::hasSmartphoneResolution()) {
|
||||
if (_videoMode.screenWidth > 320)
|
||||
error("Game resolution not supported on Smartphone");
|
||||
#ifdef ARM
|
||||
_scaleFactorXm = 11;
|
||||
_scaleFactorXd = 16;
|
||||
#else
|
||||
_scaleFactorXm = 2;
|
||||
_scaleFactorXd = 3;
|
||||
#endif
|
||||
_scaleFactorYm = 7;
|
||||
_scaleFactorYd = 8;
|
||||
_scalerProc = SmartphoneLandscape;
|
||||
|
Loading…
x
Reference in New Issue
Block a user