aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2018-11-23 04:24:55 -0500
committerMaxime Ripard <maxime.ripard@bootlin.com>2018-11-27 03:57:21 -0500
commitdc7d4b655a2c4a8db1342600319a7939eafeb9af (patch)
treeaeaba494575f48e09e170e4953ce7a397bc1d703
parentb636d3f97d041cbb5e782a29b282c40cbd77c0aa (diff)
drm/sun4i: backend: Detail the YUV to RGB values coding explanation
The values in the BT601 YUV to RGB colorspace translation are not simply coded as multiples, but rather as fixed-point signed fractional values on a given number of bits. Add an explanation about that. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181123092515.2511-24-paul.kocialkowski@bootlin.com
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_backend.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c
index 2a9569f16c81..f43c4b0f1e5d 100644
--- a/drivers/gpu/drm/sun4i/sun4i_backend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
@@ -48,8 +48,12 @@ static const u32 sunxi_rgb2yuv_coef[12] = {
48/* 48/*
49 * These coefficients are taken from the A33 BSP from Allwinner. 49 * These coefficients are taken from the A33 BSP from Allwinner.
50 * 50 *
51 * The formula is for each component, each coefficient being multiplied by 51 * The first three values of each row are coded as 13-bit signed fixed-point
52 * 1024 and each constant being multiplied by 16: 52 * numbers, with 10 bits for the fractional part. The fourth value is a
53 * constant coded as a 14-bit signed fixed-point number with 4 bits for the
54 * fractional part.
55 *
56 * The values in table order give the following colorspace translation:
53 * G = 1.164 * Y - 0.391 * U - 0.813 * V + 135 57 * G = 1.164 * Y - 0.391 * U - 0.813 * V + 135
54 * R = 1.164 * Y + 1.596 * V - 222 58 * R = 1.164 * Y + 1.596 * V - 222
55 * B = 1.164 * Y + 2.018 * U + 276 59 * B = 1.164 * Y + 2.018 * U + 276