diff options
author | fwarmerdam <fwarmerdam> | 2010-06-14 02:47:16 +0000 |
---|---|---|
committer | fwarmerdam <fwarmerdam> | 2010-06-14 02:47:16 +0000 |
commit | 005840d648f5d66ff4dc9db7721611b84eef5466 (patch) | |
tree | 33240b9f3ddfcd6e12475ed0154e0cfc45e458ab | |
parent | ca24b1957b9dc0a9cbe24754eb38b18553e18fb2 (diff) | |
download | libtiff-005840d648f5d66ff4dc9db7721611b84eef5466.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 */ |