diff options
author | Niklas Haas <git@nand.wakku.to> | 2016-06-26 19:04:36 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-06-28 19:48:29 +0200 |
commit | 9278ce98f7198e61116043fe69f885bfca54ec1c (patch) | |
tree | fdec3d79c9a97239c7e30a07258d63c7cea5ab91 /video/out/opengl/video.c | |
parent | 4ce53025cb475408bfb27a56a57322d9d0c48a4f (diff) | |
download | mpv-9278ce98f7198e61116043fe69f885bfca54ec1c.tar.bz2 mpv-9278ce98f7198e61116043fe69f885bfca54ec1c.tar.xz |
vo_opengl: implement ARIB STD-B68 (HLG) HDR TRC
This HDR function is unique in that it's still display-referred, it just
allows for values above the reference peak (super-highlights). The
official standard doesn't actually document this very well, but the
nominal peak turns out to be exactly 12.0 - so we normalize to this
value internally in mpv. (This lets us preserve the property that the
textures are encoded in the range [0,1], preventing clipping and making
the best use of an integer texture's range)
This was grouped together with SMPTE ST2084 when checking libavutil
compatibility since they were added in the same release window, in a
similar timeframe.
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r-- | video/out/opengl/video.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index 4387208ead..6fd92ddb29 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -2172,12 +2172,15 @@ static void pass_colormanage(struct gl_video *p, float peak_src, enum mp_csp_prim prim_orig = p->image_params.primaries; enum mp_csp_trc trc_orig = p->image_params.gamma; - // One exception: SMPTE ST.2084 is not implemented by LittleCMS - // for technical limitation reasons, so we use a gamma 2.2 input curve - // here instead. We could pick any value we want here, the difference - // is just coding efficiency. - if (trc_orig == MP_CSP_TRC_SMPTE_ST2084) + // One exception: HDR is not implemented by LittleCMS for technical + // limitation reasons, so we use a gamma 2.2 input curve here instead. + // We could pick any value we want here, the difference is just coding + // efficiency. + if (trc_orig == MP_CSP_TRC_SMPTE_ST2084 || + trc_orig == MP_CSP_TRC_ARIB_STD_B67) + { trc_orig = MP_CSP_TRC_GAMMA22; + } if (gl_video_get_lut3d(p, prim_orig, trc_orig)) { prim_dst = prim_orig; @@ -2216,6 +2219,11 @@ static void pass_colormanage(struct gl_video *p, float peak_src, // If the source has no information known, it's display-referred // (and should be treated relative to the specified desired peak_dst) peak_src = peak_dst; + + // 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) + peak_src = 12 * peak_dst; } // All operations from here on require linear light as a starting point, |