summaryrefslogtreecommitdiffstats
path: root/video/sws_utils.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-31 16:45:28 +0100
committerwm4 <wm4@nowhere>2019-10-31 16:51:12 +0100
commita7230dfed0bf563fd9f4673c3020d1cf8461febf (patch)
treed34d333e6f627842aa55e4737a441710d700820d /video/sws_utils.c
parent2c43d2b75a88b8e0e8f0a715f993ffc1c8977d13 (diff)
downloadmpv-a7230dfed0bf563fd9f4673c3020d1cf8461febf.tar.bz2
mpv-a7230dfed0bf563fd9f4673c3020d1cf8461febf.tar.xz
sws_utils, zimg: destroy vo_x11 and vo_drm performance
Raise swscale and zimg default parameters. This restores screenshot quality settings (maybe) unset in the commit before. Also expose some more libswscale and zimg options. Since these options are also used for VOs like x11 and drm, this will make x11/drm/etc. much slower. For compensation, provide a profile that sets the old option values: sw-fast. I'm also enabling zimg here, just as an experiment. The core problem is that we have a single set of command line options which control the settings used for most swscale/zimg uses. This was done in the previous commit. It cannot differentiate between the VOs, which need to be realtime and may accept/require lower quality options, and things like screenshots or vo_image, which can be slower, but should not sacrifice quality by default. Should this have two sets of options or something similar to do the right thing depending on the code which calls libswscale? Maybe. Or should I just ignore the problem, make it someone else's problem (users who want to use software conversion VOs), provide a sub-optimal solution, and call it a day? Definitely, sounds good, pushing to master, goodbye.
Diffstat (limited to 'video/sws_utils.c')
-rw-r--r--video/sws_utils.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/video/sws_utils.c b/video/sws_utils.c
index a41d4c6e76..47af77ca50 100644
--- a/video/sws_utils.c
+++ b/video/sws_utils.c
@@ -49,6 +49,8 @@ struct sws_opts {
int chr_hshift;
float chr_sharpen;
float lum_sharpen;
+ int fast;
+ int bitexact;
int zimg;
};
@@ -73,19 +75,20 @@ const struct m_sub_options sws_conf = {
OPT_INT("chs", chr_hshift, 0),
OPT_FLOATRANGE("ls", lum_sharpen, 0, -100.0, 100.0),
OPT_FLOATRANGE("cs", chr_sharpen, 0, -100.0, 100.0),
+ OPT_FLAG("fast", fast, 0),
+ OPT_FLAG("bitexact", bitexact, 0),
OPT_FLAG("allow-zimg", zimg, 0),
{0}
},
.size = sizeof(struct sws_opts),
.defaults = &(const struct sws_opts){
- .scaler = SWS_BICUBIC,
+ .scaler = SWS_LANCZOS,
},
};
// Highest quality, but also slowest.
-const int mp_sws_hq_flags = SWS_LANCZOS | SWS_FULL_CHR_H_INT |
- SWS_FULL_CHR_H_INP | SWS_ACCURATE_RND |
- SWS_BITEXACT;
+static const int mp_sws_hq_flags = SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP |
+ SWS_ACCURATE_RND;
// Fast, lossy.
const int mp_sws_fast_flags = SWS_BILINEAR;
@@ -104,6 +107,10 @@ static void mp_sws_update_from_cmdline(struct mp_sws_context *ctx)
ctx->flags = SWS_PRINT_INFO;
ctx->flags |= opts->scaler;
+ if (!opts->fast)
+ ctx->flags |= mp_sws_hq_flags;
+ if (opts->bitexact)
+ ctx->flags |= SWS_BITEXACT;
ctx->allow_zimg = opts->zimg;
}
@@ -357,7 +364,7 @@ int mp_image_sw_blur_scale(struct mp_image *dst, struct mp_image *src,
float gblur)
{
struct mp_sws_context *ctx = mp_sws_alloc(NULL);
- ctx->flags = mp_sws_hq_flags;
+ ctx->flags = SWS_LANCZOS | mp_sws_hq_flags;
ctx->src_filter = sws_getDefaultFilter(gblur, gblur, 0, 0, 0, 0, 0);
ctx->force_reload = true;
int res = mp_sws_scale(ctx, dst, src);