mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-29 15:11:09 +08:00
filter_kernels: Apply blur/taper before culling radius.
Modifications to the input coordinates should all be performed before the final range check against the filter boundaries. However, in the existing code, the blur/taper is applied after the filter radius check is performed. Thus, effectively the filter radius cutoff is applied to only-downscaling-metric-modified coordinates, not the final coordinates. Correct this issue and restructure the returns a bit to make it more obvious what is being done.
This commit is contained in:
committed by
Rostislav Pehlivanov
parent
85c8556eef
commit
69cc9f2a2c
@@ -100,14 +100,14 @@ static double sample_window(struct filter_window *kernel, double x)
|
||||
|
||||
// All windows are symmetric, this makes life easier
|
||||
x = fabs(x);
|
||||
if (x >= kernel->radius)
|
||||
return 0.0;
|
||||
|
||||
// Stretch and taper the window size as needed
|
||||
x = kernel->blur > 0.0 ? x / kernel->blur : x;
|
||||
x = x <= kernel->taper ? 0.0 : (x - kernel->taper) / (1 - kernel->taper);
|
||||
|
||||
return kernel->weight(kernel, x);
|
||||
if (x < kernel->radius)
|
||||
return kernel->weight(kernel, x);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// Evaluate a filter's kernel and window at a given absolute position
|
||||
|
||||
Reference in New Issue
Block a user