diff options
author | Niklas Haas <git@haasn.xyz> | 2019-10-20 16:07:21 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.xyz> | 2019-10-20 16:07:21 +0200 |
commit | c2ed79247f9d307ceff054ff3acec513e1fc6284 (patch) | |
tree | d3ef5e48bf3eee21a2597286df78992d4548177f /video/mp_image.c | |
parent | ac906fb288378af8a9de10fbae6db5bf8577052e (diff) | |
download | mpv-c2ed79247f9d307ceff054ff3acec513e1fc6284.tar.bz2 mpv-c2ed79247f9d307ceff054ff3acec513e1fc6284.tar.xz |
mp_image: infer XYZ as BT.2020 instead of BT.709
And update the comment both explaining why this defaulting matters and
why we use BT.2020 instead.
tl;dr BT.709 clips even the one test file we *do* have, so if we don't
handle XYZ "natively" in vo_gpu we might as well at least handle it in a
way that runs less risk of clipping
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index 0cf8c378a1..3b8307573f 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -761,16 +761,15 @@ void mp_image_params_guess_csp(struct mp_image_params *params) params->color.space = MP_CSP_XYZ; params->color.levels = MP_CSP_LEVELS_PC; - // The default XYZ matrix converts it to BT.709 color space - // since that's the most likely scenario. Proper VOs should ignore - // this field as well as the matrix and treat XYZ input as absolute, - // but for VOs which use the matrix (and hence, consult this field) - // this is the correct parameter. This doubles as a reasonable output - // gamut for VOs which *do* use the specialized XYZ matrix but don't - // know any better output gamut other than whatever the source is - // tagged with. + // In theory, XYZ data does not really need a concept of 'primaries' to + // function, but this field can still be relevant for guiding gamut + // mapping optimizations, and it's also used by `mp_get_csp_matrix` + // when deciding what RGB space to map XYZ to for VOs that don't want + // to directly ingest XYZ into their color pipeline. BT.709 would be a + // sane default here, but it runs the risk of clipping any wide gamut + // content, so we pick BT.2020 instead to be on the safer side. if (params->color.primaries == MP_CSP_PRIM_AUTO) - params->color.primaries = MP_CSP_PRIM_BT_709; + params->color.primaries = MP_CSP_PRIM_BT_2020; if (params->color.gamma == MP_CSP_TRC_AUTO) params->color.gamma = MP_CSP_TRC_LINEAR; } else { |