Re: [PATCH v2 4/6] [media] vivid: code refactor for color representation

Hans Verkuil
2016-07-15T18:28:51Z

On 07/15/2016 06:13 PM, Ricardo Ribalda Delgado wrote:
> 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 cf1dadd0be9e..acf0e6854832 100644
> --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> @@ -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,

This should be != TGP_COLOR_REPRESENTATION_YUV.

Otherwise HSV would map to limited range by default, which is probably wrong.

Regards,

Hans

> tpg->colorspace, tpg->real_ycbcr_enc);
>
> tpg_precalculate_colors(tpg);