diff options
-rw-r--r-- | backends/platform/wince/ARMscaler.s | 184 | ||||
-rw-r--r-- | backends/platform/wince/CEScaler.cpp | 12 | ||||
-rw-r--r-- | backends/platform/wince/Makefile | 42 |
3 files changed, 219 insertions, 19 deletions
diff --git a/backends/platform/wince/ARMscaler.s b/backends/platform/wince/ARMscaler.s new file mode 100644 index 0000000000..3397674d2b --- /dev/null +++ b/backends/platform/wince/ARMscaler.s @@ -0,0 +1,184 @@ +@ ScummVM Scumm Interpreter +@ Copyright (C) 2007 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) + + .text + + .global PocketPCHalfARM + + @ ARM implementation of PocketPCHalf scaler. + @ Scales a width x height block of 16bpp pixels from srcPtr to + @ dstPtr. srcPitch and dstPitch identify how to reach subsequent + @ lines. redblueMask and round allow for one routine to do both + @ 565 and 555 formats. +PocketPCHalfARM: + @ r0 = srcPtr + @ r1 = srcPitch + @ r2 = dstPtr + @ r3 = dstPitch + MOV r12,r13 + STMFD r13!,{r4-r11,r14} + LDMIA r12,{r4-r7} + @ r4 = width + @ r5 = height + @ r6 = redblueMask + @ r7 = round + + SUB r3,r3,r4 @ dstPitch -= width + SUBS r5,r5,#2 @ while ((height-=2) >= 0) + BLT end +height_loop: + + SUBS r11,r4,#8 @ r11= width_minus_8 + BLT thin + +width_loop: + @ unroll loop 4 times here + LDRH r8,[r0],r1 @ r8 = A = srcPtr[0] + LDRH r9,[r0],#2 @ r9 = C = srcPtr[dstPitch] + LDRH r12,[r0],-r1 @ r12= D = srcPtr[dstPitch+2] + LDRH r14,[r0],#2 @ r14= B = srcPtr[2] + + ORR r8, r8, r8, LSL #16 @ r8 = b | g | r | b | g | r + ORR r9, r9, r9, LSL #16 @ r9 = b | g | r | b | g | r + ORR r12,r12,r12,LSL #16 @ r12= b | g | r | b | g | r + ORR r14,r14,r14,LSL #16 @ r14= b | g | r | b | g | r + AND r8, r8, r6 @ r8 = 0 | g | 0 | b | 0 | r + AND r9, r9, r6 @ r9 = 0 | g | 0 | b | 0 | r + AND r12,r12,r6 @ r12= 0 | g | 0 | b | 0 | r + AND r14,r14,r6 @ r14= 0 | g | 0 | b | 0 | r + ADD r8, r8, r9 + ADD r8, r8, r12 + ADD r8, r8, r14 + ADD r8, r8, r7 @ r8 = summed pixels + rounding + AND r8, r6, r8, LSR #2 @ r8 = 0 | g | 0 | b | 0 | r + ORR r10,r8, r8, LSR #16 @ r10= 0 | g | 0 | b | g | r + + LDRH r8,[r0],r1 @ r8 = A = srcPtr[0] + LDRH r9,[r0],#2 @ r9 = C = srcPtr[dstPitch] + LDRH r12,[r0],-r1 @ r12= D = srcPtr[dstPitch+2] + LDRH r14,[r0],#2 @ r14= B = srcPtr[2] + + STRH r10,[r2],#2 @ *dstPtr++ + + ORR r8, r8, r8, LSL #16 @ r8 = b | g | r | b | g | r + ORR r9, r9, r9, LSL #16 @ r9 = b | g | r | b | g | r + ORR r12,r12,r12,LSL #16 @ r12= b | g | r | b | g | r + ORR r14,r14,r14,LSL #16 @ r14= b | g | r | b | g | r + AND r8, r8, r6 @ r8 = 0 | g | 0 | b | 0 | r + AND r9, r9, r6 @ r9 = 0 | g | 0 | b | 0 | r + AND r12,r12,r6 @ r12= 0 | g | 0 | b | 0 | r + AND r14,r14,r6 @ r14= 0 | g | 0 | b | 0 | r + ADD r8, r8, r9 + ADD r8, r8, r12 + ADD r8, r8, r14 + ADD r8, r8, r7 @ r8 = summed pixels + rounding + AND r8, r6, r8, LSR #2 @ r8 = 0 | g | 0 | b | 0 | r + ORR r10,r8, r8, LSR #16 @ r10= 0 | g | 0 | b | g | r + + LDRH r8,[r0],r1 @ r8 = A = srcPtr[0] + LDRH r9,[r0],#2 @ r9 = C = srcPtr[dstPitch] + LDRH r12,[r0],-r1 @ r12= D = srcPtr[dstPitch+2] + LDRH r14,[r0],#2 @ r14= B = srcPtr[2] + + STRH r10,[r2],#2 @ *dstPtr++ + + ORR r8, r8, r8, LSL #16 @ r8 = b | g | r | b | g | r + ORR r9, r9, r9, LSL #16 @ r9 = b | g | r | b | g | r + ORR r12,r12,r12,LSL #16 @ r12= b | g | r | b | g | r + ORR r14,r14,r14,LSL #16 @ r14= b | g | r | b | g | r + AND r8, r8, r6 @ r8 = 0 | g | 0 | b | 0 | r + AND r9, r9, r6 @ r9 = 0 | g | 0 | b | 0 | r + AND r12,r12,r6 @ r12= 0 | g | 0 | b | 0 | r + AND r14,r14,r6 @ r14= 0 | g | 0 | b | 0 | r + ADD r8, r8, r9 + ADD r8, r8, r12 + ADD r8, r8, r14 + ADD r8, r8, r7 @ r8 = summed pixels + rounding + AND r8, r6, r8, LSR #2 @ r8 = 0 | g | 0 | b | 0 | r + ORR r10,r8, r8, LSR #16 @ r10= 0 | g | 0 | b | g | r + + LDRH r8,[r0],r1 @ r8 = A = srcPtr[0] + LDRH r9,[r0],#2 @ r9 = C = srcPtr[dstPitch] + LDRH r12,[r0],-r1 @ r12= D = srcPtr[dstPitch+2] + LDRH r14,[r0],#2 @ r14= B = srcPtr[2] + + STRH r10,[r2],#2 @ *dstPtr++ + + ORR r8, r8, r8, LSL #16 @ r8 = b | g | r | b | g | r + ORR r9, r9, r9, LSL #16 @ r9 = b | g | r | b | g | r + ORR r12,r12,r12,LSL #16 @ r12= b | g | r | b | g | r + ORR r14,r14,r14,LSL #16 @ r14= b | g | r | b | g | r + AND r8, r8, r6 @ r8 = 0 | g | 0 | b | 0 | r + AND r9, r9, r6 @ r9 = 0 | g | 0 | b | 0 | r + AND r12,r12,r6 @ r12= 0 | g | 0 | b | 0 | r + AND r14,r14,r6 @ r14= 0 | g | 0 | b | 0 | r + ADD r8, r8, r9 + ADD r8, r8, r12 + ADD r8, r8, r14 + ADD r8, r8, r7 @ r8 = summed pixels + rounding + AND r8, r6, r8, LSR #2 @ r8 = 0 | g | 0 | b | 0 | r + ORR r10, r8, r8, LSR #16 @ r8 = 0 | g | 0 | b | g | r + + STRH r10,[r2],#2 @ *dstPtr++ + + SUBS r11,r11,#8 @ width_minus_8 -= 8 + BGE width_loop @ (width_minus_8 >= 0) => do 8+ more + +thin: + ADDS r11,r11,#8 @ r11= width + BEQ width_end @ if no more left to do, then bale +thin_lp: + @ single output pixels done in this bit + LDRH r8,[r0],r1 @ r8 = A = srcPtr[0] + LDRH r9,[r0],#2 @ r9 = C = srcPtr[dstPitch] + LDRH r12,[r0],-r1 @ r12= D = srcPtr[dstPitch+2] + LDRH r14,[r0],#2 @ r14= B = srcPtr[2] + + ORR r8, r8, r8, LSL #16 @ r8 = b | g | r | b | g | r + ORR r9, r9, r9, LSL #16 @ r9 = b | g | r | b | g | r + ORR r12,r12,r12,LSL #16 @ r12= b | g | r | b | g | r + ORR r14,r14,r14,LSL #16 @ r14= b | g | r | b | g | r + AND r8, r8, r6 @ r8 = 0 | g | 0 | b | 0 | r + AND r9, r9, r6 @ r9 = 0 | g | 0 | b | 0 | r + AND r12,r12,r6 @ r12= 0 | g | 0 | b | 0 | r + AND r14,r14,r6 @ r14= 0 | g | 0 | b | 0 | r + ADD r8, r8, r9 + ADD r8, r8, r12 + ADD r8, r8, r14 + ADD r8, r8, r7 @ r8 = summed pixels + rounding + AND r8, r6, r8, LSR #2 @ r8 = 0 | g | 0 | b | 0 | r + ORR r8, r8, r8, LSR #16 @ r8 = 0 | g | 0 | b | g | r + + STRH r8,[r2],#2 @ *dstPtr++ + + SUBS r11,r11,#2 + BGT thin_lp +width_end: + ADD r2,r2,r3 @ dstPtr += dstPitch + ADD r0,r0,r1,LSL #1 @ srcPtr += 2*srcPitch + SUB r0,r0,r4,LSL #1 @ srcPtr -= 2*width + + SUBS r5,r5,#2 + BGE height_loop + +end: + LDMFD r13!,{r4-r11,PC} diff --git a/backends/platform/wince/CEScaler.cpp b/backends/platform/wince/CEScaler.cpp index 86fe2a7104..dac46b801a 100644 --- a/backends/platform/wince/CEScaler.cpp +++ b/backends/platform/wince/CEScaler.cpp @@ -128,8 +128,19 @@ 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); + // Rounding constants and masks used for different pixel formats + int roundingconstants[] = { 0x00200802, 0x00201002 }; + int redbluegreenMasks[] = { 0x03E07C1F, 0x07E0F81F }; +} +#endif void PocketPCHalf(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { +#ifdef ARM + PocketPCHalfARM(srcPtr, srcPitch, dstPtr, dstPitch, width, height, redbluegreenMasks[maskUsed],roundingconstants[maskUsed]); +#else uint8 *work; int i; uint16 srcPitch16 = (uint16)(srcPitch / sizeof(uint16)); @@ -151,6 +162,7 @@ void PocketPCHalf(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 ds srcPtr += 2 * srcPitch; dstPtr += dstPitch; } +#endif } diff --git a/backends/platform/wince/Makefile b/backends/platform/wince/Makefile index 1ec8990ee5..1d08073b1d 100644 --- a/backends/platform/wince/Makefile +++ b/backends/platform/wince/Makefile @@ -7,20 +7,21 @@ srcdir = ../../.. VPATH = $(srcdir) #DISABLE_SCUMM = 1 -DISABLE_SKY = 1 -DISABLE_QUEEN = 1 -DISABLE_GOB = 1 -DISABLE_LURE = 1 -DISABLE_CINE = 1 -DISABLE_SAGA = 1 -DISABLE_KYRA = 1 -DISABLE_AGI = 1 -DISABLE_AGOS = 1 -DISABLE_SWORD1 = 1 -DISABLE_SWORD2 = 1 -DISABLE_TOUCHE = 1 +#DISABLE_SKY = 1 +#DISABLE_QUEEN = 1 +#DISABLE_GOB = 1 +#DISABLE_LURE = 1 +#DISABLE_CINE = 1 +#DISABLE_SAGA = 1 +#DISABLE_KYRA = 1 +#DISABLE_AGI = 1 +#DISABLE_AGOS = 1 +#DISABLE_SWORD1 = 1 +#DISABLE_SWORD2 = 1 +#DISABLE_TOUCHE = 1 DISABLE_PARALLACTION = 1 +DISABLE_HQ_SCALERS = 1 CXX = arm-wince-pe-g++ LD = arm-wince-pe-g++ @@ -33,20 +34,20 @@ RM = rm -f RM_REC = rm -rf ECHO = echo -n CAT = cat - +AS = arm-wince-pe-as DEFINES := -D_WIN32_WCE=300 -DARM -D__ARM__ -D_ARM_ -DUNICODE -DSCUMM_NEED_ALIGNMENT -DFPM_DEFAULT -DUSE_MAD -DNONSTANDARD_PORT -DUSE_TREMOR -DUSE_VORBIS -DUSE_MPEG2 -DWIN32 -DUSE_ZLIB DEFINES += -D__stdcall= -Dcdecl= -D__cdecl__= -D__cdecl= -Wno-multichar -#DEFINES += -O2 -DEFINES += -DDEBUG -DUSE_WINDBG -g +#DEFINES += -DDEBUG -DUSE_WINDBG -g +DEFINES += -O2 -INCLUDES := -I$(srcdir) -I. -I$(srcdir)/engines -Ilibs/include -Ilibs/include/sdl -ICEgui -ICEkeys +INCLUDES := -I$(srcdir) -I. -I$(srcdir)/engines -Imissing/gcc -Ilibs/include -Ilibs/include/sdl -ICEgui -ICEkeys -I/cygdrive/e/wince-gcc-root/include CFLAGS := CXXFLAGS := $(CFLAGS) -LDFLAGS := -Llibs/lib -L/usr/local/wince/cross-tools/lib +LDFLAGS := -Llibs/lib -L/cygdrive/e/wince-gcc-root/lib LIBS := -lSDL -lzlib -lmad -lmpeg2 -ltremorce --entry WinMainCRTStartup TARGET = scummvm.exe @@ -62,18 +63,21 @@ OBJS += CEkeys/EventsBuffer.o OBJS += $(srcdir)/gui/Actions.o $(srcdir)/gui/Key.o $(srcdir)/gui/KeysDialog.o OBJS += ../sdl/sdl.o ../sdl/graphics.o ../sdl/events.o OBJS += missing/missing.o -OBJS += PocketSCUMM.o +OBJS += PocketSCUMM.o ARMscaler.o include $(srcdir)/Makefile.common all: dist dist: $(TARGET) - bzip2 -fvk $(TARGET) +# bzip2 -fvk $(TARGET) $(STRIP) $(TARGET) PocketSCUMM.o: $(WINDRES) $*.rc $@ +ARMscaler.o: + $(AS) $*.s -o $@ + $(TARGET): $(OBJS) $(LD) $^ $(LDFLAGS) $(LIBS) -o $@ -Wl,-Map,scummvm.exe.map -Wl,--stack,65536 |