Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Wentland <harry.wentland@amd.com>
To: Pekka Paalanen <pekka.paalanen@collabora.com>
Cc: "Sebastian Wick" <sebastian.wick@redhat.com>,
	"Shashank Sharma" <shashank.sharma@amd.com>,
	"Simon Ser" <contact@emersion.fr>,
	"Alexander Goins" <agoins@nvidia.com>,
	"Michel Dänzer" <mdaenzer@redhat.com>,
	"Xaver Hugl" <xaver.hugl@gmail.com>,
	igt-dev@lists.freedesktop.org, "Jonas Ådahl" <jadahl@redhat.com>,
	"Victoria Brekenfeld" <victoria@system76.com>,
	"Joshua Ashton" <joshua@froggi.es>,
	"Daniel Vetter" <daniel@ffwll.ch>, "Aleix Pol" <aleixpol@kde.org>,
	"Naseer Ahmed" <quic_naseer@quicinc.com>,
	"Christopher Braga" <quic_cbraga@quicinc.com>
Subject: Re: [igt-dev] [RFC PATCH 5/7] igt/color: Add SW color transform functionality
Date: Fri, 3 Nov 2023 10:34:16 -0400	[thread overview]
Message-ID: <46567128-61fa-4ef3-a78a-898b0e26db2e@amd.com> (raw)
In-Reply-To: <20230918110218.3c7975c4.pekka.paalanen@collabora.com>



