diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-10-28 17:21:34 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-10-28 17:21:34 +0000 |
commit | 9740687b6be5631b2c0500eb38938a4b47df54f2 (patch) | |
tree | 14217b5aff65161b20492e2d437051ca359e4dc4 /libavcodec/h261.c | |
parent | 13e5b1f684388ea102c55b40a8f8541d384bb836 (diff) | |
download | ffmpeg-9740687b6be5631b2c0500eb38938a4b47df54f2.tar.gz |
fix and cleanup h261 mb_type selection
Originally committed as revision 3647 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h261.c')
-rw-r--r-- | libavcodec/h261.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/libavcodec/h261.c b/libavcodec/h261.c index 490e0d30a6..e7fa63e923 100644 --- a/libavcodec/h261.c +++ b/libavcodec/h261.c @@ -220,12 +220,11 @@ void ff_h261_encode_mb(MpegEncContext * s, 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 @@ void ff_h261_encode_mb(MpegEncContext * s, 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 @@ void ff_h261_encode_mb(MpegEncContext * s, /* 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) |