From 45c3e0f0d0c836158ab38db53156bb6461ad7437 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Mon, 30 May 2016 19:56:58 +0200 Subject: vo_opengl: refactor HDR mechanism Instead of doing HDR tone mapping on an ad-hoc basis inside pass_colormanage, the reference peak of an image is now part of the image params (alongside colorspace, gamma, etc.) and tone mapping is done whenever peak_src != peak_dst. To get sensible behavior when mixing HDR and SDR content and displays, target-brightness is a generic filler for "the assumed brightness of SDR content". This gets rid of the weird display_scaled hack, sets the framework for multiple HDR functions with difference reference peaks, and allows us to (in a future commit) autodetect the right source peak from the HDR metadata. (Apart from metadata, the source peak can also be controlled via vf_format. For HDR content this adjusts the overall image brightness, for SDR content it's like simulating a different exposure) --- video/filter/vf_format.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'video/filter') diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c index ff7389cb7a..109fda4053 100644 --- a/video/filter/vf_format.c +++ b/video/filter/vf_format.c @@ -38,6 +38,7 @@ struct vf_priv_s { int colorlevels; int primaries; int gamma; + float peak; int chroma_location; int stereo_in; int stereo_out; @@ -94,6 +95,8 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in, out->primaries = p->primaries; if (p->gamma) out->gamma = p->gamma; + if (p->peak) + out->peak = p->peak; if (p->chroma_location) out->chroma_location = p->chroma_location; if (p->stereo_in) @@ -142,6 +145,7 @@ static const m_option_t vf_opts_fields[] = { OPT_CHOICE_C("colorlevels", colorlevels, 0, mp_csp_levels_names), OPT_CHOICE_C("primaries", primaries, 0, mp_csp_prim_names), OPT_CHOICE_C("gamma", gamma, 0, mp_csp_trc_names), + OPT_FLOAT("peak", peak, 0), OPT_CHOICE_C("chroma-location", chroma_location, 0, mp_chroma_names), OPT_CHOICE_C("stereo-in", stereo_in, 0, mp_stereo3d_names), OPT_CHOICE_C("stereo-out", stereo_out, 0, mp_stereo3d_names), -- cgit v1.2.3