for(){
    if(){
        switch(){

to
switch(){
    for(){
        if(){

this halfs the number of times the switch is executed in bidir blocks, in
other blocks the number is the same
25 cpu cycles less with matrixbench on duron

Originally committed as revision 9860 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2007-08-01 20:37:41 +00:00
parent 93b3c0834d
commit 356ab1dace
1 changed files with 67 additions and 60 deletions

View File

@ -375,12 +375,12 @@ static int mpeg_decode_mb(MpegEncContext *s,
/* motion vectors */ /* motion vectors */
s->mv_dir = 0; s->mv_dir = 0;
for(i=0;i<2;i++) {
if (USES_LIST(mb_type, i)) {
s->mv_dir |= (MV_DIR_FORWARD >> i);
dprintf(s->avctx, "motion_type=%d\n", motion_type); dprintf(s->avctx, "motion_type=%d\n", motion_type);
switch(motion_type) { switch(motion_type) {
case MT_FRAME: /* or MT_16X8 */ 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) {
/* MT_FRAME */ /* MT_FRAME */
mb_type |= MB_TYPE_16x16; mb_type |= MB_TYPE_16x16;
@ -408,9 +408,14 @@ static int mpeg_decode_mb(MpegEncContext *s,
} }
} }
} }
}
}
break; break;
case MT_FIELD: case MT_FIELD:
s->mv_type = MV_TYPE_FIELD; s->mv_type = MV_TYPE_FIELD;
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_16x8 | MB_TYPE_INTERLACED; mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;
for(j=0;j<2;j++) { for(j=0;j<2;j++) {
@ -437,11 +442,15 @@ static int mpeg_decode_mb(MpegEncContext *s,
s->mv[i][0][k] = val; s->mv[i][0][k] = val;
} }
} }
}
}
break; break;
case MT_DMV: case MT_DMV:
{ s->mv_type = MV_TYPE_DMV;
for(i=0;i<2;i++) {
if (USES_LIST(mb_type, i)) {
int dmx, dmy, mx, my, m; int dmx, dmy, mx, my, m;
s->mv_dir |= (MV_DIR_FORWARD >> i);
mx = mpeg_decode_motion(s, s->mpeg_f_code[i][0], mx = mpeg_decode_motion(s, s->mpeg_f_code[i][0],
s->last_mv[i][0][0]); s->last_mv[i][0][0]);
s->last_mv[i][0][0] = mx; s->last_mv[i][0][0] = mx;
@ -450,7 +459,6 @@ static int mpeg_decode_mb(MpegEncContext *s,
my = mpeg_decode_motion(s, s->mpeg_f_code[i][1], my = mpeg_decode_motion(s, s->mpeg_f_code[i][1],
s->last_mv[i][0][1] >> 1); s->last_mv[i][0][1] >> 1);
dmy = get_dmv(s); dmy = get_dmv(s);
s->mv_type = MV_TYPE_DMV;
s->last_mv[i][0][1] = my<<1; s->last_mv[i][0][1] = my<<1;
@ -484,14 +492,13 @@ static int mpeg_decode_mb(MpegEncContext *s,
s->mv[i][2][1]++; s->mv[i][2][1]++;
} }
} }
}
break; break;
default: default:
av_log(s->avctx, AV_LOG_ERROR, "00 motion_type at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "00 motion_type at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
} }
}
}
s->mb_intra = 0; s->mb_intra = 0;
if (HAS_CBP(mb_type)) { if (HAS_CBP(mb_type)) {