summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Jin <bjin1990@gmail.com>2014-08-25 22:15:42 +0200
committerwm4 <wm4@nowhere>2014-08-26 22:18:55 +0200
commita8b67c66f24700205923959b005b2547490e6c8e (patch)
treed3891741ac535a9ff02e21af21d34adbacbbaa47
parent3ec6705e3410e96d74b108cb444b826749d8217c (diff)
downloadmpv-a8b67c66f24700205923959b005b2547490e6c8e.tar.bz2
mpv-a8b67c66f24700205923959b005b2547490e6c8e.tar.xz
vo_opengl: add spline64 filter kernel
The coefficients are taken from fmtconv plugin for vapoursynth: https://github.com/vapoursynth/fmtconv/blob/master/src/fmtc/ContFirSpline64.cpp The package is licensed under WTFPL, and it's from the same author of Dither plugin for avisynth.
-rw-r--r--video/out/filter_kernels.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/video/out/filter_kernels.c b/video/out/filter_kernels.c
index ed181ef38a..c8efbe5731 100644
--- a/video/out/filter_kernels.c
+++ b/video/out/filter_kernels.c
@@ -9,6 +9,10 @@
* Also see glumpy (BSD licensed), contains the same code in Python:
* http://code.google.com/p/glumpy/source/browse/glumpy/image/filter.py
*
+ * Also see Vapoursynth plugin fmtconv (WTFPL Licensed), which is based on
+ * dither plugin for avisynth from the same author:
+ * https://github.com/vapoursynth/fmtconv/tree/master/src/fmtc
+ *
* Also see: Paul Heckbert's "zoom"
*
* Also see XBMC: ConvolutionKernels.cpp etc.
@@ -222,6 +226,20 @@ static double spline36(kernel *k, double x)
* (x - 2);
}
+static double spline64(kernel *k, double x)
+{
+ if (x < 1.0)
+ return ((49.0 / 41.0 * x - 6387.0 / 2911.0) * x - 3.0 / 2911.0) * x + 1.0;
+ if (x < 2.0)
+ return ((-24.0 / 41.0 * (x - 1) + 4032.0 / 2911.0) * (x - 1) - 2328.0 / 2911.0)
+ * (x - 1);
+ if (x < 3.0)
+ return ((6.0 / 41.0 * (x - 2) - 1008.0 / 2911.0) * (x - 2) + 582.0 / 2911.0)
+ * (x - 2);
+ return ((-1.0 / 41.0 * (x - 3) + 168.0 / 2911.0) * (x - 3) - 97.0 / 2911.0)
+ * (x - 3);
+}
+
static double gaussian(kernel *k, double x)
{
return exp(-2.0 * x * x) * sqrt(2.0 / M_PI);
@@ -271,6 +289,7 @@ const struct filter_kernel mp_filter_kernels[] = {
{"mitchell", 2, mitchell, .params = {1.0/3.0, 1.0/3.0} },
{"spline16", 2, spline16},
{"spline36", 3, spline36},
+ {"spline64", 4, spline64},
{"gaussian", 2, gaussian},
{"sinc2", 2, sinc},
{"sinc3", 3, sinc},