multi-texture-format: Fix limited range quantization
And stop pre-computing values, making errors like this harder to spot.
The values 0.0625 (16/256) and 0.5 (128/256) were slightly off,
resulting e.g. in "black" not being #000000 but #010001 RGB instead.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3906>
(cherry picked from commit dfa5238bf9
)
This commit is contained in:
parent
bb9a2f1ede
commit
1ccf2cfb56
1 changed files with 3 additions and 3 deletions
|
@ -29,9 +29,9 @@ static const char *shader_global_conversions =
|
|||
"vec4 yuv_to_rgb(vec4 yuva) \n"
|
||||
"{ \n"
|
||||
" vec4 res; \n"
|
||||
" float Y = 1.16438356 * (yuva.x - 0.0625); \n"
|
||||
" float su = yuva.y - 0.5; \n"
|
||||
" float sv = yuva.z - 0.5; \n"
|
||||
" float Y = 255.0/219.0 * (yuva.x - 16.0/255.0); \n"
|
||||
" float su = yuva.y - 128.0/255.0; \n"
|
||||
" float sv = yuva.z - 128.0/255.0; \n"
|
||||
" res.r = Y + 1.59602678 * sv; \n"
|
||||
" res.g = Y - 0.39176229 * su - 0.81296764 * sv; \n"
|
||||
" res.b = Y + 2.01723214 * su; \n"
|
||||
|
|
Loading…
Reference in a new issue