diff options
author | BERO <bero@geocities.co.jp> | 2003-05-14 01:08:02 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-05-14 01:08:02 +0000 |
commit | 05858889b2261fc3a98c19e25219b435ea0f6154 (patch) | |
tree | 2f1281f4b777f720da8423fac5665cfa9ba19bca /libavcodec/h263.c | |
parent | d8e00c099731b8499a8c377469ac5796f5bd186c (diff) | |
download | ffmpeg-05858889b2261fc3a98c19e25219b435ea0f6154.tar.gz |
decode motion & modulo optimize patch by (BERO <bero at geocities dot co dot jp>)
Originally committed as revision 1872 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h263.c')
-rw-r--r-- | libavcodec/h263.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 6cc2dc47c0..259ca8431f 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -3437,10 +3437,12 @@ static int h263_decode_motion(MpegEncContext * s, int pred, int f_code) sign = get_bits1(&s->gb); shift = f_code - 1; - val = (code - 1) << shift; - if (shift > 0) + val = code; + if (shift) { + val = (val - 1) << shift; val |= get_bits(&s->gb, shift); - val++; + val++; + } if (sign) val = -val; val += pred; @@ -3448,11 +3450,7 @@ static int h263_decode_motion(MpegEncContext * s, int pred, int f_code) /* modulo decoding */ if (!s->h263_long_vectors) { l = 1 << (f_code + 4); - if (val < -l) { - val += l<<1; - } else if (val >= l) { - val -= l<<1; - } + val = ((val + l)&(l*2-1)) - l; } else { /* horrible h263 long vector mode */ if (pred < -31 && val < -63) |