From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Shankar, Uma" <uma.shankar@intel.com>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915/icl: Handle YCbCr to RGB conversion for BT2020 case
Date: Tue, 7 May 2019 18:38:10 +0300 [thread overview]
Message-ID: <20190507153810.GQ24299@intel.com> (raw)
In-Reply-To: <E7C9878FBA1C6D42A1CA3F62AEB6945F81FEF5E1@BGSMSX104.gar.corp.intel.com>
On Tue, May 07, 2019 at 02:35:15PM +0000, Shankar, Uma wrote:
>
>
> >-----Original Message-----
> >From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf Of Ville
> >Syrjälä
> >Sent: Tuesday, May 7, 2019 7:37 PM
> >To: Sharma, Shashank <shashank.sharma@intel.com>
> >Cc: intel-gfx@lists.freedesktop.org
> >Subject: Re: [Intel-gfx] [PATCH] drm/i915/icl: Handle YCbCr to RGB conversion for
> >BT2020 case
> >
> >On Tue, May 07, 2019 at 06:32:57PM +0530, Shashank Sharma wrote:
> >> From: Uma Shankar <uma.shankar@intel.com>
> >>
> >> Currently input csc for YCbCR to RGB conversion handles only
> >> BT601 and Bt709. Extending it to support BT2020 as well.
> >>
> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> >> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> >> ---
> >> drivers/gpu/drm/i915/intel_sprite.c | 24 ++++++++++++++++++++++++
> >> 1 file changed, 24 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/i915/intel_sprite.c
> >> b/drivers/gpu/drm/i915/intel_sprite.c
> >> index 44aaeac1b2ed..2536e757bec2 100644
> >> --- a/drivers/gpu/drm/i915/intel_sprite.c
> >> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> >> @@ -433,6 +433,18 @@ icl_program_input_csc(struct intel_plane *plane,
> >> 0x9EF8, 0x7800, 0xABF8,
> >> 0x0, 0x7800, 0x7ED8,
> >> },
> >> + /*
> >> + * BT.2020 full range YCbCr -> full range RGB
> >> + * The matrix required is :
> >> + * [1.000, 0.000, 1.474,
> >> + * 1.000, -0.1645, -0.5713,
> >> + * 1.000, 1.8814, 0.0000]
> >> + */
> >> + [DRM_COLOR_YCBCR_BT2020] = {
> >> + 0x7BC8, 0x7800, 0x0,
> >> + 0x8928, 0x7800, 0xAA88,
> >> + 0x0, 0x7800, 0x7F10,
> >> + },
> >> };
> >>
> >> /* Matrix for Limited Range to Full Range Conversion */ @@ -461,6
> >> +473,18 @@ icl_program_input_csc(struct intel_plane *plane,
> >> 0x8888, 0x7918, 0xADA8,
> >> 0x0, 0x7918, 0x6870,
> >> },
> >> + /*
> >> + * BT.2020 Limited range YCbCr -> full range RGB
> >> + * The matrix required is :
> >> + * [1.164, 0.000, 1.717,
> >> + * 1.138, -0.1873, -0.6504,
> >> + * 1.1380, 2.1417, 0.0000]
> >
> >Where are those 1.138 coming from?
>
> Hi Ville,
> This is the original YCBCR to RGB BT2020 matrix:
> {
> 1.00000000000, 0.00000000000, 1.47460000000,
> 1.00000000000, -0.16455312684, -0.57135312684,
> 1.00000000000, 1.88140000000, 0.00000000000
> };
>
> We have to convert Limited Range YCbCr to Full Range RGB. Hence we need to apply a scale factor:
> yscalefactor = 219.0 * normalizingfactor;
> cbcrscalefactor = 224.0 * normalizingfactor;
>
> /* Scale factors are inverted for LR to FR conversion */
> yscalefactor = 1.0 / yscalefactor;
> cbcrscalefactor = 1.0 / cbcrscalefactor;
>
> This yields the above results.
Those are the coefficients for Y, so they should still
be the same for all three output channels.
igt_color_encoding gives me:
|1.1644, 0.0000, 1.6787,|
|1.1644,-0.1873,-0.6504,|
|1.1644, 2.1418, 0.0000,|
Looks like we're also misprogramming the Y pre-offset
for the full range YCbCr case.
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-05-07 15:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 13:02 [PATCH v3 1/2] drm/i915/GLK: Properly handle plane CSC for BT2020 framebuffers Shashank Sharma
2019-05-07 13:02 ` [PATCH] drm/i915/icl: Handle YCbCr to RGB conversion for BT2020 case Shashank Sharma
2019-05-07 14:06 ` Ville Syrjälä
2019-05-07 14:35 ` Shankar, Uma
2019-05-07 15:38 ` Ville Syrjälä [this message]
2019-05-09 14:54 ` Shankar, Uma
2019-05-09 14:57 ` Ville Syrjälä
2019-05-09 15:08 ` Shankar, Uma
2019-05-09 15:30 ` Ville Syrjälä
2019-05-09 15:55 ` Shankar, Uma
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=20190507153810.GQ24299@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=uma.shankar@intel.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;
as well as URLs for NNTP newsgroup(s).