1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-04 23:40:47 +00:00

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.
This commit is contained in:
Niklas Haas 2015-02-20 07:31:22 +01:00 committed by wm4
parent 4356e893a1
commit 885c2fff70
2 changed files with 12 additions and 1 deletions
DOCS/man
video/out

View File

@ -337,7 +337,7 @@ Available video output drivers are:
Set radius for filters listed below, must be a float number between 1.0 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. 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 Note that depending on filter implementation details and video scaling
ratio, the radius that actually being used might be different ratio, the radius that actually being used might be different

View File

@ -294,6 +294,16 @@ static double lanczos(kernel *k, double x)
return radius * sin(pix) * sin(pix / radius) / (pix * pix); 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) static double ewa_lanczos(kernel *k, double x)
{ {
double radius = k->radius; double radius = k->radius;
@ -365,6 +375,7 @@ const struct filter_kernel mp_filter_kernels[] = {
{"gaussian", -1, gaussian, .params = {28.85390081777927, NAN} }, {"gaussian", -1, gaussian, .params = {28.85390081777927, NAN} },
{"sinc", -1, sinc}, {"sinc", -1, sinc},
{"ewa_lanczos", -1, ewa_lanczos, .polar = true}, {"ewa_lanczos", -1, ewa_lanczos, .polar = true},
{"ginseng", -1, ginseng, .polar = true},
{"lanczos", -1, lanczos}, {"lanczos", -1, lanczos},
{"blackman", -1, blackman}, {"blackman", -1, blackman},
{0} {0}