aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/out/filter_kernels.h
diff options
context:
space:
mode:
authorGravatar Niklas Haas <git@nand.wakku.to>2015-03-25 04:40:28 +0100
committerGravatar Niklas Haas <git@nand.wakku.to>2015-04-04 15:36:13 +0200
commit586dc5574f519a336fda0e8c1d3c94e0c1df38b2 (patch)
tree8127e7cd89ebd4bb522c05333ae6bb4421913a8d /video/out/filter_kernels.h
parent00151e987d2a290eee27a107faa9a7050fc656c0 (diff)
vo_opengl: separate kernel and window
This makes the core much more elegant, reusable, reconfigurable and also allows us to more easily add aliases for specific configurations. Furthermore, this lets us apply a generic blur factor / window function to arbitrary filters, so we can finally "mix and match" in order to fine-tune windowing functions. A few notes are in order: 1. The current system for configuring scalers is ugly and rapidly getting unwieldy. I modified the man page to make it a bit more bearable, but long-term we have to do something about it; especially since.. 2. There's currently no way to affect the blur factor or parameters of the window functions themselves. For example, I can't actually fine-tune the kaiser window's param1, since there's simply no way to do so in the current API - even though filter_kernels.c supports it just fine! 3. This removes some lesser used filters (especially those which are purely window functions to begin with). If anybody asks, you can get eg. the old behavior of scale=hanning by using scale=box:scale-window=hanning:scale-radius=1 (and yes, the result is just as terrible as that sounds - which is why nobody should have been using them in the first place). 4. This changes the semantics of the "triangle" scaler slightly - it now has an arbitrary radius. This can possibly produce weird results for people who were previously using scale-down=triangle, especially if in combination with scale-radius (for the usual upscaling). The correct fix for this is to use scale-down=bilinear_slow instead, which is an alias for triangle at radius 1. In regards to the last point, in future I want to make it so that filters have a filter-specific "preferred radius" (for the ones that are arbitrarily tunable), once the configuration system for filters has been redesigned (in particular in a way that will let us separate scale and scale-down cleanly). That way, "triangle" can simply have the preferred radius of 1 by default, while still being tunable. (Rather than the default radius being hard-coded to 3 always)
Diffstat (limited to 'video/out/filter_kernels.h')
-rw-r--r--video/out/filter_kernels.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/video/out/filter_kernels.h b/video/out/filter_kernels.h
index b2e07863fd..99776d2f07 100644
--- a/video/out/filter_kernels.h
+++ b/video/out/filter_kernels.h
@@ -21,26 +21,34 @@
#include <stdbool.h>
-struct filter_kernel {
+struct filter_window {
const char *name;
- double radius; // A negative value will use user specified radius instead.
- double (*weight)(struct filter_kernel *kernel, double x);
+ double radius; // A negative value will use user specified radius instead.
+ double (*weight)(struct filter_window *k, double x);
+ double params[2]; // User-defined custom filter parameters. Not used by
+ // all filters
+ double blur; // Blur coefficient (sharpens or widens the filter)
+};
- // The filter params can be changed at runtime. Only used by some filters.
- float params[2];
- // Whether or not the filter uses polar coordinates
- bool polar;
+struct filter_kernel {
+ struct filter_window f; // the kernel itself
+ struct filter_window w; // window storage
+ // Constant values
+ const char *window; // default window
+ bool polar; // whether or not the filter uses polar coordinates
// The following values are set by mp_init_filter() at runtime.
int size; // number of coefficients (may depend on radius)
double inv_scale; // scale factor (<1.0 is upscale, >1.0 downscale)
};
+extern const struct filter_window mp_filter_windows[];
extern const struct filter_kernel mp_filter_kernels[];
+const struct filter_window *mp_find_filter_window(const char *name);
const struct filter_kernel *mp_find_filter_kernel(const char *name);
+
bool mp_init_filter(struct filter_kernel *filter, const int *sizes,
double scale);
-void mp_compute_weights(struct filter_kernel *filter, double f, float *out_w);
void mp_compute_lut(struct filter_kernel *filter, int count, float *out_array);
#endif /* MPLAYER_FILTER_KERNELS_H */