AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1999.09.13 07:22 "uge G4 fax compressed TIFF", by Jacques Thiebauld
1999.09.14 00:17 "Re: uge G4 fax compressed TIFF", by Daniel McCoy
1999.09.14 04:59 "Re: uge G4 fax compressed TIFF", by Niles Ritter
1999.09.14 13:54 "RE: uge G4 fax compressed TIFF", by Ed Grissom
1999.09.16 10:21 "Re: uge G4 fax compressed TIFF", by Ivo Penzar
1999.09.14 08:17 "Re: uge G4 fax compressed TIFF", by Klaus Bartz
1999.09.14 15:15 "Re: uge G4 fax compressed TIFF", by Peter Smith
1999.09.14 18:32 "Re: uge G4 fax compressed TIFF", by Michael L. Welles
1999.09.15 06:57 "[Repost: Fix for decompression bug (sizes >= 65536)]", by François Dagand
1999.09.15 08:57 "[Fwd: Fix for decompression bug (sizes >= 65536)]", by Jacques Thiebauld

1999.09.15 06:57 "[Repost: Fix for decompression bug (sizes >= 65536)]", by François Dagand

Hello again,

I just received a mail from Frank D. Cringle, the guy who wrote viewfax, a software for displaying TIFF files on X-Windows. The decompression algorithm for this software was used in libtiff, according to the comments. This soft also had a problem for tiffs wider than 65536 pixels. Frank gave me a correction for this bug in viewfax, and I was able to port the correction to libtiff. Don't ask me how it works, though.

If you want to go over that limit of 65536, modify files tif_fax3.h and tif_fax3.c (lines number from v3.4 beta). ">" is the modified code, "<" is the original:

tif_fax3.h:

46c46
<  * fillruns(unsigned char* buf, uint16* runs, uint16* erun, uint32 lastx)
>  * fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
55c55
< typedef void (*TIFFFaxFillFunc)(unsigned char*, uint16*, uint16*, uint32);
> typedef void (*TIFFFaxFillFunc)(unsigned char*, uint32*, uint32*, uint32);
63c63
< extern void _TIFFFax3fillruns(unsigned char*, uint16*, uint16*, uint32);
> extern void _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32);
87c87
<  uint16 Param;  /* unsigned 16-bit run length in bits */
>  uint32 Param;  /* unsigned 32-bit run length in bits */

tif_fax3.c:

81,83c81,83
<  uint16* runs;      /* b&w runs for current/previous row */
<  uint16* refruns;  /* runs for reference line */
<  uint16* curruns; /* runs for current line */
>  uint32* runs;      /* b&w runs for current/previous row */
>  uint32* refruns;  /* runs for reference line */
>  uint32* curruns; /* runs for current line */
120,121c120,121
<     uint16* pa;    /* place to stuff next run */ \
<     uint16* thisrun;   /* current row's run array */ \
>     uint32* pa;    /* place to stuff next run */ \
>     uint32* thisrun;   /* current row's run array */ \
128c128
<     uint16* pb    /* next run in reference line */\
>     uint32* pb    /* next run in reference line */\
298c298
<   SWAP(uint16*, sp->curruns, sp->refruns);
>   SWAP(uint32*, sp->curruns, sp->refruns);
361c361
< _TIFFFax3fillruns(u_char* buf, uint16* runs, uint16* erun, uint32 lastx)
> _TIFFFax3fillruns(u_char* buf, uint32* runs, uint32* erun, uint32 lastx)
502c502
<   dsp->runs = (uint16*) _TIFFmalloc(nruns*sizeof (uint16));
>   dsp->runs = (uint32*) _TIFFmalloc(nruns*sizeof (uint32));
1378c1378
<   SWAP(uint16*, sp->curruns, sp->refruns);
>   SWAP(uint32*, sp->curruns, sp->refruns);

--- end ---