summaryrefslogtreecommitdiffstats
path: root/video/filter/vf_scale.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/filter/vf_scale.c')
-rw-r--r--video/filter/vf_scale.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/video/filter/vf_scale.c b/video/filter/vf_scale.c
index c466c5d39a..268e65ae59 100644
--- a/video/filter/vf_scale.c
+++ b/video/filter/vf_scale.c
@@ -217,13 +217,13 @@ static unsigned int find_best_out(vf_instance_t *vf, int in_format)
return best;
}
-static int reconfig(struct vf_instance *vf, struct mp_image_params *p, int flags)
+static int reconfig(struct vf_instance *vf, struct mp_image_params *in,
+ struct mp_image_params *out)
{
- int width = p->w, height = p->h, d_width = p->d_w, d_height = p->d_h;
- unsigned int outfmt = p->imgfmt;
+ int width = in->w, height = in->h, d_width = in->d_w, d_height = in->d_h;
+ unsigned int outfmt = in->imgfmt;
unsigned int best = find_best_out(vf, outfmt);
int round_w = 0, round_h = 0;
- struct mp_image_params input = *p;
if (!best) {
mp_msg(MSGT_VFILTER, MSGL_WARN,
@@ -302,30 +302,30 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *p, int flags
d_height = vf->priv->w * d_height / d_width;
d_width = vf->priv->w;
}
- //d_width=d_width*vf->priv->w/width;
- //d_height=d_height*vf->priv->h/height;
- p->w = vf->priv->w;
- p->h = vf->priv->h;
- p->d_w = d_width;
- p->d_h = d_height;
- p->imgfmt = best;
+
+ *out = *in;
+ out->w = vf->priv->w;
+ out->h = vf->priv->h;
+ out->d_w = d_width;
+ out->d_h = d_height;
+ out->imgfmt = best;
// Second-guess what libswscale is going to output and what not.
// It depends what libswscale supports for in/output, and what makes sense.
- struct mp_imgfmt_desc s_fmt = mp_imgfmt_get_desc(input.imgfmt);
- struct mp_imgfmt_desc d_fmt = mp_imgfmt_get_desc(p->imgfmt);
+ struct mp_imgfmt_desc s_fmt = mp_imgfmt_get_desc(in->imgfmt);
+ struct mp_imgfmt_desc d_fmt = mp_imgfmt_get_desc(out->imgfmt);
// keep colorspace settings if the data stays in yuv
if (!(s_fmt.flags & MP_IMGFLAG_YUV) || !(d_fmt.flags & MP_IMGFLAG_YUV)) {
- p->colorspace = MP_CSP_AUTO;
- p->colorlevels = MP_CSP_LEVELS_AUTO;
+ out->colorspace = MP_CSP_AUTO;
+ out->colorlevels = MP_CSP_LEVELS_AUTO;
}
- mp_image_params_guess_csp(p);
+ mp_image_params_guess_csp(out);
mp_sws_set_from_cmdline(vf->priv->sws);
vf->priv->sws->flags |= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT;
vf->priv->sws->flags |= vf->priv->accurate_rnd * SWS_ACCURATE_RND;
- vf->priv->sws->src = input;
- vf->priv->sws->dst = *p;
+ vf->priv->sws->src = *in;
+ vf->priv->sws->dst = *out;
if (mp_sws_reinit(vf->priv->sws) < 0) {
// error...
@@ -333,11 +333,7 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *p, int flags
"Couldn't init libswscale for this setup\n");
return -1;
}
-
- // In particular, fix up colorspace/levels if YUV<->RGB conversion is
- // performed.
-
- return vf_next_reconfig(vf, p, flags);
+ return 0;
}
static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi)