Mercurial > libavcodec.hg
comparison faxcompr.c @ 8467:3700af1c1f4f libavcodec
Fix (rewrite) find_group3_syncmarker().
author | michael |
---|---|
date | Fri, 26 Dec 2008 13:46:11 +0000 |
parents | a11f1002f6b0 |
children | 75328d3e788e |
comparison
equal
deleted
inserted
replaced
8466:a11f1002f6b0 | 8467:3700af1c1f4f |
---|---|
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 static int find_group3_syncmarker(GetBitContext *gb, int srcsize) | 252 static int find_group3_syncmarker(GetBitContext *gb, int srcsize) |
253 { | 253 { |
254 int state = get_bits(gb, 12); | 254 unsigned int state = -1; |
255 int rem = srcsize - get_bits_count(gb); | 255 srcsize -= get_bits_count(gb); |
256 while((state & 0xFFF) != 1){ | 256 while(srcsize-- > 0){ |
257 state = (state << 1) | get_bits1(gb); | 257 state+= state + get_bits1(gb); |
258 if(--rem <= 0) | 258 if((state & 0xFFF) != 1) |
259 return -1; | 259 return 0; |
260 } | 260 } |
261 return 0; | 261 return -1; |
262 } | 262 } |
263 | 263 |
264 int ff_ccitt_unpack_1d(AVCodecContext *avctx, | 264 int ff_ccitt_unpack_1d(AVCodecContext *avctx, |
265 const uint8_t *src, int srcsize, | 265 const uint8_t *src, int srcsize, |
266 uint8_t *dst, int height, int stride) | 266 uint8_t *dst, int height, int stride) |