lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c3e047f2-84eb-e697-3a69-fd930f67339d@xs4all.nl>
Date:   Wed, 24 Jun 2020 15:47:24 +0200
From:   Hans Verkuil <hverkuil@...all.nl>
To:     Kaaira Gupta <kgupta@...iitr.ac.in>,
        Helen Koike <helen.koike@...labora.com>,
        Shuah Khan <skhan@...uxfoundation.org>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        Kieran Bingham <kieran.bingham@...asonboard.com>
Subject: Re: [PATCH v5 2/3] media: tpg: Add function to return colors' order
 of test image

On 24/06/2020 15:43, Kaaira Gupta wrote:
> Currently there is no method to know the correct order of the colors for
> a test image generated by tpg. Write a function that returns a string of
> colors' order given a tpg. It returns a NULL pointer in case of test
> patterns which do not have a well defined colors' order. Hence add a
> NULL check for text in tpg_gen_text().
> 
> Signed-off-by: Kaaira Gupta <kgupta@...iitr.ac.in>
> Reviewed-by: Kieran Bingham <kieran.bingham@...asonboard.com>
> ---
>  drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 29 +++++++++++++++++--
>  include/media/tpg/v4l2-tpg.h                  |  1 +
>  2 files changed, 28 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 dde22a4cbd6c..a052b656fa6a 100644
> --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> @@ -1959,12 +1959,14 @@ void tpg_gen_text(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2],
>  	unsigned step = V4L2_FIELD_HAS_T_OR_B(tpg->field) ? 2 : 1;
>  	unsigned div = step;
>  	unsigned first = 0;
> -	unsigned len = strlen(text);
> +	unsigned len;
>  	unsigned p;
>  
> -	if (font8x16 == NULL || basep == NULL)
> +	if (font8x16 == NULL || basep == NULL || text == NULL)
>  		return;
>  
> +	len = strlen(text);
> +
>  	/* Checks if it is possible to show string */
>  	if (y + 16 >= tpg->compose.height || x + 8 >= tpg->compose.width)
>  		return;
> @@ -2006,6 +2008,29 @@ void tpg_gen_text(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2],
>  }
>  EXPORT_SYMBOL_GPL(tpg_gen_text);
>  
> +const char *tpg_g_color_order(const struct tpg_data *tpg)
> +{
> +	switch (tpg->pattern) {
> +	case TPG_PAT_75_COLORBAR:
> +	case TPG_PAT_100_COLORBAR:
> +	case TPG_PAT_CSC_COLORBAR:
> +	case TPG_PAT_100_HCOLORBAR:
> +		return "white, yellow, cyan, green, magenta, red, blue, black";
> +	case TPG_PAT_BLACK:
> +		return "Black";
> +	case TPG_PAT_WHITE:
> +		return "White";
> +	case TPG_PAT_RED:
> +		return "Red";
> +	case TPG_PAT_GREEN:
> +		return "Green";
> +	case TPG_PAT_BLUE:
> +		return "Blue";
> +	default:
> +		return NULL;
> +	}
> +}

Missing EXPORT_SYMBOL_GPL().

Regards,

	Hans

> +
>  void tpg_update_mv_step(struct tpg_data *tpg)
>  {
>  	int factor = tpg->mv_hor_mode > TPG_MOVE_NONE ? -1 : 1;
> diff --git a/include/media/tpg/v4l2-tpg.h b/include/media/tpg/v4l2-tpg.h
> index 9749ed409856..0b0ddb87380e 100644
> --- a/include/media/tpg/v4l2-tpg.h
> +++ b/include/media/tpg/v4l2-tpg.h
> @@ -252,6 +252,7 @@ void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std,
>  bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc);
>  void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop,
>  		const struct v4l2_rect *compose);
> +const char *tpg_g_color_order(const struct tpg_data *tpg);
>  
>  static inline void tpg_s_pattern(struct tpg_data *tpg, enum tpg_pattern pattern)
>  {
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