mirror of
https://github.com/mpv-player/mpv
synced 2025-03-20 10:17:31 +00:00
vo_opengl: generalize --scale-clamp etc.
This can help fight ringing without completely killing it, thus providing a middle-ground between ringing and aliasing.
This commit is contained in:
parent
e186567329
commit
18c74f7dfe
@ -56,6 +56,9 @@ Interface changes
|
||||
--demux-lavf-o=decryption_key=<hex> instead (whatever fits your situation).
|
||||
- rename --opengl-dumb-mode=no to --opengl-dumb-mode=auto, and make `no`
|
||||
always disable it (unless forced on by hardware limitation).
|
||||
- generalize --scale-clamp, --cscale-clamp etc. to accept a float between
|
||||
0.0 and 1.0 instead of just being a flag. A value of 1.0 corresponds to
|
||||
the old `yes`, and a value of 0.0 corresponds to the old `no`.
|
||||
--- mpv 0.25.0 ---
|
||||
- remove opengl-cb dxva2 dummy hwdec interop
|
||||
(see git "vo_opengl: remove dxva2 dummy hwdec backend")
|
||||
|
@ -4012,12 +4012,16 @@ The following video options are currently all specific to ``--vo=opengl`` and
|
||||
this too low (eg. 0.5) leads to bad results. It's generally recommended to
|
||||
stick to values between 0.8 and 1.2.
|
||||
|
||||
``--scale-clamp``, ``--cscale-clamp``, ``--dscale-clamp``, ``--tscale-clamp``
|
||||
Clamp the filter kernel's value range to [0-1]. This is especially useful
|
||||
for ``--tscale``, where it reduces excessive ringing artifacts in the
|
||||
temporal domain (which typically manifest themselves as short flashes or
|
||||
fringes of black, mostly around moving edges) in exchange for potentially
|
||||
adding more blur.
|
||||
``--scale-clamp=<0.0-1.0>``, ``--cscale-clamp``, ``--dscale-clamp``, ``--tscale-clamp``
|
||||
Specifies a weight bias to multiply into negative coefficients. Specifying
|
||||
``--scale-clamp=1`` has the effect of removing negative weights completely,
|
||||
thus effectively clamping the value range to [0-1]. Values between 0.0 and
|
||||
1.0 can be specified to apply only a moderate diminishment of negative
|
||||
weights. This is especially useful for ``--tscale``, where it reduces
|
||||
excessive ringing artifacts in the temporal domain (which typically
|
||||
manifest themselves as short flashes or fringes of black, mostly around
|
||||
moving edges) in exchange for potentially adding more blur. The default for
|
||||
``--tscale-clamp`` is 1.0, the others default to 0.0.
|
||||
|
||||
``--scale-cutoff=<value>``, ``--cscale-cutoff=<value>``, ``--dscale-cutoff=<value>``
|
||||
Cut off the filter kernel prematurely once the value range drops below
|
||||
|
@ -117,8 +117,8 @@ static double sample_filter(struct filter_kernel *filter, double x)
|
||||
{
|
||||
// The window is always stretched to the entire kernel
|
||||
double w = sample_window(&filter->w, x / filter->f.radius * filter->w.radius);
|
||||
double k = sample_window(&filter->f, x);
|
||||
return filter->clamp ? fmax(0.0, fmin(1.0, w * k)) : w * k;
|
||||
double k = w * sample_window(&filter->f, x);
|
||||
return k < 0 ? (1 - filter->clamp) * k : k;
|
||||
}
|
||||
|
||||
// Calculate the 1D filtering kernel for N sample points.
|
||||
|
@ -28,7 +28,7 @@ struct filter_window {
|
||||
struct filter_kernel {
|
||||
struct filter_window f; // the kernel itself
|
||||
struct filter_window w; // window storage
|
||||
bool clamp; // clamp to the range [0-1]
|
||||
double clamp; // clamping factor, affects negative weights
|
||||
double value_cutoff; // discard all contributions below this value (polar)
|
||||
// Constant values
|
||||
const char *window; // default window
|
||||
|
@ -333,7 +333,7 @@ static int validate_window_opt(struct mp_log *log, const m_option_t *opt,
|
||||
OPT_FLOAT(n"-wparam", scaler[i].window.params[0], 0), \
|
||||
OPT_FLOAT(n"-wblur", scaler[i].window.blur, 0), \
|
||||
OPT_FLOATRANGE(n"-wtaper", scaler[i].window.taper, 0, 0.0, 1.0), \
|
||||
OPT_FLAG(n"-clamp", scaler[i].clamp, 0), \
|
||||
OPT_FLOATRANGE(n"-clamp", scaler[i].clamp, 0, 0.0, 1.0), \
|
||||
OPT_FLOATRANGE(n"-radius", scaler[i].radius, 0, 0.5, 16.0), \
|
||||
OPT_FLOATRANGE(n"-antiring", scaler[i].antiring, 0, 0.0, 1.0), \
|
||||
OPT_STRING_VALIDATE(n"-window", scaler[i].window.name, 0, validate_window_opt)
|
||||
|
@ -44,7 +44,7 @@ struct scaler_config {
|
||||
float radius;
|
||||
float antiring;
|
||||
float cutoff;
|
||||
int clamp;
|
||||
float clamp;
|
||||
};
|
||||
|
||||
struct scaler {
|
||||
|
Loading…
Reference in New Issue
Block a user