aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpulib
diff options
context:
space:
mode:
authornotaz2013-02-08 02:05:48 +0200
committernotaz2013-02-08 02:05:48 +0200
commitc82f907a99f7d0d3071471489d247f4b4394a8b7 (patch)
treef807cdc8edf8a83086d6eee32b04428ac91dd2f0 /plugins/gpulib
parent955f9af0395a7fa2bba0d1c3a4e6ef5d3e111dae (diff)
downloadpcsx_rearmed-c82f907a99f7d0d3071471489d247f4b4394a8b7.tar.gz
pcsx_rearmed-c82f907a99f7d0d3071471489d247f4b4394a8b7.tar.bz2
pcsx_rearmed-c82f907a99f7d0d3071471489d247f4b4394a8b7.zip
move cspace back to frontend
plugins no longer depend on it
Diffstat (limited to 'plugins/gpulib')
-rw-r--r--plugins/gpulib/Makefile5
-rw-r--r--plugins/gpulib/cspace.c173
-rw-r--r--plugins/gpulib/cspace.h18
-rw-r--r--plugins/gpulib/cspace_neon.s165
-rw-r--r--plugins/gpulib/gpulib.mak2
-rw-r--r--plugins/gpulib/vout_pl.c1
6 files changed, 1 insertions, 363 deletions
diff --git a/plugins/gpulib/Makefile b/plugins/gpulib/Makefile
index 4a45aa2..cff6141 100644
--- a/plugins/gpulib/Makefile
+++ b/plugins/gpulib/Makefile
@@ -16,11 +16,6 @@ else
OBJS += vout_pl.o
EXT = $(ARCH).a
endif
-ifeq "$(HAVE_NEON)" "1"
-OBJS += cspace_neon.o
-else
-OBJS += cspace.o
-endif
CFLAGS += $(PLUGIN_CFLAGS)
# need to compile to another dir, same files are compiled
diff --git a/plugins/gpulib/cspace.c b/plugins/gpulib/cspace.c
deleted file mode 100644
index f0c4912..0000000
--- a/plugins/gpulib/cspace.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * (C) Gražvydas "notaz" Ignotas, 2011,2012
- *
- * This work is licensed under the terms of any of these licenses
- * (at your option):
- * - GNU GPL, version 2 or later.
- * - GNU LGPL, version 2.1 or later.
- * See the COPYING file in the top-level directory.
- */
-
-#include "cspace.h"
-
-/*
- * note: these are intended for testing and should be avoided
- * in favor of NEON version or platform-specific conversion
- */
-
-#ifndef __ARM_NEON__
-
-void bgr555_to_rgb565(void *dst_, const void *src_, int bytes)
-{
- const unsigned int *src = src_;
- unsigned int *dst = dst_;
- unsigned int p;
- int x;
-
- for (x = 0; x < bytes / 4; x++) {
- p = src[x];
- p = ((p & 0x7c007c00) >> 10) | ((p & 0x03e003e0) << 1)
- | ((p & 0x001f001f) << 11);
- dst[x] = p;
- }
-}
-
-void bgr888_to_rgb565(void *dst_, const void *src_, int bytes)
-{
- const unsigned char *src = src_;
- unsigned int *dst = dst_;
- unsigned int r1, g1, b1, r2, g2, b2;
-
- for (; bytes >= 6; bytes -= 6, src += 6, dst++) {
- r1 = src[0] & 0xf8;
- g1 = src[1] & 0xfc;
- b1 = src[2] & 0xf8;
- r2 = src[3] & 0xf8;
- g2 = src[4] & 0xfc;
- b2 = src[5] & 0xf8;
- *dst = (r2 << 24) | (g2 << 19) | (b2 << 13) |
- (r1 << 8) | (g1 << 3) | (b1 >> 3);
- }
-}
-
-// TODO?
-void rgb888_to_rgb565(void *dst, const void *src, int bytes) {}
-void bgr888_to_rgb888(void *dst, const void *src, int bytes) {}
-
-#endif // __ARM_NEON__
-
-/* YUV stuff */
-static int yuv_ry[32], yuv_gy[32], yuv_by[32];
-static unsigned char yuv_u[32 * 2], yuv_v[32 * 2];
-
-void bgr_to_uyvy_init(void)
-{
- int i, v;
-
- /* init yuv converter:
- y0 = (int)((0.299f * r0) + (0.587f * g0) + (0.114f * b0));
- y1 = (int)((0.299f * r1) + (0.587f * g1) + (0.114f * b1));
- u = (int)(8 * 0.565f * (b0 - y0)) + 128;
- v = (int)(8 * 0.713f * (r0 - y0)) + 128;
- */
- for (i = 0; i < 32; i++) {
- yuv_ry[i] = (int)(0.299f * i * 65536.0f + 0.5f);
- yuv_gy[i] = (int)(0.587f * i * 65536.0f + 0.5f);
- yuv_by[i] = (int)(0.114f * i * 65536.0f + 0.5f);
- }
- for (i = -32; i < 32; i++) {
- v = (int)(8 * 0.565f * i) + 128;
- if (v < 0)
- v = 0;
- if (v > 255)
- v = 255;
- yuv_u[i + 32] = v;
- v = (int)(8 * 0.713f * i) + 128;
- if (v < 0)
- v = 0;
- if (v > 255)
- v = 255;
- yuv_v[i + 32] = v;
- }
-}
-
-void rgb565_to_uyvy(void *d, const void *s, int pixels)
-{
- unsigned int *dst = d;
- const unsigned short *src = s;
- const unsigned char *yu = yuv_u + 32;
- const unsigned char *yv = yuv_v + 32;
- int r0, g0, b0, r1, g1, b1;
- int y0, y1, u, v;
-
- for (; pixels > 0; src += 2, dst++, pixels -= 2)
- {
- r0 = (src[0] >> 11) & 0x1f;
- g0 = (src[0] >> 6) & 0x1f;
- b0 = src[0] & 0x1f;
- r1 = (src[1] >> 11) & 0x1f;
- g1 = (src[1] >> 6) & 0x1f;
- b1 = src[1] & 0x1f;
- y0 = (yuv_ry[r0] + yuv_gy[g0] + yuv_by[b0]) >> 16;
- y1 = (yuv_ry[r1] + yuv_gy[g1] + yuv_by[b1]) >> 16;
- u = yu[b0 - y0];
- v = yv[r0 - y0];
- // valid Y range seems to be 16..235
- y0 = 16 + 219 * y0 / 31;
- y1 = 16 + 219 * y1 / 31;
-
- *dst = (y1 << 24) | (v << 16) | (y0 << 8) | u;
- }
-}
-
-void bgr555_to_uyvy(void *d, const void *s, int pixels)
-{
- unsigned int *dst = d;
- const unsigned short *src = s;
- const unsigned char *yu = yuv_u + 32;
- const unsigned char *yv = yuv_v + 32;
- int r0, g0, b0, r1, g1, b1;
- int y0, y1, u, v;
-
- for (; pixels > 0; src += 2, dst++, pixels -= 2)
- {
- b0 = (src[0] >> 10) & 0x1f;
- g0 = (src[0] >> 5) & 0x1f;
- r0 = src[0] & 0x1f;
- b1 = (src[1] >> 10) & 0x1f;
- g1 = (src[1] >> 5) & 0x1f;
- r1 = src[1] & 0x1f;
- y0 = (yuv_ry[r0] + yuv_gy[g0] + yuv_by[b0]) >> 16;
- y1 = (yuv_ry[r1] + yuv_gy[g1] + yuv_by[b1]) >> 16;
- u = yu[b0 - y0];
- v = yv[r0 - y0];
- y0 = 16 + 219 * y0 / 31;
- y1 = 16 + 219 * y1 / 31;
-
- *dst = (y1 << 24) | (v << 16) | (y0 << 8) | u;
- }
-}
-
-void bgr888_to_uyvy(void *d, const void *s, int pixels)
-{
- unsigned int *dst = d;
- const unsigned char *src8 = s;
- const unsigned char *yu = yuv_u + 32;
- const unsigned char *yv = yuv_v + 32;
- int r0, g0, b0, r1, g1, b1;
- int y0, y1, u, v;
-
- for (; pixels > 0; src8 += 3*2, dst++, pixels -= 2)
- {
- r0 = src8[0], g0 = src8[1], b0 = src8[2];
- r1 = src8[3], g1 = src8[4], b1 = src8[5];
- y0 = (r0 * 19595 + g0 * 38470 + b0 * 7471) >> 16;
- y1 = (r1 * 19595 + g1 * 38470 + b1 * 7471) >> 16;
- u = yu[(b0 - y0) / 8];
- v = yv[(r0 - y0) / 8];
- y0 = 16 + 219 * y0 / 255;
- y1 = 16 + 219 * y1 / 255;
-
- *dst = (y1 << 24) | (v << 16) | (y0 << 8) | u;
- }
-}
diff --git a/plugins/gpulib/cspace.h b/plugins/gpulib/cspace.h
deleted file mode 100644
index 1a9e339..0000000
--- a/plugins/gpulib/cspace.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-void bgr555_to_rgb565(void *dst, const void *src, int bytes);
-void bgr888_to_rgb888(void *dst, const void *src, int bytes);
-void bgr888_to_rgb565(void *dst, const void *src, int bytes);
-void rgb888_to_rgb565(void *dst, const void *src, int bytes);
-
-void bgr_to_uyvy_init(void);
-void rgb565_to_uyvy(void *d, const void *s, int pixels);
-void bgr555_to_uyvy(void *d, const void *s, int pixels);
-void bgr888_to_uyvy(void *d, const void *s, int pixels);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/plugins/gpulib/cspace_neon.s b/plugins/gpulib/cspace_neon.s
deleted file mode 100644
index b458f06..0000000
--- a/plugins/gpulib/cspace_neon.s
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * (C) Gražvydas "notaz" Ignotas, 2010
- *
- * This work is licensed under the terms of any of these licenses
- * (at your option):
- * - GNU GPL, version 2 or later.
- * - GNU LGPL, version 2.1 or later.
- * See the COPYING file in the top-level directory.
- */
-
-.text
-.align 2
-
-.global bgr555_to_rgb565
-bgr555_to_rgb565:
- pld [r1]
- mov r3, #0x07c0
- vdup.16 q15, r3
- subs r2, r2, #64
- blt btr16_end64
-0:
- pld [r1, #64*2]
- vldmia r1!, {q0-q3}
- vshl.u16 q4, q0, #11
- vshl.u16 q5, q1, #11
- vshl.u16 q6, q2, #11
- vshl.u16 q7, q3, #11
- vsri.u16 q4, q0, #10
- vsri.u16 q5, q1, #10
- vsri.u16 q6, q2, #10
- vsri.u16 q7, q3, #10
- vshl.u16 q0, q0, #1
- vshl.u16 q1, q1, #1
- vshl.u16 q2, q2, #1
- vshl.u16 q3, q3, #1
- vbit q4, q0, q15
- vbit q5, q1, q15
- vbit q6, q2, q15
- vbit q7, q3, q15
- vstmia r0!, {q4-q7}
- subs r2, r2, #64
- bge 0b
-
-btr16_end64:
- adds r2, r2, #64
- bxeq lr
- subs r2, r2, #16
- blt btr16_end16
-
- @ handle the remainder (reasonably rare)
-0:
- vld1.16 {q0}, [r1]!
- vshl.u16 q1, q0, #11
- vshl.u16 q2, q0, #1
- vsri.u16 q1, q0, #10
- vbit q1, q2, q15
- subs r2, r2, #16
- vst1.16 {q1}, [r0]!
- bge 0b
-
-btr16_end16:
- adds r2, r2, #16
- bxeq lr
- subs r2, r2, #8
- bxlt lr
-
- @ very rare
- vld1.16 d0, [r1]!
- vshl.u16 d1, d0, #11
- vshl.u16 d2, d0, #1
- vsri.u16 d1, d0, #10
- vbit d1, d2, d30
- vst1.16 d1, [r0]!
- bx lr
-
-
-.global bgr888_to_rgb888
-bgr888_to_rgb888:
- pld [r1]
- @ r2 /= 48
- mov r2, r2, lsr #4
- movw r3, #0x5556
- movt r3, #0x5555
- umull r12,r2, r3, r2
-0:
- pld [r1, #48*3]
- vld3.8 {d0-d2}, [r1, :64]!
- vld3.8 {d3-d5}, [r1, :64]!
- vswp d0, d2
- vswp d3, d5
- vst3.8 {d0-d2}, [r0, :64]!
- vst3.8 {d3-d5}, [r0, :64]!
- subs r2, r2, #1
- bne 0b
-
- bx lr
-
-
-.global bgr888_to_rgb565
-bgr888_to_rgb565:
- pld [r1]
- @ r2 /= 48
- mov r2, r2, lsr #4
- movw r3, #0x5556
- movt r3, #0x5555
- umull r12,r2, r3, r2
-
- mov r3, #0x07e0
- vdup.16 q15, r3
-0:
- pld [r1, #48*3]
- vld3.8 {d1-d3}, [r1, :64]!
- vld3.8 {d5-d7}, [r1, :64]!
-
- vshll.u8 q8, d2, #3 @ g
- vshll.u8 q9, d6, #3
- vshr.u8 d0, d3, #3 @ b
- vshr.u8 d4, d7, #3
- vzip.8 d0, d1 @ rb
- vzip.8 d4, d5
- vbit q0, q8, q15
- vbit q2, q9, q15
-
- vstmia r0!, {d0,d1}
- vstmia r0!, {d4,d5}
- subs r2, r2, #1
- bne 0b
-
- bx lr
-
-
-.global rgb888_to_rgb565
-rgb888_to_rgb565:
- pld [r1]
- @ r2 /= 48
- mov r2, r2, lsr #4
- movw r3, #0x5556
- movt r3, #0x5555
- umull r12,r2, r3, r2
-
- mov r3, #0x07e0
- vdup.16 q15, r3
-0:
- pld [r1, #48*3]
- vld3.8 {d1-d3}, [r1, :64]!
- vld3.8 {d5-d7}, [r1, :64]!
-
- vshll.u8 q8, d2, #3 @ g
- vshll.u8 q9, d6, #3
- vshr.u8 d2, d1, #3 @ b
- vshr.u8 d6, d5, #3
- vzip.8 d2, d3 @ rb
- vzip.8 d6, d7
- vbit q1, q8, q15
- vbit q3, q9, q15
-
- vstmia r0!, {d2,d3}
- vstmia r0!, {d6,d7}
- subs r2, r2, #1
- bne 0b
-
- bx lr
-
-
-@ vim:filetype=armasm
diff --git a/plugins/gpulib/gpulib.mak b/plugins/gpulib/gpulib.mak
index 035983c..6377274 100644
--- a/plugins/gpulib/gpulib.mak
+++ b/plugins/gpulib/gpulib.mak
@@ -1,5 +1,5 @@
# depends on ARCH definition
-# always adding gpulib to deps in case cspace is needed
+# always adding gpulib to deps (XXX might be no longer needed)
# users must include ../../config.mak
LDFLAGS += -shared -Wl,--no-undefined
diff --git a/plugins/gpulib/vout_pl.c b/plugins/gpulib/vout_pl.c
index 7f031fe..541b5e0 100644
--- a/plugins/gpulib/vout_pl.c
+++ b/plugins/gpulib/vout_pl.c
@@ -11,7 +11,6 @@
#include <string.h>
#include "gpu.h"
-#include "cspace.h"
#include "../../frontend/plugin_lib.h"
static const struct rearmed_cbs *cbs;