[SCM] libav/experimental: reorder if() so that the condition can be simplified saves another 4 cpu cycles

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:04:31 UTC 2013


The following commit has been merged in the experimental branch:
commit 09d1bee89e27ee2991f3aee5db38ba251f2fac95
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Wed Aug 1 19:37:28 2007 +0000

    reorder if() so that the condition can be simplified
    saves another 4 cpu cycles
    
    Originally committed as revision 9857 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 09c90e8..24e1228 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -502,14 +502,14 @@ static int mpeg_decode_mb(MpegEncContext *s,
             }
 
             cbp = get_vlc2(&s->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1);
-            if (cbp < 0 || ((cbp == 0) && (s->chroma_format < 2)) ){
-                av_log(s->avctx, AV_LOG_ERROR, "invalid cbp at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
             if(mb_block_count > 6){
                  cbp<<= mb_block_count-6;
                  cbp |= get_bits(&s->gb, mb_block_count-6);
             }
+            if (cbp <= 0){
+                av_log(s->avctx, AV_LOG_ERROR, "invalid cbp at %d %d\n", s->mb_x, s->mb_y);
+                return -1;
+            }
 
 #ifdef HAVE_XVMC
             //on 1 we memcpy blocks in xvmcvideo

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list