aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2015-04-23 14:18:01 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2015-04-23 14:18:01 +0200
commitf41bdc253f7e6e39c168a4195aa8535704dce7f1 (patch)
tree8757d34d5b5fb2e4fe6e1d06dc39efdcb8b792b5
parent00844951db15512b94b63441d85efa66937e4687 (diff)
XV601/709 calculation needs to be limited rangecolorspace2
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/v4l2-ctl/vivid-tpg.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/utils/v4l2-ctl/vivid-tpg.c b/utils/v4l2-ctl/vivid-tpg.c
index a9c825fe..3b6c53ed 100644
--- a/utils/v4l2-ctl/vivid-tpg.c
+++ b/utils/v4l2-ctl/vivid-tpg.c
@@ -508,8 +508,11 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b,
int lin_y, yc;
switch (tpg->real_ycbcr_enc) {
- case V4L2_YCBCR_ENC_601:
case V4L2_YCBCR_ENC_XV601:
+ full = false;
+ y_offset = 16;
+ /* fall through */
+ case V4L2_YCBCR_ENC_601:
case V4L2_YCBCR_ENC_SYCC:
rgb2ycbcr(full ? bt601_full : bt601, r, g, b, y_offset, y, cb, cr);
break;
@@ -534,8 +537,11 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b,
case V4L2_YCBCR_ENC_SMPTE240M:
rgb2ycbcr(full ? smpte240m_full : smpte240m, r, g, b, full ? 0 : 16, y, cb, cr);
break;
- case V4L2_YCBCR_ENC_709:
case V4L2_YCBCR_ENC_XV709:
+ full = false;
+ y_offset = 16;
+ /* fall through */
+ case V4L2_YCBCR_ENC_709:
default:
rgb2ycbcr(full ? rec709_full : rec709, r, g, b, y_offset, y, cb, cr);
break;
@@ -615,8 +621,11 @@ static void ycbcr_to_color(struct tpg_data *tpg, int y, int cb, int cr,
int y_fac = full ? COEFF(1.0, 255) : COEFF(1.0, 224);
switch (tpg->real_ycbcr_enc) {
- case V4L2_YCBCR_ENC_601:
case V4L2_YCBCR_ENC_XV601:
+ full = false;
+ y_offset = 16;
+ /* fall through */
+ case V4L2_YCBCR_ENC_601:
case V4L2_YCBCR_ENC_SYCC:
ycbcr2rgb(full ? bt601_full : bt601, y, cb, cr, y_offset, r, g, b);
break;
@@ -650,8 +659,11 @@ static void ycbcr_to_color(struct tpg_data *tpg, int y, int cb, int cr,
case V4L2_YCBCR_ENC_SMPTE240M:
ycbcr2rgb(full ? smpte240m_full : smpte240m, y, cb, cr, full ? 0 : 16, r, g, b);
break;
- case V4L2_YCBCR_ENC_709:
case V4L2_YCBCR_ENC_XV709:
+ full = false;
+ y_offset = 16;
+ /* fall through */
+ case V4L2_YCBCR_ENC_709:
default:
ycbcr2rgb(full ? rec709_full : rec709, y, cb, cr, y_offset, r, g, b);
break;

Privacy Policy