提交 51f30968 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

[media] vivid-tpg: add support for V4L2_PIX_FMT_GREY

Add monochrome support to the TPG.
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
上级 68c90d64
...@@ -199,6 +199,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) ...@@ -199,6 +199,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_XBGR32: case V4L2_PIX_FMT_XBGR32:
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:
tpg->is_yuv = false; tpg->is_yuv = false;
break; break;
case V4L2_PIX_FMT_YUV420M: case V4L2_PIX_FMT_YUV420M:
...@@ -279,6 +280,9 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) ...@@ -279,6 +280,9 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_ABGR32: case V4L2_PIX_FMT_ABGR32:
tpg->twopixelsize[0] = 2 * 4; tpg->twopixelsize[0] = 2 * 4;
break; break;
case V4L2_PIX_FMT_GREY:
tpg->twopixelsize[0] = 2;
break;
case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12:
case V4L2_PIX_FMT_NV21: case V4L2_PIX_FMT_NV21:
case V4L2_PIX_FMT_NV12M: case V4L2_PIX_FMT_NV12M:
...@@ -598,7 +602,7 @@ static void precalculate_color(struct tpg_data *tpg, int k) ...@@ -598,7 +602,7 @@ static void precalculate_color(struct tpg_data *tpg, int k)
g <<= 4; g <<= 4;
b <<= 4; b <<= 4;
} }
if (tpg->qual == TPG_QUAL_GRAY) { if (tpg->qual == TPG_QUAL_GRAY || tpg->fourcc == V4L2_PIX_FMT_GREY) {
/* 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;
...@@ -739,6 +743,9 @@ static void gen_twopix(struct tpg_data *tpg, ...@@ -739,6 +743,9 @@ static void gen_twopix(struct tpg_data *tpg,
b_v = tpg->colors[color][2]; /* B or precalculated V */ b_v = tpg->colors[color][2]; /* B or precalculated V */
switch (tpg->fourcc) { switch (tpg->fourcc) {
case V4L2_PIX_FMT_GREY:
buf[0][offset] = 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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册