On 2023-09-18 04:02, Pekka Paalanen wrote:
> On Fri, 15 Sep 2023 15:50:52 -0400
> Harry Wentland <harry.wentland@amd.com> wrote:
> 
>> On 2023-09-15 10:52, Pekka Paalanen wrote:
>>> On Fri, 8 Sep 2023 11:03:13 -0400
>>> Harry Wentland <harry.wentland@amd.com> wrote:
>>>   
>>>> In order to test color we want to compare a HW (KMS) transform
>>>> with a SW transform. This introduces color transform for an
>>>> sRGB EOTF but this can be extended to other transforms. Code is
>>>> borrowed from Skia.
>>>>
>>>> Signed-off-by: Harry Wentland <harry.wentland@amd.com>
>>>> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
>>>> Cc: Pekka Paalanen <pekka.paalanen@collabora.com>
>>>> Cc: Simon Ser <contact@emersion.fr>
>>>> Cc: Harry Wentland <harry.wentland@amd.com>
>>>> Cc: Melissa Wen <mwen@igalia.com>
>>>> Cc: Jonas Ådahl <jadahl@redhat.com>
>>>> Cc: Sebastian Wick <sebastian.wick@redhat.com>
>>>> Cc: Shashank Sharma <shashank.sharma@amd.com>
>>>> Cc: Alexander Goins <agoins@nvidia.com>
>>>> Cc: Joshua Ashton <joshua@froggi.es>
>>>> Cc: Michel Dänzer <mdaenzer@redhat.com>
>>>> Cc: Aleix Pol <aleixpol@kde.org>
>>>> Cc: Xaver Hugl <xaver.hugl@gmail.com>
>>>> Cc: Victoria Brekenfeld <victoria@system76.com>
>>>> Cc: Daniel Vetter <daniel@ffwll.ch>
>>>> Cc: Uma Shankar <uma.shankar@intel.com>
>>>> Cc: Naseer Ahmed <quic_naseer@quicinc.com>
>>>> Cc: Christopher Braga <quic_cbraga@quicinc.com>
>>>> ---
>>>>  lib/igt_color.c | 330 ++++++++++++++++++++++++++++++++++++++++++++++++
>>>>  lib/igt_color.h | 105 +++++++++++++++
>>>>  lib/igt_fb.c    |   6 +-
>>>>  lib/igt_fb.h    |   2 +
>>>>  lib/meson.build |   1 +
>>>>  5 files changed, 441 insertions(+), 3 deletions(-)
>>>>  create mode 100644 lib/igt_color.c
>>>>  create mode 100644 lib/igt_color.h
> 
> ...
> 
>>>> +/*
>>>> + * A transfer function mapping encoded values to linear values,
>>>> + * represented by this 7-parameter piecewise function:
>>>> + *
>>>> + *   linear = sign(encoded) *  (c*|encoded| + f)       , 0 <= |encoded| < d
>>>> + *          = sign(encoded) * ((a*|encoded| + b)^g + e), d <= |encoded|  
>>>
>>> The code you have does not actually do the extended form (use of sign
>>> and absolute value), but clamps the result to [0.0, 1.0].
>>>   
>>
>> Yes, the intention (and I didn't write this but copied it) is to be able to use
>> this to describe most (all?) standard transfer functions. See
>> https://github.com/google/skia/blob/main/include/core/SkColorSpace.h
> 
> My complaint is about doc and implementation disagreeing.
> 
> xvYCC and integer-encoded scRGB would need an extended range if anyone
> wanted to test those, if they even fit here. I also do not understand
> how it can be possible to express PQ EOTF or HLG OETF with this
> parameterisation. Maybe it's an approximation on a very limited domain?
> 

I have a feeling Skia maps everything to [0.0, 1.0] and agree that this
wouldn't work in the cases you mention (PQ would work with an additional
scaling of the values to 125.0).

What's here seems to work fine for sRGB but I'll have to hook this all up
to amdgpu and test both sRGB and PQ at the very least.

Harry

> 
> Thanks,
> pq
> 
>>>> + *
>>>> + * (A simple gamma transfer function sets g to gamma and a to 1.)
>>>> + */
>>>> +struct igt_color_tf {
>>>> +    float g, a,b,c,d,e,f;
>>>> +};
>>>> +
>>>> +const struct igt_color_tf srgb_tf = {2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0, 0};
>>>> +
>>>> +/* end of Skia-based code */
>>>> +
>>>> +typedef struct igt_pixel {
>>>> +	float r;
>>>> +	float g;
>>>> +	float b;
>>>> +} igt_pixel_t;  
>>>
>>> Thanks,
>>> pq  
>>
> 

  reply	other threads:[~2023-11-03 14:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08 15:03 [igt-dev] [RFC PATCH 0/7] IGT tests for the KMS Color Pipeline API Harry Wentland
2023-09-08 15:03 ` [igt-dev] [RFC PATCH 1/7] include/drm-uapi: Add COLOROP object Harry Wentland
2023-09-18  9:24   ` Kamil Konieczny
2023-11-02 15:52     ` Harry Wentland
2023-09-08 15:03 ` [igt-dev] [RFC PATCH 2/7] lib/igt_kms: Introduce drm_colorop object Harry Wentland
2023-09-18 12:48   ` Kamil Konieczny
2023-11-02 15:45     ` Harry Wentland
2023-09-08 15:03 ` [igt-dev] [RFC PATCH 3/7] lib/igt_kms: Add new COLOR PIPELINE plane property Harry Wentland
2023-09-08 15:03 ` [igt-dev] [RFC PATCH 4/7] tests/kms_properties: Add colorop properties test Harry Wentland
2023-09-08 15:03 ` [igt-dev] [RFC PATCH 5/7] igt/color: Add SW color transform functionality Harry Wentland
2023-09-15 14:52   ` Pekka Paalanen
2023-09-15 19:50     ` Harry Wentland
2023-09-18  8:02       ` Pekka Paalanen
2023-11-03 14:34         ` Harry Wentland [this message]
2023-09-18  9:21   ` Kamil Konieczny
2023-11-03 14:30     ` Harry Wentland
2023-09-08 15:03 ` [igt-dev] [RFC PATCH 6/7] lib/igt_fb: Add copy_fb function Harry Wentland
2023-09-08 15:03 ` [igt-dev] [RFC PATCH 7/7] tests/kms_colorop: Add kms_colorop tests Harry Wentland
2023-09-08 15:15 ` [igt-dev] ✗ Fi.CI.BUILD: failure for IGT tests for the KMS Color Pipeline API Patchwork

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=46567128-61fa-4ef3-a78a-898b0e26db2e@amd.com \
    --to=harry.wentland@amd.com \
    --cc=agoins@nvidia.com \
    --cc=aleixpol@kde.org \
    --cc=contact@emersion.fr \
    --cc=daniel@ffwll.ch \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jadahl@redhat.com \
    --cc=joshua@froggi.es \
    --cc=mdaenzer@redhat.com \
    --cc=pekka.paalanen@collabora.com \
    --cc=quic_cbraga@quicinc.com \
    --cc=quic_naseer@quicinc.com \
    --cc=sebastian.wick@redhat.com \
    --cc=shashank.sharma@amd.com \
    --cc=victoria@system76.com \
    --cc=xaver.hugl@gmail.com \
    /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