From 716811a3c3d8f7cb4da5cfff083429860b24d2d6 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sun, 5 Nov 2023 13:52:09 +0100 Subject: [PATCH] filters: re-add accidentally removed filters These should have gone through a deprecation period, since they are a public API. Fixes: dcd5b75be4423bf68e5fff63329f36ae2bd32f62 Fixes: https://code.videolan.org/videolan/vlc/-/issues/28417 --- meson.build | 1 + src/filters.c | 64 ++++++++++++++++++++++++++------ src/include/libplacebo/filters.h | 10 ++++- 3 files changed, 61 insertions(+), 14 deletions(-) diff --git a/meson.build b/meson.build index b628b13c..e0db136c 100644 --- a/meson.build +++ b/meson.build @@ -12,6 +12,7 @@ project('libplacebo', ['c', 'cpp'], 7, # API version { + '341': 're-add pl_filter_function_{bicubic,bcspline,catmull_rom,mitchell,robidoux,robidouxsharp} as deprecated', '340': 'add pl_queue_params.drift_compensation, PL_QUEUE_DEFAULTS and pl_queue_pts_offset', '339': 'add pl_peak_detect_params.black_cutoff', '338': 'split pl_filter_nearest into pl_filter_nearest and pl_filter_box', diff --git a/src/filters.c b/src/filters.c index cc4871fc..58f29985 100644 --- a/src/filters.c +++ b/src/filters.c @@ -491,27 +491,59 @@ const struct pl_filter_function pl_filter_function_cubic = { .tunable = {true, true}, }; -static const struct pl_filter_function filter_function_bicubic = { - .name = "bicubic", // alias +const struct pl_filter_function pl_filter_function_hermite = { + .name = "hermite", + .weight = cubic, + .radius = 1.0, + .params = {0.0, 0.0}, +}; + +const struct pl_filter_function pl_filter_function_bicubic = { + .name = "bicubic", .weight = cubic, .radius = 2.0, .params = {1.0, 0.0}, .tunable = {true, true}, }; -static const struct pl_filter_function filter_function_bcspline = { - .name = "bcspline", // alias +const struct pl_filter_function pl_filter_function_bcspline = { + .name = "bcspline", .weight = cubic, .radius = 2.0, .params = {1.0, 0.0}, .tunable = {true, true}, }; -const struct pl_filter_function pl_filter_function_hermite = { - .name = "hermite", +const struct pl_filter_function pl_filter_function_catmull_rom = { + .name = "catmull_rom", .weight = cubic, - .radius = 1.0, - .params = {0.0, 0.0}, + .radius = 2.0, + .params = {0.0, 0.5}, + .tunable = {true, true}, +}; + +const struct pl_filter_function pl_filter_function_mitchell = { + .name = "mitchell", + .weight = cubic, + .radius = 2.0, + .params = {1/3.0, 1/3.0}, + .tunable = {true, true}, +}; + +const struct pl_filter_function pl_filter_function_robidoux = { + .name = "robidoux", + .weight = cubic, + .radius = 2.0, + .params = {12 / (19 + 9 * M_SQRT2), 113 / (58 + 216 * M_SQRT2)}, + .tunable = {true, true}, +}; + +const struct pl_filter_function pl_filter_function_robidouxsharp = { + .name = "robidouxsharp", + .weight = cubic, + .radius = 2.0, + .params = {6 / (13 + 7 * M_SQRT2), 7 / (2 + 12 * M_SQRT2)}, + .tunable = {true, true}, }; static double spline16(const struct pl_filter_ctx *f, double x) @@ -597,9 +629,13 @@ const struct pl_filter_function * const pl_filter_functions[] = { &pl_filter_function_jinc, &pl_filter_function_sphinx, &pl_filter_function_cubic, - &filter_function_bicubic, // alias - &filter_function_bcspline, // alias &pl_filter_function_hermite, + &pl_filter_function_bicubic, + &pl_filter_function_bcspline, + &pl_filter_function_catmull_rom, + &pl_filter_function_mitchell, + &pl_filter_function_robidoux, + &pl_filter_function_robidouxsharp, &pl_filter_function_spline16, &pl_filter_function_spline36, &pl_filter_function_spline64, @@ -969,9 +1005,13 @@ const struct pl_filter_function_preset pl_filter_function_presets[] = { {"jinc", &pl_filter_function_jinc}, {"sphinx", &pl_filter_function_sphinx}, {"cubic", &pl_filter_function_cubic}, - {"bicubic", &filter_function_bicubic}, // alias - {"bcspline", &filter_function_bcspline}, // alias {"hermite", &pl_filter_function_hermite}, + {"bicubic", &pl_filter_function_bicubic}, + {"bcspline", &pl_filter_function_bcspline}, + {"catmull_rom", &pl_filter_function_catmull_rom}, // alias + {"mitchell", &pl_filter_function_mitchell}, + {"robidoux", &pl_filter_function_robidoux}, + {"robidouxsharp", &pl_filter_function_robidouxsharp}, {"spline16", &pl_filter_function_spline16}, {"spline36", &pl_filter_function_spline36}, {"spline64", &pl_filter_function_spline64}, diff --git a/src/include/libplacebo/filters.h b/src/include/libplacebo/filters.h index 2bd2d7be..248f7bbb 100644 --- a/src/include/libplacebo/filters.h +++ b/src/include/libplacebo/filters.h @@ -137,8 +137,14 @@ PL_API extern const struct pl_filter_function pl_filter_function_sphinx; // B ≈ 0.26, C ≈ 0.37: RobidouxSharp filter (sharper variant of Robidoux) PL_API extern const struct pl_filter_function pl_filter_function_cubic; PL_API extern const struct pl_filter_function pl_filter_function_hermite; -#define pl_filter_function_bicubic pl_filter_function_cubic -#define pl_filter_function_bcspline pl_filter_function_cubic + +// Deprecated aliases of pl_filter_function_cubic (see the table above) +PL_DEPRECATED_IN(v6.341) PL_API extern const struct pl_filter_function pl_filter_function_bicubic; +PL_DEPRECATED_IN(v6.341) PL_API extern const struct pl_filter_function pl_filter_function_bcspline; +PL_DEPRECATED_IN(v6.341) PL_API extern const struct pl_filter_function pl_filter_function_catmull_rom; +PL_DEPRECATED_IN(v6.341) PL_API extern const struct pl_filter_function pl_filter_function_mitchell; +PL_DEPRECATED_IN(v6.341) PL_API extern const struct pl_filter_function pl_filter_function_robidoux; +PL_DEPRECATED_IN(v6.341) PL_API extern const struct pl_filter_function pl_filter_function_robidouxsharp; // Cubic splines with 2/3/4 taps. Referred to as "spline16", "spline36", and // "spline64" mainly for historical reasons, based on the number of pixels in