[FFmpeg-cvslog] avfilter/vf_perspective: factor u cliping code

Michael Niedermayer git at videolan.org
Fri Aug 9 00:04:33 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Aug  8 23:24:31 2013 +0200| [3b2e99fe9ec46580165daa233c273579bde1e913] | committer: Michael Niedermayer

avfilter/vf_perspective: factor u cliping code

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

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

 libavfilter/vf_perspective.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c
index 35b4ea8..da8c089 100644
--- a/libavfilter/vf_perspective.c
+++ b/libavfilter/vf_perspective.c
@@ -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



More information about the ffmpeg-cvslog mailing list