diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-01-22 14:02:11 +0100 |
---|---|---|
committer | Leo Izen <leo.izen@gmail.com> | 2023-03-02 09:37:06 -0500 |
commit | 9dc4154fecd9ef99b56b3e9e7534142df0ccae92 (patch) | |
tree | d33a040a31fb5e358054e6fefadeb07290f98226 /video/csputils.c | |
parent | 40af0893a94d7effa31a31ef33555271b835c3ad (diff) | |
download | mpv-9dc4154fecd9ef99b56b3e9e7534142df0ccae92.tar.bz2 mpv-9dc4154fecd9ef99b56b3e9e7534142df0ccae92.tar.xz |
vo_gpu: improve XYZ conversion
Fixes #4925
Diffstat (limited to 'video/csputils.c')
-rw-r--r-- | video/csputils.c | 11 |
1 files changed, 6 insertions, 5 deletions
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 |