From 9dc4154fecd9ef99b56b3e9e7534142df0ccae92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 22 Jan 2023 14:02:11 +0100 Subject: vo_gpu: improve XYZ conversion Fixes #4925 --- video/csputils.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'video/csputils.c') diff --git a/video/csputils.c b/video/csputils.c index a0db6c8cd4..aaa32614b7 100644 --- a/video/csputils.c +++ b/video/csputils.c @@ -619,21 +619,22 @@ void mp_get_cms_matrix(struct mp_csp_primaries src, struct mp_csp_primaries dest mp_mul_matrix3x3(m, tmp); } -// get the coefficients of an SMPTE 428-1 xyz -> rgb conversion matrix +// get the coefficients of an ST 428-1 xyz -> rgb conversion matrix // intent = the rendering intent used to convert to the target primaries static void mp_get_xyz2rgb_coeffs(struct mp_csp_params *params, enum mp_render_intent intent, struct mp_cmat *m) { - struct mp_csp_primaries prim = mp_get_csp_primaries(params->color.primaries); + // Convert to DCI-P3 + struct mp_csp_primaries prim = mp_get_csp_primaries(MP_CSP_PRIM_DCI_P3); float brightness = params->brightness; mp_get_rgb2xyz_matrix(prim, m->m); mp_invert_matrix3x3(m->m); // All non-absolute mappings want to map source white to target white if (intent != MP_INTENT_ABSOLUTE_COLORIMETRIC) { - // SMPTE 428-1 defines the calibration white point as CIE xy (0.314, 0.351) - static const struct mp_csp_col_xy smpte428 = {0.314, 0.351}; - mp_apply_chromatic_adaptation(smpte428, prim.white, m->m); + // SMPTE EG 432-1 Annex H defines the white point as equal energy + static const struct mp_csp_col_xy smpte432 = {1.0/3.0, 1.0/3.0}; + mp_apply_chromatic_adaptation(smpte432, prim.white, m->m); } // Since this outputs linear RGB rather than companded RGB, we -- cgit v1.2.3