avoid spurious jpeg table updates

This commit is contained in:
Frank Warmerdam 2010-04-21 20:46:17 +00:00
parent 117b4bd0c6
commit 80b552d22f
2 changed files with 19 additions and 7 deletions

View File

@ -1,3 +1,11 @@
2010-04-21 Frank Warmerdam <warmerdam@pobox.com>
* 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 <olivier.paquet@gmail.com>
* libtiff/tif_dirinfo.c: Use correct set_field_type for

View File

@ -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( 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! */
TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
tif->tif_flags |= TIFF_DIRTYDIRECT;
TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
}
} else {
/* We do not support application-supplied JPEGTables, */
/* so mark the field not present */