Commit Graph

127 Commits

Author SHA1 Message Date
Even Rouault
3a2de853a9
Add support for optional building against libdeflate for faster Zip/Deflate compression/decompression.
So we can have 2 kind of builds with the Zip/Deflate codec:
- zlib only
- zlib + libdeflate

Speed improvements in the 35%-50% range can be expected when libdeflate is used.
Compression level up to 12 is now supported (capped to 9 when zlib is used).
Still requires zlib for situations where libdeflate cannot be used (that
is for scanline access, since libdeflate has no streaming mode)

Pseudo-tag TIFFTAG_DEFLATE_SUBCODEC=DEFLATE_SUBCODEC_ZLIB/DEFLATE_SUBCODEC_LIBDEFLATE
is added to control which subcodec (zlib or libdeflate) should be used (it defaults
of course to libdeflate, when it is available).
This is mostly aimed at being used on the writing side, to be able to reproduce
output of previous libtiff versions at a binary level, in situations where this would
be really needed. Or as a safety belt in case there would be unforeseen issues
with using libdeflate.
It can be used to know when libdeflate is available at runtime (DEFLATE_SUBCODEC_LIBDEFLATE
will be the default value in that situation).

Of course, deflate codestreams produced by libdeflate can be read by zlib, and vice-versa.
2020-10-16 13:40:10 +02:00
Bob Friesenhahn
e0d707dc15 libtiff 4.1.0 released 2019-11-03 14:15:37 -06:00
Thomas Bernard
4d26884a15
make TIFF_SSIZE_T the same bitwidth as TIFF_SIZE_T
it was previously the same bitwidth as unsigned char *
Pointers can be larger than size_t.
2019-05-31 20:10:51 +02:00
Even Rouault
371ad2658c
Make defer strile offset/bytecount loading available at runtime
... and add per-strile offset/bytecount loading capabilities.

Part of this commit makes the behaviour that was previously met when
libtiff was compiled with -DDEFER_STRILE_LOAD available for default builds
when specifying the new 'D' (Deferred) TIFFOpen() flag. In that mode, the [Tile/Strip][ByteCounts/Offsets]
arrays are only loaded when first accessed. This can speed-up the opening
of files stored on the network when just metadata retrieval is needed.
This mode has been used for years by the GDAL library when compiled with
its embeded libtiff copy.

To avoid potential out-of-tree code (typically codecs) that would use
the td_stripbytecount and td_stripoffset array inconditionnaly assuming they
have been loaded, those have been suffixed with _p (for protected). The
use of the new functions mentionned below is then recommended.

Another addition of this commit is the capability of loading only the
values of the offset/bytecount of the strile of interest instead of the
whole array. This is enabled with the new 'O' (Ondemand) flag of TIFFOpen()
(which implies 'D'). That behaviour has also been used by GDAL, which hacked
into the td_stripoffset/td_stripbytecount arrays directly. The new code
added in the _TIFFFetchStrileValue() and _TIFFPartialReadStripArray() internal
functions is mostly a port of what was in GDAL GTiff driver previously.

Related to that, the public TIFFGetStrileOffset[WithErr]() and TIFFGetStrileByteCount[WithErr]()
functions have been added to API. They are of particular interest when
using sparse files (with offset == bytecount == 0) and you want to detect
if a strile is present or not without decompressing the data, or updating
an existing sparse file.
They will also be used to enable a future enhancement where client code can entirely
skip bytecount loading in some situtations

