aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2010-12-07 13:00:46 +0200
committernotaz2010-12-14 15:25:04 +0200
commita327967e78393018a9f2a7edb38bc3af657e597a (patch)
tree707375cb00994b09fdd9bb7bea64678ad968132c
parentfa9cfe0a7ff390f15bfdc6add7e57841173d1954 (diff)
downloadpcsx_rearmed-a327967e78393018a9f2a7edb38bc3af657e597a.tar.gz
pcsx_rearmed-a327967e78393018a9f2a7edb38bc3af657e597a.tar.bz2
pcsx_rearmed-a327967e78393018a9f2a7edb38bc3af657e597a.zip
simple neon BGR555 to RGB565 converter
-rw-r--r--Makefile4
-rw-r--r--frontend/arm_utils.s48
-rw-r--r--plugins/dfxvideo/draw_fb.c9
3 files changed, 60 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index bf3eee2..d0b4bc7 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,7 @@ CFLAGS += -ggdb -Ifrontend
LDFLAGS += -lz -lpthread -ldl
ifdef CROSS_COMPILE
CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -ffast-math
+ASFLAGS += -mcpu=cortex-a8 -mfpu=neon
endif
ifndef DEBUG
CFLAGS += -O2
@@ -55,6 +56,9 @@ OBJS += gui/Config.o gui/Plugin.o
OBJS += frontend/main.o frontend/plugin.o frontend/plugin_lib.o
OBJS += frontend/linux/fbdev.o
+ifdef CROSS_COMPILE
+OBJS += frontend/arm_utils.o
+endif
$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map
diff --git a/frontend/arm_utils.s b/frontend/arm_utils.s
new file mode 100644
index 0000000..edaafb8
--- /dev/null
+++ b/frontend/arm_utils.s
@@ -0,0 +1,48 @@
+/*
+ * (C) GraÅžvydas "notaz" Ignotas, 2010
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+.text
+.align 2
+
+.global bgr555_to_rgb565
+bgr555_to_rgb565:
+ mov r3, #0x03e0
+ vdup.16 q15, r3
+ mov r2, r2, lsr #6
+0:
+ vldmia r1!, {q0-q3}
+ vshr.u16 q4, q0, #10
+ vshr.u16 q5, q1, #10
+ vshr.u16 q6, q2, #10
+ vshr.u16 q7, q3, #10
+ vshl.u16 q8, q0, #11
+ vshl.u16 q9, q1, #11
+ vshl.u16 q10, q2, #11
+ vshl.u16 q11, q3, #11
+ vand q0, q0, q15
+ vand q1, q1, q15
+ vand q2, q2, q15
+ vand q3, q3, q15
+ vshl.u16 q0, q0, #1
+ vshl.u16 q1, q1, #1
+ vshl.u16 q2, q2, #1
+ vshl.u16 q3, q3, #1
+ vorr q0, q0, q4
+ vorr q1, q1, q5
+ vorr q2, q2, q6
+ vorr q3, q3, q7
+ vorr q0, q0, q8
+ vorr q1, q1, q9
+ vorr q2, q2, q10
+ vorr q3, q3, q11
+ vstmia r0!, {q0-q3}
+ subs r2, r2, #1
+ bne 0b
+
+ bx lr
+
+@ vim:filetype=armasm
diff --git a/plugins/dfxvideo/draw_fb.c b/plugins/dfxvideo/draw_fb.c
index ce3f515..e251071 100644
--- a/plugins/dfxvideo/draw_fb.c
+++ b/plugins/dfxvideo/draw_fb.c
@@ -36,9 +36,13 @@ PSXPoint_t ptCursorPoint[8];
unsigned short usCursorActive = 0;
char * pCaptionText;
+#ifndef __arm__
+#define bgr555_to_rgb565 memcpy
+#endif
static void blit(void)
{
+ extern void bgr555_to_rgb565(void *dst, void *src, int bytes);
int x = PSXDisplay.DisplayPosition.x;
int y = PSXDisplay.DisplayPosition.y;
int w = PreviousPSXDisplay.Range.x1;
@@ -46,6 +50,9 @@ static void blit(void)
int pitch = PreviousPSXDisplay.DisplayMode.x * 2;
unsigned char *dest = pl_fbdev_buf;
+ if (w <= 0)
+ return;
+
// TODO: clear border if centering
// account for centering
@@ -57,7 +64,7 @@ static void blit(void)
unsigned short *srcs = psxVuw + y * 1024 + x;
for (; h-- > 0; dest += pitch, srcs += 1024)
{
- memcpy(dest, srcs, w * 2);
+ bgr555_to_rgb565(dest, srcs, w * 2);
}
}
}