diff options
author | Even Rouault <even.rouault@spatialys.com> | 2021-06-12 00:44:47 +0200 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2021-06-12 00:44:47 +0200 |
commit | e494de484685933c04cf19394ea769e9b213c249 (patch) | |
tree | 1c19f6747d355658470e8b83186f1af3aaf8c3a1 | |
parent | 6438425ae911ec97a08b47b87cfac9e5a9b9b047 (diff) | |
download | libtiff-git-e494de484685933c04cf19394ea769e9b213c249.tar.gz |
tif_jpeg.c: with mozjpeg, disable emission of Huffman tables in JpegTables tag, and use optimize_coding
-rw-r--r-- | libtiff/tif_jpeg.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c index a3bf448c..ca386dc4 100644 --- a/libtiff/tif_jpeg.c +++ b/libtiff/tif_jpeg.c @@ -1784,6 +1784,17 @@ JPEGSetupEncode(TIFF* tif) /* mozjpeg by default enables progressive JPEG, which is illegal in JPEG-in-TIFF */ /* So explicitly disable it. */ + if( sp->cinfo.c.num_scans != 0 && + (sp->jpegtablesmode & JPEGTABLESMODE_HUFF) != 0 ) + { + /* it has been found that mozjpeg could create corrupt strips/tiles */ + /* in non optimize_coding mode. */ + TIFFWarningExt(tif->tif_clientdata, module, + "mozjpeg library likely detected. Disable emission of " + "Huffman tables in JpegTables tag, and use optimize_coding " + "to avoid potential issues"); + sp->jpegtablesmode &= ~JPEGTABLESMODE_HUFF; + } sp->cinfo.c.num_scans = 0; sp->cinfo.c.scan_info = NULL; |