[SCM] libav/experimental: exchange for() and if() order in the MT_FRAME case safes 24 cpu cycles

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


The following commit has been merged in the experimental branch:
commit f4fbcd33d904915ad51fd9a93fdc2d9201066eb2
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Wed Aug 1 21:05:58 2007 +0000

    exchange  for() and if() order in the MT_FRAME case
    safes 24 cpu cycles
    
    Originally committed as revision 9862 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 22659e3..76af2c4 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -378,13 +378,13 @@ static int mpeg_decode_mb(MpegEncContext *s,
             dprintf(s->avctx, "motion_type=%d\n", motion_type);
             switch(motion_type) {
             case MT_FRAME: /* or MT_16X8 */
-                for(i=0;i<2;i++) {
-                    if (USES_LIST(mb_type, i)) {
-                        s->mv_dir |= (MV_DIR_FORWARD >> i);
-                        if (s->picture_structure == PICT_FRAME) {
+                if (s->picture_structure == PICT_FRAME) {
+                    mb_type |= MB_TYPE_16x16;
+                    s->mv_type = MV_TYPE_16X16;
+                    for(i=0;i<2;i++) {
+                        if (USES_LIST(mb_type, i)) {
+                            s->mv_dir |= (MV_DIR_FORWARD >> i);
                             /* MT_FRAME */
-                            mb_type |= MB_TYPE_16x16;
-                            s->mv_type = MV_TYPE_16X16;
                             s->mv[i][0][0]= s->last_mv[i][0][0]= s->last_mv[i][1][0] =
                                 mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]);
                             s->mv[i][0][1]= s->last_mv[i][0][1]= s->last_mv[i][1][1] =
@@ -394,10 +394,15 @@ static int mpeg_decode_mb(MpegEncContext *s,
                                 s->mv[i][0][0] <<= 1;
                                 s->mv[i][0][1] <<= 1;
                             }
-                        } else {
+                        }
+                    }
+                } else {
+                    mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;
+                    s->mv_type = MV_TYPE_16X8;
+                    for(i=0;i<2;i++) {
+                        if (USES_LIST(mb_type, i)) {
+                            s->mv_dir |= (MV_DIR_FORWARD >> i);
                             /* MT_16X8 */
-                            mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;
-                            s->mv_type = MV_TYPE_16X8;
                             for(j=0;j<2;j++) {
                                 s->field_select[i][j] = get_bits1(&s->gb);
                                 for(k=0;k<2;k++) {

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list