Commit f6b8af22 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] vivid-tpg: fix XV601/709 Y'CbCr encoding

For these encodings the quantization range should be ignored, since
there is only one possible Y'CbCr encoding.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent bbfef49f
...@@ -509,10 +509,19 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b, ...@@ -509,10 +509,19 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b,
switch (tpg->real_ycbcr_enc) { switch (tpg->real_ycbcr_enc) {
case V4L2_YCBCR_ENC_601: case V4L2_YCBCR_ENC_601:
case V4L2_YCBCR_ENC_XV601:
case V4L2_YCBCR_ENC_SYCC: case V4L2_YCBCR_ENC_SYCC:
rgb2ycbcr(full ? bt601_full : bt601, r, g, b, y_offset, y, cb, cr); rgb2ycbcr(full ? bt601_full : bt601, r, g, b, y_offset, y, cb, cr);
break; break;
case V4L2_YCBCR_ENC_XV601:
/* Ignore quantization range, there is only one possible
* Y'CbCr encoding. */
rgb2ycbcr(bt601, r, g, b, 16, y, cb, cr);
break;
case V4L2_YCBCR_ENC_XV709:
/* Ignore quantization range, there is only one possible
* Y'CbCr encoding. */
rgb2ycbcr(rec709, r, g, b, 16, y, cb, cr);
break;
case V4L2_YCBCR_ENC_BT2020: case V4L2_YCBCR_ENC_BT2020:
rgb2ycbcr(full ? bt2020_full : bt2020, r, g, b, y_offset, y, cb, cr); rgb2ycbcr(full ? bt2020_full : bt2020, r, g, b, y_offset, y, cb, cr);
break; break;
...@@ -535,7 +544,6 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b, ...@@ -535,7 +544,6 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b,
rgb2ycbcr(full ? smpte240m_full : smpte240m, r, g, b, y_offset, y, cb, cr); rgb2ycbcr(full ? smpte240m_full : smpte240m, r, g, b, y_offset, y, cb, cr);
break; break;
case V4L2_YCBCR_ENC_709: case V4L2_YCBCR_ENC_709:
case V4L2_YCBCR_ENC_XV709:
default: default:
rgb2ycbcr(full ? rec709_full : rec709, r, g, b, y_offset, y, cb, cr); rgb2ycbcr(full ? rec709_full : rec709, r, g, b, y_offset, y, cb, cr);
break; break;
...@@ -617,10 +625,19 @@ static void ycbcr_to_color(struct tpg_data *tpg, int y, int cb, int cr, ...@@ -617,10 +625,19 @@ static void ycbcr_to_color(struct tpg_data *tpg, int y, int cb, int cr,
switch (tpg->real_ycbcr_enc) { switch (tpg->real_ycbcr_enc) {
case V4L2_YCBCR_ENC_601: case V4L2_YCBCR_ENC_601:
case V4L2_YCBCR_ENC_XV601:
case V4L2_YCBCR_ENC_SYCC: case V4L2_YCBCR_ENC_SYCC:
ycbcr2rgb(full ? bt601_full : bt601, y, cb, cr, y_offset, r, g, b); ycbcr2rgb(full ? bt601_full : bt601, y, cb, cr, y_offset, r, g, b);
break; break;
case V4L2_YCBCR_ENC_XV601:
/* Ignore quantization range, there is only one possible
* Y'CbCr encoding. */
ycbcr2rgb(bt601, y, cb, cr, 16, r, g, b);
break;
case V4L2_YCBCR_ENC_XV709:
/* Ignore quantization range, there is only one possible
* Y'CbCr encoding. */
ycbcr2rgb(rec709, y, cb, cr, 16, r, g, b);
break;
case V4L2_YCBCR_ENC_BT2020: case V4L2_YCBCR_ENC_BT2020:
ycbcr2rgb(full ? bt2020_full : bt2020, y, cb, cr, y_offset, r, g, b); ycbcr2rgb(full ? bt2020_full : bt2020, y, cb, cr, y_offset, r, g, b);
break; break;
...@@ -652,7 +669,6 @@ static void ycbcr_to_color(struct tpg_data *tpg, int y, int cb, int cr, ...@@ -652,7 +669,6 @@ static void ycbcr_to_color(struct tpg_data *tpg, int y, int cb, int cr,
ycbcr2rgb(full ? smpte240m_full : smpte240m, y, cb, cr, y_offset, r, g, b); ycbcr2rgb(full ? smpte240m_full : smpte240m, y, cb, cr, y_offset, r, g, b);
break; break;
case V4L2_YCBCR_ENC_709: case V4L2_YCBCR_ENC_709:
case V4L2_YCBCR_ENC_XV709:
default: default:
ycbcr2rgb(full ? rec709_full : rec709, y, cb, cr, y_offset, r, g, b); ycbcr2rgb(full ? rec709_full : rec709, y, cb, cr, y_offset, r, g, b);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment