From 214a3b8bf939c3c5dacfeafb77750fe3ce751b93 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 25 Jan 2014 16:54:24 +0100 Subject: avfilter/vf_scale: simplify alignment code Signed-off-by: Michael Niedermayer --- libavfilter/vf_scale.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'libavfilter/vf_scale.c') diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index bb5cd39a78..6b7d474aff 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -273,22 +273,17 @@ static int config_props(AVFilterLink *outlink) h = scale->h; /* Check if it is requested that the result has to be divisible by a some - * factor (w or h = -n with n being the factor). After we got the factor, - * we set w/h back to -1 so that the automatic scaling is done. */ + * factor (w or h = -n with n being the factor). */ factor_w = 1; factor_h = 1; if (w < -1) { factor_w = -w; - w = -1; - scale->w = -1; } if (h < -1) { factor_h = -h; - h = -1; - scale->h = -1; } - if (w == -1 && h == -1) + if (w < 0 && h < 0) scale->w = scale->h = 0; if (!(w = scale->w)) @@ -299,9 +294,9 @@ static int config_props(AVFilterLink *outlink) /* Make sure that the result is divisible by the factor we determined * earlier. If no factor was set, it is nothing will happen as the default * factor is 1 */ - if (w == -1) + if (w < 0) w = av_rescale(h, inlink->w, inlink->h * factor_w) * factor_w; - if (h == -1) + if (h < 0) h = av_rescale(w, inlink->h, inlink->w * factor_h) * factor_h; /* Note that force_original_aspect_ratio may overwrite the previous set -- cgit v1.2.3