From d53f4471308189cf825091bb5ed95843d59affcd Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Thu, 15 Nov 2012 12:22:16 +0100
Subject: [PATCH] swr: move if() block into the only branch where it can be
 true.

This should make the code a tiny tiny bit faster.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 libswresample/resample_template.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libswresample/resample_template.c b/libswresample/resample_template.c
index d519ec6b99a..2ce97fa6ecb 100644
--- a/libswresample/resample_template.c
+++ b/libswresample/resample_template.c
@@ -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;
-- 
GitLab