A new test/defer_strile_loading.c test has been added to test the above
capabilities.
2019-05-10 14:46:45 +02:00
Bob Friesenhahn
b8eac98dd0 libtiff 4.0.10 released. 2018-11-10 09:33:11 -06:00
Norman Barker
9eacd59fec webp in tiff 2018-10-05 11:21:17 -05:00
Roger Leigh
14f304998e port: Add strtol, strtoll and strtoull
Also update strtoul.  All use the same implementation from NetBSD libc.
2018-03-23 22:37:17 +00:00
Even Rouault
442fa64e41 Merge branch 'zstd' 2018-02-14 15:41:04 +01:00
Ben Boeckel
f5b23ab1bf cmake: remove unused configure checks 2018-01-15 11:27:34 -05:00
Even Rouault
62b9df5d2a Add ZSTD compression codec
From https://github.com/facebook/zstd
"Zstandard, or zstd as short version, is a fast lossless compression
algorithm, targeting real-time compression scenarios at zlib-level
and better compression ratios. It's backed by a very fast entropy stage,
provided by Huff0 and FSE library."

We require libzstd >= 1.0.0 so as to be able to use streaming compression
and decompression methods.

The default compression level we have selected is 9 (range goes from 1 to 22),
which experimentally offers equivalent or better compression ratio than
the default deflate/ZIP level of 6, and much faster compression.

For example on a 6600x4400 16bit image, tiffcp -c zip runs in 10.7 seconds,
while tiffcp -c zstd runs in 5.3 seconds. Decompression time for zip is
840 ms, and for zstd 650 ms. File size is 42735936 for zip, and
42586822 for zstd. Similar findings on other images.

On a 25894x16701 16bit image,

                Compression time     Decompression time     File size

ZSTD                 35 s                   3.2 s          399 700 498
ZIP/Deflate       1m 20 s                   4.9 s          419 622 336
2017-12-21 13:32:02 +01:00
Bob Friesenhahn
020bd2fd3b * configure.ac: libtiff 4.0.9 released. 2017-11-18 20:00:43 +00:00
Bob Friesenhahn
84e1f1b66d libtiff 4.0.8 released 2017-05-21 19:10:50 +00:00
Bob Friesenhahn
884f973652 * libtiff 4.0.7 released.
* configure.ac: Update for 4.0.7 release.
2016-11-19 17:47:39 +00:00
Bob Friesenhahn
5612707c08 Fix failure to update libtiff version in AC_INIT. 2015-09-12 19:50:39 +00:00
Bob Friesenhahn
20dc498028 * libtiff 4.0.6 released. 2015-09-12 19:46:23 +00:00
Bob Friesenhahn
a9afad2a9f * Makefile.am (distcheck-hook), configure.ac: Applied patches by
Roger Leigh (via tiff mailing list on 2015-09-01) to fix issue
with BSD make and to make use of cmake in 'distcheck' target
conditional on if cmake is available.
2015-09-01 19:23:16 +00:00
Bob Friesenhahn
e762ba3de9 * CMakeLists.txt, Makefile.am, configure.ac: Applied patches by
Roger Leigh (via tiff mailing list on 2015-09-01).

CMake build is now included in 'distcheck' target.

Builds with CMake 2.8.9 and newer.

Tar is now resquested to use POSIX PAX format.
2015-09-01 15:38:01 +00:00
Bob Friesenhahn
27e622bff5 * configure.ac: libtiff 4.0.5 released. 2015-08-30 17:37:46 +00:00
Bob Friesenhahn
8ba4a1c894 Support large files under Windows using tif_unix.c and libtiff tools. 2015-08-19 02:31:04 +00:00
Bob Friesenhahn
5b90af247e * CMakeLists.txt: Add CMake patchset by Roger Leigh as posted to
libtiff mailing list on Mon, 22 Jun 2015 21:21:01 +0100. Several
corrections to ensure that the autotools build still works were
added by me.  I have not yet tested the build using 'cmake' or
MSVC with 'nmake'.
2015-06-25 02:27:58 +00:00
Bob Friesenhahn
f5047249d2 * libtiff 4.0.4 released. 2015-06-21 19:13:03 +00:00
Bob Friesenhahn
bdd91bbdf8 * configure.ac: Add a HAVE_FOO Automake conditional for each
add-on library.

