Commit 18b3b3b8 authored by Ricardo Ribalda's avatar Ricardo Ribalda Committed by Mauro Carvalho Chehab

[media] media/vivid: Add support for Y16 format

Support for V4L2_PIX_FMT_Y16, a 16 bit greyscale format.
Signed-off-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 9ea964f3
...@@ -220,6 +220,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) ...@@ -220,6 +220,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_ARGB32: case V4L2_PIX_FMT_ARGB32:
case V4L2_PIX_FMT_ABGR32: case V4L2_PIX_FMT_ABGR32:
case V4L2_PIX_FMT_GREY: case V4L2_PIX_FMT_GREY:
case V4L2_PIX_FMT_Y16:
tpg->is_yuv = false; tpg->is_yuv = false;
break; break;
case V4L2_PIX_FMT_YUV444: case V4L2_PIX_FMT_YUV444:
...@@ -313,6 +314,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) ...@@ -313,6 +314,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_YUV444: case V4L2_PIX_FMT_YUV444:
case V4L2_PIX_FMT_YUV555: case V4L2_PIX_FMT_YUV555:
case V4L2_PIX_FMT_YUV565: case V4L2_PIX_FMT_YUV565:
case V4L2_PIX_FMT_Y16:
tpg->twopixelsize[0] = 2 * 2; tpg->twopixelsize[0] = 2 * 2;
break; break;
case V4L2_PIX_FMT_RGB24: case V4L2_PIX_FMT_RGB24:
...@@ -712,7 +714,8 @@ static void precalculate_color(struct tpg_data *tpg, int k) ...@@ -712,7 +714,8 @@ static void precalculate_color(struct tpg_data *tpg, int k)
g <<= 4; g <<= 4;
b <<= 4; b <<= 4;
} }
if (tpg->qual == TPG_QUAL_GRAY || tpg->fourcc == V4L2_PIX_FMT_GREY) { if (tpg->qual == TPG_QUAL_GRAY || tpg->fourcc == V4L2_PIX_FMT_GREY ||
tpg->fourcc == V4L2_PIX_FMT_Y16) {
/* Rec. 709 Luma function */ /* Rec. 709 Luma function */
/* (0.2126, 0.7152, 0.0722) * (255 * 256) */ /* (0.2126, 0.7152, 0.0722) * (255 * 256) */
r = g = b = (13879 * r + 46688 * g + 4713 * b) >> 16; r = g = b = (13879 * r + 46688 * g + 4713 * b) >> 16;
...@@ -895,6 +898,10 @@ static void gen_twopix(struct tpg_data *tpg, ...@@ -895,6 +898,10 @@ static void gen_twopix(struct tpg_data *tpg,
case V4L2_PIX_FMT_GREY: case V4L2_PIX_FMT_GREY:
buf[0][offset] = r_y; buf[0][offset] = r_y;
break; break;
case V4L2_PIX_FMT_Y16:
buf[0][offset] = 0;
buf[0][offset+1] = r_y;
break;
case V4L2_PIX_FMT_YUV422P: case V4L2_PIX_FMT_YUV422P:
case V4L2_PIX_FMT_YUV420: case V4L2_PIX_FMT_YUV420:
case V4L2_PIX_FMT_YUV420M: case V4L2_PIX_FMT_YUV420M:
......
...@@ -188,6 +188,14 @@ struct vivid_fmt vivid_formats[] = { ...@@ -188,6 +188,14 @@ struct vivid_fmt vivid_formats[] = {
.planes = 1, .planes = 1,
.buffers = 1, .buffers = 1,
}, },
{
.fourcc = V4L2_PIX_FMT_Y16,
.vdownsampling = { 1 },
.bit_depth = { 16 },
.is_yuv = true,
.planes = 1,
.buffers = 1,
},
{ {
.fourcc = V4L2_PIX_FMT_RGB332, /* rrrgggbb */ .fourcc = V4L2_PIX_FMT_RGB332, /* rrrgggbb */
.vdownsampling = { 1 }, .vdownsampling = { 1 },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment