diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-06-25 14:11:44 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-06-25 14:11:44 +0000 |
commit | 0ff93477be92f76608d816361bb5efe35d663ae1 (patch) | |
tree | 52003029142fab2a51e2260a6d36187f8ffd6632 /libavcodec/mpeg12.c | |
parent | 4c99f2cdbed8bb7e6c40cf9a057aa6569d6a33eb (diff) | |
download | ffmpeg-0ff93477be92f76608d816361bb5efe35d663ae1.tar.gz |
optimization
Originally committed as revision 3249 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r-- | libavcodec/mpeg12.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 15c51096d3..f235a199b0 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -696,7 +696,7 @@ void mpeg1_encode_mb(MpegEncContext *s, // RAL: Parameter added: f_or_b_code static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code) { - int code, bit_size, l, m, bits, range, sign; + int code, bit_size, l, bits, range, sign; if (val == 0) { /* zero vector */ @@ -708,13 +708,8 @@ static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code) bit_size = f_or_b_code - 1; range = 1 << bit_size; /* modulo encoding */ - l = 16 * range; - m = 2 * l; - if (val < -l) { - val += m; - } else if (val >= l) { - val -= m; - } + l= INT_BIT - 5 - bit_size; + val= (val<<l)>>l; if (val >= 0) { val--; @@ -1411,8 +1406,8 @@ static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred) val += pred; /* modulo decoding */ - l = 1 << (shift+4); - val = ((val + l)&(l*2-1)) - l; + l= INT_BIT - 5 - shift; + val = (val<<l)>>l; return val; } |