* test/Makefile.am (JPEG_DEPENDENT_CHECK_PROG): raw_decode
requires JPEG support to compile.  Use Automake conditional to
only include it when JPEG support is available.
2015-06-21 18:46:29 +00:00
Bob Friesenhahn
d21d2b3057 * libtiff/tif_config.vc.h: Make adjustments to match the new
definitions that configure produces, including for WIN64.  Still
needs to be tested.

'lld' is not assured by the run-time DLLs and so GCC warns.
Add TIFF_SIZE_T and TIFF_SIZE_FORMAT to provide a type definition
and printf format specifier to deal with printing values of
'size_t' type.  In particular, this was necessary for WIN64.
Added a configure test for if the system headers provide 'optarg'
(normal case) and block out the many explicit 'extern' statements
in the utilities.  This was found to be necessary under Windows
when getopt is in a DLL and the symbols are already imported with
dllimport via standard header files.
2015-06-21 01:09:09 +00:00
Bob Friesenhahn
108fe0c660 * configure.ac: For 64-bit MinGW, fix SSIZE_FORMAT formatting
specifier.  64-bit MinGW supports 'long long' but support for
'lld' is not assured by the run-time DLLs.
2015-06-20 20:33:17 +00:00
Lee Howard
b5587ac2e4 From Ludolf Holzheid on Bugzilla Bug #2498:
Attached is a patch that adds a configure option to select the file I/O style
on Windows hosts.

It defaults to --enable-win32-io on all windows targets other than Cygwin and
to --disable-win32-io on Cygwin, and thus should be backwards-compatible.

