diff --git a/ChangeLog b/ChangeLog index fe756341..167fa461 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-04-21 Frank Warmerdam + + * libtiff/tif_jpeg.c: avoid preparing jpeg tables everytime + JPEGSetupEncode() is called if the tables already seem to be + established. This prevents spurious updates and rewriting of + directories with jpegtables when doing updates to existing images. + http://trac.osgeo.org/gdal/ticket/3539 + 2010-04-20 Olivier Paquet * libtiff/tif_dirinfo.c: Use correct set_field_type for diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c index d7cb5862..feba186e 100644 --- a/libtiff/tif_jpeg.c +++ b/libtiff/tif_jpeg.c @@ -1,4 +1,4 @@ -/* $Id: tif_jpeg.c,v 1.88 2010-03-10 18:56:48 bfriesen Exp $ */ +/* $Id: tif_jpeg.c,v 1.89 2010-04-21 20:46:17 fwarmerdam Exp $ */ /* * Copyright (c) 1994-1997 Sam Leffler @@ -1612,12 +1612,16 @@ JPEGSetupEncode(TIFF* tif) /* Create a JPEGTables field if appropriate */ if (sp->jpegtablesmode & (JPEGTABLESMODE_QUANT|JPEGTABLESMODE_HUFF)) { - if (!prepare_JPEGTables(tif)) - return (0); - /* Mark the field present */ - /* Can't use TIFFSetField since BEENWRITING is already set! */ - TIFFSetFieldBit(tif, FIELD_JPEGTABLES); - tif->tif_flags |= TIFF_DIRTYDIRECT; + if( sp->jpegtables == NULL + || memcpy(sp->jpegtables,"\0\0\0\0\0\0\0\0\0",8) == 0 ) + { + if (!prepare_JPEGTables(tif)) + return (0); + /* Mark the field present */ + /* Can't use TIFFSetField since BEENWRITING is already set! */ + tif->tif_flags |= TIFF_DIRTYDIRECT; + TIFFSetFieldBit(tif, FIELD_JPEGTABLES); + } } else { /* We do not support application-supplied JPEGTables, */ /* so mark the field not present */