diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/out/gpu/video.c | 2 | ||||
-rw-r--r-- | video/out/gpu/video_shaders.c | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index db0d045852..a03e6e80c4 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -419,7 +419,7 @@ const struct m_sub_options gl_video_conf = { {"hdr-peak-percentile", OPT_FLOAT(tone_map.peak_percentile), M_RANGE(0.0, 100.0)}, {"hdr-peak-decay-rate", OPT_FLOAT(tone_map.decay_rate), - M_RANGE(1.0, 1000.0)}, + M_RANGE(0.0, 1000.0)}, {"hdr-scene-threshold-low", OPT_FLOAT(tone_map.scene_threshold_low), M_RANGE(0, 20.0)}, {"hdr-scene-threshold-high", OPT_FLOAT(tone_map.scene_threshold_high), diff --git a/video/out/gpu/video_shaders.c b/video/out/gpu/video_shaders.c index 049151bd24..260d0afb3d 100644 --- a/video/out/gpu/video_shaders.c +++ b/video/out/gpu/video_shaders.c @@ -644,9 +644,12 @@ static void hdr_update_peak(struct gl_shader_cache *sc, // Use an IIR low-pass filter to smooth out the detected values, with a // configurable decay rate based on the desired time constant (tau) - float a = 1.0 - cos(1.0 / opts->decay_rate); - float decay = sqrt(a*a + 2*a) - a; - GLSLF(" average += %f * (cur - average);\n", decay); + if (opts->decay_rate) { + float decay = 1.0f - expf(-1.0f / opts->decay_rate); + GLSLF(" average += %f * (cur - average);\n", decay); + } else { + GLSLF(" average = cur;\n"); + } // Scene change hysteresis float log_db = 10.0 / log(10.0); |