From e1fd80097c6c224c9de06182d0a9aa0d21a57a67 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Thu, 20 Aug 2015 21:45:58 +0200 Subject: 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. --- video/out/filter_kernels.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'video/out/filter_kernels.c') 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. -- cgit v1.2.3