summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2015-02-20 07:31:22 +0100
committerwm4 <wm4@nowhere>2015-02-20 16:21:46 +0100
commit885c2fff7091e9ea71cad8da56904ead73ca0853 (patch)
treefb49e2646f4af8dc4aadc3671d885923bff099a2
parent4356e893a138e24f2d54dee2b96d2720e69d4c18 (diff)
downloadmpv-885c2fff7091e9ea71cad8da56904ead73ca0853.tar.bz2
mpv-885c2fff7091e9ea71cad8da56904ead73ca0853.tar.xz
vo_opengl: add ginseng upscaler
This is a variation of ewa_lanczos that is sinc-windowed instead of jinc-windowed. Results are pretty similar, but the logic is simpler. This could potentially replace the ugly ewa_lanczos code. It's hard to tell, but from comparing stills I think this one has slightly less ringing than regular ewa_lanczos.
-rw-r--r--DOCS/man/vo.rst2
-rw-r--r--video/out/filter_kernels.c11
2 files changed, 12 insertions, 1 deletions
diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst
index 2ccefea891..10019451e0 100644
--- a/DOCS/man/vo.rst
+++ b/DOCS/man/vo.rst
@@ -337,7 +337,7 @@ Available video output drivers are:
Set radius for filters listed below, must be a float number between 1.0
and 16.0. Defaults to be 3.0 if not specified.
- ``sinc``, ``lanczos``, ``ewa_lanczos``, ``blackman``, ``gaussian``
+ ``sinc``, ``lanczos``, ``ewa_lanczos``, ``ginseng``, ``blackman``, ``gaussian``
Note that depending on filter implementation details and video scaling
ratio, the radius that actually being used might be different
diff --git a/video/out/filter_kernels.c b/video/out/filter_kernels.c
index 77dbea57c0..b8a2e0d965 100644
--- a/video/out/filter_kernels.c
+++ b/video/out/filter_kernels.c
@@ -294,6 +294,16 @@ static double lanczos(kernel *k, double x)
return radius * sin(pix) * sin(pix / radius) / (pix * pix);
}
+static double ginseng(kernel *k, double x)
+{
+ double radius = k->radius;
+ if (fabs(x) < 1e-8)
+ return 1.0;
+ if (fabs(x) >= radius)
+ return 0.0;
+ return jinc(k, x) * sinc(k, x / radius);
+}
+
static double ewa_lanczos(kernel *k, double x)
{
double radius = k->radius;
@@ -365,6 +375,7 @@ const struct filter_kernel mp_filter_kernels[] = {
{"gaussian", -1, gaussian, .params = {28.85390081777927, NAN} },
{"sinc", -1, sinc},
{"ewa_lanczos", -1, ewa_lanczos, .polar = true},
+ {"ginseng", -1, ginseng, .polar = true},
{"lanczos", -1, lanczos},
{"blackman", -1, blackman},
{0}