mirror of https://github.com/mpv-player/mpv
vo_gpu: split --linear-scaling into two separate options
Since linear downscaling makes sense to handle independently from linear/sigmoid upscaling, we split this option up. Now, linear-downscaling is its own option that only controls linearization when downscaling and nothing more. Likewise, linear-upscaling / sigmoid-upscaling are two mutually exclusive options (the latter overriding the former) that apply only to upscaling and no longer implicitly enable linear light downscaling as well. The old behavior was very confusing, as evidenced by issues such as #6213. The current behavior should make much more sense, and only minimally breaks backwards compatibility (since using linear-scaling directly was very uncommon - most users got this for free as part of gpu-hq and relied only on that). Closes #6213.
This commit is contained in:
parent
448cbd472e
commit
7ad60a7c5e
|
@ -28,6 +28,10 @@ Interface changes
|
|||
- add --opensles-buffer-size-in-ms, allowing user to tune the soft buffer size.
|
||||
It overrides the --audio-buffer option unless it's set to 0 (with the default
|
||||
being 250).
|
||||
- remove `--linear-scaling`, replaced by `--linear-upscaling` and
|
||||
`--linear-downscaling`. This means that `--sigmoid-upscaling` no longer
|
||||
implies linear light downscaling as well, which was confusing.
|
||||
- the built-in `gpu-hq` profile now includes` --linear-downscaling`.
|
||||
--- mpv 0.29.0 ---
|
||||
- drop --opensles-sample-rate, as --audio-samplerate should be used if desired
|
||||
- drop deprecated --videotoolbox-format, --ff-aid, --ff-vid, --ff-sid,
|
||||
|
|
|
@ -4314,11 +4314,6 @@ The following video options are currently all specific to ``--vo=gpu`` and
|
|||
will reproduce the source image perfectly if no scaling is performed.
|
||||
Enabled by default. Note that this option never affects ``--cscale``.
|
||||
|
||||
``--linear-scaling``
|
||||
Scale in linear light. It should only be used with a
|
||||
``--fbo-format`` that has at least 16 bit precision. This option
|
||||
has no effect on HDR content.
|
||||
|
||||
``--correct-downscaling``
|
||||
When using convolution based filters, extend the filter size when
|
||||
downscaling. Increases quality, but reduces performance while downscaling.
|
||||
|
@ -4327,6 +4322,32 @@ The following video options are currently all specific to ``--vo=gpu`` and
|
|||
better than without it) since it will extend the size to match only the
|
||||
milder of the scale factors between the axes.
|
||||
|
||||
``--linear-downscaling``
|
||||
Scale in linear light when downscaling. It should only be used with a
|
||||
``--fbo-format`` that has at least 16 bit precision. This option
|
||||
has no effect on HDR content.
|
||||
|
||||
``--linear-upscaling``
|
||||
Scale in linear light when upscaling. Like ``--linear-downscaling``, it
|
||||
should only be used with a ``--fbo-format`` that has at least 16 bits
|
||||
precisions. This is not usually recommended except for testing/specific
|
||||
purposes. Users are advised to either enable ``--sigmoid-upscaling`` or
|
||||
keep both options disabled (i.e. scaling in gamma light).
|
||||
|
||||
``--sigmoid-upscaling``
|
||||
When upscaling, use a sigmoidal color transform to avoid emphasizing
|
||||
ringing artifacts. This is incompatible with and replaces
|
||||
``--linear-upscaling``. (Note that sigmoidization also requires
|
||||
linearization, so the ``LINEAR`` rendering step fires in both cases)
|
||||
|
||||
``--sigmoid-center``
|
||||
The center of the sigmoid curve used for ``--sigmoid-upscaling``, must be a
|
||||
float between 0.0 and 1.0. Defaults to 0.75 if not specified.
|
||||
|
||||
``--sigmoid-slope``
|
||||
The slope of the sigmoid curve used for ``--sigmoid-upscaling``, must be a
|
||||
float between 1.0 and 20.0. Defaults to 6.5 if not specified.
|
||||
|
||||
``--interpolation``
|
||||
Reduce stuttering caused by mismatches in the video fps and display refresh
|
||||
rate (also known as judder).
|
||||
|
@ -4715,7 +4736,8 @@ The following video options are currently all specific to ``--vo=gpu`` and
|
|||
|
||||
LINEAR (fixed)
|
||||
Linear light image, before scaling. This only fires when
|
||||
``--linear-scaling`` is in effect.
|
||||
``--linear-upscaling``, ``--linear-downscaling`` or
|
||||
``--sigmoid-upscaling`` is in effect.
|
||||
|
||||
SIGMOID (fixed)
|
||||
Sigmoidized light, before scaling. This only fires when
|
||||
|
@ -4772,18 +4794,6 @@ The following video options are currently all specific to ``--vo=gpu`` and
|
|||
remaining quantization artifacts. Higher numbers add more noise. (Default
|
||||
48)
|
||||
|
||||
``--sigmoid-upscaling``
|
||||
When upscaling, use a sigmoidal color transform to avoid emphasizing
|
||||
ringing artifacts. This also implies ``--linear-scaling``.
|
||||
|
||||
``--sigmoid-center``
|
||||
The center of the sigmoid curve used for ``--sigmoid-upscaling``, must be a
|
||||
float between 0.0 and 1.0. Defaults to 0.75 if not specified.
|
||||
|
||||
``--sigmoid-slope``
|
||||
The slope of the sigmoid curve used for ``--sigmoid-upscaling``, must be a
|
||||
float between 1.0 and 20.0. Defaults to 6.5 if not specified.
|
||||
|
||||
``--sharpen=<value>``
|
||||
If set to a value other than 0, enable an unsharp masking filter. Positive
|
||||
values will sharpen the image (but add more ringing and aliasing). Negative
|
||||
|
|
|
@ -40,6 +40,7 @@ cscale=spline36
|
|||
dscale=mitchell
|
||||
dither-depth=auto
|
||||
correct-downscaling=yes
|
||||
linear-downscaling=yes
|
||||
sigmoid-upscaling=yes
|
||||
deband=yes
|
||||
|
||||
|
|
|
@ -373,8 +373,9 @@ const struct m_sub_options gl_video_conf = {
|
|||
SCALER_OPTS("tscale", SCALER_TSCALE),
|
||||
OPT_INTRANGE("scaler-lut-size", scaler_lut_size, 0, 4, 10),
|
||||
OPT_FLAG("scaler-resizes-only", scaler_resizes_only, 0),
|
||||
OPT_FLAG("linear-scaling", linear_scaling, 0),
|
||||
OPT_FLAG("correct-downscaling", correct_downscaling, 0),
|
||||
OPT_FLAG("linear-downscaling", linear_downscaling, 0),
|
||||
OPT_FLAG("linear-upscaling", linear_upscaling, 0),
|
||||
OPT_FLAG("sigmoid-upscaling", sigmoid_upscaling, 0),
|
||||
OPT_FLOATRANGE("sigmoid-center", sigmoid_center, 0, 0.0, 1.0),
|
||||
OPT_FLOATRANGE("sigmoid-slope", sigmoid_slope, 0, 1.0, 20.0),
|
||||
|
@ -423,6 +424,8 @@ const struct m_sub_options gl_video_conf = {
|
|||
OPT_REPLACED("opengl-fbo-format", "fbo-format"),
|
||||
OPT_REPLACED("opengl-dumb-mode", "gpu-dumb-mode"),
|
||||
OPT_REPLACED("opengl-gamma", "gamma-factor"),
|
||||
OPT_REMOVED("linear-scaling", "Split into --linear-upscaling and "
|
||||
"--linear-downscaling"),
|
||||
{0}
|
||||
},
|
||||
.size = sizeof(struct gl_video_opts),
|
||||
|
@ -2332,13 +2335,18 @@ static void pass_scale_main(struct gl_video *p)
|
|||
|
||||
// Pre-conversion, like linear light/sigmoidization
|
||||
GLSLF("// scaler pre-conversion\n");
|
||||
bool use_linear = p->opts.linear_scaling || p->opts.sigmoid_upscaling;
|
||||
bool use_linear = false;
|
||||
if (downscaling) {
|
||||
use_linear = p->opts.linear_downscaling;
|
||||
|
||||
// Linear light downscaling results in nasty artifacts for HDR curves due
|
||||
// to the potentially extreme brightness differences severely compounding
|
||||
// any ringing. So just scale in gamma light instead.
|
||||
if (mp_trc_is_hdr(p->image_params.color.gamma) && downscaling)
|
||||
use_linear = false;
|
||||
// Linear light downscaling results in nasty artifacts for HDR curves
|
||||
// due to the potentially extreme brightness differences severely
|
||||
// compounding any ringing. So just scale in gamma light instead.
|
||||
if (mp_trc_is_hdr(p->image_params.color.gamma))
|
||||
use_linear = false;
|
||||
} else if (upscaling) {
|
||||
use_linear = p->opts.linear_upscaling || p->opts.sigmoid_upscaling;
|
||||
}
|
||||
|
||||
if (use_linear) {
|
||||
p->use_linear = true;
|
||||
|
@ -3494,9 +3502,9 @@ static bool check_dumb_mode(struct gl_video *p)
|
|||
return false;
|
||||
|
||||
// otherwise, use auto-detection
|
||||
if (o->target_prim || o->target_trc || o->linear_scaling ||
|
||||
o->correct_downscaling || o->sigmoid_upscaling || o->interpolation ||
|
||||
o->blend_subs || o->deband || o->unsharp)
|
||||
if (o->target_prim || o->target_trc || o->correct_downscaling ||
|
||||
o->linear_downscaling || o->linear_upscaling || o->sigmoid_upscaling ||
|
||||
o->interpolation || o->blend_subs || o->deband || o->unsharp)
|
||||
return false;
|
||||
// check remaining scalers (tscale is already implicitly excluded above)
|
||||
for (int i = 0; i < SCALER_COUNT; i++) {
|
||||
|
@ -3652,8 +3660,11 @@ static void check_gl_features(struct gl_video *p)
|
|||
p->opts.target_trc != MP_CSP_TRC_AUTO || p->use_lut_3d;
|
||||
|
||||
// mix() is needed for some gamma functions
|
||||
if (!have_mglsl && (p->opts.linear_scaling || p->opts.sigmoid_upscaling)) {
|
||||
p->opts.linear_scaling = false;
|
||||
if (!have_mglsl && (p->opts.linear_downscaling ||
|
||||
p->opts.linear_upscaling || p->opts.sigmoid_upscaling))
|
||||
{
|
||||
p->opts.linear_downscaling = false;
|
||||
p->opts.linear_upscaling = false;
|
||||
p->opts.sigmoid_upscaling = false;
|
||||
MP_WARN(p, "Disabling linear/sigmoid scaling (GLSL version too old).\n");
|
||||
}
|
||||
|
|
|
@ -112,8 +112,9 @@ struct gl_video_opts {
|
|||
float tone_mapping_param;
|
||||
float tone_mapping_desat;
|
||||
int gamut_warning;
|
||||
int linear_scaling;
|
||||
int correct_downscaling;
|
||||
int linear_downscaling;
|
||||
int linear_upscaling;
|
||||
int sigmoid_upscaling;
|
||||
float sigmoid_center;
|
||||
float sigmoid_slope;
|
||||
|
|
Loading…
Reference in New Issue