From 0b160e125723baa42aa3e880945817e518946bd2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 22 Jul 2013 14:41:33 +0200 Subject: vf_scale: actually respect param and param2 suboptions This was forgotten in commit b81f5e2. --- video/filter/vf_scale.c | 3 +++ video/sws_utils.c | 4 ++++ video/sws_utils.h | 1 + 3 files changed, 8 insertions(+) diff --git a/video/filter/vf_scale.c b/video/filter/vf_scale.c index 7237a2c224..738487f7d8 100644 --- a/video/filter/vf_scale.c +++ b/video/filter/vf_scale.c @@ -425,6 +425,9 @@ static int vf_open(vf_instance_t *vf, char *args) vf->control = control; vf->uninit = uninit; vf->priv->sws = mp_sws_alloc(vf); + vf->priv->sws->params[0] = vf->priv->param[0]; + vf->priv->sws->params[1] = vf->priv->param[1]; + mp_msg(MSGT_VFILTER, MSGL_V, "SwScale params: %d x %d (-1=no scaling)\n", vf->priv->cfg_w, vf->priv->cfg_h); diff --git a/video/sws_utils.c b/video/sws_utils.c index 91635cf6dd..ff139ea794 100644 --- a/video/sws_utils.c +++ b/video/sws_utils.c @@ -164,6 +164,7 @@ struct mp_sws_context *mp_sws_alloc(void *talloc_parent) .contrast = 1 << 16, // 1.0 in 16.16 fixed point .saturation = 1 << 16, .force_reload = true, + .params = {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT}, .cached = talloc_zero(ctx, struct mp_sws_context), }; talloc_set_destructor(ctx, free_mp_sws); @@ -223,6 +224,9 @@ int mp_sws_reinit(struct mp_sws_context *ctx) av_opt_set_int(ctx->sws, "dsth", dst->h, 0); av_opt_set_int(ctx->sws, "dst_format", d_fmt, 0); + av_opt_set_double(ctx->sws, "param0", ctx->params[0], 0); + av_opt_set_double(ctx->sws, "param1", ctx->params[1], 0); + // This can fail even with normal operation, e.g. if a conversion path // simply does not support these settings. sws_setColorspaceDetails(ctx->sws, sws_getCoefficients(s_csp), s_range, diff --git a/video/sws_utils.h b/video/sws_utils.h index 07fc3c76b1..a3c1d59be3 100644 --- a/video/sws_utils.h +++ b/video/sws_utils.h @@ -37,6 +37,7 @@ struct mp_sws_context { // By default, they are NULL. // Freeing the mp_sws_context will deallocate these if set. struct SwsFilter *src_filter, *dst_filter; + double params[2]; // Cached context (if any) struct SwsContext *sws; -- cgit v1.2.3