summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-01-22 14:02:11 +0100
committerLeo Izen <leo.izen@gmail.com>2023-03-02 09:37:06 -0500
commit9dc4154fecd9ef99b56b3e9e7534142df0ccae92 (patch)
treed33a040a31fb5e358054e6fefadeb07290f98226 /video/out
parent40af0893a94d7effa31a31ef33555271b835c3ad (diff)
downloadmpv-9dc4154fecd9ef99b56b3e9e7534142df0ccae92.tar.bz2
mpv-9dc4154fecd9ef99b56b3e9e7534142df0ccae92.tar.xz
vo_gpu: improve XYZ conversion
Fixes #4925
Diffstat (limited to 'video/out')
-rw-r--r--video/out/gpu/video.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 3f789b6046..df689b53c3 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -2333,7 +2333,7 @@ static void pass_convert_yuv(struct gl_video *p)
// Pre-colormatrix input gamma correction
if (cparams.color.space == MP_CSP_XYZ)
- GLSL(color.rgb = pow(color.rgb, vec3(2.6));) // linear light
+ pass_linearize(p->sc, p->image_params.color.gamma);
// We always explicitly normalize the range in pass_read_video
cparams.input_bits = cparams.texture_bits = 0;
@@ -2347,6 +2347,13 @@ static void pass_convert_yuv(struct gl_video *p)
GLSL(color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;)
+ if (cparams.color.space == MP_CSP_XYZ) {
+ pass_delinearize(p->sc, p->image_params.color.gamma);
+ // mp_get_csp_matrix implicitly converts XYZ to DCI-P3
+ p->image_params.color.space = MP_CSP_RGB;
+ p->image_params.color.primaries = MP_CSP_PRIM_DCI_P3;
+ }
+
if (p->image_params.color.space == MP_CSP_BT_2020_C) {
// Conversion for C'rcY'cC'bc via the BT.2020 CL system:
// C'bc = (B'-Y'c) / 1.9404 | C'bc <= 0