This allows programs using the Unix file I/O style (such as Netpbm's tifftopnm)
to link against libtiff if configured for e.g. MinGW.
2015-06-14 22:55:16 +00:00
Lee Howard
a411152d3f From Marcos H. Woehrmann on Bugzilla Bug #2405. This corrects the shell equality operator. 2015-06-14 21:51:17 +00:00
Bob Friesenhahn
478e51124b * tools/gif2tiff.c (readgifimage): Fix Coverity 1024222 "Untrusted
value as argument".
(checksignature): Fix Coverity 1024894 "Ignoring number of bytes
read".
(readextension): Fix Coverity 1024893 "Ignoring number of bytes
read".
(readgifimage): Fix Coverity 1024890 "Ignoring number of bytes
read".
(readraster): Fix Coverity 1024891 "Ignoring number of bytes
read".
(readgifimage): Fix Coverity 1024892 "Ignoring number of bytes
read".
2015-05-30 20:15:59 +00:00
Even Rouault
a1caf14ce4 * libtiff 4.0.4beta released 2015-01-26 12:24:11 +00:00
Bob Friesenhahn
e90c73e611 * configure.ac: Applied patch by Brad Smith to improve pkg-config
static linking by adding -lm to Libs.private when needed.
2013-03-29 16:50:11 +00:00
Bob Friesenhahn
21a904d74c * libtiff 4.0.3 released. 2012-09-22 16:12:43 +00:00
Bob Friesenhahn
7d38024b8d * libtiff{tiff.h, tif_print.c, tif_dirinfo.c, tif_dirread.c}: Add
some TIFF/FX support in libtiff.  Add the tag definitions to
tiff.h.  Add the related TIFF field definitions to tif_dirinfo.c,
and also fixes an error in a comment.  Adds the photometric values
to tif_print.c, and fixes a bug.  These changes are by Steve
Underwood.

* libtiff/tif_write.c: Fix bug rewriting image tiles in a
2012-08-19 16:56:32 +00:00
Frank Warmerdam
111baa289b updated for 4.0.2 release 2012-06-16 00:19:35 +00:00
Bob Friesenhahn
75b1743466 * libtiff 4.0.1 released. 2012-02-18 22:11:19 +00:00
Bob Friesenhahn
b326998fc2 * configure.ac: Add support for using library symbol versioning on
ELF systems with the GNU linker.  Support is enabled via
--enable-ld-version-script.  Disabled by default for now until
there is a decision for how to deploy a libtiff with versioned
symbols after libtiff 4.0.0 was already released.
2012-01-22 19:50:36 +00:00
Bob Friesenhahn
d338f7fe22 * configure.ac: Add libtiff private dependency on -llzma for
pkg-config.  Patch by Mark Brand.
Updated Automake to 1.11.2.
2011-12-22 17:03:48 +00:00
Bob Friesenhahn
f7b79dc7dc Released libtiff 4.0.0. 2011-12-22 00:29:28 +00:00
Bob Friesenhahn
feab28eac4 Release v4-0-0beta7. 2011-04-09 21:01:00 +00:00
Bob Friesenhahn
c546a4ccf8 * configure.ac: Should use AC_CANONICAL_HOST since host specifies
the run-time target whereas target is used to specify the final
output target if the package is a build tool (like a compiler),
which libtiff is not.  Resolves libtiff bug 2307 "Use
AC_CANONICAL_HOST macro".
2011-04-09 15:43:03 +00:00
Bob Friesenhahn
519b727004 * configure.ac: Support configuring TIFF_INT64_FORMAT and
TIFF_UINT64_FORMAT appropriately for MinGW32.

* tools/tiffdump.c (ReadDirectory): MinGW32 needs to use WIN32
printf conventions for 64-bit types because it uses the WIN32 CRT.

* libtiff/{tif_dumpmode.c,tif_luv.c,tif_lzw.c,tif_print.c,
tif_read.c,tif_strip.c,tif_thunder.c}: MinGW32 needs to use WIN32
printf conventions for 64-bit types because it uses the WIN32 CRT.

* tools/tiff2pdf.c (t2p_write_pdf_string): Fix printf syntax not
understood by WIN32 CRT.
2011-04-02 20:54:08 +00:00
Frank Warmerdam
9d37e46393 fix macro set for chunky-read-support 2011-02-18 22:28:58 +00:00
Frank Warmerdam
bc3bc9925b added a configure option to enable CHUNKY_STRIP_READ support (--enable-chunky-strip-read) 2011-02-18 21:54:22 +00:00
Frank Warmerdam
82361dfa04 implement optional support for deferred strip/tile offset/size loading 2011-02-18 20:53:04 +00:00
Lee Howard
ccdc78ec32 * configure.ac, libtiff/Makefile.am: Build tif_win32.c on
Windows except on Cygwin
        http://bugzilla.maptools.org/show_bug.cgi?id=2224
2010-12-15 00:37:00 +00:00
Andrey Kiselev
a2d72c2dd4 Implement a new TIFF compression scheme LZMA reserving a new value 34925 for
Compression tag. As per bug http://bugzilla.maptools.org/show_bug.cgi?id=2221
2010-12-14 12:52:59 +00:00
Bob Friesenhahn
faf5f3ebae * libtiff-4.pc.in: Added libtiff pkg-config .pc file support.
Patch by Vincent Torri.
2010-11-27 20:54:51 +00:00
Bob Friesenhahn
af78267c3b * libtiff 4.0.0alpha6 released. 2010-06-11 22:58:57 +00:00
Bob Friesenhahn
d4038e39c5 * libtiff 4.0.0alpha5 released. 2009-11-04 17:49:25 +00:00
Bob Friesenhahn
8743e53820 * configure.ac: x86_64 should use the same fill order as i386. 2009-10-07 20:15:26 +00:00
Bob Friesenhahn
aeb4c8be72 * libtiff 4.0.0alpha4 released.
* HOWTO-RELEASE: Improved release instructions.
2009-08-27 17:40:49 +00:00
Bob Friesenhahn
8297307011 * configure.ac: Updated autotools. Autoconf 2.64, Automake 1.11,
libtool 2.2.6.  Enabled support for silent build rules
(--enable-silent-rules or 'make V=0') and colorized tests.

* html/{index.html, v3.9.0.html}: Update for 3.9.0 release.
2009-08-20 22:57:38 +00:00