From 5a3045f1a27e350e919723921d365321e4ef8dfc Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 24 Sep 2012 16:34:03 +0200 Subject: [PATCH] vf_scale: do the upscale detection AFTER calculating dimensions Otherwise it heavily violates the manpage's description, and describing what it did before in the documentation is something too complicated to describe in the English language. --- libmpcodecs/vf_scale.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index 19bfeec4d2..71428685ac 100644 --- a/libmpcodecs/vf_scale.c +++ b/libmpcodecs/vf_scale.c @@ -238,13 +238,6 @@ static int config(struct vf_instance *vf, } } - if(vf->priv->noup){ - if((vf->priv->w > width) + (vf->priv->h > height) >= vf->priv->noup){ - vf->priv->w= width; - vf->priv->h= height; - } - } - if (vf->priv->w <= -8) { vf->priv->w += 8; round_w = 1; @@ -288,6 +281,14 @@ static int config(struct vf_instance *vf, if (round_h) vf->priv->h = ((vf->priv->h + 8) / 16) * 16; + // check for upscaling, now that all parameters had been applied + if(vf->priv->noup){ + if((vf->priv->w > width) + (vf->priv->h > height) >= vf->priv->noup){ + vf->priv->w= width; + vf->priv->h= height; + } + } + // calculate the missing parameters: switch(best) { case IMGFMT_YV12: /* YV12 needs w & h rounded to 2 */