Mercurial > libavcodec.hg
changeset 8467:3700af1c1f4f libavcodec
Fix (rewrite) find_group3_syncmarker().
author | michael |
---|---|
date | Fri, 26 Dec 2008 13:46:11 +0000 |
parents | a11f1002f6b0 |
children | 75328d3e788e |
files | faxcompr.c |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/faxcompr.c Fri Dec 26 13:39:19 2008 +0000 +++ b/faxcompr.c Fri Dec 26 13:46:11 2008 +0000 @@ -251,14 +251,14 @@ 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,