swr: move if() block into the only branch where it can be true.
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 15 Nov 2012 11:22:16 +0000 (12:22 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 15 Nov 2012 11:33:40 +0000 (12:33 +0100)
This should make the code a tiny tiny bit faster.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libswresample/resample_template.c

index d519ec6..2ce97fa 100644 (file)
@@ -126,12 +126,13 @@ int RENAME(swri_resample)(ResampleContext *c, DELEM *dst, const DELEM *src, int
         }
         *consumed= FFMAX(sample_index, 0);
         index += FFMIN(sample_index, 0) << c->phase_shift;
-    }
 
-    if(compensation_distance){
-        compensation_distance -= dst_index;
-        av_assert1(compensation_distance > 0);
+        if(compensation_distance){
+            compensation_distance -= dst_index;
+            av_assert1(compensation_distance > 0);
+        }
     }
+
     if(update_ctx){
         c->frac= frac;
         c->index= index;