mirror of
https://github.com/mpv-player/mpv
synced 2024-12-11 09:25:56 +00:00
vo_opengl: clamp filters to their size
This gives better results with fancy-downscaling. The issue here is that fancy-downscalign "extends" the filter radius by some amount, which requires using a larger filter size and shader. Then most of the filter is "unused", but some filters still return non-0 coefficients, which create heavy artifacts. Just clamp them off. I'm not sure if this is the right solution, but at least it's better than before.
This commit is contained in:
parent
2833670b71
commit
309c5fee59
@ -91,7 +91,8 @@ void mp_compute_weights(struct filter_kernel *filter, double f, float *out_w)
|
||||
double sum = 0;
|
||||
for (int n = 0; n < filter->size; n++) {
|
||||
double x = f - (n - filter->size / 2 + 1);
|
||||
double w = filter->weight(filter, fabs(x) / filter->inv_scale);
|
||||
double c = fabs(x) / filter->inv_scale;
|
||||
double w = c <= filter->radius ? filter->weight(filter, c) : 0;
|
||||
out_w[n] = w;
|
||||
sum += w;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user