[FFmpeg-cvslog] avfilter/vf_scale: simplify alignment code

Michael Niedermayer git at videolan.org
Sat Jan 25 17:05:53 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Jan 25 16:54:24 2014 +0100| [214a3b8bf939c3c5dacfeafb77750fe3ce751b93] | committer: Michael Niedermayer

avfilter/vf_scale: simplify alignment code

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=214a3b8bf939c3c5dacfeafb77750fe3ce751b93
---

 libavfilter/vf_scale.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index bb5cd39..6b7d474 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



More information about the ffmpeg-cvslog mailing list