0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

vo: make cscale follow scale by default

This commit is contained in:
Kacper Michajłow 2023-09-17 01:47:43 +02:00 committed by Niklas Haas
parent 8121d41245
commit 4bedcd36f6
4 changed files with 22 additions and 3 deletions

View File

@ -64,6 +64,7 @@ Interface changes
- rename `--cache-dir` and `--cache-unlink-files` to `--demuxer-cache-dir` and
`--demuxer-cache-unlink-files`
- enable `--correct-downscaling`, `--linear-downscaling`, `--sigmoid-upscaling`
- `--cscale` defaults to `--scale` if not defined
--- mpv 0.36.0 ---
- add `--target-contrast`
- Target luminance value is now also applied when ICC profile is used.

View File

@ -5314,7 +5314,8 @@ them.
``--cscale=<filter>``
As ``--scale``, but for interpolating chroma information. If the image is
not subsampled, this option is ignored entirely.
not subsampled, this option is ignored entirely. If this option is unset,
the filter implied by ``--scale`` will be applied.
``--dscale=<filter>``
Like ``--scale``, but apply these filters on downscaling instead. If this

View File

@ -307,7 +307,7 @@ static const struct gl_video_opts gl_video_opts_def = {
.cutoff = 0.001}, // scale
{{NULL, .params={NAN, NAN}}, {.params = {NAN, NAN}},
.cutoff = 0.001}, // dscale
{{"bilinear", .params={NAN, NAN}}, {.params = {NAN, NAN}},
{{NULL, .params={NAN, NAN}}, {.params = {NAN, NAN}},
.cutoff = 0.001}, // cscale
{{"mitchell", .params={NAN, NAN}}, {.params = {NAN, NAN}},
.clamp = 1, }, // tscale
@ -1733,6 +1733,12 @@ static void reinit_scaler(struct gl_video *p, struct scaler *scaler,
conf = &p->opts.scaler[SCALER_SCALE];
}
if (conf && scaler->index == SCALER_CSCALE && (!conf->kernel.name ||
!conf->kernel.name[0]))
{
conf = &p->opts.scaler[SCALER_SCALE];
}
struct filter_kernel bare_window;
const struct filter_kernel *t_kernel = mp_find_filter_kernel(conf->kernel.name);
const struct filter_window *t_window = mp_find_filter_window(conf->window.name);
@ -2302,6 +2308,13 @@ static void pass_read_video(struct gl_video *p)
continue;
const struct scaler_config *conf = &p->opts.scaler[scaler_id];
if (scaler_id == SCALER_CSCALE && (!conf->kernel.name ||
!conf->kernel.name[0]))
{
conf = &p->opts.scaler[SCALER_SCALE];
}
struct scaler *scaler = &p->scaler[scaler_id];
// bilinear scaling is a free no-op thanks to GPU sampling
@ -4180,6 +4193,8 @@ static int validate_scaler_opt(struct mp_log *log, const m_option_t *opt,
r = M_OPT_EXIT;
} else if (bstr_equals0(name, "dscale") && !param.len) {
return r; // empty dscale means "use same as upscaler"
} else if (bstr_equals0(name, "cscale") && !param.len) {
return r; // empty cscale means "use same as upscaler"
} else {
snprintf(s, sizeof(s), "%.*s", BSTR_P(param));
if (!handle_scaler_opt(s, tscale))

View File

@ -1740,7 +1740,9 @@ static const struct pl_filter_config *map_scaler(struct priv *p,
const struct gl_video_opts *opts = p->opts_cache->opts;
const struct scaler_config *cfg = &opts->scaler[unit];
if (unit == SCALER_DSCALE && (!cfg->kernel.name || !strcmp(cfg->kernel.name, "")))
if (unit == SCALER_DSCALE && (!cfg->kernel.name || !cfg->kernel.name[0]))
cfg = &opts->scaler[SCALER_SCALE];
if (unit == SCALER_CSCALE && (!cfg->kernel.name || !cfg->kernel.name[0]))
cfg = &opts->scaler[SCALER_SCALE];
for (int i = 0; fixed_presets[i].name; i++) {