summaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2016-08-04 05:59:47 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-08-24 08:36:11 -0300
commit9ddbf68d264a8c2578dcb08d550dd00a273e12fa (patch)
tree375e89b080acf9efb0b9b419bd11443f14b11cfc /drivers/media/common
parent1ee6dd5a918bd98dea20a2847f1ca15964dca952 (diff)
downloadlinux-9ddbf68d264a8c2578dcb08d550dd00a273e12fa.tar.gz
linux-9ddbf68d264a8c2578dcb08d550dd00a273e12fa.tar.bz2
linux-9ddbf68d264a8c2578dcb08d550dd00a273e12fa.zip
[media] v4l2-tpg-core: drop SYCC, use higher precision 601 conversion matrix
The SYCC Y'CbCr encoding is identical to the 601 encoding. Since the SYCC define is about to be removed for use in the kernel we need to drop it in the TPG code as well. This patch also adds a 4th decimal to the 601 conversion matrix. That was specified by the sYCC spec and it makes sense to use this across the board. [mchehab@s-opensource.com: fix conflicts with LaTeX math expression patch] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/v4l2-tpg/v4l2-tpg-core.c14
1 files changed, 6 insertions, 8 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..1684810cab83 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -504,14 +504,14 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b,
#define COEFF(v, r) ((int)(0.5 + (v) * (r) * 256.0))
static const int bt601[3][3] = {
- { COEFF(0.299, 219), COEFF(0.587, 219), COEFF(0.114, 219) },
- { COEFF(-0.169, 224), COEFF(-0.331, 224), COEFF(0.5, 224) },
- { COEFF(0.5, 224), COEFF(-0.419, 224), COEFF(-0.081, 224) },
+ { COEFF(0.299, 219), COEFF(0.587, 219), COEFF(0.114, 219) },
+ { COEFF(-0.1687, 224), COEFF(-0.3313, 224), COEFF(0.5, 224) },
+ { COEFF(0.5, 224), COEFF(-0.4187, 224), COEFF(-0.0813, 224) },
};
static const int bt601_full[3][3] = {
- { COEFF(0.299, 255), COEFF(0.587, 255), COEFF(0.114, 255) },
- { COEFF(-0.169, 255), COEFF(-0.331, 255), COEFF(0.5, 255) },
- { COEFF(0.5, 255), COEFF(-0.419, 255), COEFF(-0.081, 255) },
+ { COEFF(0.299, 255), COEFF(0.587, 255), COEFF(0.114, 255) },
+ { COEFF(-0.1687, 255), COEFF(-0.3313, 255), COEFF(0.5, 255) },
+ { COEFF(0.5, 255), COEFF(-0.4187, 255), COEFF(-0.0813, 255) },
};
static const int rec709[3][3] = {
{ COEFF(0.2126, 219), COEFF(0.7152, 219), COEFF(0.0722, 219) },
@@ -558,7 +558,6 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b,
switch (tpg->real_ycbcr_enc) {
case V4L2_YCBCR_ENC_601:
- case V4L2_YCBCR_ENC_SYCC:
rgb2ycbcr(full ? bt601_full : bt601, r, g, b, y_offset, y, cb, cr);
break;
case V4L2_YCBCR_ENC_XV601:
@@ -674,7 +673,6 @@ static void ycbcr_to_color(struct tpg_data *tpg, int y, int cb, int cr,
switch (tpg->real_ycbcr_enc) {
case V4L2_YCBCR_ENC_601:
- case V4L2_YCBCR_ENC_SYCC:
ycbcr2rgb(full ? bt601_full : bt601, y, cb, cr, y_offset, r, g, b);
break;
case V4L2_YCBCR_ENC_XV601: