summaryrefslogtreecommitdiff
path: root/drivers/media/common/v4l2-tpg
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2016-06-28 11:14:19 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-08 16:16:52 -0300
commit85a5f85ef9d600d5027b6691c826621a55ad288a (patch)
treecdb626965c635757f09f22610d678edfa97067b9 /drivers/media/common/v4l2-tpg
parentc1023ba74fc77dc56dc317bd98f5060aab889ac1 (diff)
[media] v4l2-tpg: ignore V4L2_DV_RGB_RANGE setting for YUV formats
The V4L2_DV_RGB_RANGE_* settings are, as the name says, for RGB formats only. So they should be ignored for non-RGB formats. 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/v4l2-tpg')
-rw-r--r--drivers/media/common/v4l2-tpg/v4l2-tpg-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index cf1dadd0be9e..3ec3cebe62b9 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -777,7 +777,7 @@ static void precalculate_color(struct tpg_data *tpg, int k)
* Remember that r, g and b are still in the 0 - 0xff0 range.
*/
if (tpg->real_rgb_range == V4L2_DV_RGB_RANGE_LIMITED &&
- tpg->rgb_range == V4L2_DV_RGB_RANGE_FULL) {
+ tpg->rgb_range == V4L2_DV_RGB_RANGE_FULL && !tpg->is_yuv) {
/*
* Convert from full range (which is what r, g and b are)
* to limited range (which is the 'real' RGB range), which
@@ -787,7 +787,7 @@ static void precalculate_color(struct tpg_data *tpg, int k)
g = (g * 219) / 255 + (16 << 4);
b = (b * 219) / 255 + (16 << 4);
} else if (tpg->real_rgb_range != V4L2_DV_RGB_RANGE_LIMITED &&
- tpg->rgb_range == V4L2_DV_RGB_RANGE_LIMITED) {
+ tpg->rgb_range == V4L2_DV_RGB_RANGE_LIMITED && !tpg->is_yuv) {
/*
* Clamp r, g and b to the limited range and convert to full
* range since that's what we deliver.