From: notaz Date: Fri, 8 Feb 2013 00:13:03 +0000 (+0200) Subject: frontend: add armv6 color space converter X-Git-Tag: r19~19 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d57557c0644f9294e30657f0c7cf673cf2914695;p=pcsx_rearmed.git frontend: add armv6 color space converter --- diff --git a/Makefile b/Makefile index b6f381cc..9f8b7772 100644 --- a/Makefile +++ b/Makefile @@ -129,6 +129,10 @@ OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o OBJS += frontend/cspace.o ifeq "$(HAVE_NEON)" "1" OBJS += frontend/cspace_neon.o +else +ifeq "$(ARCH)" "arm" +OBJS += frontend/cspace_arm.o +endif endif ifeq "$(PLATFORM)" "generic" diff --git a/frontend/cspace.c b/frontend/cspace.c index f0c49126..33a981df 100644 --- a/frontend/cspace.c +++ b/frontend/cspace.c @@ -15,7 +15,7 @@ * in favor of NEON version or platform-specific conversion */ -#ifndef __ARM_NEON__ +#ifndef __arm__ void bgr555_to_rgb565(void *dst_, const void *src_, int bytes) { @@ -32,6 +32,10 @@ void bgr555_to_rgb565(void *dst_, const void *src_, int bytes) } } +#endif + +#ifndef __ARM_NEON__ + void bgr888_to_rgb565(void *dst_, const void *src_, int bytes) { const unsigned char *src = src_; diff --git a/frontend/cspace_arm.S b/frontend/cspace_arm.S new file mode 100644 index 00000000..e9d15a5b --- /dev/null +++ b/frontend/cspace_arm.S @@ -0,0 +1,65 @@ +/* + * (C) Gražvydas "notaz" Ignotas, 2013 + * + * This work is licensed under the terms of GNU GPL version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "arm_features.h" + +.text +.align 2 + +@ lr=0x001f001f +@ trashes r11, r12 +.macro bgr555_to_rgb565_one rn + and r11, lr, \rn + and r12, lr, \rn, lsr #5 + and \rn, lr, \rn, lsr #10 + orr r12, r11, lsl #5 + orr \rn, r12, lsl #6 +.endm + +.macro pld_ reg offs=#0 +#ifdef HAVE_ARMV6 + pld [\reg, \offs] +#endif +.endm + +.global bgr555_to_rgb565 @ void *dst, const void *src, int bytes +bgr555_to_rgb565: + pld_ r1 + push {r4-r11,lr} + mov lr, #0x001f + subs r2, #4*8 + orr lr, lr, lsl #16 + blt 1f + +0: + ldmia r1!, {r3-r10} + subs r2, #4*8 + bgr555_to_rgb565_one r3 + + pld_ r1, #32*2 + bgr555_to_rgb565_one r4 + bgr555_to_rgb565_one r5 + bgr555_to_rgb565_one r6 + bgr555_to_rgb565_one r7 + bgr555_to_rgb565_one r8 + bgr555_to_rgb565_one r9 + bgr555_to_rgb565_one r10 + stmia r0!, {r3-r10} + bge 0b + +1: + adds r2, #4*8 + popeq {r4-r11,pc} + +2: + ldr r3, [r1], #4 + subs r2, #4 + bgr555_to_rgb565_one r3 + str r3, [r0], #4 + bgt 2b + + pop {r4-r11,pc} diff --git a/jni/Android.mk b/jni/Android.mk index 05a92d46..81962e01 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -35,6 +35,7 @@ ifeq ($(TARGET_ARCH),arm) # gpu LOCAL_CFLAGS += -DREARMED LOCAL_SRC_FILES += ../plugins/gpu_unai/gpulib_if.cpp ../plugins/gpu_unai/gpu_arm.s + LOCAL_SRC_FILES += ../frontend/cspace_arm.S else LOCAL_ARM_NEON := true LOCAL_CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP