diff options
author | Niklas Haas <git@haasn.xyz> | 2019-01-01 07:30:00 +0100 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2019-02-18 01:54:06 +0200 |
commit | 6179dcbb798aa9e3501af82ae46975e881d80626 (patch) | |
tree | 4ec798500982b8a3bf39bb4a03fe242cca5555d1 /video/out/gpu/video.h | |
parent | 3fe882d4ae80fa060a71dad0d6d1605afcfe98b6 (diff) | |
download | mpv-6179dcbb798aa9e3501af82ae46975e881d80626.tar.bz2 mpv-6179dcbb798aa9e3501af82ae46975e881d80626.tar.xz |
vo_gpu: redesign peak detection algorithm
The previous approach of using an FIR with tunable hard threshold for
scene changes had several problems:
- the FIR involved annoying hard-coded buffer sizes, high VRAM usage,
and the FIR sum was prone to numerical overflow which limited the
number of frames we could average over. We also totally redesign the
scene change detection.
- the hard scene change detection was prone to both false positives and
false negatives, each with their own (annoying) issues.
Scrap this entirely and switch to a dual approach of using a simple
single-pole IIR low pass filter to smooth out noise, while using a
softer scene change curve (with tunable low and high thresholds), based
on `smoothstep`. The IIR filter is extremely simple in its
implementation and has an arbitrarily user-tunable cutoff frequency,
while the smoothstep-based scene change curve provides a good, tunable
tradeoff between adaptation speed and stability - without exhibiting
either of the traditional issues associated with the hard cutoff.
Another way to think about the new options is that the "low threshold"
provides a margin of error within which we don't care about small
fluctuations in the scene (which will therefore be smoothed out by the
IIR filter).
Diffstat (limited to 'video/out/gpu/video.h')
-rw-r--r-- | video/out/gpu/video.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/video/out/gpu/video.h b/video/out/gpu/video.h index ee5c0a2861..077f69332f 100644 --- a/video/out/gpu/video.h +++ b/video/out/gpu/video.h @@ -95,13 +95,13 @@ enum tone_mapping { TONE_MAPPING_LINEAR, }; -// How many frames to average over for HDR peak detection -#define PEAK_DETECT_FRAMES 63 - struct gl_tone_map_opts { int curve; float curve_param; int compute_peak; + float decay_rate; + int scene_threshold_low; + int scene_threshold_high; float desat; float desat_exp; int gamut_warning; // bool |