comparison faxcompr.c @ 10304:370d05e51d90 libavcodec

Finally distinguish TIFF_CCITT_RLE and TIFF_G3 1-D case, so both of them will be decoded correctly. This fixes issue 1423.
author kostya
date Mon, 28 Sep 2009 05:17:20 +0000
parents cc02e912d20e
children 86fadefa1143
comparison
equal deleted inserted replaced
10303:8a49525f2b1e 10304:370d05e51d90
267 return -1; 267 return -1;
268 } 268 }
269 269
270 int ff_ccitt_unpack(AVCodecContext *avctx, 270 int ff_ccitt_unpack(AVCodecContext *avctx,
271 const uint8_t *src, int srcsize, 271 const uint8_t *src, int srcsize,
272 uint8_t *dst, int height, int stride, enum TiffCompr compr) 272 uint8_t *dst, int height, int stride, enum TiffCompr compr, int opts)
273 { 273 {
274 int j; 274 int j;
275 GetBitContext gb; 275 GetBitContext gb;
276 int *runs, *ref, *runend; 276 int *runs, *ref, *runend;
277 int ret; 277 int ret;
291 av_free(runs); 291 av_free(runs);
292 av_free(ref); 292 av_free(ref);
293 return -1; 293 return -1;
294 } 294 }
295 }else{ 295 }else{
296 int g3d1 = (compr == TIFF_G3) && !(opts & 1);
296 if(compr!=TIFF_CCITT_RLE && find_group3_syncmarker(&gb, srcsize*8) < 0) 297 if(compr!=TIFF_CCITT_RLE && find_group3_syncmarker(&gb, srcsize*8) < 0)
297 break; 298 break;
298 if(compr==TIFF_CCITT_RLE || get_bits1(&gb)) 299 if(compr==TIFF_CCITT_RLE || g3d1 || get_bits1(&gb))
299 ret = decode_group3_1d_line(avctx, &gb, avctx->width, runs, runend); 300 ret = decode_group3_1d_line(avctx, &gb, avctx->width, runs, runend);
300 else 301 else
301 ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, runend, ref); 302 ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, runend, ref);
302 if(compr==TIFF_CCITT_RLE && (get_bits_count(&gb) & 7)) 303 if(compr==TIFF_CCITT_RLE && (get_bits_count(&gb) & 7))
303 skip_bits(&gb, 8 - (get_bits_count(&gb) & 7)); 304 skip_bits(&gb, 8 - (get_bits_count(&gb) & 7));