diff options
author | Frank Warmerdam <warmerdam@pobox.com> | 2010-06-14 02:47:16 +0000 |
---|---|---|
committer | Frank Warmerdam <warmerdam@pobox.com> | 2010-06-14 02:47:16 +0000 |
commit | 35c4f9d3f9b4100f8249f7e1fdba3aa344eb97c8 (patch) | |
tree | fe88cc9fe2a2ea62c0cbf4ecdd30039817c0bdf0 | |
parent | 7801642bce2ce0c6500e835ca2a6c87ab01087bd (diff) | |
download | libtiff-git-35c4f9d3f9b4100f8249f7e1fdba3aa344eb97c8.tar.gz |
avoid recreate jpegtables unnecessarily (#2135, gdal#3633)
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | libtiff/tif_jpeg.c | 18 |
2 files changed, 14 insertions, 7 deletions
@@ -1,5 +1,8 @@ 2010-06-13 Frank Warmerdam <warmerdam@pobox.com> + * libtiff/tif_jpeg.c: avoid re-preparing jpeg tables unnecessarily + (gdal #3633, libtiff #2135). + * libtiff/tif_dirread.c: Fixed bad handling of out of order tags definated late by a codec (#2210) diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c index 0f7c8dc1..a967827e 100644 --- a/libtiff/tif_jpeg.c +++ b/libtiff/tif_jpeg.c @@ -1,4 +1,4 @@ -/* $Id: tif_jpeg.c,v 1.50.2.8 2010-06-08 18:50:42 bfriesen Exp $ */ +/* $Id: tif_jpeg.c,v 1.50.2.9 2010-06-14 02:47:16 fwarmerdam Exp $ */ /* * Copyright (c) 1994-1997 Sam Leffler @@ -1269,12 +1269,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 + || memcmp(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 */ |