media: v4l2-tpg-core: Add 16-bit bayer

Add 16-bit bayer formats to the test pattern generator, namely
  V4L2_PIX_FMT_SRGGB16
  V4L2_PIX_FMT_SGRBG16
  V4L2_PIX_FMT_SGBRG16
  V4L2_PIX_FMT_SBGGR16

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Bård Eirik Winther 2018-10-08 08:29:06 -04:00 коммит произвёл Mauro Carvalho Chehab
Родитель 8f845c6331
Коммит 9b48daa7bb
1 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -202,6 +202,10 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_SGBRG12:
case V4L2_PIX_FMT_SGRBG12:
case V4L2_PIX_FMT_SRGGB12:
case V4L2_PIX_FMT_SBGGR16:
case V4L2_PIX_FMT_SGBRG16:
case V4L2_PIX_FMT_SGRBG16:
case V4L2_PIX_FMT_SRGGB16:
tpg->interleaved = true;
tpg->vdownsampling[1] = 1;
tpg->hdownsampling[1] = 1;
@ -394,6 +398,10 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_SGRBG12:
case V4L2_PIX_FMT_SGBRG12:
case V4L2_PIX_FMT_SBGGR12:
case V4L2_PIX_FMT_SRGGB16:
case V4L2_PIX_FMT_SGRBG16:
case V4L2_PIX_FMT_SGBRG16:
case V4L2_PIX_FMT_SBGGR16:
tpg->twopixelsize[0] = 4;
tpg->twopixelsize[1] = 4;
break;
@ -1358,6 +1366,22 @@ static void gen_twopix(struct tpg_data *tpg,
buf[0][offset] |= (buf[0][offset] >> 4) & 0xf;
buf[1][offset] |= (buf[1][offset] >> 4) & 0xf;
break;
case V4L2_PIX_FMT_SBGGR16:
buf[0][offset] = buf[0][offset + 1] = odd ? g_u_s : b_v;
buf[1][offset] = buf[1][offset + 1] = odd ? r_y_h : g_u_s;
break;
case V4L2_PIX_FMT_SGBRG16:
buf[0][offset] = buf[0][offset + 1] = odd ? b_v : g_u_s;
buf[1][offset] = buf[1][offset + 1] = odd ? g_u_s : r_y_h;
break;
case V4L2_PIX_FMT_SGRBG16:
buf[0][offset] = buf[0][offset + 1] = odd ? r_y_h : g_u_s;
buf[1][offset] = buf[1][offset + 1] = odd ? g_u_s : b_v;
break;
case V4L2_PIX_FMT_SRGGB16:
buf[0][offset] = buf[0][offset + 1] = odd ? g_u_s : r_y_h;
buf[1][offset] = buf[1][offset + 1] = odd ? b_v : g_u_s;
break;
}
}
@ -1376,6 +1400,10 @@ unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line)
case V4L2_PIX_FMT_SGBRG12:
case V4L2_PIX_FMT_SGRBG12:
case V4L2_PIX_FMT_SRGGB12:
case V4L2_PIX_FMT_SBGGR16:
case V4L2_PIX_FMT_SGBRG16:
case V4L2_PIX_FMT_SGRBG16:
case V4L2_PIX_FMT_SRGGB16:
return buf_line & 1;
default:
return 0;