linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH] v4l2-tpg: fix the SMPTE-2084 transfer function
Date: Tue, 8 Aug 2017 07:17:26 -0300	[thread overview]
Message-ID: <20170808071726.488b0585@vento.lan> (raw)
In-Reply-To: <0b1447e4-edaf-05a6-0cac-b969ff3ccb28@xs4all.nl>

Em Wed, 26 Jul 2017 20:45:55 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:

> The SMPTE-2084 transfer functions maps to the luminance range of 0-10000 cd/m^2.
> Other transfer functions use the traditional range of 0-100 cd/m^2.
> 
> I didn't take this into account so the luminance was off by a factor of 100.
> 
> Since qv4l2 made the same mistake in reverse I never noticed this until I tested with
> actual SMPTE-2084 video.
> 
> This patch also includes the v4l2-tpg-colors.h relative to this directory when
> building the gen-colors utility, otherwise it would fail. This was needed to regenerate
> the tables.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
> diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c
> index 9bcbd318489b..ac86cbe08440 100644
> --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c
> +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c
> @@ -36,7 +36,11 @@
>    */
> 
>   #include <linux/videodev2.h>
> +#ifdef COMPILE_APP
> +#include "../../../../include/media/v4l2-tpg-colors.h"
> +#else
>   #include <media/v4l2-tpg-colors.h>
> +#endif
> 
>   /* sRGB colors with range [0-255] */
>   const struct color tpg_colors[TPG_COLOR_MAX] = {

The above sucks. We shouldn't be adding hacks at the Kernel tree due
to userspace.

In particular, this one is evil, as it assumes a particular location
of the header inside libv4l.

Instead of this ugly hack, you could just add an extra line at the
"sync-with-kernel" target at v4l-utils Makefile with:

	sed 's,<media/v4l2-tpg-colors.h>,"../../../../include/media/v4l2-tpg-colors.h",' -i ./utils/common/v4l2-tpg-colors.c

Thanks,
Mauro

      reply	other threads:[~2017-08-08 10:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26 18:45 [PATCH] v4l2-tpg: fix the SMPTE-2084 transfer function Hans Verkuil
2017-08-08 10:17 ` Mauro Carvalho Chehab [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170808071726.488b0585@vento.lan \
    --to=mchehab@s-opensource.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).