avfilter/vf_perspective: factor u cliping code
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 8 Aug 2013 21:24:31 +0000 (23:24 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 8 Aug 2013 22:03:43 +0000 (00:03 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/vf_perspective.c

index 35b4ea8..da8c089 100644 (file)
@@ -301,19 +301,15 @@ static void resample_linear(PerspectiveContext *s,
                     sum   = (sum + (1 << (SUB_PIXEL_BITS - 1))) >> SUB_PIXEL_BITS;
                 }
             } else {
+                if (u < 0)
+                    u = 0;
+                else
+                    u = w - 1;
                 if ((unsigned)v < (unsigned)(h - 1)){
-                    if (u < 0)
-                        u = 0;
-                    else
-                        u = w - 1;
                     index = u + v * src_linesize;
                     sum   = subVI * src[index] + subV * src[index + src_linesize];
                     sum   = (sum + (1 << (SUB_PIXEL_BITS - 1))) >> SUB_PIXEL_BITS;
                 } else {
-                    if (u < 0)
-                        u = 0;
-                    else
-                        u = w - 1;
                     if (v < 0)
                         v = 0;
                     else