Commit 214a3b8b authored by Michael Niedermayer's avatar Michael Niedermayer

avfilter/vf_scale: simplify alignment code

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 1e48c39e
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment