diff options
author | Niklas Haas <git@haasn.xyz> | 2017-07-03 11:23:48 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.xyz> | 2017-07-03 11:51:37 +0200 |
commit | 8854a2bef61090fdcc6b815112ddd966ef07d771 (patch) | |
tree | 553ec82e7df0eeff9aa980c00f6ad5c14b385518 /video/out/filter_kernels.c | |
parent | 41b3b116695bcad3fdb3129b133e2a97d9a76847 (diff) | |
download | mpv-8854a2bef61090fdcc6b815112ddd966ef07d771.tar.bz2 mpv-8854a2bef61090fdcc6b815112ddd966ef07d771.tar.xz |
filter_kernels: add radius cutoff functionality
This allows filter functions to be prematurely cut off once their
contributions start becoming insignificant. This effectively prevents
wasted GPU time sampling from parts of the function that are essentially
reduced to zero by the window function, providing anywhere from a 10% to
20% speedup. (5700μs -> 4700μs for me)
Diffstat (limited to 'video/out/filter_kernels.c')
-rw-r--r-- | video/out/filter_kernels.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/video/out/filter_kernels.c b/video/out/filter_kernels.c index 11680a064a..09f85af5f4 100644 --- a/video/out/filter_kernels.c +++ b/video/out/filter_kernels.c @@ -152,10 +152,14 @@ static void mp_compute_weights(struct filter_kernel *filter, double f, void mp_compute_lut(struct filter_kernel *filter, int count, float *out_array) { if (filter->polar) { + filter->radius_cutoff = 0.0; // Compute a 1D array indexed by radius for (int x = 0; x < count; x++) { double r = x * filter->f.radius / (count - 1); out_array[x] = sample_filter(filter, r); + + if (fabs(out_array[x]) > filter->value_cutoff) + filter->radius_cutoff = r; } } else { // Compute a 2D array indexed by subpixel position |