Commit Graph

30 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
Roger Leigh
7c9ca61785 cmake: Do not use absolute libm path 2020-10-09 08:32:44 +01:00
Thomas Bernard
35cc068275
CmakeLists.txt: define WORDS_BIGENDIAN when the CPU is big endian
fixes #184
2020-03-21 00:31:41 +01:00
Chris Degawa
16377d39ea
mingw-w64 cmake: Don't find libm
mingw-w64 will provide libm symbols by default without -lm and mingw-64's
libm is just a stub.

This is just to make sure that on systems with msys2 and also cygwin, cmake
doesn't find a libm that actually contains math functions.
2020-02-26 23:03:32 +00:00
Rolf Eike Beer
47b1d516d3 CMake: simplify parsing variables from configure 2019-11-15 10:45:47 +01:00
Bob Friesenhahn
f18e1a2db5 Fix Cmake HAVE_GETOPT for systems which declare getopt in stdio.h.
Fix utility baked-in getopt prototype which appears when HAVE_GETOPT is not defined.
2019-11-03 11:21:26 -06:00
Even Rouault
5e7e9b597f
CMakeLists.txt: properly set value of HOST_FILLORDER to LSB2MSB for Windows CMake builds
As can be seen in https://ci.appveyor.com/project/rleigh-codelibre/libtiff-didfs/builds/25846668/job/ory5w098j8wcij9x
log, the HOST_FILLORDER is not properly set:

[00:02:58] -- CMAKE_HOST_SYSTEM_PROCESSOR set to AMD64
[00:02:58] -- HOST_FILLORDER set to FILLORDER_MSB2LSB

Ther reason is that we match the "amd64.*" lowercase string whereas
CMAKE_HOST_SYSTEM_PROCESSOR is set to AMD64 uppercase.
2019-07-15 12:19:27 +02: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
Thomas Bernard
2201714e88
CMakeLists.txt: fix TIFF_SIZE_T 2019-02-03 14:13:54 +01: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
Even Rouault
eafc7e3052 Merge branch 'libtiff-as-subdirectory-fixes' into 'master'
Prefer target_include_directories

See merge request libtiff/libtiff!12
2018-02-09 14:32:32 +00:00
Kevin Funk
7bf855b942 Bump minimum required CMake version to v2.8.11
Because we use the BUILD_INTERFACE generator expression
2018-01-29 20:38:02 +01:00
Ben Boeckel
4eb15b2739 cmake: avoid setting hard-coded variables in the cache 2018-01-15 11:27:34 -05:00
Ben Boeckel
8d3c75b99f cmake: avoid an unnecessary intermediate variable 2018-01-15 11:27:34 -05:00
Ben Boeckel
0f2624713b cmake: avoid an unnecessary intermediate variable 2018-01-15 11:27:34 -05:00
Ben Boeckel
bed3b0cb9d cmake: avoid tautological logic 2018-01-15 11:27:34 -05:00
Ben Boeckel
fc3b735300 cmake: use check_symbol_exists
This accounts for symbols being provided by macros.
2018-01-15 11:27:34 -05: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
Even Rouault
f2a3b02040 * .travis.yml, build/travis-ci: new files from
0001-ci-Add-Travis-support-for-Linux-builds-with-Autoconf.patch by
Roger Leigh (sent to mailing list on 2017-06-08)
This patch adds support for the Travis-CI service.

* .appveyor.yml: new file from
0002-ci-Add-AppVeyor-support.patch by Roger Leigh (sent to mailing
list on 2017-06-08)
This patch adds a .appveyor.yml file to the top-level.  This allows
one to opt in to having a branch built on Windows with Cygwin,
MinGW and MSVC automatically when a branch is pushed to GitHub,
GitLab, BitBucket or any other supported git hosting service.

* CMakeLists.txt, test/CMakeLists.txt, test/TiffTestCommon.cmake: apply
patch 0001-cmake-Improve-Cygwin-and-MingGW-test-support.patch from Roger
Leigh (sent to mailing list on 2017-06-08)
This patch makes the CMake build system support running the tests
with MinGW or Cygwin.
2017-06-08 20:46:10 +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
ba57d5f0b7 * CMakeLists.txt, libtiff/test/Makefile.am: Applied patches by
Roger Leigh (via tiff mailing list on 2015-08-31.

CMake reads all version information directly from configure.ac to
avoid duplication of values.  This basically greps over the file
for the LIBTIFF_* variables, then translates them to the form
needed for cmake. This includes the release version and libtool
shared library version information.

Make shared/static library building configurable.  Currently it
always builds shared libraries, with static libs having a _static
suffix (copying zlib, but it means it's got a non-standard name).
CMake has a -DBUILD_SHARED_LIBS=ON|OFF option to select one or the
other, which is now used instead.  There's now a single "tiff"
target to build either shared or static as required, and all the
tests and tools are linked with this. Note: the Windows tests fail
when linked with a static libtiff (says: libtiff.dll not found).
Not really a regression since this was not tested up to this
point, and it's likely the unit tests haven't (ever?) been run on
Windows with a static libtiff, so there's some additional
portability issue here to address.  Works fine on UNIX systems,
and fine on Windows with the default to build a DLL.

Add a missing file which wasn't being distributed, causing unit
tests to fail.  Note that "find . -name '*.cmake'" lists all the
CMake files which need distributing in addition to all the
CMakeLists.txt files (which now are distributed).
2015-09-01 02:51:50 +00:00
Bob Friesenhahn
e9b10efff9 Additional CMake-related files were missing from the distribution tarball. 2015-08-31 00:01:18 +00:00
Bob Friesenhahn
bcf0cb43f4 Add ld-version-script option to cmake build. 2015-08-29 15:30:28 +00:00
Bob Friesenhahn
c65c70205c Fix Cmake build issues caused by Windows large file updates. 2015-08-21 01:59:33 +00:00
Bob Friesenhahn
80dc16cf74 * cmake: Add d suffix to debug libraries with MSVC. Patch #3 of 3
by Roger Leigh posted to tiff list on Wed, 1 Jul 2015 15:58:20
+0100.

* cmake: Add extra warning flags.  Patch #2 of 3 by Roger Leigh
posted to tiff list on Wed, 1 Jul 2015 15:58:20 +0100.

* cmake: Correct snprintf fallback for VS2015.  Patch #1 of 3 by
Roger Leigh posted to tiff list on Wed, 1 Jul 2015 15:58:20 +0100.
2015-07-04 22:09:27 +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