[FFmpeg-cvslog] swr: move if() block into the only branch where it can be true.

Michael Niedermayer git at videolan.org
Thu Nov 15 12:34:35 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Nov 15 12:22:16 2012 +0100| [d53f4471308189cf825091bb5ed95843d59affcd] | committer: Michael Niedermayer

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 at gmx.at>

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

 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 d519ec6..2ce97fa 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;



More information about the ffmpeg-cvslog mailing list