diff options
author | Niklas Haas <git@nand.wakku.to> | 2015-08-20 21:45:58 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-08-20 21:55:19 +0200 |
commit | e1fd80097c6c224c9de06182d0a9aa0d21a57a67 (patch) | |
tree | 215e0f15984b045d5bc8df4149824b2a891bee30 /video/out/filter_kernels.c | |
parent | 96648169e342b9843246075a36fae2ad0bd06f88 (diff) | |
download | mpv-e1fd80097c6c224c9de06182d0a9aa0d21a57a67.tar.bz2 mpv-e1fd80097c6c224c9de06182d0a9aa0d21a57a67.tar.xz |
vo_opengl: add tscale-clamp option
This significantly reduces the amount of noticeable flashing when using
tscale kernels with negative lobes, by cutting them off completely.
I'm not sure if this has any negative effects. It needs a bit of
subjective testing over a period of time, so I just made it an option.
Fixes #2155.
Diffstat (limited to 'video/out/filter_kernels.c')
-rw-r--r-- | video/out/filter_kernels.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/video/out/filter_kernels.c b/video/out/filter_kernels.c index a748ac10ab..0f6d5a98bc 100644 --- a/video/out/filter_kernels.c +++ b/video/out/filter_kernels.c @@ -113,7 +113,8 @@ static double sample_filter(struct filter_kernel *filter, double w = window->weight ? window->weight(window, x/bw * window->radius / filter->f.radius) : 1.0; - return c < filter->f.radius ? w * filter->f.weight(&filter->f, c) : 0.0; + double v = c < filter->f.radius ? w * filter->f.weight(&filter->f, c) : 0.0; + return filter->clamp ? fmax(0.0, fmin(1.0, v)) : v; } // Calculate the 1D filtering kernel for N sample points. |