diff options
author | Niklas Haas <git@haasn.xyz> | 2017-06-10 14:01:25 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-06-18 20:48:23 +0200 |
commit | c335e84230916d7d7a38288031516e8b2ec1c36b (patch) | |
tree | 009b92a90285b7fae212d82caec588dd6ef709d8 /video/mp_image.c | |
parent | 642e963c86040350ac8f06b9731e6126f4d55316 (diff) | |
download | mpv-c335e84230916d7d7a38288031516e8b2ec1c36b.tar.bz2 mpv-c335e84230916d7d7a38288031516e8b2ec1c36b.tar.xz |
video: refactor HDR implementation
List of changes:
1. Kill nom_peak, since it's a pointless non-field that stores nothing
of value and is _always_ derived from ref_white anyway.
2. Kill ref_white/--target-brightness, because the only case it really
existed for (PQ) actually doesn't need to be this general: According
to ITU-R BT.2100, PQ *always* assumes a reference monitor with a
white point of 100 cd/m².
3. Improve documentation and comments surrounding this stuff.
4. Clean up some of the code in general. Move stuff where it belongs.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index bc706b8856..ae0fc02e49 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -408,7 +408,6 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src) } dst->params.color.primaries = src->params.color.primaries; dst->params.color.gamma = src->params.color.gamma; - dst->params.color.nom_peak = src->params.color.nom_peak; dst->params.color.sig_peak = src->params.color.sig_peak; if ((dst->fmt.flags & MP_IMGFLAG_YUV) == (src->fmt.flags & MP_IMGFLAG_YUV)) { dst->params.color.space = src->params.color.space; @@ -531,8 +530,6 @@ char *mp_image_params_to_str_buf(char *b, size_t bs, m_opt_choice_str(mp_csp_prim_names, p->color.primaries), m_opt_choice_str(mp_csp_trc_names, p->color.gamma), m_opt_choice_str(mp_csp_levels_names, p->color.levels)); - if (p->color.nom_peak) - mp_snprintf_cat(b, bs, " NP=%f", p->color.nom_peak); if (p->color.sig_peak) mp_snprintf_cat(b, bs, " SP=%f", p->color.sig_peak); mp_snprintf_cat(b, bs, " CL=%s", @@ -687,11 +684,10 @@ void mp_image_params_guess_csp(struct mp_image_params *params) params->color.gamma = MP_CSP_TRC_AUTO; } - // Guess the nominal peak (independent of the colorspace) - if (params->color.gamma == MP_CSP_TRC_SMPTE_ST2084) { - if (!params->color.nom_peak) - params->color.nom_peak = 10000; // As per the spec - } + // If the signal peak is unknown, we're forced to pick the TRC's nominal + // range as the signal peak to prevent clipping + if (!params->color.sig_peak) + params->color.sig_peak = mp_trc_nom_peak(params->color.gamma); } // Copy properties and data of the AVFrame into the mp_image, without taking |