diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-09-12 12:26:09 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-09-12 12:26:09 +0000 |
commit | 66370d3fca1ce0628d83ff34f47e11515ff7eb9f (patch) | |
tree | 79d9884a5496e9ad754da5845e33a887f5391eb5 /libavcodec/h263.c | |
parent | 7866eeff46f3807696100d1061b6cd07af0dd9eb (diff) | |
download | ffmpeg-66370d3fca1ce0628d83ff34f47e11515ff7eb9f.tar.gz |
statistics for forw & back p-MBs instead of just one counter for both
Originally committed as revision 925 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h263.c')
-rw-r--r-- | libavcodec/h263.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 05c0f6a567..a7c6e723ae 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -18,7 +18,9 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * ac prediction encoding & b-frame support by Michael Niedermayer <michaelni@gmx.at> + * ac prediction encoding, b-frame support, error resilience, optimizations, + * qpel decoding, gmc decoding, interlaced decoding, + * by Michael Niedermayer <michaelni@gmx.at> */ //#define DEBUG @@ -363,6 +365,8 @@ void mpeg4_encode_mb(MpegEncContext * s, case 0: /* direct */ h263_encode_motion(s, motion_x, 1); h263_encode_motion(s, motion_y, 1); + s->b_count++; + s->f_count++; break; case 1: /* bidir */ h263_encode_motion(s, s->mv[0][0][0] - s->last_mv[0][0][0], s->f_code); @@ -373,18 +377,22 @@ void mpeg4_encode_mb(MpegEncContext * s, s->last_mv[0][0][1]= s->mv[0][0][1]; s->last_mv[1][0][0]= s->mv[1][0][0]; s->last_mv[1][0][1]= s->mv[1][0][1]; + s->b_count++; + s->f_count++; break; case 2: /* backward */ h263_encode_motion(s, motion_x - s->last_mv[1][0][0], s->b_code); h263_encode_motion(s, motion_y - s->last_mv[1][0][1], s->b_code); s->last_mv[1][0][0]= motion_x; s->last_mv[1][0][1]= motion_y; + s->b_count++; break; case 3: /* forward */ h263_encode_motion(s, motion_x - s->last_mv[0][0][0], s->f_code); h263_encode_motion(s, motion_y - s->last_mv[0][0][1], s->f_code); s->last_mv[0][0][0]= motion_x; s->last_mv[0][0][1]= motion_y; + s->f_count++; break; default: printf("unknown mb type\n"); @@ -515,7 +523,7 @@ void mpeg4_encode_mb(MpegEncContext * s, s->p_tex_bits+= bits - s->last_bits; s->last_bits=bits; } - s->p_count++; + s->f_count++; } } else { int cbp; @@ -2851,9 +2859,9 @@ int h263_decode_mb(MpegEncContext *s, s->mv[0][0][0] = s->motion_val[xy][0]*time_pb/time_pp + mx; s->mv[0][0][1] = s->motion_val[xy][1]*time_pb/time_pp + my; s->mv[1][0][0] = mx ? s->mv[0][0][0] - s->motion_val[xy][0] - : s->motion_val[xy][0]*(time_pb - time_pp)/time_pp + mx; + : s->motion_val[xy][0]*(time_pb - time_pp)/time_pp; s->mv[1][0][1] = my ? s->mv[0][0][1] - s->motion_val[xy][1] - : s->motion_val[xy][1]*(time_pb - time_pp)/time_pp + my; + : s->motion_val[xy][1]*(time_pb - time_pp)/time_pp; if(s->non_b_mv4_table[xy]){ int i; s->mv_type = MV_TYPE_8X8; @@ -2862,9 +2870,9 @@ int h263_decode_mb(MpegEncContext *s, s->mv[0][i][0] = s->motion_val[xy][0]*time_pb/time_pp + mx; s->mv[0][i][1] = s->motion_val[xy][1]*time_pb/time_pp + my; s->mv[1][i][0] = mx ? s->mv[0][i][0] - s->motion_val[xy][0] - : s->motion_val[xy][0]*(time_pb - time_pp)/time_pp + mx; + : s->motion_val[xy][0]*(time_pb - time_pp)/time_pp; s->mv[1][i][1] = my ? s->mv[0][i][1] - s->motion_val[xy][1] - : s->motion_val[xy][1]*(time_pb - time_pp)/time_pp + my; + : s->motion_val[xy][1]*(time_pb - time_pp)/time_pp; } PRINT_MB_TYPE("4"); }else{ @@ -2970,7 +2978,7 @@ intra: static int h263_decode_motion(MpegEncContext * s, int pred, int f_code) { - int code, val, sign, shift, l, m; + int code, val, sign, shift, l; code = get_vlc2(&s->gb, mv_vlc.table, MV_VLC_BITS, 2); if (code < 0) @@ -2991,11 +2999,10 @@ static int h263_decode_motion(MpegEncContext * s, int pred, int f_code) /* modulo decoding */ if (!s->h263_long_vectors) { l = (1 << (f_code - 1)) * 32; - m = 2 * l; if (val < -l) { - val += m; + val += l<<1; } else if (val >= l) { - val -= m; + val -= l<<1; } } else { /* horrible h263 long vector mode */ |