# HG changeset patch # User kostya # Date 1254115040 0 # Node ID 370d05e51d90f214c112e7c443f244dce65996ce # Parent 8a49525f2b1edde455166befa9dabce7470ea710 Finally distinguish TIFF_CCITT_RLE and TIFF_G3 1-D case, so both of them will be decoded correctly. This fixes issue 1423. diff -r 8a49525f2b1e -r 370d05e51d90 faxcompr.c --- a/faxcompr.c Mon Sep 28 05:15:27 2009 +0000 +++ b/faxcompr.c Mon Sep 28 05:17:20 2009 +0000 @@ -269,7 +269,7 @@ int ff_ccitt_unpack(AVCodecContext *avctx, const uint8_t *src, int srcsize, - uint8_t *dst, int height, int stride, enum TiffCompr compr) + uint8_t *dst, int height, int stride, enum TiffCompr compr, int opts) { int j; GetBitContext gb; @@ -293,9 +293,10 @@ return -1; } }else{ + int g3d1 = (compr == TIFF_G3) && !(opts & 1); if(compr!=TIFF_CCITT_RLE && find_group3_syncmarker(&gb, srcsize*8) < 0) break; - if(compr==TIFF_CCITT_RLE || get_bits1(&gb)) + if(compr==TIFF_CCITT_RLE || g3d1 || get_bits1(&gb)) ret = decode_group3_1d_line(avctx, &gb, avctx->width, runs, runend); else ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, runend, ref); diff -r 8a49525f2b1e -r 370d05e51d90 faxcompr.h --- a/faxcompr.h Mon Sep 28 05:15:27 2009 +0000 +++ b/faxcompr.h Mon Sep 28 05:17:20 2009 +0000 @@ -40,6 +40,6 @@ */ int ff_ccitt_unpack(AVCodecContext *avctx, const uint8_t *src, int srcsize, - uint8_t *dst, int height, int stride, enum TiffCompr compr); + uint8_t *dst, int height, int stride, enum TiffCompr compr, int opts); #endif /* AVCODEC_FAXCOMPR_H */ diff -r 8a49525f2b1e -r 370d05e51d90 tiff.c --- a/tiff.c Mon Sep 28 05:15:27 2009 +0000 +++ b/tiff.c Mon Sep 28 05:17:20 2009 +0000 @@ -146,13 +146,11 @@ src2[i] = ff_reverse[src[i]]; } memset(src2+size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - if(s->compr == TIFF_G3 && !(s->fax_opts & 1)) - s->compr = TIFF_CCITT_RLE; switch(s->compr){ case TIFF_CCITT_RLE: case TIFF_G3: case TIFF_G4: - ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride, s->compr); + ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride, s->compr, s->fax_opts); break; } av_free(src2);