Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1444363 > unrolled thread
| Started by | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
|---|---|
| First post | 2016-07-15 17:20 +0200 |
| Last post | 2016-07-15 17:20 +0200 |
| Articles | 5 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/6] Add HSV format Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2016-07-15 17:20 +0200
[PATCH 3/6] [media] Documentation: Add Ricardo Ribalda as author Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2016-07-15 17:20 +0200
[PATCH 5/6] [media] vivid: Add support for HSV formats Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2016-07-15 17:20 +0200
[PATCH 1/6] [media] videodev2.h Add HSV formats Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2016-07-15 17:20 +0200
[PATCH 4/6] [media] vivid: code refactor for color representation Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2016-07-15 17:20 +0200
| From | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
|---|---|
| Date | 2016-07-15 17:20 +0200 |
| Subject | [PATCH 0/6] Add HSV format |
| Message-ID | <rVd4e-8vN-7@gated-at.bofh.it> |
HSV formats are extremely useful for image segmentation. This set of patches makes v4l2 aware of this kind of formats. Vivid changes have been divided in three to ease the reviewing process. We are working on patches for Gstreamer and OpenCV that will make use of these formats. Thanks! Ricardo Ribalda Delgado (6): [media] videodev2.h Add HSV formats [media] Documentation: Add HSV format [media] Documentation: Add Ricardo Ribalda as author [media] vivid: code refactor for color representation [media] vivid: Add support for HSV formats [media] vivid: Rename variable .../DocBook/media/v4l/pixfmt-packed-hsv.xml | 195 ++++++++++++ Documentation/DocBook/media/v4l/pixfmt.xml | 13 + Documentation/DocBook/media/v4l/v4l2.xml | 19 ++ drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 341 ++++++++++++++------- drivers/media/platform/vivid/vivid-core.h | 2 +- drivers/media/platform/vivid/vivid-vid-common.c | 66 ++-- drivers/media/v4l2-core/v4l2-ioctl.c | 2 + include/media/v4l2-tpg.h | 8 +- include/uapi/linux/videodev2.h | 4 + 9 files changed, 503 insertions(+), 147 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/pixfmt-packed-hsv.xml -- 2.8.1
[toc] | [next] | [standalone]
| From | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
|---|---|
| Date | 2016-07-15 17:20 +0200 |
| Subject | [PATCH 3/6] [media] Documentation: Add Ricardo Ribalda as author |
| Message-ID | <rVd4e-8vN-19@gated-at.bofh.it> |
| In reply to | #1444363 |
My initials were on the Changelog, but there was no link to my mail.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
Documentation/DocBook/media/v4l/v4l2.xml | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml
index f38039b7c338..e09839d56113 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -117,6 +117,17 @@ Remote Controller chapter.</contrib>
</address>
</affiliation>
</author>
+
+ <author>
+ <firstname>Ricardo</firstname>
+ <surname>Ribalda</surname>
+ <contrib>HSV formats and minor fixes.</contrib>
+ <affiliation>
+ <address>
+ <email>ricardo.ribalda@gmail.com</email>
+ </address>
+ </affiliation>
+ </author>
</authorgroup>
<copyright>
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
|---|---|
| Date | 2016-07-15 17:20 +0200 |
| Subject | [PATCH 5/6] [media] vivid: Add support for HSV formats |
| Message-ID | <rVd4e-8vN-11@gated-at.bofh.it> |
| In reply to | #1444363 |
This patch adds support for V4L2_PIX_FMT_HSV24 and V4L2_PIX_FMT_HSV32.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 94 +++++++++++++++++++++++--
drivers/media/platform/vivid/vivid-vid-common.c | 14 ++++
include/media/v4l2-tpg.h | 1 +
3 files changed, 105 insertions(+), 4 deletions(-)
diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index 3cab77ea92a4..d87a7a6a6b22 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -318,6 +318,10 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->hmask[0] = ~1;
tpg->color_representation = TGP_COLOR_REPRESENTATION_YUV;
break;
+ case V4L2_PIX_FMT_HSV24:
+ case V4L2_PIX_FMT_HSV32:
+ tpg->color_representation = TGP_COLOR_REPRESENTATION_HSV;
+ break;
default:
return false;
}
@@ -351,6 +355,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
break;
case V4L2_PIX_FMT_RGB24:
case V4L2_PIX_FMT_BGR24:
+ case V4L2_PIX_FMT_HSV24:
tpg->twopixelsize[0] = 2 * 3;
break;
case V4L2_PIX_FMT_BGR666:
@@ -361,6 +366,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_ARGB32:
case V4L2_PIX_FMT_ABGR32:
case V4L2_PIX_FMT_YUV32:
+ case V4L2_PIX_FMT_HSV32:
tpg->twopixelsize[0] = 2 * 4;
break;
case V4L2_PIX_FMT_NV12:
@@ -408,6 +414,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->twopixelsize[1] = 4;
break;
}
+
return true;
}
EXPORT_SYMBOL_GPL(tpg_s_fourcc);
@@ -490,6 +497,64 @@ static inline int linear_to_rec709(int v)
return tpg_linear_to_rec709[v];
}
+static void color_to_hsv(struct tpg_data *tpg, int r, int g, int b,
+ int *h, int *s, int *v)
+{
+ int max_rgb, min_rgb, diff_rgb;
+ int aux;
+ int third;
+
+ r >>= 4;
+ g >>= 4;
+ b >>= 4;
+
+ /*V*/
+ max_rgb = max3(r, g, b);
+ *v = max_rgb;
+ if (!max_rgb) {
+ *h = 0;
+ *s = 0;
+ return;
+ }
+
+ /*S*/
+ min_rgb = min3(r, g, b);
+ diff_rgb = max_rgb - min_rgb;
+ aux = 255 * diff_rgb;
+ aux += max_rgb / 2;
+ aux /= max_rgb;
+ *s = aux;
+ if (!aux) {
+ *h = 0;
+ return;
+ }
+
+ /*H*/
+ if (max_rgb == r) {
+ aux = g - b;
+ third = 0;
+ } else if (max_rgb == g) {
+ aux = b - r;
+ third = 60;
+ } else {
+ aux = r - g;
+ third = 120;
+ }
+
+ aux *= 30;
+ aux += diff_rgb / 2;
+ aux /= diff_rgb;
+ aux += third;
+
+ /*Clamp H*/
+ if (aux < 0)
+ aux += 180;
+ else if (aux > 180)
+ aux -= 180;
+ *h = aux;
+
+}
+
static void rgb2ycbcr(const int m[3][3], int r, int g, int b,
int y_offset, int *y, int *cb, int *cr)
{
@@ -829,7 +894,19 @@ static void precalculate_color(struct tpg_data *tpg, int k)
ycbcr_to_color(tpg, y, cb, cr, &r, &g, &b);
}
- if (tpg->color_representation == TGP_COLOR_REPRESENTATION_YUV) {
+ switch (tpg->color_representation) {
+ case TGP_COLOR_REPRESENTATION_HSV:
+ {
+ int h, s, v;
+
+ color_to_hsv(tpg, r, g, b, &h, &s, &v);
+ tpg->colors[k][0] = h;
+ tpg->colors[k][1] = s;
+ tpg->colors[k][2] = v;
+ break;
+ }
+ case TGP_COLOR_REPRESENTATION_YUV:
+ {
/* Convert to YCbCr */
int y, cb, cr;
@@ -863,7 +940,10 @@ static void precalculate_color(struct tpg_data *tpg, int k)
tpg->colors[k][0] = y;
tpg->colors[k][1] = cb;
tpg->colors[k][2] = cr;
- } else {
+ break;
+ }
+ case TGP_COLOR_REPRESENTATION_RGB:
+ {
if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) {
r = (r * 219) / 255 + (16 << 4);
g = (g * 219) / 255 + (16 << 4);
@@ -913,6 +993,8 @@ static void precalculate_color(struct tpg_data *tpg, int k)
tpg->colors[k][0] = r;
tpg->colors[k][1] = g;
tpg->colors[k][2] = b;
+ break;
+ }
}
}
@@ -938,8 +1020,8 @@ static void gen_twopix(struct tpg_data *tpg,
alpha = 0;
if (color == TPG_COLOR_RANDOM)
precalculate_color(tpg, color);
- r_y = tpg->colors[color][0]; /* R or precalculated Y */
- g_u = tpg->colors[color][1]; /* G or precalculated U */
+ r_y = tpg->colors[color][0]; /* R or precalculated Y, H */
+ g_u = tpg->colors[color][1]; /* G or precalculated U, V */
b_v = tpg->colors[color][2]; /* B or precalculated V */
switch (tpg->fourcc) {
@@ -1121,6 +1203,7 @@ static void gen_twopix(struct tpg_data *tpg,
buf[0][offset + 1] = (g_u << 5) | b_v;
break;
case V4L2_PIX_FMT_RGB24:
+ case V4L2_PIX_FMT_HSV24:
buf[0][offset] = r_y;
buf[0][offset + 1] = g_u;
buf[0][offset + 2] = b_v;
@@ -1138,6 +1221,7 @@ static void gen_twopix(struct tpg_data *tpg,
break;
case V4L2_PIX_FMT_RGB32:
case V4L2_PIX_FMT_XRGB32:
+ case V4L2_PIX_FMT_HSV32:
alpha = 0;
/* fall through */
case V4L2_PIX_FMT_YUV32:
@@ -1896,6 +1980,8 @@ static const char *tpg_color_representation_str(enum tgp_color_representation
{
switch (color_representation) {
+ case TGP_COLOR_REPRESENTATION_HSV:
+ return "HSV";
case TGP_COLOR_REPRESENTATION_YUV:
return "YCbCr";
case TGP_COLOR_REPRESENTATION_RGB:
diff --git a/drivers/media/platform/vivid/vivid-vid-common.c b/drivers/media/platform/vivid/vivid-vid-common.c
index 314799111cf7..cc985685ed05 100644
--- a/drivers/media/platform/vivid/vivid-vid-common.c
+++ b/drivers/media/platform/vivid/vivid-vid-common.c
@@ -445,6 +445,20 @@ struct vivid_fmt vivid_formats[] = {
.planes = 1,
.buffers = 1,
},
+ {
+ .fourcc = V4L2_PIX_FMT_HSV24, /* HSV 24bits */
+ .vdownsampling = { 1 },
+ .bit_depth = { 24 },
+ .planes = 1,
+ .buffers = 1,
+ },
+ {
+ .fourcc = V4L2_PIX_FMT_HSV32, /* HSV 32bits */
+ .vdownsampling = { 1 },
+ .bit_depth = { 32 },
+ .planes = 1,
+ .buffers = 1,
+ },
/* Multiplanar formats */
diff --git a/include/media/v4l2-tpg.h b/include/media/v4l2-tpg.h
index 13ea42bb9530..17a257d12941 100644
--- a/include/media/v4l2-tpg.h
+++ b/include/media/v4l2-tpg.h
@@ -90,6 +90,7 @@ enum tpg_move_mode {
enum tgp_color_representation {
TGP_COLOR_REPRESENTATION_RGB,
TGP_COLOR_REPRESENTATION_YUV,
+ TGP_COLOR_REPRESENTATION_HSV,
};
extern const char * const tpg_aspect_strings[];
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
|---|---|
| Date | 2016-07-15 17:20 +0200 |
| Subject | [PATCH 1/6] [media] videodev2.h Add HSV formats |
| Message-ID | <rVd4e-8vN-15@gated-at.bofh.it> |
| In reply to | #1444363 |
These formats store the color information of the image
in a geometrical representation. The colors are mapped into a
cylinder, where the angle is the HUE, the height is the VALUE
and the distance to the center is the SATURATION. This is a very
useful format for image segmentation algorithms.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
include/uapi/linux/videodev2.h | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index f899bf1c5fc0..54670cd59212 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1238,6 +1238,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_TM6000: descr = "A/V + VBI Mux Packet"; break;
case V4L2_PIX_FMT_CIT_YYVYUY: descr = "GSPCA CIT YYVYUY"; break;
case V4L2_PIX_FMT_KONICA420: descr = "GSPCA KONICA420"; break;
+ case V4L2_PIX_FMT_HSV24: descr = "24-bit HSV 8-8-8"; break;
+ case V4L2_PIX_FMT_HSV32: descr = "32-bit XHSV 8-8-8-8"; break;
case V4L2_SDR_FMT_CU8: descr = "Complex U8"; break;
case V4L2_SDR_FMT_CU16LE: descr = "Complex U16LE"; break;
case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 724f43e69d03..c7fb760386cf 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -580,6 +580,10 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */
#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
+/* HSV formats */
+#define V4L2_PIX_FMT_HSV24 v4l2_fourcc('H', 'S', 'V', '3')
+#define V4L2_PIX_FMT_HSV32 v4l2_fourcc('H', 'S', 'V', '4')
+
/* compressed formats */
#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
|---|---|
| Date | 2016-07-15 17:20 +0200 |
| Subject | [PATCH 4/6] [media] vivid: code refactor for color representation |
| Message-ID | <rVd4e-8vN-25@gated-at.bofh.it> |
| In reply to | #1444363 |
Replace is_yuv with color_representation. Which can be used by HSV
formats.
This change should ease the review of the following patches.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 44 ++++++++++++++-------
drivers/media/platform/vivid/vivid-core.h | 2 +-
drivers/media/platform/vivid/vivid-vid-common.c | 52 ++++++++++++-------------
include/media/v4l2-tpg.h | 7 +++-
4 files changed, 63 insertions(+), 42 deletions(-)
diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index 3ec3cebe62b9..3cab77ea92a4 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -237,13 +237,13 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_GREY:
case V4L2_PIX_FMT_Y16:
case V4L2_PIX_FMT_Y16_BE:
- tpg->is_yuv = false;
+ tpg->color_representation = TGP_COLOR_REPRESENTATION_RGB;
break;
case V4L2_PIX_FMT_YUV444:
case V4L2_PIX_FMT_YUV555:
case V4L2_PIX_FMT_YUV565:
case V4L2_PIX_FMT_YUV32:
- tpg->is_yuv = true;
+ tpg->color_representation = TGP_COLOR_REPRESENTATION_YUV;
break;
case V4L2_PIX_FMT_YUV420M:
case V4L2_PIX_FMT_YVU420M:
@@ -256,7 +256,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->hdownsampling[1] = 2;
tpg->hdownsampling[2] = 2;
tpg->planes = 3;
- tpg->is_yuv = true;
+ tpg->color_representation = TGP_COLOR_REPRESENTATION_YUV;
break;
case V4L2_PIX_FMT_YUV422M:
case V4L2_PIX_FMT_YVU422M:
@@ -268,7 +268,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->hdownsampling[1] = 2;
tpg->hdownsampling[2] = 2;
tpg->planes = 3;
- tpg->is_yuv = true;
+ tpg->color_representation = TGP_COLOR_REPRESENTATION_YUV;
break;
case V4L2_PIX_FMT_NV16M:
case V4L2_PIX_FMT_NV61M:
@@ -280,7 +280,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->hdownsampling[1] = 1;
tpg->hmask[1] = ~1;
tpg->planes = 2;
- tpg->is_yuv = true;
+ tpg->color_representation = TGP_COLOR_REPRESENTATION_YUV;
break;
case V4L2_PIX_FMT_NV12M:
case V4L2_PIX_FMT_NV21M:
@@ -292,7 +292,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->hdownsampling[1] = 1;
tpg->hmask[1] = ~1;
tpg->planes = 2;
- tpg->is_yuv = true;
+ tpg->color_representation = TGP_COLOR_REPRESENTATION_YUV;
break;
case V4L2_PIX_FMT_YUV444M:
case V4L2_PIX_FMT_YVU444M:
@@ -302,21 +302,21 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
tpg->vdownsampling[2] = 1;
tpg->hdownsampling[1] = 1;
tpg->hdownsampling[2] = 1;
- tpg->is_yuv = true;
+ tpg->color_representation = TGP_COLOR_REPRESENTATION_YUV;
break;
case V4L2_PIX_FMT_NV24:
case V4L2_PIX_FMT_NV42:
tpg->vdownsampling[1] = 1;
tpg->hdownsampling[1] = 1;
tpg->planes = 2;
- tpg->is_yuv = true;
+ tpg->color_representation = TGP_COLOR_REPRESENTATION_YUV;
break;
case V4L2_PIX_FMT_YUYV:
case V4L2_PIX_FMT_UYVY:
case V4L2_PIX_FMT_YVYU:
case V4L2_PIX_FMT_VYUY:
tpg->hmask[0] = ~1;
- tpg->is_yuv = true;
+ tpg->color_representation = TGP_COLOR_REPRESENTATION_YUV;
break;
default:
return false;
@@ -820,7 +820,7 @@ static void precalculate_color(struct tpg_data *tpg, int k)
cb = (128 << 4) + (tmp_cb * tpg->contrast * tpg->saturation) / (128 * 128);
cr = (128 << 4) + (tmp_cr * tpg->contrast * tpg->saturation) / (128 * 128);
- if (tpg->is_yuv) {
+ if (tpg->color_representation == TGP_COLOR_REPRESENTATION_YUV) {
tpg->colors[k][0] = clamp(y >> 4, 1, 254);
tpg->colors[k][1] = clamp(cb >> 4, 1, 254);
tpg->colors[k][2] = clamp(cr >> 4, 1, 254);
@@ -829,7 +829,7 @@ static void precalculate_color(struct tpg_data *tpg, int k)
ycbcr_to_color(tpg, y, cb, cr, &r, &g, &b);
}
- if (tpg->is_yuv) {
+ if (tpg->color_representation == TGP_COLOR_REPRESENTATION_YUV) {
/* Convert to YCbCr */
int y, cb, cr;
@@ -1842,7 +1842,9 @@ static void tpg_recalc(struct tpg_data *tpg)
if (tpg->quantization == V4L2_QUANTIZATION_DEFAULT)
tpg->real_quantization =
- V4L2_MAP_QUANTIZATION_DEFAULT(!tpg->is_yuv,
+ V4L2_MAP_QUANTIZATION_DEFAULT(
+ tpg->color_representation ==
+ TGP_COLOR_REPRESENTATION_RGB,
tpg->colorspace, tpg->real_ycbcr_enc);
tpg_precalculate_colors(tpg);
@@ -1889,11 +1891,25 @@ static int tpg_pattern_avg(const struct tpg_data *tpg,
return -1;
}
+static const char *tpg_color_representation_str(enum tgp_color_representation
+ color_representation)
+{
+ switch (color_representation) {
+
+ case TGP_COLOR_REPRESENTATION_YUV:
+ return "YCbCr";
+ case TGP_COLOR_REPRESENTATION_RGB:
+ default:
+ return "RGB";
+
+ }
+}
+
void tpg_log_status(struct tpg_data *tpg)
{
pr_info("tpg source WxH: %ux%u (%s)\n",
- tpg->src_width, tpg->src_height,
- tpg->is_yuv ? "YCbCr" : "RGB");
+ tpg->src_width, tpg->src_height,
+ tpg_color_representation_str(tpg->color_representation));
pr_info("tpg field: %u\n", tpg->field);
pr_info("tpg crop: %ux%u@%dx%d\n", tpg->crop.width, tpg->crop.height,
tpg->crop.left, tpg->crop.top);
diff --git a/drivers/media/platform/vivid/vivid-core.h b/drivers/media/platform/vivid/vivid-core.h
index a7daa40d0a49..191ba679ad65 100644
--- a/drivers/media/platform/vivid/vivid-core.h
+++ b/drivers/media/platform/vivid/vivid-core.h
@@ -80,7 +80,7 @@ extern unsigned vivid_debug;
struct vivid_fmt {
u32 fourcc; /* v4l2 format id */
- bool is_yuv;
+ enum tgp_color_representation color_representation;
bool can_do_overlay;
u8 vdownsampling[TPG_MAX_PLANES];
u32 alpha_mask;
diff --git a/drivers/media/platform/vivid/vivid-vid-common.c b/drivers/media/platform/vivid/vivid-vid-common.c
index fcda3ae4e6b0..314799111cf7 100644
--- a/drivers/media/platform/vivid/vivid-vid-common.c
+++ b/drivers/media/platform/vivid/vivid-vid-common.c
@@ -48,7 +48,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_YUYV,
.vdownsampling = { 1 },
.bit_depth = { 16 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 1,
.buffers = 1,
.data_offset = { PLANE0_DATA_OFFSET },
@@ -57,7 +57,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_UYVY,
.vdownsampling = { 1 },
.bit_depth = { 16 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 1,
.buffers = 1,
},
@@ -65,7 +65,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_YVYU,
.vdownsampling = { 1 },
.bit_depth = { 16 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 1,
.buffers = 1,
},
@@ -73,7 +73,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_VYUY,
.vdownsampling = { 1 },
.bit_depth = { 16 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 1,
.buffers = 1,
},
@@ -81,7 +81,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_YUV422P,
.vdownsampling = { 1, 1, 1 },
.bit_depth = { 8, 4, 4 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 3,
.buffers = 1,
},
@@ -89,7 +89,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_YUV420,
.vdownsampling = { 1, 2, 2 },
.bit_depth = { 8, 4, 4 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 3,
.buffers = 1,
},
@@ -97,7 +97,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_YVU420,
.vdownsampling = { 1, 2, 2 },
.bit_depth = { 8, 4, 4 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 3,
.buffers = 1,
},
@@ -105,7 +105,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_NV12,
.vdownsampling = { 1, 2 },
.bit_depth = { 8, 8 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 2,
.buffers = 1,
},
@@ -113,7 +113,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_NV21,
.vdownsampling = { 1, 2 },
.bit_depth = { 8, 8 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 2,
.buffers = 1,
},
@@ -121,7 +121,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_NV16,
.vdownsampling = { 1, 1 },
.bit_depth = { 8, 8 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 2,
.buffers = 1,
},
@@ -129,7 +129,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_NV61,
.vdownsampling = { 1, 1 },
.bit_depth = { 8, 8 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 2,
.buffers = 1,
},
@@ -137,7 +137,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_NV24,
.vdownsampling = { 1, 1 },
.bit_depth = { 8, 16 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 2,
.buffers = 1,
},
@@ -145,7 +145,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_NV42,
.vdownsampling = { 1, 1 },
.bit_depth = { 8, 16 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 2,
.buffers = 1,
},
@@ -184,7 +184,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_GREY,
.vdownsampling = { 1 },
.bit_depth = { 8 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 1,
.buffers = 1,
},
@@ -192,7 +192,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_Y16,
.vdownsampling = { 1 },
.bit_depth = { 16 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 1,
.buffers = 1,
},
@@ -200,7 +200,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_Y16_BE,
.vdownsampling = { 1 },
.bit_depth = { 16 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 1,
.buffers = 1,
},
@@ -452,7 +452,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_NV16M,
.vdownsampling = { 1, 1 },
.bit_depth = { 8, 8 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 2,
.buffers = 2,
.data_offset = { PLANE0_DATA_OFFSET, 0 },
@@ -461,7 +461,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_NV61M,
.vdownsampling = { 1, 1 },
.bit_depth = { 8, 8 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 2,
.buffers = 2,
.data_offset = { 0, PLANE0_DATA_OFFSET },
@@ -470,7 +470,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_YUV420M,
.vdownsampling = { 1, 2, 2 },
.bit_depth = { 8, 4, 4 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 3,
.buffers = 3,
},
@@ -478,7 +478,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_YVU420M,
.vdownsampling = { 1, 2, 2 },
.bit_depth = { 8, 4, 4 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 3,
.buffers = 3,
},
@@ -486,7 +486,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_NV12M,
.vdownsampling = { 1, 2 },
.bit_depth = { 8, 8 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 2,
.buffers = 2,
},
@@ -494,7 +494,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_NV21M,
.vdownsampling = { 1, 2 },
.bit_depth = { 8, 8 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 2,
.buffers = 2,
},
@@ -502,7 +502,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_YUV422M,
.vdownsampling = { 1, 1, 1 },
.bit_depth = { 8, 4, 4 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 3,
.buffers = 3,
},
@@ -510,7 +510,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_YVU422M,
.vdownsampling = { 1, 1, 1 },
.bit_depth = { 8, 4, 4 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 3,
.buffers = 3,
},
@@ -518,7 +518,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_YUV444M,
.vdownsampling = { 1, 1, 1 },
.bit_depth = { 8, 8, 8 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 3,
.buffers = 3,
},
@@ -526,7 +526,7 @@ struct vivid_fmt vivid_formats[] = {
.fourcc = V4L2_PIX_FMT_YVU444M,
.vdownsampling = { 1, 1, 1 },
.bit_depth = { 8, 8, 8 },
- .is_yuv = true,
+ .color_representation = TGP_COLOR_REPRESENTATION_YUV,
.planes = 3,
.buffers = 3,
},
diff --git a/include/media/v4l2-tpg.h b/include/media/v4l2-tpg.h
index 329bebfa930c..13ea42bb9530 100644
--- a/include/media/v4l2-tpg.h
+++ b/include/media/v4l2-tpg.h
@@ -87,6 +87,11 @@ enum tpg_move_mode {
TPG_MOVE_POS_FAST,
};
+enum tgp_color_representation {
+ TGP_COLOR_REPRESENTATION_RGB,
+ TGP_COLOR_REPRESENTATION_YUV,
+};
+
extern const char * const tpg_aspect_strings[];
#define TPG_MAX_PLANES 3
@@ -119,7 +124,7 @@ struct tpg_data {
u8 saturation;
s16 hue;
u32 fourcc;
- bool is_yuv;
+ enum tgp_color_representation color_representation;
u32 colorspace;
u32 xfer_func;
u32 ycbcr_enc;
--
2.8.1
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web