Skip to content

Commit

Permalink
filters: re-add accidentally removed filters
Browse files Browse the repository at this point in the history
These should have gone through a deprecation period, since they are
a public API.

Fixes: dcd5b75
Fixes: https://code.videolan.org/videolan/vlc/-/issues/28417
  • Loading branch information
haasn committed Nov 5, 2023
1 parent 2510304 commit 716811a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 14 deletions.
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
64 changes: 52 additions & 12 deletions src/filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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},
Expand Down
10 changes: 8 additions & 2 deletions src/include/libplacebo/filters.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 716811a

Please sign in to comment.