| 1 |
Changes in TIFF v4.0.0 |
| 2 |
====================== |
| 3 |
|
| 4 |
.. table:: References |
| 5 |
:widths: auto |
| 6 |
|
| 7 |
====================== ========================================== |
| 8 |
Current Version v4.0.0 (:tag:`Release-v4-0-0`) |
| 9 |
Previous Version :doc:`v3.9.5 <v3.9.5>` |
| 10 |
Master Download Site `<https://download.osgeo.org/libtiff/>`_ |
| 11 |
Master HTTP Site `<https://download.osgeo.org/libtiff/>`_ |
| 12 |
====================== ========================================== |
| 13 |
|
| 14 |
|
| 15 |
This document describes the changes made to the software between the |
| 16 |
*previous* and *current* versions (see above). If you don't |
| 17 |
find something listed here, then it was not done in this timeframe, or |
| 18 |
it was not considered important enough to be mentioned. Please consult |
| 19 |
the ChangeLog file in the source package for full change details. The |
| 20 |
following information is located here: |
| 21 |
|
| 22 |
|
| 23 |
Major changes |
| 24 |
------------- |
| 25 |
|
| 26 |
BigTIFF support changes: |
| 27 |
|
| 28 |
* The ``options`` parameter in the :c:func:`TIFFOpen` and :c:func:`TIFFClientOpen` funcs has |
| 29 |
been extended. When creating new files, you can add option ``4`` to |
| 30 |
specify you want to create a ClassicTIFF file, though that is the |
| 31 |
default and the option is not strictly necessary. (As such, old |
| 32 |
calling code will continue to function and create ClassicTIFF files.) |
| 33 |
Or you can add option ``8`` to specify you want to create a BigTIFF file |
| 34 |
instead. This new option is also reflected in some of the tools we |
| 35 |
already upgraded. For instance, you can use the ``-8`` option on :program:`tiffcp` to |
| 36 |
have :program:`tiffcp` produce BigTIFF files instead of the default ClassicTIFF. |
| 37 |
(Whilst an additional option is provided for version selection when |
| 38 |
creating new files, no such option is necessary when reading TIFF |
| 39 |
files. LibTiff reads ClassicTIFF and BigTIFF both, and the application |
| 40 |
does not need to be aware which TIFF version an opened file is.) |
| 41 |
|
| 42 |
* Although the tag count in BigTIFF is 64bit, we restricted the |
| 43 |
count in the implementation to a much more reasonable size. This is |
| 44 |
necessary in current implementation, because all tag data gets read |
| 45 |
automatically in the IFD reading stage, so if there's half a dozen |
| 46 |
private tags with multiple gigabytes of data that causes considerable |
| 47 |
overhead even if the application level is never interested in these |
| 48 |
tags. Our choice to ignore tags with data longer then a certain sanity |
| 49 |
value is much needed as things stand. We also recommend to step away |
| 50 |
from writing tiles that are 8 kilobyte in their uncompressed form, or |
| 51 |
writing single-line strips, in really big files, resulting in mega's |
| 52 |
of tiles or strips. It's much more efficient to choose bigger tile or |
| 53 |
strip sizes, up to several megabyte if needed, and have a few kilo of |
| 54 |
tiles or strips instead. |
| 55 |
|
| 56 |
* Although it's rare, some application code does directly access |
| 57 |
file offsets. Some of these are automatically upgraded because they |
| 58 |
used the :c:type:`toff_t` type, others need to be aware that the datatype |
| 59 |
changed and need to start using :c:type:`toff_t` or :c:type:`uint64`. This impacts access |
| 60 |
to tags like the ``EXIF`` IFD tag, for example, or the ``SubIfds`` tag, or to |
| 61 |
``StripOffsets`` or ``TileOffsets``, the return type of functions like |
| 62 |
:c:func:`TIFFCurrentDirOffset`, and a parameter type to functions like |
| 63 |
:c:func:`TIFFSetSubDirectory`. |
| 64 |
|
| 65 |
* Although it's rare, some application code does use structures |
| 66 |
like :c:struct:`TIFFHeader` or :c:struct:`TIFFDirEntry` that used to be an exact binary |
| 67 |
representation of TIFF structures. These need to change. The old |
| 68 |
TIFFHeader structure is replaced by the new TIFFHeaderClassic, |
| 69 |
TIFFHeaderBig, and TIFFHeaderCommon structures that are an exact |
| 70 |
binary representation of the ClassicTIFF and BigTIFF header, and of |
| 71 |
the part that is common to both. There is no new equivalent for the |
| 72 |
old :c:struct:`TIFFDirEntry` structure (or more precisely, there is still a |
| 73 |
:c:struct:`TIFFDirEntry` structure, but it is changed, moved to library-private |
| 74 |
definition, and no longer an exact binary representation of the tag |
| 75 |
structure of either TIFF version). |
| 76 |
|
| 77 |
* Sizer functions, like :c:func:`TIFFTileSize` or :c:func:`TIFFScanlineSize` and the |
| 78 |
like, return a :c:func:`tmsize_t` value (:c:func:`tmsize_t` is defined as :c:type:`int32` on 32bit |
| 79 |
machines, and :c:type:`int64` on 64bit machines, and as such it is meant to |
| 80 |
represent signed memory sizes). This is because we figure 98% of the |
| 81 |
calling code uses the return value as sizes in allocations and the |
| 82 |
like. So, any overflow that is theoretically possible with BigTIFF |
| 83 |
when LibTiff is running on a 32bit system, is best detected inside the |
| 84 |
sizer functions and it is best to return a type that makes sense as a |
| 85 |
memory size. If your calling code is the exception and is interested |
| 86 |
in actual file size, you best use the newer :c:func:`TIFFTileSize64` or |
| 87 |
:c:func:`TIFFScanlineSize64` function that returns an :c:type:`uint64` type. |
| 88 |
|
| 89 |
* These TIFF tags require a 64-bit type as an argument in |
| 90 |
libtiff 4.0.0: |
| 91 |
|
| 92 |
* :c:macro:`TIFFTAG_FREEBYTECOUNTS` |
| 93 |
* :c:macro:`TIFFTAG_FREEOFFSETS` |
| 94 |
* :c:macro:`TIFFTAG_STRIPBYTECOUNTS` |
| 95 |
* :c:macro:`TIFFTAG_STRIPOFFSETS` |
| 96 |
* :c:macro:`TIFFTAG_TILEBYTECOUNTS` |
| 97 |
* :c:macro:`TIFFTAG_TILEOFFSETS` |
| 98 |
|
| 99 |
Other important backward incompatible changes in the public API: |
| 100 |
|
| 101 |
* :c:func:`TIFFRewriteField` renamed into :c:func:`_TIFFRewriteField` and moved out |
| 102 |
from the public interface (from :file:`tiffio.h` to :file:`tiffiop.h`). Type of its |
| 103 |
``count`` parameter changed from :c:type:`uint32` to :c:type:`tmsize_t`. |
| 104 |
|
| 105 |
* :c:func:`TIFFMergeFieldInfo` returns non-void result now. It returns 0 |
| 106 |
if successful and -1 if failed. Though this is now obsoleted function |
| 107 |
and should not be used in new programs. Use the new tag extension |
| 108 |
scheme instead. |
| 109 |
|
| 110 |
* :c:func:`TIFFFieldWithTag` and :c:func:`TIFFFieldWithName` functions now return |
| 111 |
pointer to :c:struct:`TIFFField` constant object instead of :c:struct:`TIFFFieldInfo`. |
| 112 |
|
| 113 |
* :c:func:`TIFFReassignTagToIgnore` function and :c:enum:`TIFFIgnoreSense` enumeration |
| 114 |
have been removed. They was unused and never been used properly. |
| 115 |
Should be unneeded for high-level applications. |
| 116 |
|
| 117 |
* :c:struct:`TIFFTagValue` structure removed from the public :file:`tiffio.h` |
| 118 |
to private :file:`tif_dir.h` and not accessible anymore. It should be unneeded |
| 119 |
for high-level applications. |
| 120 |
|
| 121 |
|
| 122 |
Software configuration changes |
| 123 |
------------------------------ |
| 124 |
|
| 125 |
Updated autotools: Autoconf 2.68, Automake 1.11.1, libtool 2.4. |
| 126 |
|
| 127 |
* Enabled support for Automake silent build rules |
| 128 |
(``--enable-silent-rules`` or ``make V=0``) |
| 129 |
|
| 130 |
* Enabled support for Automake colorized and parallel tests. |
| 131 |
|
| 132 |
* Added detection of 64-bit integer types since libtiff 4.0 |
| 133 |
requires use of 64-bit signed and unsigned integer types. |
| 134 |
|
| 135 |
* Libtiff now provides a more comprehensive test suite with |
| 136 |
over 72 tests, which may be executed on Unix-like systems, or |
| 137 |
under Microsoft Windows using MinGW/MSYS or Cygwin. |
| 138 |
|
| 139 |
* ``--disable-lzma`` configure option to disable use of liblzma. |
| 140 |
|
| 141 |
* ``--enable-defer-strile-load`` configure option to enable |
| 142 |
experimental deferred strip/tile offset/size loading. May |
| 143 |
cause some extremely sophisticated uses of libtiff to fail. |
| 144 |
|
| 145 |
* ``--enable-chunky-strip-read`` configure option to enable |
| 146 |
experimental enable reading large strips in chunks in |
| 147 |
:c:func:`TIFFReadScanline`. |
| 148 |
|
| 149 |
* Now always uses WIN32 native I/O functions for Microsoft |
| 150 |
Windows except for under Cygwin. |
| 151 |
|
| 152 |
* Now provides a pkg-config support file (libtiff-4.pc). |
| 153 |
|
| 154 |
|
| 155 |
Library changes |
| 156 |
--------------- |
| 157 |
|
| 158 |
* Patches/fixes made to stable libtiff (v3.9.X) are also |
| 159 |
applied to 4.0.0. There are too many to list here. See the |
| 160 |
distribution :file:`ChangeLog` for a detailed change list. |
| 161 |
|
| 162 |
* There is considerable change in some files like |
| 163 |
:c:func:`tif_dirread` and :c:func:`tif_dirwrite`. These changes don't impact |
| 164 |
backwards compatibility, they are mostly a clean rewrite that |
| 165 |
does allow BigTIFF support as well as somewhat more robust |
| 166 |
reading of the unexpected already and will also serve future |
| 167 |
API extension but does not impact current API or functionality |
| 168 |
in a negative way that you need to know about. |
| 169 |
|
| 170 |
* Although there is still a functional definition for types |
| 171 |
like :c:type:`toff_t` (file offset), :c:type:`tstrip_t` (strip index number), etc, |
| 172 |
we recommend against using these in newer code. We have |
| 173 |
learned that it is next to impossible to use these |
| 174 |
consistently and make real abstraction of the binary format of |
| 175 |
these types. Instead, at a certain level we always end up |
| 176 |
doing casts anyway, and taking the exact binary format into |
| 177 |
account, so these types are nothing but dangerously misleading |
| 178 |
and obfuscating. You do not need to update calling code that |
| 179 |
uses them, as 99.9% of such code will continue to work. But we |
| 180 |
recommend against using them in newer calling code, and we |
| 181 |
started replacing them with binary clear types like :c:type:`uint16`, |
| 182 |
:c:type:`uint32` and such in the library. |
| 183 |
|
| 184 |
* We do use and will continue to use one functional type |
| 185 |
that is an exception to the above rule, being :c:type:`tmsize_t`. This |
| 186 |
is a signed memory size type, i.e. it is :c:type:`int32` on 32bit |
| 187 |
machines, or :c:type:`int64` on 64bit machines. |
| 188 |
|
| 189 |
* Optionally support LZMA compression via TIFF tag 34925. |
| 190 |
:program:`tiffcp` supports compression levels similar to ``-c lzma:p1`` or |
| 191 |
``-c zip:p9`` for setting the LZMA compression parameters. |
| 192 |
|
| 193 |
* Optionally defer the load of strip/tile offset and size |
| 194 |
tags for optimized scanning of directories. Enabled with the |
| 195 |
``--enable-defer-strile-load`` configure option (:c:macro:`DEFER_STRILE_LOAD` |
| 196 |
``#define`` in :file:`tif_config.h`). |
| 197 |
|
| 198 |
* Optionally enable experimental support for reading big |
| 199 |
strips in chunks. Enabled with the ``--enable-chunky-strip-read`` |
| 200 |
configure option. |
| 201 |
|
| 202 |
|
| 203 |
Tools changes |
| 204 |
------------- |
| 205 |
|
| 206 |
* :program:`tiffset`: add ``-d`` and ``-sd`` switches to allow operation on |
| 207 |
a particular directory, not just the first. |
| 208 |
|
| 209 |
|
| 210 |
Contributed software changes |
| 211 |
---------------------------- |
| 212 |
|
| 213 |
* None |