gl-renderer: Fix limited range quantization

The highest possible value is 255, not 256, like in previous part of the
calculation. While on it, use the values directly, making the code more
readable.

Fix suggested by Pekka Paalanen and Loïc Molinari.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
This commit is contained in:
Robert Mader 2024-06-11 14:35:53 +02:00
parent fa587e3fc0
commit 9a754434f1
1 changed files with 4 additions and 5 deletions

View File

@ -102,12 +102,11 @@ yuva2rgba(vec4 yuva)
/* ITU-R BT.601 & BT.709 quantization (limited range) */
/* Y = 255/219 * (x - 16/256) */
Y = 1.16438356 * (yuva.x - 0.0625);
Y = 255.0/219.0 * (yuva.x - 16.0/255.0);
/* Remove offset 128/256, but the 255/224 multiplier comes later */
su = yuva.y - 0.5;
sv = yuva.z - 0.5;
/* Remove offset 128/255, but the 255/224 multiplier comes later */
su = yuva.y - 128.0/255.0;
sv = yuva.z - 128.0/255.0;
/*
* ITU-R BT.601 encoding coefficients (inverse), with the