1 /*
2 * This file is part of libplacebo.
3 *
4 * libplacebo is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * libplacebo is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with libplacebo. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 /*
19 * Some of the filter code originally derives (via mpv) from Glumpy:
20 * # Copyright (c) 2009-2016 Nicolas P. Rougier. All rights reserved.
21 * # Distributed under the (new) BSD License.
22 * (https://github.com/glumpy/glumpy/blob/master/glumpy/library/build-spatial-filters.py)
23 *
24 * The math underlying each filter function was written from scratch, with
25 * some algorithms coming from a number of different sources, including:
26 * - https://en.wikipedia.org/wiki/Window_function
27 * - https://en.wikipedia.org/wiki/Jinc
28 * - http://vector-agg.cvs.sourceforge.net/viewvc/vector-agg/agg-2.5/include/agg_image_filters.h
29 * - Vapoursynth plugin fmtconv (WTFPL Licensed), which is based on
30 * dither plugin for avisynth from the same author:
31 * https://github.com/vapoursynth/fmtconv/tree/master/src/fmtc
32 * - Paul Heckbert's "zoom"
33 * - XBMC: ConvolutionKernels.cpp etc.
34 * - https://github.com/AviSynth/jinc-resize (only used to verify the math)
35 */
36
37 #include <math.h>
38
39 #include "common.h"
40 #include "filters.h"
41 #include "log.h"
42
pl_filter_function_eq(const struct pl_filter_function * a,const struct pl_filter_function * b)43 bool pl_filter_function_eq(const struct pl_filter_function *a,
44 const struct pl_filter_function *b)
45 {
46 if (!a || !b)
47 return a == b;
48
49 bool r = a->resizable == b->resizable &&
50 a->weight == b->weight &&
51 a->radius == b->radius;
52
53 for (int i = 0; i < PL_FILTER_MAX_PARAMS; i++) {
54 r &= a->tunable[i] == b->tunable[i];
55 if (a->tunable[i])
56 r &= a->params[i] == b->params[i];
57 }
58
59 return r;
60 }
61
pl_filter_config_eq(const struct pl_filter_config * a,const struct pl_filter_config * b)62 bool pl_filter_config_eq(const struct pl_filter_config *a,
63 const struct pl_filter_config *b)
64 {
65 if (!a || !b)
66 return a == b;
67
68 return pl_filter_function_eq(a->kernel, b->kernel) &&
69 pl_filter_function_eq(a->window, b->window) &&
70 a->clamp == b->clamp &&
71 a->blur == b->blur &&
72 a->taper == b->taper &&
73 a->polar == b->polar;
74 }
75
pl_filter_sample(const struct pl_filter_config * c,double x)76 double pl_filter_sample(const struct pl_filter_config *c, double x)
77 {
78 double radius = c->kernel->radius;
79
80 // All filters are symmetric, and in particular only need to be defined
81 // for [0, radius].
82 x = fabs(x);
83
84 // Apply the blur and taper coefficients as needed
85 double kx = c->blur > 0.0 ? x / c->blur : x;
86 kx = kx <= c->taper ? 0.0 : (kx - c->taper) / (1.0 - c->taper / radius);
87
88 // Return early for values outside of the kernel radius, since the functions
89 // are not necessarily valid outside of this interval. No such check is
90 // needed for the window, because it's always stretched to fit.
91 if (kx > radius)
92 return 0.0;
93
94 double k = c->kernel->weight(c->kernel, kx);
95
96 // Apply the optional windowing function
97 if (c->window)
98 k *= c->window->weight(c->window, x / radius * c->window->radius);
99
100 return k < 0 ? (1 - c->clamp) * k : k;
101 }
102
103 // Compute a single row of weights for a given filter in one dimension, indexed
104 // by the indicated subpixel offset. Writes `f->row_size` values to `out`.
compute_row(struct pl_filter * f,double offset,float * out)105 static void compute_row(struct pl_filter *f, double offset, float *out)
106 {
107 double wsum = 0.0;
108 for (int i = 0; i < f->row_size; i++) {
109 // For the example of a filter with row size 4 and offset 0.3, we have:
110 //
111 // 0 1 * 2 3
112 //
113 // * indicates the sampled position. What we want to compute is the
114 // distance from each index to that sampled position.
115 pl_assert(f->row_size % 2 == 0);
116 const int base = f->row_size / 2 - 1; // index to the left of the center
117 const double center = base + offset; // offset of center relative to idx 0
118 double x = i - center;
119
120 // Stretch/squish the kernel by readjusting the value range
121 x *= f->params.config.kernel->radius / f->radius;
122 double w = pl_filter_sample(&f->params.config, x);
123 out[i] = w;
124 wsum += w;
125 }
126
127 // Readjust weights to preserve energy
128 pl_assert(wsum > 0);
129 for (int i = 0; i < f->row_size; i++)
130 out[i] /= wsum;
131 }
132
dupfilter(void * alloc,const struct pl_filter_function * f)133 static struct pl_filter_function *dupfilter(void *alloc,
134 const struct pl_filter_function *f)
135 {
136 return f ? pl_memdup(alloc, (void *)f, sizeof(*f)) : NULL;
137 }
138
pl_filter_generate(pl_log log,const struct pl_filter_params * params)139 pl_filter pl_filter_generate(pl_log log, const struct pl_filter_params *params)
140 {
141 pl_assert(params);
142 if (params->lut_entries <= 0 || !params->config.kernel) {
143 pl_fatal(log, "Invalid params: missing lut_entries or config.kernel");
144 return NULL;
145 }
146
147 struct pl_filter *f = pl_zalloc_ptr(NULL, f);
148 f->params = *params;
149 f->params.config.kernel = dupfilter(f, params->config.kernel);
150 f->params.config.window = dupfilter(f, params->config.window);
151
152 // Compute the required filter radius
153 float radius = f->params.config.kernel->radius;
154 f->radius = radius;
155 if (params->filter_scale > 1.0)
156 f->radius *= params->filter_scale;
157
158 float *weights;
159 if (params->config.polar) {
160 // Compute a 1D array indexed by radius
161 weights = pl_alloc(f, params->lut_entries * sizeof(float));
162 f->radius_cutoff = 0.0;
163 for (int i = 0; i < params->lut_entries; i++) {
164 double x = radius * i / (params->lut_entries - 1);
165 weights[i] = pl_filter_sample(&f->params.config, x);
166 if (fabs(weights[i]) > params->cutoff)
167 f->radius_cutoff = x;
168 }
169 } else {
170 // Pick the most appropriate row size
171 f->row_size = ceil(f->radius) * 2;
172 if (params->max_row_size && f->row_size > params->max_row_size) {
173 pl_info(log, "Required filter size %d exceeds the maximum allowed "
174 "size of %d. This may result in adverse effects (aliasing, "
175 "or moiré artifacts).", f->row_size, params->max_row_size);
176 f->row_size = params->max_row_size;
177 f->insufficient = true;
178 }
179 f->row_stride = PL_ALIGN(f->row_size, params->row_stride_align);
180
181 // Compute a 2D array indexed by the subpixel position
182 weights = pl_calloc(f, params->lut_entries * f->row_stride, sizeof(float));
183 for (int i = 0; i < params->lut_entries; i++) {
184 compute_row(f, i / (double)(params->lut_entries - 1),
185 weights + f->row_stride * i);
186 }
187 }
188
189 f->weights = weights;
190 return f;
191 }
192
pl_filter_free(pl_filter * filter)193 void pl_filter_free(pl_filter *filter)
194 {
195 pl_free_ptr((void **) filter);
196 }
197
pl_find_filter_function_preset(const char * name)198 const struct pl_filter_function_preset *pl_find_filter_function_preset(const char *name)
199 {
200 if (!name)
201 return NULL;
202
203 for (int i = 0; pl_filter_function_presets[i].name; i++) {
204 if (strcmp(pl_filter_function_presets[i].name, name) == 0)
205 return &pl_filter_function_presets[i];
206 }
207
208 return NULL;
209 }
210
pl_find_filter_preset(const char * name)211 const struct pl_filter_preset *pl_find_filter_preset(const char *name)
212 {
213 if (!name)
214 return NULL;
215
216 for (int i = 0; pl_filter_presets[i].name; i++) {
217 if (strcmp(pl_filter_presets[i].name, name) == 0)
218 return &pl_filter_presets[i];
219 }
220
221 return NULL;
222 }
223
224 // Built-in filter functions
225
box(const struct pl_filter_function * f,double x)226 static double box(const struct pl_filter_function *f, double x)
227 {
228 return x < 0.5 ? 1.0 : 0.0;
229 }
230
231 const struct pl_filter_function pl_filter_function_box = {
232 .resizable = true,
233 .weight = box,
234 .radius = 1.0,
235 };
236
triangle(const struct pl_filter_function * f,double x)237 static double triangle(const struct pl_filter_function *f, double x)
238 {
239 return 1.0 - x / f->radius;
240 }
241
242 const struct pl_filter_function pl_filter_function_triangle = {
243 .resizable = true,
244 .weight = triangle,
245 .radius = 1.0,
246 };
247
cosine(const struct pl_filter_function * f,double x)248 static double cosine(const struct pl_filter_function *f, double x)
249 {
250 return cos(x);
251 }
252
253 const struct pl_filter_function pl_filter_function_cosine = {
254 .weight = cosine,
255 .radius = M_PI / 2.0,
256 };
257
hann(const struct pl_filter_function * f,double x)258 static double hann(const struct pl_filter_function *f, double x)
259 {
260 return 0.5 + 0.5 * cos(M_PI * x);
261 }
262
263 const struct pl_filter_function pl_filter_function_hann = {
264 .weight = hann,
265 .radius = 1.0,
266 };
267
hamming(const struct pl_filter_function * f,double x)268 static double hamming(const struct pl_filter_function *f, double x)
269 {
270 return 0.54 + 0.46 * cos(M_PI * x);
271 }
272
273 const struct pl_filter_function pl_filter_function_hamming = {
274 .weight = hamming,
275 .radius = 1.0,
276 };
277
welch(const struct pl_filter_function * f,double x)278 static double welch(const struct pl_filter_function *f, double x)
279 {
280 return 1.0 - x * x;
281 }
282
283 const struct pl_filter_function pl_filter_function_welch = {
284 .weight = welch,
285 .radius = 1.0,
286 };
287
bessel_i0(double x)288 static double bessel_i0(double x)
289 {
290 double s = 1.0;
291 double y = x * x / 4.0;
292 double t = y;
293 int i = 2;
294 while (t > 1e-12) {
295 s += t;
296 t *= y / (i * i);
297 i += 1;
298 }
299 return s;
300 }
301
kaiser(const struct pl_filter_function * f,double x)302 static double kaiser(const struct pl_filter_function *f, double x)
303 {
304 double alpha = fmax(f->params[0], 0.0);
305 return bessel_i0(alpha * sqrt(1.0 - x * x)) / alpha;
306 }
307
308 const struct pl_filter_function pl_filter_function_kaiser = {
309 .tunable = {true},
310 .weight = kaiser,
311 .radius = 1.0,
312 .params = {2.0},
313 };
314
blackman(const struct pl_filter_function * f,double x)315 static double blackman(const struct pl_filter_function *f, double x)
316 {
317 double a = f->params[0];
318 double a0 = (1 - a) / 2.0, a1 = 1 / 2.0, a2 = a / 2.0;
319 x *= M_PI;
320 return a0 + a1 * cos(x) + a2 * cos(2 * x);
321 }
322
323 const struct pl_filter_function pl_filter_function_blackman = {
324 .tunable = {true},
325 .weight = blackman,
326 .radius = 1.0,
327 .params = {0.16},
328 };
329
bohman(const struct pl_filter_function * f,double x)330 static double bohman(const struct pl_filter_function *f, double x)
331 {
332 double pix = M_PI * x;
333 return (1.0 - x) * cos(pix) + sin(pix) / M_PI;
334 }
335
336 const struct pl_filter_function pl_filter_function_bohman = {
337 .weight = bohman,
338 .radius = 1.0,
339 };
340
gaussian(const struct pl_filter_function * f,double x)341 static double gaussian(const struct pl_filter_function *f, double x)
342 {
343 return exp(-2.0 * x * x / f->params[0]);
344 }
345
346 const struct pl_filter_function pl_filter_function_gaussian = {
347 .resizable = true,
348 .tunable = {true},
349 .weight = gaussian,
350 .radius = 2.0,
351 .params = {1.0},
352 };
353
quadratic(const struct pl_filter_function * f,double x)354 static double quadratic(const struct pl_filter_function *f, double x)
355 {
356 if (x < 0.5) {
357 return 0.75 - x * x;
358 } else {
359 return 0.5 * (x - 1.5) * (x - 1.5);
360 }
361 }
362
363 const struct pl_filter_function pl_filter_function_quadratic = {
364 .weight = quadratic,
365 .radius = 1.5,
366 };
367
sinc(const struct pl_filter_function * f,double x)368 static double sinc(const struct pl_filter_function *f, double x)
369 {
370 if (x < 1e-8)
371 return 1.0;
372 x *= M_PI;
373 return sin(x) / x;
374 }
375
376 const struct pl_filter_function pl_filter_function_sinc = {
377 .resizable = true,
378 .weight = sinc,
379 .radius = 1.0,
380 };
381
jinc(const struct pl_filter_function * f,double x)382 static double jinc(const struct pl_filter_function *f, double x)
383 {
384 if (x < 1e-8)
385 return 1.0;
386 x *= M_PI;
387 return 2.0 * j1(x) / x;
388 }
389
390 const struct pl_filter_function pl_filter_function_jinc = {
391 .resizable = true,
392 .weight = jinc,
393 .radius = 1.2196698912665045, // first zero
394 };
395
sphinx(const struct pl_filter_function * f,double x)396 static double sphinx(const struct pl_filter_function *f, double x)
397 {
398 if (x < 1e-8)
399 return 1.0;
400 x *= M_PI;
401 return 3.0 * (sin(x) - x * cos(x)) / (x * x * x);
402 }
403
404 const struct pl_filter_function pl_filter_function_sphinx = {
405 .resizable = true,
406 .weight = sphinx,
407 .radius = 1.4302966531242027, // first zero
408 };
409
bcspline(const struct pl_filter_function * f,double x)410 static double bcspline(const struct pl_filter_function *f, double x)
411 {
412 double b = f->params[0],
413 c = f->params[1];
414 double p0 = (6.0 - 2.0 * b) / 6.0,
415 p2 = (-18.0 + 12.0 * b + 6.0 * c) / 6.0,
416 p3 = (12.0 - 9.0 * b - 6.0 * c) / 6.0,
417 q0 = (8.0 * b + 24.0 * c) / 6.0,
418 q1 = (-12.0 * b - 48.0 * c) / 6.0,
419 q2 = (6.0 * b + 30.0 * c) / 6.0,
420 q3 = (-b - 6.0 * c) / 6.0;
421
422 // Needed to ensure the kernel is sanely scaled, i.e. bcspline(0.0) = 1.0
423 double scale = 1.0 / p0;
424 if (x < 1.0) {
425 return scale * (p0 + x * x * (p2 + x * p3));
426 } else if (x < 2.0) {
427 return scale * (q0 + x * (q1 + x * (q2 + x * q3)));
428 }
429 return 0.0;
430 }
431
432 const struct pl_filter_function pl_filter_function_bcspline = {
433 .tunable = {true, true},
434 .weight = bcspline,
435 .radius = 2.0,
436 .params = {0.5, 0.5},
437 };
438
439 const struct pl_filter_function pl_filter_function_catmull_rom = {
440 .tunable = {true, true},
441 .weight = bcspline,
442 .radius = 2.0,
443 .params = {0.0, 0.5},
444 };
445
446 const struct pl_filter_function pl_filter_function_mitchell = {
447 .tunable = {true, true},
448 .weight = bcspline,
449 .radius = 2.0,
450 .params = {1/3.0, 1/3.0},
451 };
452
453 const struct pl_filter_function pl_filter_function_robidoux = {
454 .tunable = {true, true},
455 .weight = bcspline,
456 .radius = 2.0,
457 .params = {12 / (19 + 9 * M_SQRT2), 113 / (58 + 216 * M_SQRT2)},
458 };
459
460 const struct pl_filter_function pl_filter_function_robidouxsharp = {
461 .tunable = {true, true},
462 .weight = bcspline,
463 .radius = 2.0,
464 .params = {6 / (13 + 7 * M_SQRT2), 7 / (2 + 12 * M_SQRT2)},
465 };
466
467 #define POW3(x) ((x) <= 0 ? 0 : (x) * (x) * (x))
bicubic(const struct pl_filter_function * f,double x)468 static double bicubic(const struct pl_filter_function *f, double x)
469 {
470 return (1.0/6.0) * ( 1 * POW3(x + 2)
471 - 4 * POW3(x + 1)
472 + 6 * POW3(x + 0)
473 - 4 * POW3(x - 1));
474 }
475
476 const struct pl_filter_function pl_filter_function_bicubic = {
477 .weight = bicubic,
478 .radius = 2.0,
479 };
480
spline16(const struct pl_filter_function * f,double x)481 static double spline16(const struct pl_filter_function *f, double x)
482 {
483 if (x < 1.0) {
484 return ((x - 9.0/5.0 ) * x - 1.0/5.0 ) * x + 1.0;
485 } else {
486 return ((-1.0/3.0 * (x-1) + 4.0/5.0) * (x-1) - 7.0/15.0 ) * (x-1);
487 }
488 }
489
490 const struct pl_filter_function pl_filter_function_spline16 = {
491 .weight = spline16,
492 .radius = 2.0,
493 };
494
spline36(const struct pl_filter_function * f,double x)495 static double spline36(const struct pl_filter_function *f, double x)
496 {
497 if (x < 1.0) {
498 return ((13.0/11.0 * x - 453.0/209.0) * x - 3.0/209.0) * x + 1.0;
499 } else if (x < 2.0) {
500 return ((-6.0/11.0 * (x-1) + 270.0/209.0) * (x-1) - 156.0/ 209.0) * (x-1);
501 } else {
502 return ((1.0/11.0 * (x-2) - 45.0/209.0) * (x-2) + 26.0/209.0) * (x-2);
503 }
504 }
505
506 const struct pl_filter_function pl_filter_function_spline36 = {
507 .weight = spline36,
508 .radius = 3.0,
509 };
510
spline64(const struct pl_filter_function * f,double x)511 static double spline64(const struct pl_filter_function *f, double x)
512 {
513 if (x < 1.0) {
514 return ((49.0/41.0 * x - 6387.0/2911.0) * x - 3.0/2911.0) * x + 1.0;
515 } else if (x < 2.0) {
516 return ((-24.0/41.0 * (x-1) + 4032.0/2911.0) * (x-1) - 2328.0/2911.0) * (x-1);
517 } else if (x < 3.0) {
518 return ((6.0/41.0 * (x-2) - 1008.0/2911.0) * (x-2) + 582.0/2911.0) * (x-2);
519 } else {
520 return ((-1.0/41.0 * (x-3) + 168.0/2911.0) * (x-3) - 97.0/2911.0) * (x-3);
521 }
522 }
523
524 const struct pl_filter_function pl_filter_function_spline64 = {
525 .weight = spline64,
526 .radius = 4.0,
527 };
528
529 // Named filter functions
530 const struct pl_filter_function_preset pl_filter_function_presets[] = {
531 {"none", NULL},
532 {"box", &pl_filter_function_box},
533 {"dirichlet", &pl_filter_function_box}, // alias
534 {"triangle", &pl_filter_function_triangle},
535 {"cosine", &pl_filter_function_cosine},
536 {"hann", &pl_filter_function_hann},
537 {"hanning", &pl_filter_function_hann}, // alias
538 {"hamming", &pl_filter_function_hamming},
539 {"welch", &pl_filter_function_welch},
540 {"kaiser", &pl_filter_function_kaiser},
541 {"blackman", &pl_filter_function_blackman},
542 {"bohman", &pl_filter_function_bohman},
543 {"gaussian", &pl_filter_function_gaussian},
544 {"quadratic", &pl_filter_function_quadratic},
545 {"quadric", &pl_filter_function_quadratic}, // alias
546 {"sinc", &pl_filter_function_sinc},
547 {"jinc", &pl_filter_function_jinc},
548 {"sphinx", &pl_filter_function_sphinx},
549 {"bcspline", &pl_filter_function_bcspline},
550 {"hermite", &pl_filter_function_bcspline}, // alias
551 {"catmull_rom", &pl_filter_function_catmull_rom},
552 {"mitchell", &pl_filter_function_mitchell},
553 {"robidoux", &pl_filter_function_robidoux},
554 {"robidouxsharp", &pl_filter_function_robidouxsharp},
555 {"bicubic", &pl_filter_function_bicubic},
556 {"spline16", &pl_filter_function_spline16},
557 {"spline36", &pl_filter_function_spline36},
558 {"spline64", &pl_filter_function_spline64},
559 {0},
560 };
561
562 const int pl_num_filter_function_presets = PL_ARRAY_SIZE(pl_filter_function_presets) - 1;
563
564 // Built-in filter function presets
565 const struct pl_filter_config pl_filter_spline16 = {
566 .kernel = &pl_filter_function_spline16,
567 };
568
569 const struct pl_filter_config pl_filter_spline36 = {
570 .kernel = &pl_filter_function_spline36,
571 };
572
573 const struct pl_filter_config pl_filter_spline64 = {
574 .kernel = &pl_filter_function_spline64,
575 };
576
577 const struct pl_filter_config pl_filter_nearest = {
578 .kernel = &pl_filter_function_box,
579 };
580
581 const struct pl_filter_config pl_filter_bilinear = {
582 .kernel = &pl_filter_function_triangle,
583 };
584
585 const struct pl_filter_config pl_filter_gaussian = {
586 .kernel = &pl_filter_function_gaussian,
587 };
588
589 // Sinc configured to three taps
590 static const struct pl_filter_function sinc3 = {
591 .resizable = true,
592 .weight = sinc,
593 .radius = 3.0,
594 };
595
596 const struct pl_filter_config pl_filter_sinc = {
597 .kernel = &sinc3,
598 };
599
600 const struct pl_filter_config pl_filter_lanczos = {
601 .kernel = &sinc3,
602 .window = &pl_filter_function_sinc,
603 };
604
605 const struct pl_filter_config pl_filter_ginseng = {
606 .kernel = &sinc3,
607 .window = &pl_filter_function_jinc,
608 };
609
610 // Jinc configured to three taps
611 static const struct pl_filter_function jinc3 = {
612 .resizable = true,
613 .weight = jinc,
614 .radius = 3.2383154841662362, // third zero
615 };
616
617 const struct pl_filter_config pl_filter_ewa_jinc = {
618 .kernel = &jinc3,
619 .polar = true,
620 };
621
622 const struct pl_filter_config pl_filter_ewa_lanczos = {
623 .kernel = &jinc3,
624 .window = &pl_filter_function_jinc,
625 .polar = true,
626 };
627
628 const struct pl_filter_config pl_filter_ewa_ginseng = {
629 .kernel = &jinc3,
630 .window = &pl_filter_function_sinc,
631 .polar = true,
632 };
633
634 const struct pl_filter_config pl_filter_ewa_hann = {
635 .kernel = &jinc3,
636 .window = &pl_filter_function_hann,
637 .polar = true,
638 };
639
640 const struct pl_filter_config pl_filter_haasnsoft = {
641 .kernel = &jinc3,
642 .window = &pl_filter_function_hann,
643 // The blur is tuned to equal out orthogonal and diagonal contributions
644 // on a regular grid. This has the effect of almost completely killing
645 // aliasing.
646 .blur = 1.11,
647 .polar = true,
648 };
649
650 // Spline family
651 const struct pl_filter_config pl_filter_bicubic = {
652 .kernel = &pl_filter_function_bicubic,
653 };
654
655 const struct pl_filter_config pl_filter_catmull_rom = {
656 .kernel = &pl_filter_function_catmull_rom,
657 };
658
659 const struct pl_filter_config pl_filter_mitchell = {
660 .kernel = &pl_filter_function_mitchell,
661 };
662
663 const struct pl_filter_config pl_filter_mitchell_clamp = {
664 .kernel = &pl_filter_function_mitchell,
665 .clamp = 1.0,
666 };
667
668 const struct pl_filter_config pl_filter_robidoux = {
669 .kernel = &pl_filter_function_robidoux,
670 };
671
672 const struct pl_filter_config pl_filter_robidouxsharp = {
673 .kernel = &pl_filter_function_robidouxsharp,
674 };
675
676 const struct pl_filter_config pl_filter_ewa_robidoux = {
677 .kernel = &pl_filter_function_robidoux,
678 .polar = true,
679 };
680
681 const struct pl_filter_config pl_filter_ewa_robidouxsharp = {
682 .kernel = &pl_filter_function_robidouxsharp,
683 .polar = true,
684 };
685
686 // Named filter configs
687 const struct pl_filter_preset pl_filter_presets[] = {
688 {"none", NULL, "Built-in sampling"},
689 COMMON_FILTER_PRESETS,
690 {0}
691 };
692
693 const int pl_num_filter_presets = PL_ARRAY_SIZE(pl_filter_presets) - 1;
694