From d484cb3f3245573ec024d6a50099d9a5a5e4400d Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 14 Nov 2014 15:22:37 +0100 Subject: vo_opengl: allow setting different filters for downscaling --- DOCS/man/vo.rst | 7 ++++++- video/out/gl_video.c | 7 +++++-- video/out/gl_video.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst index 14ce9efc9e..e0dd002bff 100644 --- a/DOCS/man/vo.rst +++ b/DOCS/man/vo.rst @@ -438,12 +438,17 @@ Available video output drivers are: this options will make rendering a single operation. Note that chroma scalers are always done as 1-pass filters. - ``cscale=`` + ``cscale=`` As ``lscale``, but for chroma (2x slower with little visible effect). Note that with some scaling filters, upscaling is always done in RGB. If chroma is not subsampled, this option is ignored, and the luma scaler is used instead. Setting this option is often useless. + ``lscale-down=``, ``cscale-down=`` + Like ``lscale`` and ``cscale``, but apply these filters on downscaling + instead. If these options are unset, the filter implied by ``lscale`` + (and ``cscale``, respectively) will be applied. + ``cparam1``, ``cparam2``, ``cradius`` Set filter parameters and radius for ``cscale``. diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 27b4fe366d..fe3f63ea16 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -326,6 +326,8 @@ const struct m_sub_options gl_video_conf = { {"quadbuffer", GL_3D_QUADBUFFER})), OPT_STRING_VALIDATE("lscale", scalers[0], 0, validate_scaler_opt), OPT_STRING_VALIDATE("cscale", scalers[1], 0, validate_scaler_opt), + OPT_STRING_VALIDATE("lscale-down", dscalers[0], 0, validate_scaler_opt), + OPT_STRING_VALIDATE("cscale-down", dscalers[1], 0, validate_scaler_opt), OPT_FLOAT("lparam1", scaler_params[0][0], 0), OPT_FLOAT("lparam2", scaler_params[0][1], 0), OPT_FLOAT("cparam1", scaler_params[1][0], 0), @@ -1263,6 +1265,8 @@ static const char *expected_scaler(struct gl_video *p, int unit) { return "bilinear"; } + if (p->opts.dscalers[unit] && get_scale_factor(p) < 1.0) + return p->opts.dscalers[unit]; return p->opts.scalers[unit]; } @@ -2386,8 +2390,7 @@ void gl_video_set_options(struct gl_video *p, struct gl_video_opts *opts) p->opts = *opts; for (int n = 0; n < 2; n++) { p->opts.scalers[n] = (char *)handle_scaler_opt(p->opts.scalers[n]); - assert(p->opts.scalers[n]); - p->scalers[n].name = p->opts.scalers[n]; + p->opts.dscalers[n] = (char *)handle_scaler_opt(p->opts.dscalers[n]); } if (!p->opts.gamma && p->video_eq.values[MP_CSP_EQ_GAMMA] != 0) diff --git a/video/out/gl_video.h b/video/out/gl_video.h index 8ea5d3420f..a28109a5a2 100644 --- a/video/out/gl_video.h +++ b/video/out/gl_video.h @@ -29,6 +29,7 @@ struct lut3d { struct gl_video_opts { char *scalers[2]; + char *dscalers[2]; float scaler_params[2][2]; float scaler_radius[2]; int indirect; -- cgit v1.2.3