summaryrefslogtreecommitdiffstats
path: root/patches/gst-plugins-base-0.10.34/add-rgb666-support-to-videotestsrc.patch
blob: 74fd685c3b2eaa9413aa2b24c44b2c93cb0b13d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From b03b40150cb7755d3bcdb1a42883a5543779e1dc Mon Sep 17 00:00:00 2001
From: Luotao Fu <l.fu@pengutronix.de>
Date: Thu, 11 Dec 2008 15:17:36 +0100
Subject: [PATCH]  add rgb666 support

 This one adds RGB666 support to videotestsrc.

Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
---
 gst/videotestsrc/videotestsrc.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c
index b9f29fb..e6fb9e5 100644
--- gst/videotestsrc/videotestsrc.c
+++ gst/videotestsrc/videotestsrc.c
@@ -329,6 +329,7 @@ static void paint_setup_xRGB8888 (paintinfo * p, unsigned char *dest);
 static void paint_setup_xBGR8888 (paintinfo * p, unsigned char *dest);
 static void paint_setup_RGBx8888 (paintinfo * p, unsigned char *dest);
 static void paint_setup_BGRx8888 (paintinfo * p, unsigned char *dest);
+static void paint_setup_RGB666 (paintinfo * p, unsigned char *dest);
 static void paint_setup_RGB888 (paintinfo * p, unsigned char *dest);
 static void paint_setup_BGR888 (paintinfo * p, unsigned char *dest);
 static void paint_setup_RGB565 (paintinfo * p, unsigned char *dest);
@@ -351,6 +352,7 @@ static void paint_hline_IMC1 (paintinfo * p, int x, int y, int w);
 static void paint_hline_YUV9 (paintinfo * p, int x, int y, int w);
 static void paint_hline_str4 (paintinfo * p, int x, int y, int w);
 static void paint_hline_str3 (paintinfo * p, int x, int y, int w);
+static void paint_hline_RGB666 (paintinfo * p, int x, int y, int w);
 static void paint_hline_RGB565 (paintinfo * p, int x, int y, int w);
 static void paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w);
 
@@ -432,6 +434,8 @@ struct fourcc_list_struct fourcc_list[] = {
       0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff},
   {VTS_RGB, "RGB ", "BGRA8888", 32, paint_setup_BGRA8888, paint_hline_str4, 32,
       0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff},
+  {VTS_RGB, "RGB ", "RGB666", 32, paint_setup_RGB666, paint_hline_RGB666, 18,
+      0x0003f000, 0x00000fc0, 0x0000003f},
   {VTS_RGB, "RGB ", "RGB888", 24, paint_setup_RGB888, paint_hline_str3, 24,
       0x00ff0000, 0x0000ff00, 0x000000ff},
   {VTS_RGB, "RGB ", "BGR888", 24, paint_setup_BGR888, paint_hline_str3, 24,
@@ -1700,6 +1704,16 @@ paint_setup_BGRx8888 (paintinfo * p, unsigned char *dest)
 }
 
 static void
+paint_setup_RGB666 (paintinfo * p, unsigned char *dest)
+{
+  p->yp = dest + 0;
+  p->up = dest + 1;
+  p->vp = dest + 2;
+  p->ystride = p->width * 4;
+  p->endptr = p->dest + p->ystride * p->height;
+}
+
+static void
 paint_setup_RGB888 (paintinfo * p, unsigned char *dest)
 {
   p->yp = dest + 0;
@@ -1735,6 +1749,20 @@ paint_hline_str4 (paintinfo * p, int x, int y, int w)
 }
 
 static void
+paint_hline_RGB666  (paintinfo * p, int x, int y, int w)
+{
+  int offset = y * p->ystride;
+  guint8 a, b, c;
+  a = (p->color->R & 0xC0) >> 6;
+  b = ((p->color->R & 0xf0) << 2) | ((p->color->G & 0xf0) >> 4);
+  c = ((p->color->G & 0x0c) << 4) | (p->color->B >> 2);
+
+  oil_splat_u8 (p->yp + offset + x * 4, 4, &c, w);
+  oil_splat_u8 (p->up + offset + x * 4, 4, &b, w);
+  oil_splat_u8 (p->vp + offset + x * 4, 4, &a, w);
+}
+
+static void
 paint_hline_str3 (paintinfo * p, int x, int y, int w)
 {
   int offset = y * p->ystride;
-- 
1.5.6.5