All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arthur Grillo <arthurgrillo@riseup.net>
To: "Rodrigo Siqueira" <rodrigosiqueiramelo@gmail.com>,
	"Melissa Wen" <melissa.srw@gmail.com>,
	"Maíra Canal" <mairacanal@riseup.net>,
	"Haneen Mohammed" <hamohammed.sa@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	arthurgrillo@riseup.net, "Jonathan Corbet" <corbet@lwn.net>,
	pekka.paalanen@haloniitty.fi,
	"Louis Chauvet" <louis.chauvet@bootlin.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com,
	 thomas.petazzoni@bootlin.com, seanpaul@google.com,
	marcheu@google.com,  nicolejadeyee@google.com
Subject: [PATCH 2/7] drm/vkms: Add comments
Date: Wed, 06 Mar 2024 17:03:09 -0300	[thread overview]
Message-ID: <20240306-louis-vkms-conv-v1-2-5bfe7d129fdd@riseup.net> (raw)
In-Reply-To: <20240306-louis-vkms-conv-v1-0-5bfe7d129fdd@riseup.net>

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
---
 drivers/gpu/drm/vkms/vkms_formats.c | 47 +++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c
index 44d9b9b3bdc3..55ed3f598bd7 100644
--- a/drivers/gpu/drm/vkms/vkms_formats.c
+++ b/drivers/gpu/drm/vkms/vkms_formats.c
@@ -577,6 +577,18 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
 		},
 		.y_offset = 0,
 	};
+
+	/*
+	 * Those matrixies were generated using the colour python framework
+	 *
+	 * Below are the function calls used to generate eac matrix, go to
+	 * https://colour.readthedocs.io/en/develop/generated/colour.matrix_YCbCr.html
+	 * for more info:
+	 *
+	 * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.601"],
+	 *                                  is_legal = False,
+	 *                                  bits = 8) * 2**32).astype(int)
+	 */
 	static struct conversion_matrix yuv_bt601_full = {
 		.matrix = {
 			{ 4294967296, 0,           6021544149 },
@@ -585,6 +597,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
 		},
 		.y_offset = 0,
 	};
+
+	/*
+	 * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.601"],
+	 *                                  is_legal = True,
+	 *                                  bits = 8) * 2**32).astype(int)
+	 */
 	static struct conversion_matrix yuv_bt601_limited = {
 		.matrix = {
 			{ 5020601039, 0,           6881764740 },
@@ -593,6 +611,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
 		},
 		.y_offset = 16,
 	};
+
+	/*
+	 * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.709"],
+	 *                                  is_legal = False,
+	 *                                  bits = 8) * 2**32).astype(int)
+	 */
 	static struct conversion_matrix yuv_bt709_full = {
 		.matrix = {
 			{ 4294967296, 0,          6763714498 },
@@ -601,6 +625,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
 		},
 		.y_offset = 0,
 	};
+
+	/*
+	 * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.709"],
+	 *                                  is_legal = True,
+	 *                                  bits = 8) * 2**32).astype(int)
+	 */
 	static struct conversion_matrix yuv_bt709_limited = {
 		.matrix = {
 			{ 5020601039, 0,          7729959424 },
@@ -609,6 +639,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
 		},
 		.y_offset = 16,
 	};
+
+	/*
+	 * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.2020"],
+	 *                                  is_legal = False,
+	 *                                  bits = 8) * 2**32).astype(int)
+	 */
 	static struct conversion_matrix yuv_bt2020_full = {
 		.matrix = {
 			{ 4294967296, 0,          6333358775 },
@@ -617,6 +653,12 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
 		},
 		.y_offset = 0,
 	};
+
+	/*
+	 * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.2020"],
+	 *                                  is_legal = True,
+	 *                                  bits = 8) * 2**32).astype(int)
+	 */
 	static struct conversion_matrix yuv_bt2020_limited = {
 		.matrix = {
 			{ 5020601039, 0,          7238124312 },
@@ -625,6 +667,11 @@ get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding,
 		},
 		.y_offset = 16,
 	};
+
+	/*
+	 * The next matrices are just the previous ones, but with the first and
+	 * second columns swapped
+	 */
 	static struct conversion_matrix yvu_bt601_full = {
 		.matrix = {
 			{ 4294967296, 6021544149,  0 },

-- 
2.43.0


  parent reply	other threads:[~2024-03-06 20:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 20:03 [PATCH 0/7] Additions to "Reimplement line-per-line pixel conversion for plane reading" series Arthur Grillo
2024-03-06 20:03 ` [PATCH 1/7] drm: Fix drm_fixp2int_round() making it add 0.5 Arthur Grillo
2024-03-08 20:57   ` Harry Wentland
2024-03-12 18:27   ` Melissa Wen
2024-03-13 18:47     ` Arthur Grillo
2024-03-14 12:59       ` Melissa Wen
2024-03-14 13:29         ` Pekka Paalanen
2024-03-14 13:31         ` Melissa Wen
2024-03-14 13:37           ` Harry Wentland
2024-03-16 11:59     ` Arthur Grillo
2024-03-16 14:10       ` Melissa Wen
2024-03-06 20:03 ` Arthur Grillo [this message]
2024-03-12 20:20   ` [PATCH 2/7] drm/vkms: Add comments Melissa Wen
2024-03-06 20:03 ` [PATCH 3/7] drm/vkmm: Use drm_fixed api Arthur Grillo
2024-03-06 20:03 ` [PATCH 4/7] drm/vkms: Fix compilation issues Arthur Grillo
2024-03-07  0:03   ` Louis Chauvet
2024-03-07 11:43     ` Arthur Grillo
2024-03-06 20:03 ` [PATCH 5/7] drm/vkms: Add comments to format tests Arthur Grillo
2024-03-06 20:03 ` [PATCH 6/7] drm/vkms: Change the gray RGB representation Arthur Grillo
2024-03-12 20:16   ` Melissa Wen
2024-03-06 20:03 ` [PATCH 7/7] drm/vkms: Add how to run the Kunit tests Arthur Grillo
2024-03-08 20:38 ` [PATCH 0/7] Additions to "Reimplement line-per-line pixel conversion for plane reading" series Maíra Canal
2024-03-09 11:58   ` Louis Chauvet
2024-03-12 20:26   ` Melissa Wen

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=20240306-louis-vkms-conv-v1-2-5bfe7d129fdd@riseup.net \
    --to=arthurgrillo@riseup.net \
    --cc=airlied@gmail.com \
    --cc=corbet@lwn.net \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=jeremie.dautheribes@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=louis.chauvet@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mairacanal@riseup.net \
    --cc=marcheu@google.com \
    --cc=melissa.srw@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mripard@kernel.org \
    --cc=nicolejadeyee@google.com \
    --cc=pekka.paalanen@haloniitty.fi \
    --cc=rodrigosiqueiramelo@gmail.com \
    --cc=seanpaul@google.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.