summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-10-14 15:47:43 +0000
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-14 15:47:43 +0000
commit361a7671a045c53ee8e1d5367bc2b1ebbbc757d5 (patch)
tree9af2f1307802e2f2200f7fcd6c785ca8ae86a170 /linux/drivers/media
parentdf0d94ddb68d94430e1b5489d37eebda90a510fa (diff)
downloadmediapointer-dvb-s2-361a7671a045c53ee8e1d5367bc2b1ebbbc757d5.tar.gz
mediapointer-dvb-s2-361a7671a045c53ee8e1d5367bc2b1ebbbc757d5.tar.bz2
Add support for rgb555 pixel formats to vivi
From: Magnus Damm <damm@igel.co.jp> This patch adds RGB555 pixel format support to the vivi driver. Both little endian and big endian versions are added. The driver follows the RGB pixel format described in Table 2-2 of the V4L2 API spec, _not_ the older BGR interpretation described in Table 2-1. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/vivi.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c
index c1aa35ddc..863024acc 100644
--- a/linux/drivers/media/video/vivi.c
+++ b/linux/drivers/media/video/vivi.c
@@ -152,6 +152,16 @@ static struct vivi_fmt formats[] = {
.fourcc = V4L2_PIX_FMT_RGB565X, /* rrrrrggg gggbbbbb */
.depth = 16,
},
+ {
+ .name = "RGB555 (LE)",
+ .fourcc = V4L2_PIX_FMT_RGB555, /* gggbbbbb arrrrrgg */
+ .depth = 16,
+ },
+ {
+ .name = "RGB555 (BE)",
+ .fourcc = V4L2_PIX_FMT_RGB555X, /* arrrrrgg gggbbbbb */
+ .depth = 16,
+ },
};
static struct vivi_fmt *get_format(struct v4l2_format *f)
@@ -338,6 +348,30 @@ static void gen_twopix(struct vivi_fh *fh, unsigned char *buf, int colorpos)
break;
}
break;
+ case V4L2_PIX_FMT_RGB555:
+ switch (color) {
+ case 0:
+ case 2:
+ *p = (g_u << 5) | b_v;
+ break;
+ case 1:
+ case 3:
+ *p = (r_y << 2) | (g_u >> 3);
+ break;
+ }
+ break;
+ case V4L2_PIX_FMT_RGB555X:
+ switch (color) {
+ case 0:
+ case 2:
+ *p = (r_y << 2) | (g_u >> 3);
+ break;
+ case 1:
+ case 3:
+ *p = (g_u << 5) | b_v;
+ break;
+ }
+ break;
}
}
}
@@ -821,6 +855,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
g >>= 2;
b >>= 3;
break;
+ case V4L2_PIX_FMT_RGB555:
+ case V4L2_PIX_FMT_RGB555X:
+ r >>= 3;
+ g >>= 3;
+ b >>= 3;
+ break;
}
if (is_yuv) {