diff options
author | Niklas Haas <git@nand.wakku.to> | 2016-06-28 01:18:55 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-06-28 19:48:29 +0200 |
commit | f9fe5d06ad8ba5f8aa6068dd3c6a1a9fc6332707 (patch) | |
tree | 5f43576a6def8301585c4dbf1741c2abb73ee0b3 | |
parent | f3b6966d14e8cb34477474b85c83beb46e542e70 (diff) |
vo_opengl: use image_params instead of *_src for autoconfig
I'm not even sure why we ever consulted *_src to begin with, since that
just describes the current image format - and not the original metadata.
(And in fact, we specifically had logic to work around the impliciations
this had on linear scaling)
image_params is *the* authoritative source on the intended (i.e.
reference) image metadata, whereas *_src may be changed by previous
passes already. So only consult image_params for picking auto-generated
values.
Also, add some more missing "wide gamut" and "non-gamma" curves to the
autoconfig blacklist. (Maybe it would make sense to move this list to
csputils in the future? Or perhaps even auto-detect it based on the
associated primaries)
-rw-r--r-- | video/out/opengl/video.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index a870fe0e4f..89030a8952 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -2194,26 +2194,29 @@ static void pass_colormanage(struct gl_video *p, float peak_src, // Some exceptions apply to source spaces that even hardcore technoluddites // would probably not enjoy viewing unaltered if (prim_dst == MP_CSP_PRIM_AUTO) { - prim_dst = prim_src; + prim_dst = p->image_params.primaries; // Avoid outputting very wide gamut content automatically, since the // majority target audience has standard gamut displays - if (prim_dst == MP_CSP_PRIM_BT_2020 || prim_dst == MP_CSP_PRIM_PRO_PHOTO) + if (prim_dst == MP_CSP_PRIM_BT_2020 || + prim_dst == MP_CSP_PRIM_PRO_PHOTO || + prim_dst == MP_CSP_PRIM_V_GAMUT) + { prim_dst = MP_CSP_PRIM_BT_709; + } } if (trc_dst == MP_CSP_TRC_AUTO) { - trc_dst = trc_src; - // Avoid outputting linear light at all costs. First try - // falling back to the image gamma (e.g. in the case that the input - // was linear light due to linear-scaling) - if (trc_dst == MP_CSP_TRC_LINEAR) - trc_dst = p->image_params.gamma; - - // Failing that, pick gamma 2.2 as a reasonable default. This is also - // picked as a default for outputting HDR content - if (trc_dst == MP_CSP_TRC_LINEAR || trc_dst == MP_CSP_TRC_SMPTE_ST2084) + trc_dst = p->image_params.gamma; + + // Avoid outputting linear light or HDR content "by default" + if (trc_dst == MP_CSP_TRC_LINEAR || + trc_dst == MP_CSP_TRC_SMPTE_ST2084 || + trc_dst == MP_CSP_TRC_ARIB_STD_B67 || + trc_dst == MP_CSP_TRC_V_LOG) + { trc_dst = MP_CSP_TRC_GAMMA22; + } } if (!peak_src) { @@ -2223,11 +2226,11 @@ static void pass_colormanage(struct gl_video *p, float peak_src, // Exception: ARIB STD-B67's nominal peak is exactly 12 times the // target's reference peak - if (trc_src == MP_CSP_TRC_ARIB_STD_B67) + if (p->image_params.gamma == MP_CSP_TRC_ARIB_STD_B67) peak_src = 12 * peak_dst; // Similar deal for V-Log - if (trc_src == MP_CSP_TRC_V_LOG) + if (p->image_params.gamma == MP_CSP_TRC_V_LOG) peak_src = 46.0855 * peak_dst; } |