# HG changeset patch # User michael # Date 1098984094 0 # Node ID bae9c6de090b0682e0360b506f9d63413210a62e # Parent 7b5353eb0dd8d5e790be4f6539557b16b6aa1242 fix and cleanup h261 mb_type selection diff -r 7b5353eb0dd8 -r bae9c6de090b h261.c --- a/h261.c Thu Oct 28 12:12:33 2004 +0000 +++ b/h261.c Thu Oct 28 17:21:34 2004 +0000 @@ -220,12 +220,11 @@ int motion_x, int motion_y) { H261Context * h = (H261Context *)s; - int old_mtype, mvd, mv_diff_x, mv_diff_y, i, cbp; + int mvd, mv_diff_x, mv_diff_y, i, cbp; cbp = 63; // avoid warning mvd = 0; h->current_mba++; - old_mtype = h->mtype; h->mtype = 0; if (!s->mb_intra){ @@ -233,14 +232,8 @@ cbp= get_cbp(s, block); /* mvd indicates if this block is motion compensated */ - if(((motion_x >> 1) - h->current_mv_x != 0) || ((motion_y >> 1 ) - h->current_mv_y) != 0){ - mvd = 1; - } - else if((motion_x >> 1 == 0) && (motion_y >> 1 == 0)){ - mvd = 0; - } - else - mvd = 1; + mvd = motion_x | motion_y; + if((cbp | mvd | s->dquant ) == 0) { /* skip macroblock */ s->skip_count++; @@ -255,14 +248,15 @@ /* calculate MTYPE */ if(!s->mb_intra){ - h->mtype+=2; - if(mvd == 1){ - h->mtype+=2; - if(cbp!=0) - h->mtype+=1; + h->mtype++; + + if(mvd || s->loop_filter) + h->mtype+=3; if(s->loop_filter) h->mtype+=3; - } + if(cbp || s->dquant) + h->mtype++; + assert(h->mtype > 1); } if(s->dquant)