mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-28 14:29:25 +08:00
vo_opengl: add parameter to gaussian filter
Add a new parameter 'p' to gaussian filter. The new formula used a different base taken from fmtconv plugin, so that the new parameter is exactly same as the one used in Avisynth and Vapoursynth. The new default value is 2 / log(2) * 10, with the default value it conforms to the original kernel taken from vector-agg.
This commit is contained in:
+9
-1
@@ -319,6 +319,14 @@ Available video output drivers are:
|
||||
Mitchell-Netravali. The ``b`` and ``c`` parameters can be set with
|
||||
``lparam1`` and ``lparam2``. Both are set to 1/3 by default.
|
||||
|
||||
``gaussian``
|
||||
Gaussian filter with a parameter ``p`` for sharpness control.
|
||||
``p`` can be set to float number between 1(blurry) and 100(sharp)
|
||||
and has a default value of about 28.8 (see ``lparam1``).
|
||||
|
||||
Note that for extremely small value of ``p``, a large filter radius
|
||||
might be required to avoid unintended artifacts (see ``lradius``).
|
||||
|
||||
|
||||
There are some more filters. For a complete list, pass ``help`` as
|
||||
value, e.g.::
|
||||
@@ -336,7 +344,7 @@ Available video output drivers are:
|
||||
Set radius for filters listed below, must be a float number between 1.0
|
||||
and 8.0. Defaults to be 2.0 if not specified.
|
||||
|
||||
``sinc``, ``lanczos``, ``blackman``
|
||||
``sinc``, ``lanczos``, ``blackman``, ``gaussian``
|
||||
|
||||
Note that depending on filter implementation details and video scaling
|
||||
ratio, the radius that actually being used might be different
|
||||
|
||||
@@ -244,7 +244,12 @@ static double spline64(kernel *k, double x)
|
||||
|
||||
static double gaussian(kernel *k, double x)
|
||||
{
|
||||
return exp(-2.0 * x * x) * sqrt(2.0 / M_PI);
|
||||
double p = k->params[0];
|
||||
if (p > 100.0)
|
||||
p = 100.0;
|
||||
if (p < 1.0)
|
||||
p = 1.0;
|
||||
return pow(2.0, -(p / 10.0) * x * x);
|
||||
}
|
||||
|
||||
static double sinc(kernel *k, double x)
|
||||
@@ -292,7 +297,7 @@ const struct filter_kernel mp_filter_kernels[] = {
|
||||
{"spline16", 2, spline16},
|
||||
{"spline36", 3, spline36},
|
||||
{"spline64", 4, spline64},
|
||||
{"gaussian", 2, gaussian},
|
||||
{"gaussian", -1, gaussian, .params = {28.85390081777927, NAN} },
|
||||
{"sinc2", 2, sinc},
|
||||
{"sinc3", 3, sinc},
|
||||
{"sinc4", 4, sinc},
|
||||
|
||||
Reference in New Issue
Block a user