Branch data Line data Source code
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 : : #pragma once
19 : :
20 : : #include <libplacebo/filters.h>
21 : :
22 : : static inline float pl_filter_radius_bound(const struct pl_filter_config *c)
23 : : {
24 [ + + - + : 475786 : const float r = c->radius && c->kernel->resizable ? c->radius : c->kernel->radius;
+ + - + ]
25 [ + + + + ]: 475786 : return c->blur > 0.0 ? r * c->blur : r;
26 : : }
27 : :
28 : : #define COMMON_FILTER_PRESETS \
29 : : /* Highest priority / recommended filters */ \
30 : : {"bilinear", &pl_filter_bilinear, "Bilinear"}, \
31 : : {"nearest", &pl_filter_nearest, "Nearest neighbour"}, \
32 : : {"bicubic", &pl_filter_bicubic, "Bicubic"}, \
33 : : {"lanczos", &pl_filter_lanczos, "Lanczos"}, \
34 : : {"ewa_lanczos", &pl_filter_ewa_lanczos, "Jinc (EWA Lanczos)"}, \
35 : : {"ewa_lanczossharp", &pl_filter_ewa_lanczossharp, "Sharpened Jinc"}, \
36 : : {"ewa_lanczos4sharpest",&pl_filter_ewa_lanczos4sharpest, "Sharpened Jinc-AR, 4 taps"},\
37 : : {"gaussian", &pl_filter_gaussian, "Gaussian"}, \
38 : : {"spline16", &pl_filter_spline16, "Spline (2 taps)"}, \
39 : : {"spline36", &pl_filter_spline36, "Spline (3 taps)"}, \
40 : : {"spline64", &pl_filter_spline64, "Spline (4 taps)"}, \
41 : : {"mitchell", &pl_filter_mitchell, "Mitchell-Netravali"}, \
42 : : \
43 : : /* Remaining filters */ \
44 : : {"sinc", &pl_filter_sinc, "Sinc (unwindowed)"}, \
45 : : {"ginseng", &pl_filter_ginseng, "Ginseng (Jinc-Sinc)"}, \
46 : : {"ewa_jinc", &pl_filter_ewa_jinc, "EWA Jinc (unwindowed)"}, \
47 : : {"ewa_ginseng", &pl_filter_ewa_ginseng, "EWA Ginseng"}, \
48 : : {"ewa_hann", &pl_filter_ewa_hann, "EWA Hann"}, \
49 : : {"hermite", &pl_filter_hermite, "Hermite"}, \
50 : : {"catmull_rom", &pl_filter_catmull_rom, "Catmull-Rom"}, \
51 : : {"robidoux", &pl_filter_robidoux, "Robidoux"}, \
52 : : {"robidouxsharp", &pl_filter_robidouxsharp, "RobidouxSharp"}, \
53 : : {"ewa_robidoux", &pl_filter_ewa_robidoux, "EWA Robidoux"}, \
54 : : {"ewa_robidouxsharp", &pl_filter_ewa_robidouxsharp, "EWA RobidouxSharp"}, \
55 : : \
56 : : /* Aliases */ \
57 : : {"triangle", &pl_filter_bilinear}, \
58 : : {"ewa_hanning", &pl_filter_ewa_hann}
|