From 12e58ff8a65c537a222a3fb954f88d98a3a5bfd2 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Wed, 2 Jan 2019 03:03:38 +0100 Subject: vo_gpu: allow boosting dark scenes when tone mapping In theory our "eye adaptation" algorithm works in both ways, both darkening bright scenes and brightening dark scenes. But I've always just prevented the latter with a hard clamp, since I wanted to avoid blowing up dark scenes into looking funny (and full of noise). But allowing a tiny bit of over-exposure might be a good thing. I won't change the default just yet (better let users test), but a moderate value of 1.2 might be better than the current 1.0 limit. Needs testing especially on dark scenes. --- video/out/gpu/video.c | 2 ++ video/out/gpu/video.h | 1 + video/out/gpu/video_shaders.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'video/out') diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index a29f09bc3d..6bf0bb31a1 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -316,6 +316,7 @@ static const struct gl_video_opts gl_video_opts_def = { .tone_map = { .curve = TONE_MAPPING_HABLE, .curve_param = NAN, + .max_boost = 1.0, .decay_rate = 100.0, .scene_threshold_low = 50, .scene_threshold_high = 200, @@ -376,6 +377,7 @@ const struct m_sub_options gl_video_conf = { OPT_INTRANGE("hdr-scene-threshold-high", tone_map.scene_threshold_high, 0, 0, 10000), OPT_FLOAT("tone-mapping-param", tone_map.curve_param, 0), + OPT_FLOATRANGE("tone-mapping-max-boost", tone_map.max_boost, 0, 1.0, 10.0), OPT_FLOAT("tone-mapping-desaturate", tone_map.desat, 0), OPT_FLOATRANGE("tone-mapping-desaturate-exponent", tone_map.desat_exp, 0, 0.0, 20.0), diff --git a/video/out/gpu/video.h b/video/out/gpu/video.h index 077f69332f..0bd5c57e8f 100644 --- a/video/out/gpu/video.h +++ b/video/out/gpu/video.h @@ -98,6 +98,7 @@ enum tone_mapping { struct gl_tone_map_opts { int curve; float curve_param; + float max_boost; int compute_peak; float decay_rate; int scene_threshold_low; diff --git a/video/out/gpu/video_shaders.c b/video/out/gpu/video_shaders.c index 0fff8f05f2..fbccd56eb3 100644 --- a/video/out/gpu/video_shaders.c +++ b/video/out/gpu/video_shaders.c @@ -652,7 +652,7 @@ static void pass_tone_map(struct gl_shader_cache *sc, } GLSL(float sig_orig = sig[sig_idx];) - GLSLF("float slope = min(1.0, %f / sig_avg);\n", sdr_avg); + GLSLF("float slope = min(%f, %f / sig_avg);\n", opts->max_boost, sdr_avg); GLSL(sig *= slope;) GLSL(sig_peak *= slope;) -- cgit v1.2.3