diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-12-26 13:46:11 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-12-26 13:46:11 +0000 |
commit | eb12536a31897c67d5a930e5f5c2f129d721412f (patch) | |
tree | 303f5f0ba76f2909fdfecbad608dc45e7dcc812e /libavcodec | |
parent | 44fe71133d42711ca3a60f875a4906624482f562 (diff) | |
download | ffmpeg-eb12536a31897c67d5a930e5f5c2f129d721412f.tar.gz |
Fix (rewrite) find_group3_syncmarker().
Originally committed as revision 16325 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/faxcompr.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c index 940444647f..9f1da4d279 100644 --- a/libavcodec/faxcompr.c +++ b/libavcodec/faxcompr.c @@ -251,14 +251,14 @@ static void put_line(uint8_t *dst, int size, int width, const int *runs) static int find_group3_syncmarker(GetBitContext *gb, int srcsize) { - int state = get_bits(gb, 12); - int rem = srcsize - get_bits_count(gb); - while((state & 0xFFF) != 1){ - state = (state << 1) | get_bits1(gb); - if(--rem <= 0) - return -1; + unsigned int state = -1; + srcsize -= get_bits_count(gb); + while(srcsize-- > 0){ + state+= state + get_bits1(gb); + if((state & 0xFFF) != 1) + return 0; } - return 0; + return -1; } int ff_ccitt_unpack_1d(AVCodecContext *avctx, |