summaryrefslogtreecommitdiffstats
path: root/postproc/yuv2rgb.c
diff options
context:
space:
mode:
authormichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-16 20:25:50 +0000
committermichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-16 20:25:50 +0000
commitf3ab565a232442d4b4548d6c14b7aefac3efa7c9 (patch)
tree299c64c56ec95d9e8998315a49b1c9faa2c1183c /postproc/yuv2rgb.c
parent0b8054d7ade30371f66b047e7f4a80b073e0fe39 (diff)
downloadmpv-f3ab565a232442d4b4548d6c14b7aefac3efa7c9.tar.bz2
mpv-f3ab565a232442d4b4548d6c14b7aefac3efa7c9.tar.xz
8bpp support (no dithering yet, use -vop noise for now)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6452 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'postproc/yuv2rgb.c')
-rw-r--r--postproc/yuv2rgb.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/postproc/yuv2rgb.c b/postproc/yuv2rgb.c
index 10db46f467..6aeb91c48d 100644
--- a/postproc/yuv2rgb.c
+++ b/postproc/yuv2rgb.c
@@ -392,6 +392,47 @@ static void yuv2rgb_c_16 (uint8_t * py_1, uint8_t * py_2,
}
}
+// This is exactly the same code as yuv2rgb_c_32 except for the types of
+// r, g, b, dst_1, dst_2
+static void yuv2rgb_c_8 (uint8_t * py_1, uint8_t * py_2,
+ uint8_t * pu, uint8_t * pv,
+ void * _dst_1, void * _dst_2, int h_size)
+{
+ int U, V, Y;
+ uint8_t * r, * g, * b;
+ uint8_t * dst_1, * dst_2;
+
+ h_size >>= 3;
+ dst_1 = _dst_1;
+ dst_2 = _dst_2;
+
+ while (h_size--) {
+ RGB(0);
+ DST1(0);
+ DST2(0);
+
+ RGB(1);
+ DST2(1);
+ DST1(1);
+
+ RGB(2);
+ DST1(2);
+ DST2(2);
+
+ RGB(3);
+ DST2(3);
+ DST1(3);
+
+ pu += 4;
+ pv += 4;
+ py_1 += 8;
+ py_2 += 8;
+ dst_1 += 8;
+ dst_2 += 8;
+ }
+}
+
+
static int div_round (int dividend, int divisor)
{
if (dividend > 0)
@@ -407,6 +448,7 @@ static void yuv2rgb_c_init (int bpp, int mode)
uint32_t *table_32 = 0;
uint16_t *table_16 = 0;
uint8_t *table_8 = 0;
+ uint8_t *table_332 = 0;
int entry_size = 0;
void *table_r = 0, *table_g = 0, *table_b = 0;
@@ -489,6 +531,42 @@ static void yuv2rgb_c_init (int bpp, int mode)
}
break;
+ case 8:
+ yuv2rgb_c_internal = yuv2rgb_c_8;
+
+ table_332 = malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t));
+
+ entry_size = sizeof (uint8_t);
+ table_r = table_332 + 197;
+ table_b = table_332 + 197 + 685;
+ table_g = table_332 + 197 + 2*682;
+
+ for (i = -197; i < 256+197; i++) {
+ int j = table_Y[i+384] >> 5;
+
+ if (mode == MODE_RGB)
+ j <<= 5;
+
+ ((uint8_t *)table_r)[i] = j;
+ }
+ for (i = -132; i < 256+132; i++) {
+ int j = table_Y[i+384] >> 5;
+
+ if (mode == MODE_BGR)
+ j <<= 1;
+
+ ((uint8_t *)table_g)[i] = j << 2;
+ }
+ for (i = -232; i < 256+232; i++) {
+ int j = table_Y[i+384] >> 6;
+
+ if (mode == MODE_BGR)
+ j <<= 6;
+
+ ((uint8_t *)table_b)[i] = j;
+ }
+ break;
+
default:
mp_msg(MSGT_SWS,MSGL_ERR,"%ibpp not supported by yuv2rgb\n", bpp);
//exit (1);