# HG changeset patch # User michael # Date 1186002358 0 # Node ID 40c87c0f754bb332cee698294613cff54007978a # Parent f5d2349dccd752714e395dfa43bcbf4d91a540f7 exchange for() and if() order in the MT_FRAME case safes 24 cpu cycles diff -r f5d2349dccd7 -r 40c87c0f754b mpeg12.c --- a/mpeg12.c Wed Aug 01 20:44:08 2007 +0000 +++ b/mpeg12.c Wed Aug 01 21:05:58 2007 +0000 @@ -378,13 +378,13 @@ 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 @@ 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++) {