Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
685c73260e | ||
|
|
7753fff93e | ||
|
|
4dbeb487fa | ||
|
|
6216805c10 | ||
|
|
9dff73bebc | ||
|
|
5650dd434b | ||
|
|
db5972e098 | ||
|
|
9c97172706 | ||
|
|
a60b9d75e9 | ||
|
|
94f6f7315b | ||
|
|
b535e2bf6f | ||
|
|
95911a1c2c | ||
|
|
3d206dd424 | ||
|
|
e81febb70f | ||
|
|
eba593294d | ||
|
|
88152bebaf | ||
|
|
81b26f034d | ||
|
|
5087fe8507 | ||
|
|
a664b35b96 | ||
|
|
f8dd26d304 | ||
|
|
d40aa2dba4 | ||
|
|
0d6e6bc228 | ||
|
|
a55124f960 | ||
|
|
ea53869fb6 | ||
|
|
a7cb83ff00 | ||
|
|
02230f5642 | ||
|
|
cadfff2e1d | ||
|
|
eccbe7112e | ||
|
|
6589e863d8 | ||
|
|
6272852b8d | ||
|
|
d1487d7be3 | ||
|
|
f1a91e42b3 | ||
|
|
8929277ee7 | ||
|
|
c820d16c30 | ||
|
|
6d616b716d | ||
|
|
1c7b4f59c4 | ||
|
|
821e91d79e | ||
|
|
f00e8166da | ||
|
|
36cbce4d58 | ||
|
|
f59f4a0d43 | ||
|
|
fa7a5b36a5 | ||
|
|
9d6c745d68 | ||
|
|
3cdffebd6d | ||
|
|
8e269601ce | ||
|
|
c2789e2dc1 | ||
|
|
6360737552 | ||
|
|
986f906ed0 | ||
|
|
b00d0060ba | ||
|
|
27fc7da3f0 | ||
|
|
9a19607464 | ||
|
|
8f8916c1d3 | ||
|
|
de67665367 | ||
|
|
e5bacb710f | ||
|
|
9f528cd1d0 | ||
|
|
942e1d5787 | ||
|
|
dbdda56243 | ||
|
|
6357fdfe72 | ||
|
|
8a7a48d7a6 | ||
|
|
05cc3842bc | ||
|
|
5eb068a4cd | ||
|
|
2653d1f860 | ||
|
|
2c020586ef | ||
|
|
e847ff922d | ||
|
|
3688f59a88 | ||
|
|
62d76b6942 | ||
|
|
07ad8fc313 | ||
|
|
7a3fb2deb1 | ||
|
|
fe77ab2933 | ||
|
|
15a6e537df | ||
|
|
dd29a569fb | ||
|
|
b8ac0e1a08 | ||
|
|
e9aeaa60bf | ||
|
|
ea882c3c24 | ||
|
|
03666cb5fd | ||
|
|
1baa2ae009 | ||
|
|
4ff9b5bd57 | ||
|
|
e59805a542 | ||
|
|
6507678444 | ||
|
|
be023be419 | ||
|
|
27cb3445f8 | ||
|
|
4e63559f2b | ||
|
|
706e895071 | ||
|
|
23194d8dc1 | ||
|
|
08e11fcab4 | ||
|
|
f600f4783f | ||
|
|
3c73bd4e3f | ||
|
|
ffdae44185 | ||
|
|
5a5f71ebed | ||
|
|
2fc4422e3c | ||
|
|
585b795bd3 | ||
|
|
b8d67338a4 | ||
|
|
0171fffd8b | ||
|
|
0b13e4c54e | ||
|
|
5576398153 | ||
|
|
5dd28a6d5d | ||
|
|
dcfd41ac4e | ||
|
|
60c7dd4b17 | ||
|
|
a455f07aa0 | ||
|
|
28c38d648b | ||
|
|
00a7af3b4c | ||
|
|
969ec37b5d | ||
|
|
e3b387e000 | ||
|
|
c785239cdc | ||
|
|
aed77c7271 | ||
|
|
9676263f0a | ||
|
|
a6db4dba26 | ||
|
|
d4149c6ea0 | ||
|
|
a47d88dfe5 | ||
|
|
ac0dc61642 | ||
|
|
e41d6f7f6d | ||
|
|
c8473efc35 | ||
|
|
deb4fc9dc8 | ||
|
|
360f37108f | ||
|
|
5d8db4b5af | ||
|
|
72bd93dd2b | ||
|
|
693d7bc0f5 | ||
|
|
cffd2852c4 | ||
|
|
845243dbf0 | ||
|
|
178c3ec53e | ||
|
|
7dc39d1820 | ||
|
|
80b47cbc63 | ||
|
|
462f1f475f | ||
|
|
f3d5c259a5 | ||
|
|
0d92971bcb | ||
|
|
699c7d4cbd | ||
|
|
fb0adc29d6 | ||
|
|
8528b2efcc | ||
|
|
c798b6d73e | ||
|
|
e0523817f3 | ||
|
|
dee840de72 | ||
|
|
5da038136c | ||
|
|
7f785d921a | ||
|
|
5abbbaa014 | ||
|
|
b72ff5be4e | ||
|
|
4d80f0a0c7 | ||
|
|
bbd0873cff | ||
|
|
de4eb41ff3 | ||
|
|
29d7641553 | ||
|
|
1b74e216e7 | ||
|
|
a20298c478 | ||
|
|
1398819a20 | ||
|
|
c0b80d25ec | ||
|
|
8833b848d3 | ||
|
|
9a23b3c4c5 | ||
|
|
c4b8c35a84 | ||
|
|
04118f8a42 | ||
|
|
3f84a2b453 | ||
|
|
51d00bc6d5 | ||
|
|
dfb4383686 | ||
|
|
e1fee35139 | ||
|
|
d4253ba1d3 | ||
|
|
6c40341116 | ||
|
|
8825c4b021 | ||
|
|
dfd5e8fda0 | ||
|
|
41bb7c3a85 | ||
|
|
dee5bda6c0 | ||
|
|
251395dd28 | ||
|
|
58b32c8ea6 | ||
|
|
d753cc15a2 | ||
|
|
928fc695df | ||
|
|
6c778e6b1f | ||
|
|
d7bdca8c4b | ||
|
|
99554bc7b7 | ||
|
|
2454463357 | ||
|
|
4b0bbcfacf | ||
|
|
6fd7d51025 | ||
|
|
e924dd999f | ||
|
|
b4ca093e73 | ||
|
|
b94c2313ce | ||
|
|
a6cd5e5960 | ||
|
|
1c3ecce849 | ||
|
|
9ab54a8580 | ||
|
|
2af10009a5 | ||
|
|
2d1e74dbd1 | ||
|
|
20503843ab | ||
|
|
ce1477da0b | ||
|
|
cf0bdb6729 | ||
|
|
b4acdea3e7 | ||
|
|
1ae923da26 | ||
|
|
a56c5a0975 | ||
|
|
b2387f3324 | ||
|
|
87d39ea1b9 | ||
|
|
c503d6a65b | ||
|
|
358b1938e1 | ||
|
|
c5c9e6f077 | ||
|
|
5e9d713ed4 | ||
|
|
5ebecad3d4 | ||
|
|
91d24c2585 | ||
|
|
a4a26fc753 | ||
|
|
e217f9d5a0 | ||
|
|
4d019acf96 | ||
|
|
a571789645 | ||
|
|
6b9cb37577 | ||
|
|
5a8e565482 | ||
|
|
395a3c881b | ||
|
|
e79965bbe7 | ||
|
|
307afbc66d | ||
|
|
c95c773508 | ||
|
|
cc5f3312a7 | ||
|
|
c69be56bce | ||
|
|
c662851405 | ||
|
|
e1ab15b90b | ||
|
|
ffb7c45730 | ||
|
|
f46f73ba1a | ||
|
|
4c809ccf16 | ||
|
|
e414a9d579 | ||
|
|
af3dfc78a4 | ||
|
|
3c8480e3b7 | ||
|
|
bb1ff4f80e | ||
|
|
8ce83e402f | ||
|
|
2005dbb4f8 | ||
|
|
021a737bfa | ||
|
|
025467ab01 | ||
|
|
562bfcad1d | ||
|
|
1d28fe6380 | ||
|
|
cee5e991e5 | ||
|
|
25bad3798f | ||
|
|
376916d25f | ||
|
|
e0f66bf0c2 | ||
|
|
f964953812 | ||
|
|
10fe25bddf | ||
|
|
19af4e4ab5 | ||
|
|
97e9225fa5 | ||
|
|
651b14ffa9 | ||
|
|
0c74f424b1 | ||
|
|
5fd944398f | ||
|
|
3705f82b64 | ||
|
|
818fb8ce88 | ||
|
|
9d9c83d279 | ||
|
|
f53258e4bb | ||
|
|
3dff9205c1 | ||
|
|
9d62554d07 | ||
|
|
3375c9aef3 | ||
|
|
4e2a38d58a | ||
|
|
2a78a5bcfb | ||
|
|
67e5cfe29a | ||
|
|
85a286648d | ||
|
|
6791bff9f7 | ||
|
|
393bed45bd | ||
|
|
c7d27f3758 | ||
|
|
b87fadea8e | ||
|
|
16ab4a205c | ||
|
|
335947359c | ||
|
|
68d62c65a0 | ||
|
|
cf118ec82e | ||
|
|
dfacff5a84 | ||
|
|
65feafdf64 | ||
|
|
dbb825a831 | ||
|
|
ea185ba31a | ||
|
|
de7bfd7d43 | ||
|
|
e7b57edcbf | ||
|
|
0b02532471 | ||
|
|
ce3d768b4d | ||
|
|
55a8ed454b | ||
|
|
4728ce9b8e | ||
|
|
5320c9d89c | ||
|
|
8d0bf12233 | ||
|
|
51558511bd | ||
|
|
a4db8cd398 | ||
|
|
95994b65ea | ||
|
|
3c7e2aff4f | ||
|
|
d14d67ef38 | ||
|
|
5769bfea8c | ||
|
|
e1b4eef40f | ||
|
|
f8498e2a9a | ||
|
|
86d31b233b | ||
|
|
2cccf6d75b | ||
|
|
cfc9269c0a | ||
|
|
efa56cdc07 | ||
|
|
4be388f1a6 | ||
|
|
6c4d39c6ed | ||
|
|
8c6676d883 | ||
|
|
ef4a936e3e | ||
|
|
995763a316 | ||
|
|
5e7c59d6a9 | ||
|
|
1fb779037d | ||
|
|
4d0329a453 | ||
|
|
49856998c3 | ||
|
|
668d2c1a52 | ||
|
|
1e7d217a32 | ||
|
|
f56fbd4528 | ||
|
|
ed6f7be3ef | ||
|
|
8b20804fc0 | ||
|
|
05b38946b1 | ||
|
|
341588333e | ||
|
|
bb33843b63 | ||
|
|
f438759105 | ||
|
|
b57c8b03ea | ||
|
|
32cbd32218 | ||
|
|
5fd37d37e6 | ||
|
|
a4acea370f | ||
|
|
5177b6a638 | ||
|
|
7b3c170189 | ||
|
|
36c522699b | ||
|
|
7d2df16340 | ||
|
|
f71fc35535 | ||
|
|
f0c1b25f4a | ||
|
|
432a3b64ad | ||
|
|
fc733c6a26 | ||
|
|
07f922106b | ||
|
|
12140bfdb2 | ||
|
|
69eef88fc0 | ||
|
|
4126f6d794 | ||
|
|
83384f847f | ||
|
|
27b26dfcee | ||
|
|
eab89a627f | ||
|
|
ca85b5f760 | ||
|
|
91e7bd01d0 | ||
|
|
280a568ae8 | ||
|
|
3225f137a9 | ||
|
|
4b54117c6d | ||
|
|
ce304fe647 | ||
|
|
1dff4271ad | ||
|
|
ac72178f1a | ||
|
|
73692ebdf8 | ||
|
|
eabde1635a | ||
|
|
6ac40fefa1 | ||
|
|
6e2dac5f90 | ||
|
|
add28aa361 | ||
|
|
4fc16f649f | ||
|
|
cb88a5b6bf | ||
|
|
54eeadb88b | ||
|
|
74e8d3cf71 | ||
|
|
6aeda415e0 | ||
|
|
df547d0ee5 | ||
|
|
130ef8d657 | ||
|
|
ccbdbd5258 | ||
|
|
493d328e92 | ||
|
|
e429387c54 | ||
|
|
1bcbc6bcf0 | ||
|
|
f127333d8c | ||
|
|
d1028f7a8d | ||
|
|
7f7258f25b | ||
|
|
350ff161c8 | ||
|
|
9812658366 | ||
|
|
df665f6077 | ||
|
|
c2755a3d20 | ||
|
|
4f34a374b2 | ||
|
|
e97e716e21 | ||
|
|
5fc887f552 | ||
|
|
74bcfc74da | ||
|
|
7b1f03c386 | ||
|
|
b36bb2f9be | ||
|
|
72187a0fb7 | ||
|
|
70f8d926cc | ||
|
|
78b1977875 | ||
|
|
56aa5d01e6 | ||
|
|
7583f9f3ed | ||
|
|
8e424c701e | ||
|
|
cff0aeba96 | ||
|
|
6ac0ab5064 | ||
|
|
e2ac7e48ac | ||
|
|
738e04099b | ||
|
|
b8d15d9dbe | ||
|
|
97785f8527 | ||
|
|
71c90a51bc | ||
|
|
c978a6c3ea | ||
|
|
50eab58d6e | ||
|
|
46ea8e2a5c | ||
|
|
a693d1f365 | ||
|
|
be9785ac6d | ||
|
|
c58e47a183 | ||
|
|
7eb0f8ca76 | ||
|
|
be0bac4c88 | ||
|
|
b2cdf4292a | ||
|
|
211704a9e6 | ||
|
|
527208be70 | ||
|
|
33cda33473 | ||
|
|
86e058e4ed | ||
|
|
118c5d1082 | ||
|
|
c6c80cefa6 | ||
|
|
e3e23b1dd0 | ||
|
|
95942e5048 | ||
|
|
9f0c7bff9b | ||
|
|
a0a18437d6 | ||
|
|
e8874d75f5 | ||
|
|
0dabdfe857 | ||
|
|
6fd4237b0b | ||
|
|
cea6047054 | ||
|
|
ba425745d6 | ||
|
|
f79d2d5d1e | ||
|
|
7e28cd362b | ||
|
|
7ead6c42c7 | ||
|
|
e53b14876f | ||
|
|
d0c721cad7 | ||
|
|
b5c7d4c4e0 | ||
|
|
9be22b639e | ||
|
|
b90b20d36d | ||
|
|
d2f2dbc392 | ||
|
|
9bd48f0dbd | ||
|
|
8c0859a804 | ||
|
|
17adf4308c | ||
|
|
b8b12c44c1 | ||
|
|
214fe59954 | ||
|
|
ada85f3663 | ||
|
|
ddd7f04482 | ||
|
|
f0a7bb7bdc | ||
|
|
1d5b1181c9 | ||
|
|
881a070194 | ||
|
|
6bb0f1171a | ||
|
|
bda075a7f3 | ||
|
|
223078d722 | ||
|
|
61656f9218 | ||
|
|
d1f658afa5 | ||
|
|
b0e1c25dd1 | ||
|
|
c861f25cbc | ||
|
|
ec8ef90c1f | ||
|
|
aa2cd98b3e | ||
|
|
feb8db628d | ||
|
|
538b8f2935 | ||
|
|
c8e1289def | ||
|
|
3f37593175 | ||
|
|
afaabc3e50 | ||
|
|
69818e2f2d | ||
|
|
6366e8f776 | ||
|
|
33aee1275d | ||
|
|
82a7fbb1fa | ||
|
|
688012dca2 | ||
|
|
ff049e353e | ||
|
|
8ef8f7ce21 | ||
|
|
12ba27949b | ||
|
|
f171d7a2cd | ||
|
|
d63de61b1e | ||
|
|
9c22495e5e | ||
|
|
a63e18ca43 | ||
|
|
e304e5a5cb | ||
|
|
0f8ae9442a | ||
|
|
bc4d708262 | ||
|
|
46832efcb0 | ||
|
|
9477634d2a | ||
|
|
d1b6b9c1b3 | ||
|
|
97d65859bc | ||
|
|
8a4f6b587b | ||
|
|
6be14e882f | ||
|
|
c0f0316931 | ||
|
|
3c774f1903 | ||
|
|
188e054164 | ||
|
|
3f8db71882 | ||
|
|
7be6324424 | ||
|
|
9ce5083225 | ||
|
|
c074eb73d3 | ||
|
|
47591619e1 | ||
|
|
1123f312b4 | ||
|
|
e146a61d9d | ||
|
|
4eea4d5d93 | ||
|
|
9f84326b13 | ||
|
|
bdaf7c7f4f | ||
|
|
e131fde62b | ||
|
|
3bde37ac83 | ||
|
|
dc3369a794 | ||
|
|
a34d7ddee2 | ||
|
|
d46354584f | ||
|
|
70645941f9 | ||
|
|
4bcdec3734 | ||
|
|
f1f86eedee | ||
|
|
0c16f2d84b | ||
|
|
c2a28a12c6 | ||
|
|
193c94b30c | ||
|
|
3cfa4b9b12 |
+47
-40
@@ -1,3 +1,14 @@
|
||||
# Operating system (build VM template)
|
||||
image:
|
||||
- "Visual Studio 2022"
|
||||
- "Visual Studio 2019"
|
||||
|
||||
platform: x64
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
- Debug
|
||||
|
||||
environment:
|
||||
AV_PROJECTS: 'c:\projects'
|
||||
AV_TIFF_DOWNLOAD: 'c:\projects\download'
|
||||
@@ -6,78 +17,75 @@ environment:
|
||||
AV_TIFF_INSTALL: 'c:\projects\install'
|
||||
|
||||
matrix:
|
||||
- compiler: vc-cmake
|
||||
- compiler: cygwin-cmake
|
||||
configuration: Release
|
||||
generator: Unix Makefiles
|
||||
shared: ON
|
||||
- compiler: cygwin-cmake
|
||||
configuration: Debug
|
||||
generator: Unix Makefiles
|
||||
shared: OFF
|
||||
- compiler: mingw-cmake
|
||||
configuration: Release
|
||||
generator: MinGW Makefiles
|
||||
shared: ON
|
||||
- compiler: mingw-cmake
|
||||
configuration: Debug
|
||||
generator: MinGW Makefiles
|
||||
shared: OFF
|
||||
- compiler: vc14-cmake
|
||||
configuration: Release
|
||||
arch: x64
|
||||
generator: Visual Studio 16 2019
|
||||
shared: ON
|
||||
- compiler: vc14-cmake
|
||||
configuration: Debug
|
||||
arch: Win32
|
||||
generator: Visual Studio 16 2019
|
||||
shared: OFF
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- image: "Visual Studio 2019"
|
||||
compiler: cygwin-cmake
|
||||
configuration: Release
|
||||
- image: "Visual Studio 2019"
|
||||
compiler: cygwin-cmake
|
||||
configuration: Debug
|
||||
- image: "Visual Studio 2019"
|
||||
compiler: mingw-cmake
|
||||
configuration: Release
|
||||
- image: "Visual Studio 2019"
|
||||
compiler: mingw-cmake
|
||||
configuration: Debug
|
||||
|
||||
cache:
|
||||
#- 'c:\projects\download -> appveyor.yml'
|
||||
|
||||
# Operating system (build VM template)
|
||||
os: 'Visual Studio 2019'
|
||||
|
||||
# clone directory
|
||||
# Clone directory
|
||||
clone_folder: 'c:\projects\libtiff'
|
||||
clone_depth: 5
|
||||
|
||||
platform: x64
|
||||
|
||||
init:
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
before_build:
|
||||
- 'if %compiler%==vc-cmake if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2022" set "generator=Visual Studio 17 2022"'
|
||||
- 'if %compiler%==vc-cmake if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" set "generator=Visual Studio 16 2019"'
|
||||
- 'if %compiler%==cygwin-cmake set "generator=Unix Makefiles"'
|
||||
- 'if %compiler%==mingw-cmake set "generator=Ninja"'
|
||||
- 'if %Configuration%==Release set "shared=ON"'
|
||||
- 'if %Configuration%==Debug set "shared=OFF"'
|
||||
- 'if %compiler%==vc-cmake if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2022" set "arch=x64"'
|
||||
- 'if %compiler%==vc-cmake if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" set "arch=Win32"'
|
||||
- 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\cygwin64\bin\cygpath -u %AV_TIFF_SOURCE%`) DO SET AV_TIFF_CYG_SOURCE=%%F'
|
||||
- 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\cygwin64\bin\cygpath -u %AV_TIFF_INSTALL%`) DO SET AV_TIFF_CYG_INSTALL=%%F'
|
||||
- 'if %compiler%==cygwin-cmake C:\cygwin64\setup-x86_64 -q -R C:\cygwin64 -s http://cygwin.mirror.constant.com -l %AV_TIFF_DOWNLOAD%\cygwin -P cmake,libjpeg-devel,zlib-devel'
|
||||
- 'if %compiler%==cygwin-cmake C:\cygwin64\setup-x86_64 -q -R C:\cygwin64 -s http://cygwin.mirror.constant.com -l %AV_TIFF_DOWNLOAD%\cygwin -g -P cmake,libjpeg-devel,zlib-devel'
|
||||
- 'if %compiler%==cygwin-cmake set "PATH=C:\cygwin64\bin;%PATH%"'
|
||||
- set
|
||||
- 'if %compiler%==cygwin-cmake cygpath --version || echo cygpath not found'
|
||||
- 'if %compiler%==cygwin-cmake cmake --version || echo CMake not found'
|
||||
- set "AV_CMAKE_ARGS=-DBUILD_SHARED_LIBS:BOOL=%shared%"
|
||||
- 'if %compiler%==cygwin-cmake set "AV_CMAKE_ARGS=%AV_CMAKE_ARGS% -Dfatal-warnings=ON"'
|
||||
- 'if %compiler%==mingw32-cmake set "AV_CMAKE_ARGS=%AV_CMAKE_ARGS% -Dfatal-warnings=ON"'
|
||||
- 'if %compiler%==mingw-cmake set "AV_CMAKE_ARGS=%AV_CMAKE_ARGS% -Dfatal-warnings=ON"'
|
||||
- set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_SOURCE%"
|
||||
- set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_INSTALL%"
|
||||
- 'if %compiler%==cygwin-cmake set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_CYG_SOURCE%'
|
||||
- 'if %compiler%==cygwin-cmake set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_CYG_INSTALL%'
|
||||
- 'if %compiler%==mingw-cmake set "PATH=C:\MinGW\bin;%PATH%"'
|
||||
- 'if %compiler%==mingw-cmake C:\msys64\usr\bin\bash -lc "pacman -Syuu --noconfirm"'
|
||||
- 'if %compiler%==mingw-cmake C:\msys64\usr\bin\bash -lc "pacman -Syuu --noconfirm"'
|
||||
- 'if %compiler%==mingw-cmake C:\msys64\usr\bin\bash -lc "pacman -S --needed --noconfirm mingw-w64-ucrt-x86_64-{toolchain,cmake,ninja,zlib,libjpeg-turbo}"'
|
||||
- 'if %compiler%==mingw-cmake set "PATH=C:\msys64\ucrt64\bin;C:\msys64\usr\bin;%PATH%"'
|
||||
- mkdir %AV_TIFF_BUILD%
|
||||
- cd %AV_TIFF_BUILD%
|
||||
- set
|
||||
- echo Running cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_TIFF_CMAKE_SOURCE%
|
||||
- 'if %compiler%==cygwin-cmake bash -c "cmake -G \"%generator%\" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%"'
|
||||
# Disable doc building because of 'Could not import extension sphinxcontrib.applehelp (exception: No module named 'sphinxcontrib.applehelp')'
|
||||
- 'if %compiler%==cygwin-cmake bash -c "cmake -G \"%generator%\" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE% -Dtiff-docs=off"'
|
||||
- 'if %compiler%==mingw-cmake cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%'
|
||||
- 'if %compiler%==vc14-cmake cmake -G "%generator%" -A %arch% -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%'
|
||||
- 'if %compiler%==vc-cmake cmake -G "%generator%" -A %arch% -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%'
|
||||
|
||||
build_script:
|
||||
- cd %AV_TIFF_BUILD%
|
||||
- 'if %compiler%==cygwin-cmake bash -c "cmake --build . --config %configuration% --target install"'
|
||||
- 'if %compiler%==mingw-cmake cmake --build . --config %configuration% --target install'
|
||||
- 'if %compiler%==vc14-cmake cmake --build . --config %configuration% --target install'
|
||||
- 'if %compiler%==vc9-cmake cmake --build . --config %configuration% --target install'
|
||||
- 'if %compiler%==vc-cmake cmake --build . --config %configuration% --target install'
|
||||
|
||||
# scripts to run after build
|
||||
after_build:
|
||||
@@ -90,8 +98,7 @@ before_test:
|
||||
- cd %AV_TIFF_BUILD%
|
||||
- 'if %compiler%==cygwin-cmake bash -c "ctest -V -C %configuration%"'
|
||||
- 'if %compiler%==mingw-cmake ctest -V -C %configuration%'
|
||||
- 'if %compiler%==vc14-cmake ctest -V -C %configuration%'
|
||||
- 'if %compiler%==vc9-cmake ctest -V -C %configuration%'
|
||||
- 'if %compiler%==vc-cmake ctest -V -C %configuration%'
|
||||
|
||||
# AppVeyor don't yet have a configurable retention policy, so this will
|
||||
# eventually use up all the storage allowance.
|
||||
|
||||
+9
-4
@@ -1,4 +1,4 @@
|
||||
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu22.04:latest
|
||||
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu24.04:latest
|
||||
|
||||
stages:
|
||||
- build
|
||||
@@ -19,7 +19,7 @@ autoconf-current:
|
||||
|
||||
autoconf-old:
|
||||
stage: build
|
||||
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu20.04:latest
|
||||
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu22.04:latest
|
||||
script:
|
||||
- sh build/gitlab-ci autoconf-minimal
|
||||
after_script:
|
||||
@@ -30,6 +30,11 @@ cmake-makefiles-current:
|
||||
script:
|
||||
- sh build/gitlab-ci cmake "Unix Makefiles" Release
|
||||
|
||||
cmake-makefiles-current-static:
|
||||
stage: build
|
||||
script:
|
||||
- sh build/gitlab-ci cmake "Unix Makefiles" Release static
|
||||
|
||||
cmake-ninja-current:
|
||||
stage: build
|
||||
script:
|
||||
@@ -37,13 +42,13 @@ cmake-ninja-current:
|
||||
|
||||
cmake-makefiles-old:
|
||||
stage: build
|
||||
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu20.04:latest
|
||||
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu22.04:latest
|
||||
script:
|
||||
- sh build/gitlab-ci cmake "Unix Makefiles" Release
|
||||
|
||||
coverity:
|
||||
stage: static-analysis
|
||||
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu22.04-coverity:latest
|
||||
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu24.04-coverity:latest
|
||||
script:
|
||||
- sh build/gitlab-ci coverity "Ninja" Debug
|
||||
only:
|
||||
|
||||
+10
-1
@@ -6,8 +6,17 @@ repos:
|
||||
# tif_fax3sm.c is a generated file
|
||||
# tiffvers.h as well, and its formatting is sensitive for
|
||||
# FindTIFF.cmake to detect the version number
|
||||
# Furthermore, the .in files are formatting sensitive for
|
||||
# cmake functions.
|
||||
exclude: >
|
||||
(?x)^(
|
||||
libtiff/tif_fax3sm.c|
|
||||
libtiff/tiffvers.h
|
||||
libtiff/tiffvers.h|
|
||||
libtiff/tiffvers.h.in|
|
||||
libtiff/tif_config.h|
|
||||
libtiff/tif_config.h.in|
|
||||
libtiff/tif_config.h.cmake.in|
|
||||
libtiff/tiffconf.h|
|
||||
libtiff/tiffconf.h.in|
|
||||
libtiff/tiffconf.h.cmake.in
|
||||
)
|
||||
|
||||
+10
-6
@@ -35,9 +35,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
# Read version information from configure.ac.
|
||||
include(AutotoolsVersion)
|
||||
message(STATUS "Building tiff version ${LIBTIFF_VERSION_FULL}")
|
||||
message(STATUS "libtiff library version ${SO_VERSION}")
|
||||
string(TIMESTAMP BUILD_DATE "%Y%m%d")
|
||||
message(STATUS "libtiff build date: ${BUILD_DATE}")
|
||||
|
||||
# Project definition
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
@@ -166,6 +163,13 @@ include(PkgConfig)
|
||||
message(STATUS "")
|
||||
message(STATUS "Libtiff is now configured for ${CMAKE_SYSTEM}")
|
||||
message(STATUS "")
|
||||
if (NOT LIBTIFF_RELEASE_VERSION STREQUAL LIBTIFF_VERSION_FULL)
|
||||
message(STATUS " Libtiff release version ${LIBTIFF_RELEASE_VERSION} is not equal to build version!")
|
||||
endif()
|
||||
message(STATUS " Libtiff build version: ${LIBTIFF_VERSION_FULL}")
|
||||
message(STATUS " Libtiff library version: ${SO_VERSION}")
|
||||
message(STATUS " Libtiff release date: ${LIBTIFF_RELEASE_DATE}")
|
||||
message(STATUS "")
|
||||
message(STATUS " Installation directory: ${prefix}")
|
||||
message(STATUS " Documentation directory: ${LIBTIFF_DOCDIR}")
|
||||
message(STATUS " C compiler: ${CMAKE_C_COMPILER}")
|
||||
@@ -207,7 +211,7 @@ else()
|
||||
message(STATUS " Old JPEG support: Requested:${old-jpeg} Availability:${JPEG_SUPPORT} Support:${OJPEG_SUPPORT} (Depends on JPEG Support)")
|
||||
endif()
|
||||
if(JPEG_SUPPORT AND HAVE_JPEGTURBO_DUAL_MODE_8_12)
|
||||
message(STATUS " JPEG 8/12 bit dual mode: Support: yes (libjpeg turbo >= 2.2 dual mode)")
|
||||
message(STATUS " JPEG 8/12 bit dual mode: Support: yes (libjpeg turbo >= 3.0 dual mode)")
|
||||
else()
|
||||
message(STATUS " JPEG 8/12 bit dual mode: Requested:${jpeg12} Availability:${JPEG12_FOUND} Support:${JPEG_DUAL_MODE_8_12}")
|
||||
endif()
|
||||
@@ -217,9 +221,9 @@ if(ZLIB_SUPPORT)
|
||||
else()
|
||||
message(STATUS " LERC support: Requested:${lerc} Availability:${LERC_FOUND} Support:${LERC_SUPPORT} (Depends on ZLIB Support)")
|
||||
endif()
|
||||
message(STATUS " LZMA2 support: Requested:${lzma} Availability:${LIBLZMA_FOUND} Support:${LZMA_SUPPORT}")
|
||||
message(STATUS " LZMA2 support: Requested:${lzma} Availability:${liblzma_FOUND} Support:${LZMA_SUPPORT}")
|
||||
message(STATUS " ZSTD support: Requested:${zstd} Availability:${ZSTD_USABLE} Support:${ZSTD_SUPPORT}")
|
||||
message(STATUS " WEBP support: Requested:${webp} Availability:${WEBP_FOUND} Support:${WEBP_SUPPORT}")
|
||||
message(STATUS " WEBP support: Requested:${webp} Availability:${WebP_FOUND} Support:${WEBP_SUPPORT}")
|
||||
message(STATUS "")
|
||||
message(STATUS " C++ support: ${cxx} (requested) ${CXX_SUPPORT} (availability)")
|
||||
message(STATUS "")
|
||||
|
||||
+8
-4
@@ -100,11 +100,13 @@ Notes on releasing.
|
||||
|
||||
make release
|
||||
|
||||
This will update "RELEASE-DATE", "VERSION", and libtiff/tiffvers.h
|
||||
in the source tree.
|
||||
This will update "RELEASE-DATE", "VERSION" in the source tree,
|
||||
and libtiff/tiffvers.h in the build tree.
|
||||
|
||||
12. In the source tree, verify that the version info in RELEASE-DATE,
|
||||
VERSION and libtiff/tiffvers.h is right.
|
||||
VERSION is right.
|
||||
In the build tree, verify that the version info in
|
||||
libtiff/tiffvers.h is right.
|
||||
|
||||
13. In the build tree do
|
||||
|
||||
@@ -148,4 +150,6 @@ Notes on releasing.
|
||||
scp tiff-*.tar.gz tiff-*.tar.gz.sig tiff-*.tar.xz tiff-*.tar.xz.sig tiff-*.zip tiff-*.zip.sig \
|
||||
bfriesen@upload.osgeo.org:/osgeo/download/libtiff
|
||||
|
||||
18. Announce to list: tiff@lists.osgeo.org
|
||||
18. Create a gitlab release at https://gitlab.com/libtiff/libtiff/-/releases
|
||||
|
||||
19. Announce to list: tiff@lists.osgeo.org
|
||||
|
||||
+7
-3
@@ -25,7 +25,7 @@
|
||||
|
||||
docdir = $(LIBTIFF_DOCDIR)
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.12 dist-zip foreign
|
||||
AUTOMAKE_OPTIONS = 1.11 dist-zip foreign
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
docfiles = \
|
||||
@@ -62,10 +62,14 @@ distcheck-hook:
|
||||
|
||||
SUBDIRS = port libtiff tools build contrib test doc
|
||||
|
||||
|
||||
NEW_LIBTIFF_RELEASE_DATE=$(shell date +"%Y%m%d")
|
||||
|
||||
release:
|
||||
(rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)
|
||||
@(echo --- Setting release date to $(NEW_LIBTIFF_RELEASE_DATE) and release version to $(LIBTIFF_VERSION) ---)
|
||||
(rm -f $(top_srcdir)/RELEASE-DATE && echo $(NEW_LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)
|
||||
(rm -f $(top_srcdir)/VERSION && echo $(LIBTIFF_VERSION) > $(top_srcdir)/VERSION)
|
||||
(rm -f $(top_srcdir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),;s,LIBTIFF_MAJOR_VERSION,$(LIBTIFF_MAJOR_VERSION),;s,LIBTIFF_MINOR_VERSION,$(LIBTIFF_MINOR_VERSION),;s,LIBTIFF_MICRO_VERSION,$(LIBTIFF_MICRO_VERSION),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_srcdir)/libtiff/tiffvers.h)
|
||||
(rm -f $(top_builddir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(NEW_LIBTIFF_RELEASE_DATE),;s,LIBTIFF_MAJOR_VERSION,$(LIBTIFF_MAJOR_VERSION),;s,LIBTIFF_MINOR_VERSION,$(LIBTIFF_MINOR_VERSION),;s,LIBTIFF_MICRO_VERSION,$(LIBTIFF_MICRO_VERSION),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_builddir)/libtiff/tiffvers.h && sed -i 's,@,,g' $(top_builddir)/libtiff/tiffvers.h)
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libtiff-4.pc
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
TIFF Software Distribution
|
||||
--------------------------
|
||||
This file is just a placeholder; all the documentation is now in
|
||||
HTML in the html directory. To view the documentation point your
|
||||
favorite WWW viewer at html/index.html;
|
||||
This file is just a placeholder; the entire documentation is now located
|
||||
as reStructuredText in the doc directory. To view the documentation
|
||||
as HTML, visit https://libtiff.gitlab.io/libtiff/ or
|
||||
http://www.simplesystems.org/libtiff/ or within the release package
|
||||
in the doc/html-prebuilt directory. The manual pages are
|
||||
located at doc/man-prebuilt.
|
||||
|
||||
e.g.
|
||||
The release package can be downloaded at
|
||||
|
||||
firefox html/index.html
|
||||
|
||||
If you don't have an HTML viewer then you can read the HTML source
|
||||
or fetch a PostScript version of this documentation from the directory
|
||||
|
||||
http://download.osgeo.org/libtiff/
|
||||
http://download.osgeo.org/libtiff/
|
||||
|
||||
If you can't hack either of these options then basically what you
|
||||
want to do is:
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
20221213
|
||||
20240911
|
||||
|
||||
+13
-9
@@ -1,17 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
retval=0
|
||||
|
||||
set -x
|
||||
|
||||
case `uname` in
|
||||
Darwin*)
|
||||
glibtoolize --force --copy
|
||||
glibtoolize --force --copy || retval=$?
|
||||
;;
|
||||
*)
|
||||
libtoolize --force --copy
|
||||
libtoolize --force --copy || retval=$?
|
||||
;;
|
||||
esac
|
||||
aclocal -I ./m4
|
||||
autoheader
|
||||
automake --foreign --add-missing --copy
|
||||
autoconf
|
||||
aclocal -I ./m4 || retval=$?
|
||||
autoheader || retval=$?
|
||||
automake --foreign --add-missing --copy || retval=$?
|
||||
autoconf || retval=$?
|
||||
# Get latest config.guess and config.sub from upstream master since
|
||||
# these are often out of date.
|
||||
for file in config.guess config.sub
|
||||
@@ -20,8 +24,8 @@ do
|
||||
wget -q --timeout=5 -O config/$file.tmp \
|
||||
"https://git.savannah.gnu.org/cgit/config.git/plain/${file}" \
|
||||
&& mv -f config/$file.tmp config/$file \
|
||||
&& chmod a+x config/$file
|
||||
retval=$?
|
||||
&& chmod a+x config/$file || retval=$?
|
||||
rm -f config/$file.tmp
|
||||
test $retval -eq 0 || exit $retval
|
||||
done
|
||||
|
||||
exit $retval
|
||||
|
||||
+27
-4
@@ -13,7 +13,7 @@ autoconf_build()
|
||||
mkdir autoconf-build
|
||||
cd autoconf-build
|
||||
echo "Running ../configure --prefix=$(pwd)/../autoconf-install) ${opts}"
|
||||
../configure --prefix=$(pwd)/../autoconf-install ${opts}
|
||||
CFLAGS="-Wall -Wextra -Werror" ../configure --prefix=$(pwd)/../autoconf-install ${opts}
|
||||
make
|
||||
make install
|
||||
make check
|
||||
@@ -30,7 +30,7 @@ autoconf_build_minimal()
|
||||
mkdir autoconf-build
|
||||
cd autoconf-build
|
||||
echo "Running ../configure --prefix=$(pwd)/../autoconf-install) ${opts}"
|
||||
../configure --prefix=$(pwd)/../autoconf-install ${opts}
|
||||
CFLAGS="-Wall -Wextra -Werror" ../configure --prefix=$(pwd)/../autoconf-install ${opts}
|
||||
make
|
||||
make install
|
||||
make check
|
||||
@@ -46,11 +46,34 @@ cmake_build()
|
||||
mkdir cmake-build
|
||||
cd cmake-build
|
||||
opts="-Dfatal-warnings=ON"
|
||||
echo "Running cmake -G "$1" -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install ${opts} .."
|
||||
cmake -G "$1" -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install ${opts} ..
|
||||
para3=`echo "$3" | sed 's/./\L&/g'`
|
||||
if [ "$para3" = "static" ]; then
|
||||
opts2="-DBUILD_SHARED_LIBS:BOOL=OFF"
|
||||
else
|
||||
opts2=""
|
||||
fi
|
||||
echo "Running cmake -G "$1" -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install ${opts} ${opts2} .."
|
||||
cmake -G "$1" -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install -DCMAKE_C_FLAGS="-Wall -Wextra -Werror" ${opts} ${opts2} ..
|
||||
$COVERITY_BUILD cmake --build .
|
||||
cmake --build . --target install
|
||||
ctest -V
|
||||
cd ..
|
||||
if [ "$para3" = "static" ]; then
|
||||
echo No test project build for STATIC CI/CD build - skipped -.
|
||||
else
|
||||
# Build test project using find_package(Tiff CONFIG)
|
||||
mkdir cmake-test-build
|
||||
cd cmake-test-build
|
||||
cmake -G "$1" -DCMAKE_BUILD_TYPE="$2" "-DTiff_DIR=$PWD/../cmake-install/lib/cmake/tiff" -S ../build/test_cmake -B .
|
||||
cmake --build .
|
||||
cd ..
|
||||
mkdir cmake-test-no-target-build
|
||||
cd cmake-test-no-target-build
|
||||
cmake -G "$1" -DCMAKE_BUILD_TYPE="$2" "-DTiff_DIR=$PWD/../cmake-install/lib/cmake/tiff" -S ../build/test_cmake_no_target -B .
|
||||
cmake --build .
|
||||
# Return to cmake-build for coverity_build()
|
||||
cd ../cmake-build
|
||||
fi
|
||||
}
|
||||
|
||||
# Static-analysis with coverity
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.9.0)
|
||||
project(test)
|
||||
|
||||
find_package(Tiff CONFIG REQUIRED)
|
||||
|
||||
add_executable(test test.c)
|
||||
target_link_libraries(test PRIVATE TIFF::tiff)
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "tiffio.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TIFFGetVersion();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.9.0)
|
||||
project(test)
|
||||
|
||||
find_package(Tiff CONFIG REQUIRED)
|
||||
|
||||
add_executable(test test.c)
|
||||
target_include_directories(test PRIVATE ${TIFF_INCLUDE_DIR})
|
||||
target_link_libraries(test PRIVATE ${TIFF_LIBRARIES})
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "tiffio.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
TIFFGetVersion();
|
||||
return 0;
|
||||
}
|
||||
@@ -29,4 +29,4 @@ set(PACKAGE_NAME "LibTIFF Software")
|
||||
set(PACKAGE_TARNAME "${PROJECT_NAME}")
|
||||
set(PACKAGE_VERSION "${PROJECT_VERSION}${LIBTIFF_ALPHA_VERSION}")
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "tiff@lists.maptools.org")
|
||||
set(PACKAGE_BUGREPORT "tiff@lists.osgeo.org")
|
||||
|
||||
@@ -40,6 +40,12 @@ endforeach()
|
||||
set(LIBTIFF_VERSION "${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}")
|
||||
set(LIBTIFF_VERSION_FULL "${LIBTIFF_VERSION}${LIBTIFF_ALPHA_VERSION}")
|
||||
|
||||
# Get release version from file VERSION
|
||||
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" LIBTIFF_RELEASE_VERSION)
|
||||
|
||||
# Package date - get it from file RELEASE-DATE
|
||||
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/RELEASE-DATE" LIBTIFF_RELEASE_DATE)
|
||||
|
||||
# Convert the libtool version variables to proper major and minor versions
|
||||
math(EXPR SO_MAJOR "${LIBTIFF_CURRENT} - ${LIBTIFF_AGE}")
|
||||
set(SO_MINOR "${LIBTIFF_AGE}")
|
||||
|
||||
@@ -66,15 +66,14 @@ unset(Deflate_OLD_FIND_LIBRARY_PREFIXES)
|
||||
|
||||
mark_as_advanced(Deflate_INCLUDE_DIR)
|
||||
|
||||
if(Deflate_INCLUDE_DIR AND EXISTS "${Deflate_INCLUDE_DIR}/deflate.h")
|
||||
file(STRINGS "${Deflate_INCLUDE_DIR}/libdeflate.h" Deflate_H REGEX "^#define LIBDEFLATE_VERSION_STRING\s+\"[^\"]*\"$")
|
||||
|
||||
string(REGEX REPLACE "^.*Deflate_VERSION \"([0-9]+).*$" "\\1" Deflate_MAJOR_VERSION "${Deflate_H}")
|
||||
string(REGEX REPLACE "^.*Deflate_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" Deflate_MINOR_VERSION "${Deflate_H}")
|
||||
if(Deflate_INCLUDE_DIR AND EXISTS "${Deflate_INCLUDE_DIR}/libdeflate.h")
|
||||
file(STRINGS "${Deflate_INCLUDE_DIR}/libdeflate.h" Deflate_H REGEX "^#define[\t ]+LIBDEFLATE_VERSION_STRING[\t ]+.*")
|
||||
string(REGEX REPLACE "^.*LIBDEFLATE_VERSION_STRING[\t ]+\"([0-9]+).*$" "\\1" Deflate_MAJOR_VERSION "${Deflate_H}")
|
||||
string(REGEX REPLACE "^.*LIBDEFLATE_VERSION_STRING[\t ]\"[0-9]+\\.([0-9]+).*$" "\\1" Deflate_MINOR_VERSION "${Deflate_H}")
|
||||
set(Deflate_VERSION_STRING "${Deflate_MAJOR_VERSION}.${Deflate_MINOR_VERSION}")
|
||||
|
||||
set(Deflate_MAJOR_VERSION "${Deflate_VERSION_MAJOR}")
|
||||
set(Deflate_MINOR_VERSION "${Deflate_VERSION_MINOR}")
|
||||
set(Deflate_VERSION_MAJOR "${Deflate_MAJOR_VERSION}")
|
||||
set(Deflate_VERSION_MINOR "${Deflate_MINOR_VERSION}")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
@@ -110,7 +109,7 @@ if(Deflate_FOUND)
|
||||
|
||||
if(NOT Deflate_LIBRARY_RELEASE AND NOT Deflate_LIBRARY_DEBUG)
|
||||
set_target_properties(Deflate::Deflate PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${Deflate_LIBRARY}")
|
||||
IMPORTED_LOCATION "${Deflate_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -110,7 +110,7 @@ if(JBIG_FOUND)
|
||||
|
||||
if(NOT JBIG_LIBRARY_RELEASE AND NOT JBIG_LIBRARY_DEBUG)
|
||||
set_target_properties(JBIG::JBIG PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${JBIG_LIBRARY}")
|
||||
IMPORTED_LOCATION "${JBIG_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+16
-2
@@ -11,7 +11,7 @@ IMPORTED Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines :prop_tgt:`IMPORTED` target ``LERC::LERC``, if
|
||||
CMath has been found.
|
||||
LERC has been found.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
@@ -23,6 +23,7 @@ This module defines the following variables:
|
||||
LERC_INCLUDE_DIRS - where to find Lerc_c_api.h, etc.
|
||||
LERC_LIBRARIES - List of libraries when using LERC.
|
||||
LERC_FOUND - True if LERC found.
|
||||
LERC_VERSION_STRING - version number as a string (ex: "4.0.1")
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
@@ -47,6 +48,19 @@ unset(LERC_NAMES)
|
||||
|
||||
mark_as_advanced(LERC_INCLUDE_DIR)
|
||||
|
||||
if(LERC_INCLUDE_DIR AND EXISTS "${LERC_INCLUDE_DIR}/Lerc_c_api.h")
|
||||
file(STRINGS "${LERC_INCLUDE_DIR}/Lerc_c_api.h" LERC_H REGEX "^#define[\t ]+LERC_VERSION_[A-Z]+[\t ]+[0-9]+")
|
||||
string(REGEX REPLACE "^.*#define[\t ]+LERC_VERSION_MAJOR[\t ]+([0-9]+).*$" "\\1" LERC_VERSION_MAJOR "${LERC_H}")
|
||||
string(REGEX REPLACE "^.*#define[\t ]+LERC_VERSION_MINOR[\t ]+([0-9]+).*$" "\\1" LERC_VERSION_MINOR "${LERC_H}")
|
||||
string(REGEX REPLACE "^.*#define[\t ]+LERC_VERSION_PATCH[\t ]+([0-9]+).*$" "\\1" LERC_VERSION_PATCH "${LERC_H}")
|
||||
set(LERC_VERSION_STRING "${LERC_VERSION_MAJOR}.${LERC_VERSION_MINOR}.${LERC_VERSION_PATCH}")
|
||||
unset(LERC_H)
|
||||
unset(LERC_VERSION_MAJOR)
|
||||
unset(LERC_VERSION_MINOR)
|
||||
unset(LERC_VERSION_PATCH)
|
||||
endif()
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LERC
|
||||
REQUIRED_VARS LERC_LIBRARY LERC_INCLUDE_DIR
|
||||
@@ -80,7 +94,7 @@ if(LERC_FOUND)
|
||||
|
||||
if(NOT LERC_LIBRARY_RELEASE AND NOT LERC_LIBRARY_DEBUG)
|
||||
set_target_properties(LERC::LERC PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${LERC_LIBRARY}")
|
||||
IMPORTED_LOCATION "${LERC_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+10
-10
@@ -10,7 +10,7 @@ Find the native WebP includes and library.
|
||||
IMPORTED Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines :prop_tgt:`IMPORTED` target ``WebP::WebP``, if
|
||||
This module defines :prop_tgt:`IMPORTED` target ``WebP::webp``, if
|
||||
WebP has been found.
|
||||
|
||||
Result Variables
|
||||
@@ -64,28 +64,28 @@ if(WebP_FOUND)
|
||||
set(WebP_LIBRARIES ${WebP_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(NOT TARGET WebP::WebP)
|
||||
add_library(WebP::WebP UNKNOWN IMPORTED)
|
||||
set_target_properties(WebP::WebP PROPERTIES
|
||||
if(NOT TARGET WebP::webp)
|
||||
add_library(WebP::webp UNKNOWN IMPORTED)
|
||||
set_target_properties(WebP::webp PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${WebP_INCLUDE_DIRS}")
|
||||
|
||||
if(WebP_LIBRARY_RELEASE)
|
||||
set_property(TARGET WebP::WebP APPEND PROPERTY
|
||||
set_property(TARGET WebP::webp APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(WebP::WebP PROPERTIES
|
||||
set_target_properties(WebP::webp PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${WebP_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(WebP_LIBRARY_DEBUG)
|
||||
set_property(TARGET WebP::WebP APPEND PROPERTY
|
||||
set_property(TARGET WebP::webp APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(WebP::WebP PROPERTIES
|
||||
set_target_properties(WebP::webp PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${WebP_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
|
||||
if(NOT WebP_LIBRARY_RELEASE AND NOT WebP_LIBRARY_DEBUG)
|
||||
set_target_properties(WebP::WebP PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${WebP_LIBRARY}")
|
||||
set_target_properties(WebP::webp PROPERTIES
|
||||
IMPORTED_LOCATION "${WebP_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -101,7 +101,7 @@ if(ZSTD_FOUND)
|
||||
|
||||
if(NOT ZSTD_LIBRARY_RELEASE AND NOT ZSTD_LIBRARY_DEBUG)
|
||||
set_target_properties(ZSTD::ZSTD PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${ZSTD_LIBRARY}")
|
||||
IMPORTED_LOCATION "${ZSTD_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindLibLZMA
|
||||
Findliblzma
|
||||
-----------
|
||||
|
||||
Find LZMA compression algorithm headers and library.
|
||||
@@ -13,7 +13,7 @@ Imported Targets
|
||||
|
||||
.. versionadded:: 3.14
|
||||
|
||||
This module defines :prop_tgt:`IMPORTED` target ``LibLZMA::LibLZMA``, if
|
||||
This module defines :prop_tgt:`IMPORTED` target ``liblzma::liblzma``, if
|
||||
liblzma has been found.
|
||||
|
||||
Result variables
|
||||
@@ -21,7 +21,7 @@ Result variables
|
||||
|
||||
This module will set the following variables in your project:
|
||||
|
||||
``LIBLZMA_FOUND``
|
||||
``liblzma_FOUND``
|
||||
True if liblzma headers and library were found.
|
||||
``LIBLZMA_INCLUDE_DIRS``
|
||||
Directory where liblzma headers are located.
|
||||
@@ -70,7 +70,7 @@ endif()
|
||||
if (LIBLZMA_LIBRARY)
|
||||
include(CheckLibraryExists)
|
||||
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
|
||||
set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY})
|
||||
set(CMAKE_REQUIRED_QUIET ${liblzma_FIND_QUIETLY})
|
||||
if(NOT LIBLZMA_LIBRARY_RELEASE AND NOT LIBLZMA_LIBRARY_DEBUG)
|
||||
set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY})
|
||||
elseif(LIBLZMA_LIBRARY_RELEASE)
|
||||
@@ -86,7 +86,7 @@ if (LIBLZMA_LIBRARY)
|
||||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(LibLZMA REQUIRED_VARS LIBLZMA_LIBRARY
|
||||
find_package_handle_standard_args(liblzma REQUIRED_VARS LIBLZMA_LIBRARY
|
||||
LIBLZMA_INCLUDE_DIR
|
||||
LIBLZMA_HAS_AUTO_DECODER
|
||||
LIBLZMA_HAS_EASY_ENCODER
|
||||
@@ -95,31 +95,31 @@ find_package_handle_standard_args(LibLZMA REQUIRED_VARS LIBLZMA_LIBRARY
|
||||
)
|
||||
mark_as_advanced( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY )
|
||||
|
||||
if (LIBLZMA_FOUND)
|
||||
if (liblzma_FOUND)
|
||||
set(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY})
|
||||
set(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR})
|
||||
if(NOT TARGET LibLZMA::LibLZMA)
|
||||
add_library(LibLZMA::LibLZMA UNKNOWN IMPORTED)
|
||||
set_target_properties(LibLZMA::LibLZMA PROPERTIES
|
||||
if(NOT TARGET liblzma::liblzma)
|
||||
add_library(liblzma::liblzma UNKNOWN IMPORTED)
|
||||
set_target_properties(liblzma::liblzma PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${LIBLZMA_INCLUDE_DIR}
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES C)
|
||||
|
||||
if(LIBLZMA_LIBRARY_RELEASE)
|
||||
set_property(TARGET LibLZMA::LibLZMA APPEND PROPERTY
|
||||
set_property(TARGET liblzma::liblzma APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(LibLZMA::LibLZMA PROPERTIES
|
||||
set_target_properties(liblzma::liblzma PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${LIBLZMA_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(LIBLZMA_LIBRARY_DEBUG)
|
||||
set_property(TARGET LibLZMA::LibLZMA APPEND PROPERTY
|
||||
set_property(TARGET liblzma::liblzma APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(LibLZMA::LibLZMA PROPERTIES
|
||||
set_target_properties(liblzma::liblzma PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${LIBLZMA_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
|
||||
if(NOT LIBLZMA_LIBRARY_RELEASE AND NOT LIBLZMA_LIBRARY_DEBUG)
|
||||
set_target_properties(LibLZMA::LibLZMA PROPERTIES
|
||||
set_target_properties(liblzma::liblzma PROPERTIES
|
||||
IMPORTED_LOCATION "${LIBLZMA_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -26,7 +26,8 @@
|
||||
|
||||
# liblzma2
|
||||
set(LZMA_SUPPORT FALSE)
|
||||
find_package(LibLZMA)
|
||||
find_package(liblzma)
|
||||
|
||||
option(lzma "use liblzma (required for LZMA2 compression)" ${LIBLZMA_FOUND})
|
||||
if (lzma AND LIBLZMA_FOUND)
|
||||
set(LZMA_SUPPORT TRUE)
|
||||
|
||||
@@ -29,13 +29,13 @@ function(set_libs_private out_var)
|
||||
foreach(lib IN LISTS ARGN)
|
||||
get_filename_component(name "${lib}" NAME)
|
||||
foreach(prefix IN LISTS CMAKE_FIND_LIBRARY_PREFIXES)
|
||||
if(name MATCHES "^${prefix}")
|
||||
if(NOT("${prefix}" STREQUAL "") AND name MATCHES "^${prefix}")
|
||||
string(REGEX REPLACE "^${prefix}" "" name "${name}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(suffix IN LISTS CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
if(name MATCHES "${suffix}$")
|
||||
if(NOT("${suffix}" STREQUAL "") AND name MATCHES "${suffix}$")
|
||||
string(REGEX REPLACE "${suffix}$" "" name "${name}")
|
||||
break()
|
||||
endif()
|
||||
@@ -63,5 +63,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libtiff-4.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc @ONLY)
|
||||
|
||||
# Install pkg-config file
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
if (tiff-install)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
endif()
|
||||
|
||||
@@ -26,17 +26,6 @@
|
||||
|
||||
include(TestBigEndian)
|
||||
|
||||
|
||||
# CPU bit order
|
||||
set(HOST_FILLORDER FILLORDER_MSB2LSB)
|
||||
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i.*86.*" OR
|
||||
CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*" OR
|
||||
# AMD64 on Windows
|
||||
CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "AMD64" OR
|
||||
CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64.*")
|
||||
set(HOST_FILLORDER FILLORDER_LSB2MSB)
|
||||
endif()
|
||||
|
||||
# CPU endianness
|
||||
test_big_endian(HOST_BIG_ENDIAN)
|
||||
if(HOST_BIG_ENDIAN)
|
||||
|
||||
+22
-6
@@ -22,10 +22,26 @@
|
||||
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
# OF THIS SOFTWARE.
|
||||
|
||||
|
||||
# Add target tiff_release to update the version information in the root files
|
||||
# VERSION and RELEASE-DATE.
|
||||
add_custom_target(tiff_release
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DSOURCE_DIR:PATH=${PROJECT_SOURCE_DIR}"
|
||||
"-DLIBTIFF_VERSION=${PROJECT_VERSION}"
|
||||
-P "${CMAKE_CURRENT_LIST_DIR}/ReleaseScript.cmake"
|
||||
COMMENT "Releasing ${PROJECT_NAME} ${PROJECT_VERSION}")
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DSOURCE_DIR:PATH=${PROJECT_SOURCE_DIR}"
|
||||
"-DLIBTIFF_VERSION=${PROJECT_VERSION}"
|
||||
"-DLIBTIFF_BASIC_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"-DLIBTIFF_BASIC_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
-P "${CMAKE_CURRENT_LIST_DIR}/ReleaseScript.cmake"
|
||||
COMMENT "Releasing ${PROJECT_NAME} ${PROJECT_VERSION} ...")
|
||||
|
||||
# Version information is taken from configure.ac
|
||||
# Note: Single command "cmake --build . --target tiff_release"
|
||||
# does not work correctly, because version information is taken from CMakeCache.txt,
|
||||
# which is not updated by cmake --build.
|
||||
# Therefore, force CMake re-configure if configure.ac has changed.
|
||||
# By the way, release-date and VERSION will not change but only when --targt tiff_release is called.
|
||||
set_property(
|
||||
DIRECTORY
|
||||
APPEND
|
||||
PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/configure.ac
|
||||
)
|
||||
|
||||
|
||||
@@ -22,11 +22,21 @@
|
||||
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
# OF THIS SOFTWARE.
|
||||
|
||||
# Update release date to current date
|
||||
string(TIMESTAMP LIBTIFF_RELEASE_DATE "%Y%m%d")
|
||||
|
||||
# Update version information in all relevant files
|
||||
message(STATUS "Setting release version to ${LIBTIFF_VERSION}")
|
||||
message(STATUS "Setting release date to ${LIBTIFF_RELEASE_DATE}")
|
||||
|
||||
configure_file("${SOURCE_DIR}/libtiff/tiffvers.h.cmake.in"
|
||||
"${SOURCE_DIR}/libtiff/tiffvers.h"
|
||||
@ONLY)
|
||||
# Only needed here, for manual build of target tiff_release
|
||||
# because otherwise tiffvers.h is generated when building all targets.
|
||||
configure_file(${LIBTIFF_BASIC_SOURCE_DIR}/libtiff/tiffvers.h.cmake.in
|
||||
${LIBTIFF_BASIC_BINARY_DIR}/libtiff/tiffvers.h
|
||||
@ONLY)
|
||||
|
||||
# Write version information and release date to root files.
|
||||
FILE(WRITE ${LIBTIFF_BASIC_SOURCE_DIR}/VERSION "${LIBTIFF_VERSION}" \n)
|
||||
FILE(WRITE ${LIBTIFF_BASIC_SOURCE_DIR}/RELEASE-DATE "${LIBTIFF_RELEASE_DATE}" \n)
|
||||
message(STATUS "Files tiffvers.h, VERSION and RELEASE-DATE updated.")
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
if(NOT "@BUILD_SHARED_LIBS@")
|
||||
# TODO: import dependencies
|
||||
endif()
|
||||
|
||||
function(set_variable_from_rel_or_absolute_path var root rel_or_abs_path)
|
||||
if(IS_ABSOLUTE "${rel_or_abs_path}")
|
||||
set(${var} "${rel_or_abs_path}" PARENT_SCOPE)
|
||||
else()
|
||||
set(${var} "${root}/${rel_or_abs_path}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Tell the user project where to find our headers and libraries
|
||||
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
|
||||
get_filename_component(_ROOT "${_DIR}/@PROJECT_ROOT_DIR@" ABSOLUTE)
|
||||
# Use _ROOT as prefix here for the possibility of relocation after installation.
|
||||
set_variable_from_rel_or_absolute_path("TIFF_INCLUDE_DIR" "${_ROOT}" "@CMAKE_INSTALL_INCLUDEDIR@")
|
||||
set(TIFF_INCLUDE_DIRS ${TIFF_INCLUDE_DIR})
|
||||
|
||||
set(TIFF_LIBRARIES TIFF::tiff)
|
||||
|
||||
if(NOT TARGET TIFF::tiff)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/TiffTargets.cmake")
|
||||
endif()
|
||||
|
||||
unset (_ROOT)
|
||||
unset (_DIR)
|
||||
@@ -31,6 +31,14 @@ set(ZSTD_USABLE FALSE)
|
||||
find_package(ZSTD)
|
||||
|
||||
if(ZSTD_FOUND)
|
||||
if(TARGET zstd::libzstd_shared)
|
||||
add_library(ZSTD::ZSTD ALIAS zstd::libzstd_shared)
|
||||
set(ZSTD_HAVE_DECOMPRESS_STREAM ON)
|
||||
elseif(TARGET zstd::libzstd_static)
|
||||
add_library(ZSTD::ZSTD ALIAS zstd::libzstd_static)
|
||||
set(ZSTD_HAVE_DECOMPRESS_STREAM ON)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED ZSTD_HAVE_DECOMPRESS_STREAM)
|
||||
set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ZSTD_INCLUDE_DIRS})
|
||||
|
||||
+27
-31
@@ -25,7 +25,7 @@ dnl OF THIS SOFTWARE.
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.64)
|
||||
AC_INIT([LibTIFF Software],[4.5.0],[tiff@lists.maptools.org],[tiff])
|
||||
AC_INIT([LibTIFF Software],[4.7.0],[tiff@lists.osgeo.org],[tiff])
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
AC_CONFIG_MACRO_DIR(m4)
|
||||
AC_LANG(C)
|
||||
@@ -40,12 +40,13 @@ AM_MAINTAINER_MODE
|
||||
dnl Versioning.
|
||||
dnl Don't fill the ALPHA_VERSION field, if not applicable.
|
||||
LIBTIFF_MAJOR_VERSION=4
|
||||
LIBTIFF_MINOR_VERSION=5
|
||||
LIBTIFF_MINOR_VERSION=7
|
||||
LIBTIFF_MICRO_VERSION=0
|
||||
LIBTIFF_ALPHA_VERSION=
|
||||
LIBTIFF_VERSION=$LIBTIFF_MAJOR_VERSION.$LIBTIFF_MINOR_VERSION.$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION
|
||||
dnl This will be used with the 'make release' target
|
||||
LIBTIFF_RELEASE_DATE=`date +"%Y%m%d"`
|
||||
dnl This (LIBTIFF_RELEASE_DATE) is used to set the #define TIFFLIB_VERSION in tiffvers.h.
|
||||
LIBTIFF_RELEASE_DATE=$(cat ${srcdir}/RELEASE-DATE)
|
||||
|
||||
|
||||
dnl Libtool library revision control info
|
||||
dnl See the libtool documentation under the heading "Libtool's versioning
|
||||
@@ -76,9 +77,9 @@ dnl 5. If any interfaces have been added since the last public release, then
|
||||
dnl increment age.
|
||||
dnl 6. If any interfaces have been removed since the last public release,
|
||||
dnl then set age to 0.
|
||||
LIBTIFF_CURRENT=6
|
||||
LIBTIFF_CURRENT=7
|
||||
LIBTIFF_REVISION=0
|
||||
LIBTIFF_AGE=0
|
||||
LIBTIFF_AGE=1
|
||||
LIBTIFF_VERSION_INFO=$LIBTIFF_CURRENT:$LIBTIFF_REVISION:$LIBTIFF_AGE
|
||||
|
||||
# This is a special hack for OpenBSD and MirOS systems. The dynamic linker
|
||||
@@ -163,8 +164,13 @@ AC_SUBST(tiff_libs_private)
|
||||
tiff_requires_private=
|
||||
AC_SUBST(tiff_requires_private)
|
||||
|
||||
|
||||
AM_CONDITIONAL(BUILD_STATIC, test "$enable_static" = "yes")
|
||||
|
||||
dnl Avoid -Werror to interfere with feature detection
|
||||
SAVED_CFLAGS="$CFLAGS"
|
||||
CFLAGS=$(echo "$CFLAGS " | sed "s/-Werror //")
|
||||
|
||||
dnl We don't need to add math library to all targets
|
||||
case "${host_os}" in
|
||||
cygwin* | mingw32* | beos* | darwin*)
|
||||
@@ -197,7 +203,7 @@ dnl Check if optarg (and presumably related externs) already declared in headers
|
||||
AC_CHECK_DECLS([optarg])
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Deprecated features and backward compatibilty
|
||||
dnl Deprecated features and backward compatibility
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([deprecated],
|
||||
@@ -254,22 +260,6 @@ AC_CHECK_FUNCS([mmap setmode])
|
||||
dnl Will use local replacements for unavailable functions
|
||||
AC_REPLACE_FUNCS(getopt)
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Check the native cpu bit order.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
AC_MSG_CHECKING([native cpu bit order])
|
||||
case "$host_cpu" in
|
||||
i*86*|x86_64*)
|
||||
HOST_FILLORDER=FILLORDER_LSB2MSB
|
||||
AC_MSG_RESULT([lsb2msb])
|
||||
;;
|
||||
*)
|
||||
HOST_FILLORDER=FILLORDER_MSB2LSB
|
||||
AC_MSG_RESULT([msb2lsb])
|
||||
;;
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED(HOST_FILLORDER, $HOST_FILLORDER, [Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB)])
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Configure legacy tifconf.h HOST_BIGENDIAN.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
@@ -592,7 +582,7 @@ if test "x$enable_jpeg" != "xno" ; then
|
||||
fi
|
||||
|
||||
if test "$jpeg_lib" = "yes" -a "$jpeg_h" = "yes" ; then
|
||||
dnl Check for jpeg12_read_scanlines which has been added in libjpeg-turbo 2.2
|
||||
dnl Check for jpeg12_read_scanlines which has been added in libjpeg-turbo 3.0
|
||||
dnl for dual 8/12 bit mode.
|
||||
AC_CHECK_LIB(jpeg, jpeg12_read_scanlines, [HAVE_JPEGTURBO_DUAL_MODE_8_12=yes], [HAVE_JPEGTURBO_DUAL_MODE_8_12=no],)
|
||||
HAVE_JPEG=yes
|
||||
@@ -611,7 +601,7 @@ if test "$HAVE_JPEG" = "yes" ; then
|
||||
fi
|
||||
|
||||
if test "$HAVE_JPEGTURBO_DUAL_MODE_8_12" = "yes"; then
|
||||
AC_DEFINE(HAVE_JPEGTURBO_DUAL_MODE_8_12,1,[libjpeg-turbo >= 2.2 dual mode enabled])
|
||||
AC_DEFINE(HAVE_JPEGTURBO_DUAL_MODE_8_12,1,[libjpeg-turbo >= 3.0 dual mode enabled])
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -750,6 +740,7 @@ if test "$HAVE_LERC" = "yes" ; then
|
||||
AC_DEFINE(LERC_SUPPORT,1,[Support lerc compression])
|
||||
LIBS="-l${lerc_lib_name} $LIBS"
|
||||
tiff_libs_private="-l${lerc_lib_name} ${tiff_libs_private}"
|
||||
tiff_requires_private="Lerc ${tiff_requires_private}"
|
||||
|
||||
if test "$HAVE_RPATH" = "yes" -a "x$with_lerc_lib_dir" != "x" ; then
|
||||
LIBDIR="-R $with_lerc_lib_dir $LIBDIR"
|
||||
@@ -926,7 +917,7 @@ AM_CONDITIONAL(HAVE_WEBP, test "$HAVE_WEBP" = 'yes')
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Should 8/12 bit jpeg mode be enabled?
|
||||
dnl This should not be used starting with libjpeg-turbo >= 2.2 that has
|
||||
dnl This should not be used starting with libjpeg-turbo >= 3.0 that has
|
||||
dnl built-in support for dual mode.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
@@ -935,7 +926,7 @@ if test "$HAVE_JPEGTURBO_DUAL_MODE_8_12" = "no"; then
|
||||
|
||||
AC_ARG_ENABLE(jpeg12,
|
||||
AS_HELP_STRING([--enable-jpeg12],
|
||||
[enable libjpeg 8/12bit dual mode (not to be used with libjpeg-turbo >= 2.2)]),,)
|
||||
[enable libjpeg 8/12bit dual mode (not to be used with libjpeg-turbo >= 3.0)]),,)
|
||||
AC_ARG_WITH(jpeg12-include-dir,
|
||||
AS_HELP_STRING([--with-jpeg12-include-dir=DIR],
|
||||
[location of libjpeg 12bit headers]),,)
|
||||
@@ -1009,14 +1000,14 @@ AM_CONDITIONAL(HAVE_OPENGL, test "$HAVE_OPENGL" = "yes")
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Check for Win32 IO: make sure we have windows.h but not cygwin
|
||||
dnl this must be after the ogl test, since that looks for windows.h and we
|
||||
dnl test it
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE(win32-io,
|
||||
AS_HELP_STRING([--disable-win32-io],
|
||||
[disable Win32 I/O (Windows only, enabled by default except for Cygwin)]),,)
|
||||
|
||||
AC_CHECK_HEADER(windows.h)
|
||||
|
||||
win32_io_ok=no
|
||||
case "${host_os}" in
|
||||
cygwin*)
|
||||
@@ -1161,8 +1152,7 @@ if test "$CHECK_JPEG_YCBCR_SUBSAMPLING" = "yes" ; then
|
||||
[Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled).])
|
||||
fi
|
||||
|
||||
|
||||
for python in python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python3 python; do
|
||||
for python in python3.16 python3.15 python3.14 python3.13 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python3 python; do
|
||||
AC_CHECK_PROGS(PYTHON_BIN, [$python])
|
||||
if test "x$PYTHON_BIN" != "x"; then
|
||||
break
|
||||
@@ -1204,6 +1194,7 @@ fi
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
CFLAGS="$SAVED_CFLAGS"
|
||||
|
||||
AC_SUBST(LIBDIR)
|
||||
|
||||
@@ -1225,6 +1216,7 @@ AC_CONFIG_FILES([Makefile \
|
||||
doc/Makefile \
|
||||
libtiff-4.pc \
|
||||
libtiff/Makefile \
|
||||
libtiff/tiffvers.h \
|
||||
port/Makefile \
|
||||
test/Makefile \
|
||||
tools/Makefile])
|
||||
@@ -1237,6 +1229,10 @@ dnl ---------------------------------------------------------------------------
|
||||
LOC_MSG()
|
||||
LOC_MSG([Libtiff is now configured for ${host}])
|
||||
LOC_MSG()
|
||||
LOC_MSG([ Libtiff build version: ${LIBTIFF_VERSION}])
|
||||
LOC_MSG([ Libtiff library version: ${LIBTIFF_VERSION_INFO}])
|
||||
LOC_MSG([ Libtiff release date: ${LIBTIFF_RELEASE_DATE}])
|
||||
LOC_MSG()
|
||||
LOC_MSG([ Installation directory: ${prefix}])
|
||||
LOC_MSG([ Documentation directory: ${LIBTIFF_DOCDIR}])
|
||||
LOC_MSG([ C compiler: ${CC} ${CFLAGS}])
|
||||
|
||||
@@ -149,7 +149,8 @@ uint32_t TIFF_WriteOverview(TIFF *hTIFF, uint32_t nXSize, uint32_t nYSize,
|
||||
if (TIFFWriteCheck(hTIFF, bTiled, "TIFFBuildOverviews") == 0)
|
||||
return 0;
|
||||
|
||||
TIFFWriteDirectory(hTIFF);
|
||||
if (!TIFFWriteDirectory(hTIFF))
|
||||
return 0;
|
||||
iNumDir = TIFFNumberOfDirectories(hTIFF);
|
||||
if (iNumDir > TIFF_DIR_MAX)
|
||||
{
|
||||
|
||||
@@ -43,6 +43,7 @@ TIFFOvrCache *TIFFCreateOvrCache(TIFF *hTIFF, toff_t nDirOffset)
|
||||
{
|
||||
TIFFOvrCache *psCache;
|
||||
toff_t nBaseDirOffset;
|
||||
int nRet;
|
||||
|
||||
psCache = (TIFFOvrCache *)_TIFFmalloc(sizeof(TIFFOvrCache));
|
||||
psCache->nDirOffset = nDirOffset;
|
||||
@@ -52,7 +53,9 @@ TIFFOvrCache *TIFFCreateOvrCache(TIFF *hTIFF, toff_t nDirOffset)
|
||||
/* Get definition of this raster from the TIFF file itself. */
|
||||
/* -------------------------------------------------------------------- */
|
||||
nBaseDirOffset = TIFFCurrentDirOffset(psCache->hTIFF);
|
||||
TIFFSetSubDirectory(hTIFF, nDirOffset);
|
||||
nRet = TIFFSetSubDirectory(hTIFF, nDirOffset);
|
||||
(void)nRet;
|
||||
assert(nRet == 1);
|
||||
|
||||
TIFFGetField(hTIFF, TIFFTAG_IMAGEWIDTH, &(psCache->nXSize));
|
||||
TIFFGetField(hTIFF, TIFFTAG_IMAGELENGTH, &(psCache->nYSize));
|
||||
@@ -120,7 +123,9 @@ TIFFOvrCache *TIFFCreateOvrCache(TIFF *hTIFF, toff_t nDirOffset)
|
||||
|
||||
psCache->nBlockOffset = 0;
|
||||
|
||||
TIFFSetSubDirectory(psCache->hTIFF, nBaseDirOffset);
|
||||
nRet = TIFFSetSubDirectory(psCache->hTIFF, nBaseDirOffset);
|
||||
(void)nRet;
|
||||
assert(nRet == 1);
|
||||
|
||||
return psCache;
|
||||
}
|
||||
@@ -193,8 +198,11 @@ static void TIFFWriteOvrRow(TIFFOvrCache *psCache)
|
||||
nTileID = TIFFComputeTile(
|
||||
psCache->hTIFF, iTileX * psCache->nBlockXSize,
|
||||
iTileY * psCache->nBlockYSize, 0, (tsample_t)iSample);
|
||||
TIFFWriteEncodedTile(psCache->hTIFF, nTileID, pabyData,
|
||||
TIFFTileSize(psCache->hTIFF));
|
||||
if (TIFFWriteEncodedTile(psCache->hTIFF, nTileID, pabyData,
|
||||
TIFFTileSize(psCache->hTIFF)) < 0)
|
||||
{
|
||||
fprintf(stderr, "TIFFWriteEncodedTile() failed\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -205,9 +213,12 @@ static void TIFFWriteOvrRow(TIFFOvrCache *psCache)
|
||||
if ((iTileY + 1) * psCache->nBlockYSize > psCache->nYSize)
|
||||
RowsInStrip =
|
||||
psCache->nYSize - iTileY * psCache->nBlockYSize;
|
||||
TIFFWriteEncodedStrip(
|
||||
psCache->hTIFF, nTileID, pabyData,
|
||||
TIFFVStripSize(psCache->hTIFF, RowsInStrip));
|
||||
if (TIFFWriteEncodedStrip(
|
||||
psCache->hTIFF, nTileID, pabyData,
|
||||
TIFFVStripSize(psCache->hTIFF, RowsInStrip)) < 0)
|
||||
{
|
||||
fprintf(stderr, "TIFFWriteEncodedStrip() failed\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,8 +231,11 @@ static void TIFFWriteOvrRow(TIFFOvrCache *psCache)
|
||||
nTileID = TIFFComputeTile(psCache->hTIFF,
|
||||
iTileX * psCache->nBlockXSize,
|
||||
iTileY * psCache->nBlockYSize, 0, 0);
|
||||
TIFFWriteEncodedTile(psCache->hTIFF, nTileID, pabyData,
|
||||
TIFFTileSize(psCache->hTIFF));
|
||||
if (TIFFWriteEncodedTile(psCache->hTIFF, nTileID, pabyData,
|
||||
TIFFTileSize(psCache->hTIFF)) < 0)
|
||||
{
|
||||
fprintf(stderr, "TIFFWriteEncodedTile() failed\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -231,14 +245,15 @@ static void TIFFWriteOvrRow(TIFFOvrCache *psCache)
|
||||
if ((iTileY + 1) * psCache->nBlockYSize > psCache->nYSize)
|
||||
RowsInStrip =
|
||||
psCache->nYSize - iTileY * psCache->nBlockYSize;
|
||||
TIFFWriteEncodedStrip(
|
||||
psCache->hTIFF, nTileID, pabyData,
|
||||
TIFFVStripSize(psCache->hTIFF, RowsInStrip));
|
||||
if (TIFFWriteEncodedStrip(
|
||||
psCache->hTIFF, nTileID, pabyData,
|
||||
TIFFVStripSize(psCache->hTIFF, RowsInStrip)) < 0)
|
||||
{
|
||||
fprintf(stderr, "TIFFWriteEncodedStrip() failed\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* TODO: add checks on error status return of TIFFWriteEncodedTile and
|
||||
* TIFFWriteEncodedStrip */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Rotate buffers. */
|
||||
|
||||
+16
-19
@@ -446,7 +446,6 @@ int main(int argc, char *argv[])
|
||||
int inputlen = BUFFER_SZ;
|
||||
|
||||
line = (char *)malloc(inputlen);
|
||||
token = (char *)NULL;
|
||||
while ((line = super_fgets(line, &inputlen, ifile)) != NULL)
|
||||
{
|
||||
state = 0;
|
||||
@@ -459,38 +458,38 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (state == 0)
|
||||
{
|
||||
int state, next;
|
||||
int state2, next2;
|
||||
|
||||
char brkused, quoted;
|
||||
char brkused2, quoted2;
|
||||
|
||||
state = 0;
|
||||
next = 0;
|
||||
state2 = 0;
|
||||
next2 = 0;
|
||||
while (tokenizer(0, newstr, inputlen, token, "", "#", "", 0,
|
||||
&brkused, &next, "ed) == 0)
|
||||
&brkused2, &next2, "ed2) == 0)
|
||||
{
|
||||
if (state == 0)
|
||||
if (state2 == 0)
|
||||
dataset = (unsigned char)atoi(newstr);
|
||||
else if (state == 1)
|
||||
else if (state2 == 1)
|
||||
recnum = (unsigned char)atoi(newstr);
|
||||
state++;
|
||||
state2++;
|
||||
}
|
||||
}
|
||||
else if (state == 1)
|
||||
{
|
||||
int next;
|
||||
int next2;
|
||||
|
||||
unsigned long len;
|
||||
|
||||
char brkused, quoted;
|
||||
char brkused2, quoted2;
|
||||
|
||||
next = 0;
|
||||
next2 = 0;
|
||||
len = (unsigned long)strlen(token);
|
||||
while (tokenizer(0, newstr, inputlen, token, "", "&", "", 0,
|
||||
&brkused, &next, "ed) == 0)
|
||||
&brkused2, &next2, "ed2) == 0)
|
||||
{
|
||||
if (brkused && next > 0)
|
||||
if (brkused2 && next2 > 0)
|
||||
{
|
||||
char *s = &token[next - 1];
|
||||
char *s = &token[next2 - 1];
|
||||
|
||||
len -= convertHTMLcodes(s, (int)strlen(s));
|
||||
}
|
||||
@@ -511,16 +510,14 @@ int main(int argc, char *argv[])
|
||||
fputc((len >> 8) & 255, ofile);
|
||||
fputc(len & 255, ofile);
|
||||
}
|
||||
next = 0;
|
||||
next2 = 0;
|
||||
while (len--)
|
||||
fputc(token[next++], ofile);
|
||||
fputc(token[next2++], ofile);
|
||||
}
|
||||
state++;
|
||||
}
|
||||
free(token);
|
||||
token = (char *)NULL;
|
||||
free(newstr);
|
||||
newstr = (char *)NULL;
|
||||
}
|
||||
free(line);
|
||||
|
||||
|
||||
+90
-75
@@ -26,79 +26,6 @@
|
||||
|
||||
docdir = $(LIBTIFF_DOCDIR)/manual
|
||||
|
||||
if TIFF_DOCS
|
||||
if SPHINX
|
||||
doc-html:
|
||||
$(SPHINX_BUILD) \
|
||||
-D "release=$(LIBTIFF_VERSION)" \
|
||||
-D "version=$(LIBTIFF_MAJOR_VERSION).$(LIBTIFF_MINOR_VERSION)" \
|
||||
-d "$(builddir)/cache" \
|
||||
-b html \
|
||||
"$(srcdir)" "$(builddir)/html"
|
||||
|
||||
doc-man:
|
||||
$(SPHINX_BUILD) \
|
||||
-D "release=$(LIBTIFF_VERSION)" \
|
||||
-D "version=$(LIBTIFF_MAJOR_VERSION).$(LIBTIFF_MINOR_VERSION)" \
|
||||
-d "$(builddir)/cache" \
|
||||
-b man \
|
||||
"$(srcdir)" "$(builddir)/man"
|
||||
|
||||
man1_MANS = $(TIFF_MAN1_GEN)
|
||||
man3_MANS = $(TIFF_MAN3_GEN)
|
||||
|
||||
@TIFF_MAN_RULES@
|
||||
|
||||
all-local: doc-html doc-man
|
||||
|
||||
clean-local:
|
||||
rm -r html
|
||||
rm -r man
|
||||
rm -r cache
|
||||
|
||||
html_installdir = html
|
||||
else
|
||||
# Sphinx not available
|
||||
doc-html:
|
||||
echo "HTML documentation generation not configured (sphinx not available)"
|
||||
exit 1
|
||||
|
||||
doc-man:
|
||||
echo "Manual page documentation generation not configured (sphinx not available)"
|
||||
exit 1
|
||||
|
||||
man1_MANS = $(TIFF_MAN1_PREBUILT)
|
||||
man3_MANS = $(TIFF_MAN3_PREBUILT)
|
||||
|
||||
html_installdir = $(srcdir)/html-prebuilt
|
||||
endif
|
||||
|
||||
|
||||
install-data-local: all-local
|
||||
find $(html_installdir) -type d | sed -e 's;^$(html_installdir);;' | while read dir; do \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(docdir)$$dir'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(docdir)$$dir" || exit 1; \
|
||||
done
|
||||
find $(html_installdir) -type f | sed -e 's;^$(html_installdir);;' | while read docfile; do \
|
||||
docsubdir=$$(dirname $$docfile); \
|
||||
echo "$(INSTALL_DATA) '$(html_installdir)$$docfile' '$(DESTDIR)$(docdir)$$docsubdir'"; \
|
||||
$(INSTALL_DATA) "$(html_installdir)$$docfile" "$(DESTDIR)$(docdir)$$docsubdir"; \
|
||||
done
|
||||
|
||||
uninstall-local:
|
||||
echo "rm -r $(DESTDIR)$(docdir)"
|
||||
rm -r $(DESTDIR)$(docdir)
|
||||
else
|
||||
# Documentation generation disabled
|
||||
doc-html:
|
||||
echo "HTML documentation generation not configured"
|
||||
exit 1
|
||||
|
||||
doc-man:
|
||||
echo "Manual page documentation generation not configured"
|
||||
exit 1
|
||||
endif
|
||||
|
||||
rst_sources = \
|
||||
index.rst \
|
||||
build.rst \
|
||||
@@ -129,6 +56,7 @@ rst_sources = \
|
||||
project/acknowledgements.rst \
|
||||
project/bugs.rst \
|
||||
project/mailinglist.rst \
|
||||
project/psc.rst \
|
||||
addingtags.rst \
|
||||
specification/index.rst \
|
||||
specification/bigtiff.rst \
|
||||
@@ -193,6 +121,12 @@ rst_sources = \
|
||||
releases/v4.0.4.rst \
|
||||
releases/v3.7.2.rst \
|
||||
releases/v4.5.0.rst \
|
||||
releases/v4.5.1.rst \
|
||||
releases/v4.6.0.rst \
|
||||
releases/v4.7.0.rst \
|
||||
rfcs/index.rst \
|
||||
rfcs/rfc1_psc.rst \
|
||||
rfcs/rfc2_restoring_needed_tools.rst \
|
||||
functions.rst \
|
||||
tools.rst \
|
||||
terms.rst \
|
||||
@@ -257,6 +191,7 @@ rst_sources = \
|
||||
functions/TIFFSetTagExtender.rst \
|
||||
functions/TIFFStrileQuery.rst \
|
||||
libtiff.rst \
|
||||
multi_page.rst \
|
||||
images.rst
|
||||
|
||||
EXTRA_DIST = \
|
||||
@@ -266,8 +201,88 @@ EXTRA_DIST = \
|
||||
images \
|
||||
$(rst_sources)
|
||||
|
||||
if TIFF_DOCS
|
||||
if SPHINX
|
||||
doc-html: $(EXTRA_DIST) ../configure.ac
|
||||
$(SPHINX_BUILD) \
|
||||
-D "release=$(LIBTIFF_VERSION)" \
|
||||
-D "version=$(LIBTIFF_MAJOR_VERSION).$(LIBTIFF_MINOR_VERSION)" \
|
||||
-d "$(builddir)/cache" \
|
||||
-b html \
|
||||
"$(srcdir)" "$(builddir)/html"
|
||||
touch doc-html
|
||||
|
||||
doc-man: $(EXTRA_DIST) ../configure.ac
|
||||
$(SPHINX_BUILD) \
|
||||
-D "release=$(LIBTIFF_VERSION)" \
|
||||
-D "version=$(LIBTIFF_MAJOR_VERSION).$(LIBTIFF_MINOR_VERSION)" \
|
||||
-d "$(builddir)/cache" \
|
||||
-b man \
|
||||
"$(srcdir)" "$(builddir)/man"
|
||||
touch doc-man
|
||||
|
||||
man1_MANS = $(TIFF_MAN1_GEN)
|
||||
man3_MANS = $(TIFF_MAN3_GEN)
|
||||
|
||||
@TIFF_MAN_RULES@
|
||||
|
||||
all-local: doc-html doc-man
|
||||
|
||||
clean-local:
|
||||
rm -rf html
|
||||
rm -rf man
|
||||
rm -rf cache
|
||||
rm -f doc-html
|
||||
rm -f doc-man
|
||||
|
||||
html_installdir = html
|
||||
else
|
||||
# Sphinx not available
|
||||
doc-html:
|
||||
echo "HTML documentation generation not configured (sphinx not available)"
|
||||
exit 1
|
||||
|
||||
doc-man:
|
||||
echo "Manual page documentation generation not configured (sphinx not available)"
|
||||
exit 1
|
||||
|
||||
.PHONY: doc-html doc-man
|
||||
|
||||
man1_MANS = $(TIFF_MAN1_PREBUILT)
|
||||
man3_MANS = $(TIFF_MAN3_PREBUILT)
|
||||
|
||||
html_installdir = $(srcdir)/html-prebuilt
|
||||
endif
|
||||
|
||||
|
||||
install-data-local: all-local
|
||||
find $(html_installdir) -type d | sed -e 's;^$(html_installdir);;' | while read dir; do \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(docdir)$$dir'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(docdir)$$dir" || exit 1; \
|
||||
done
|
||||
find $(html_installdir) -type f | sed -e 's;^$(html_installdir);;' | while read docfile; do \
|
||||
docsubdir=$$(dirname $$docfile); \
|
||||
echo "$(INSTALL_DATA) '$(html_installdir)$$docfile' '$(DESTDIR)$(docdir)$$docsubdir'"; \
|
||||
$(INSTALL_DATA) "$(html_installdir)$$docfile" "$(DESTDIR)$(docdir)$$docsubdir"; \
|
||||
done
|
||||
|
||||
uninstall-local:
|
||||
echo "rm -r $(DESTDIR)$(docdir)"
|
||||
rm -r $(DESTDIR)$(docdir)
|
||||
else
|
||||
# Documentation generation disabled
|
||||
doc-html:
|
||||
echo "HTML documentation generation not configured"
|
||||
exit 1
|
||||
|
||||
doc-man:
|
||||
echo "Manual page documentation generation not configured"
|
||||
exit 1
|
||||
|
||||
.PHONY: doc-html doc-man
|
||||
|
||||
endif
|
||||
|
||||
dist-hook: doc-html doc-man
|
||||
cp -r html $(distdir)/html-prebuilt
|
||||
cp -r man $(distdir)/man-prebuilt
|
||||
|
||||
.PHONY: doc-html doc-man
|
||||
|
||||
+9
-11
@@ -54,7 +54,7 @@ This structure looks like this:
|
||||
Generally the same as field_readcount. A few built-in exceptions exist, but
|
||||
I haven't analysed why they differ.
|
||||
|
||||
.. c:member:: TIFFDataType TIFFDataType.field_type
|
||||
.. c:member:: TIFFDataType TIFFFieldInfo.field_type
|
||||
|
||||
Type of the field. One of :c:enumerator:`TIFF_BYTE`, :c:enumerator:`TIFF_ASCII`,
|
||||
:c:enumerator:`TIFF_SHORT`, :c:enumerator:`TIFF_LONG`,
|
||||
@@ -63,11 +63,10 @@ This structure looks like this:
|
||||
:c:enumerator:`TIFF_SLONG`, :c:enumerator:`TIFF_SRATIONAL`,
|
||||
:c:enumerator:`TIFF_FLOAT`, :c:enumerator:`TIFF_DOUBLE` or
|
||||
:c:enumerator:`TIFF_IFD`.
|
||||
|
||||
.. note::
|
||||
|
||||
Some fields can support more than one type (for
|
||||
instance short and long). These fields should have multiple TIFFFieldInfos.
|
||||
And for BigTIFF :c:enumerator:`TIFF_LONG8`,
|
||||
:c:enumerator:`TIFF_SLONG8` and :c:enumerator:`TIFF_IFD8`,
|
||||
which are automatically reverted to 4 byte fields in
|
||||
ClassicTIFF.
|
||||
|
||||
.. c:member:: unsigned short TIFFFieldInfo.field_bit
|
||||
|
||||
@@ -95,15 +94,14 @@ This structure looks like this:
|
||||
A name for the tag. Normally mixed case (studly caps)
|
||||
like ``StripByteCounts``, and relatively short.
|
||||
|
||||
A :c:struct:`TIFFFieldInfo` definition exists for each built-in tag in the
|
||||
:file:`tif_dirinfo.c` file. Some tags which support multiple data types
|
||||
have more than one definition, one per data type supported.
|
||||
Within :file:`tif_dirinfo.c` file, the built-in TIFF tags are defined with
|
||||
:c:struct:`TIFFField` structure that has additional parameters defining the var_arg
|
||||
interface of :c:func:`TIFFSetField` and :c:func:`TIFFGetField`.
|
||||
|
||||
Various functions exist for getting the internal :c:struct:`TIFFFieldInfo`
|
||||
definitions, including :c:func:`_TIFFFindFieldInfo`, and
|
||||
:c:func:`_TIFFFindFieldInfoByName`. See
|
||||
:file:`tif_dirinfo.c` for details. There must be some mechanism to get the whole
|
||||
list, though I don't see it off hand.
|
||||
:file:`tif_dirinfo.c` for details.
|
||||
|
||||
.. _Tag_Auto_registration:
|
||||
|
||||
|
||||
@@ -175,3 +175,5 @@ man_pages = [
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
man_show_urls = True
|
||||
|
||||
smartquotes = False
|
||||
|
||||
@@ -27,6 +27,15 @@ the associated function to close the file handle.
|
||||
The given structure will be completely freed, so you should save opened file
|
||||
handle and pointer to the close procedure in external variables before
|
||||
calling :c:func:`TIFFCleanup`, if you will need these ones to close the file.
|
||||
:c:func:`TIFFCleanup` calls :c:func:`TIFFFlush`, which stores all pending data
|
||||
in the file.
|
||||
|
||||
.. note::
|
||||
Both functions have no return value.
|
||||
If you want to check whether the data has been successfully written
|
||||
to the file, you can call :c:func:`TIFFFlush`, which has a return value,
|
||||
before :c:func:`TIFFClose`.
|
||||
|
||||
|
||||
Diagnostics
|
||||
-----------
|
||||
|
||||
@@ -63,6 +63,10 @@ Be aware:
|
||||
- that unlike :c:func:`TIFFWriteDirectory`, :c:func:`TIFFCheckpointDirectory`
|
||||
does not free up the directory data structures in memory.
|
||||
|
||||
After ``libtiff`` version 4.6.0 :c:func:`TIFFCreateDirectory` also releases
|
||||
the directory part of the `tif` structure by calling :c:func:`TIFFFreeDirectory`,
|
||||
which should have been called by the user application before creating a new directory.
|
||||
|
||||
Diagnostics
|
||||
-----------
|
||||
|
||||
|
||||
@@ -94,6 +94,11 @@ is not necessary. There are some test programmes that briefly demonstrate
|
||||
the creation and reading of EXIF, GPS and custom directories.
|
||||
See test/custom_dir.c and test/custom_dir_EXIF_231.c
|
||||
|
||||
After ``libtiff`` version 4.6.0 :c:func:`TIFFCreateCustomDirectory`,
|
||||
:c:func:`TIFFCreateEXIFDirectory` and :c:func:`TIFFCreateGPSDirectory` also
|
||||
releases the directory part of the `tif` structure by calling :c:func:`TIFFFreeDirectory`,
|
||||
which should have been called by the user application before creating a new directory.
|
||||
|
||||
Hints and detailed instructions
|
||||
-------------------------------
|
||||
|
||||
|
||||
@@ -61,6 +61,11 @@ Diagnostics
|
||||
All error messages are directed to the :c:func:`TIFFErrorExtR` routine.
|
||||
Likewise, warning messages are directed to the :c:func:`TIFFWarningExtR` routine.
|
||||
|
||||
Note
|
||||
----
|
||||
|
||||
This functionality was introduced with libtiff 4.1.
|
||||
|
||||
See also
|
||||
--------
|
||||
|
||||
|
||||
@@ -65,6 +65,9 @@ or :c:func:`TIFFClientOpenExt`.
|
||||
Furthermore, a **custom defined data structure** *user_data* for the
|
||||
error handler can be given along.
|
||||
|
||||
Please refer to :doc:`/functions/TIFFOpenOptions` for how to setup the
|
||||
application-specific handler introduced with libtiff 4.5.
|
||||
|
||||
Note
|
||||
----
|
||||
|
||||
|
||||
@@ -29,4 +29,10 @@ Return values
|
||||
See also
|
||||
--------
|
||||
|
||||
:doc:`TIFFFieldName` (3tiff),
|
||||
:doc:`TIFFFieldPassCount` (3tiff),
|
||||
:doc:`TIFFFieldQuery` (3tiff),
|
||||
:doc:`TIFFFieldReadCount` (3tiff),
|
||||
:doc:`TIFFFieldTag` (3tiff),
|
||||
:doc:`TIFFFieldWriteCount` (3tiff),
|
||||
:doc:`libtiff` (3tiff)
|
||||
|
||||
@@ -28,4 +28,10 @@ Return values
|
||||
See also
|
||||
--------
|
||||
|
||||
:doc:`TIFFFieldDataType` (3tiff),
|
||||
:doc:`TIFFFieldPassCount` (3tiff),
|
||||
:doc:`TIFFFieldQuery` (3tiff),
|
||||
:doc:`TIFFFieldReadCount` (3tiff),
|
||||
:doc:`TIFFFieldTag` (3tiff),
|
||||
:doc:`TIFFFieldWriteCount` (3tiff),
|
||||
:doc:`libtiff` (3tiff)
|
||||
|
||||
@@ -26,10 +26,14 @@ expect a :c:var:`count` value to be passed before the actual data pointer.
|
||||
|
||||
When a :c:var:`count` is required, it will be of type :c:type:`uint32_t`
|
||||
if :c:func:`TIFFFieldReadCount` reports :c:macro:`TIFF_VARIABLE2`,
|
||||
and of type :c:type:`uint16_t` otherwise. (This distinction is
|
||||
and of type :c:type:`uint16_t` otherwise. Use :c:func:`TIFFFieldWriteCount`
|
||||
for :c:func:`TIFFSetField`, respectively. (This distinction is
|
||||
critical for use of :c:func:`TIFFGetField`, but normally not so for
|
||||
use of :c:func:`TIFFSetField`.)
|
||||
|
||||
An alternative function for the :c:var:`count` value determination
|
||||
is :c:func:`TIFFFieldSetGetCountSize`.
|
||||
|
||||
Return values
|
||||
-------------
|
||||
|
||||
@@ -39,4 +43,10 @@ or 0 (false).
|
||||
See also
|
||||
--------
|
||||
|
||||
:doc:`TIFFFieldDataType` (3tiff),
|
||||
:doc:`TIFFFieldName` (3tiff),
|
||||
:doc:`TIFFFieldQuery` (3tiff),
|
||||
:doc:`TIFFFieldReadCount` (3tiff),
|
||||
:doc:`TIFFFieldTag` (3tiff),
|
||||
:doc:`TIFFFieldWriteCount` (3tiff),
|
||||
:doc:`libtiff`
|
||||
|
||||
@@ -36,8 +36,11 @@ return a pointer to TIFF field information structure `fip` by the tag's
|
||||
With dt== :c:macro:`TIFF_ANY` the behaviour is the same than for
|
||||
*TIFFFieldWithTag()*.
|
||||
|
||||
All three functions return :c:var:`NULL`, when the tag is not
|
||||
registered within ``libtiff`` (see also :ref:`Tag_Auto_registration` ).
|
||||
|
||||
.. TODO: Check if ``libtiff`` is able to handle tag definitions with two different
|
||||
definitions. From the code point of view, I don't believe that.
|
||||
definitions. From the code point of view, I don't believe that.
|
||||
|
||||
Such a `TIFFDataType` dependent search could be useful when the same
|
||||
tag is defined twice but with different data types, which is true for
|
||||
@@ -47,11 +50,11 @@ With dt== :c:macro:`TIFF_ANY` the behaviour is the same than for
|
||||
|
||||
The following routines return status information about TIFF fields.
|
||||
|
||||
:c:var:`fip` is a field information pointer previously returned by
|
||||
`TIFFFindField()`, `TIFFFieldWithTag()`, `TIFFFieldWithName()`.
|
||||
:c:var:`fip` is a field information pointer previously returned by
|
||||
`TIFFFindField()`, `TIFFFieldWithTag()`, `TIFFFieldWithName()`.
|
||||
|
||||
:c:func:`TIFFFieldIsAnonymous` returns true (nonzero) if the field,
|
||||
read from file, is unknown to ``libtiff`` and a anonymous field has
|
||||
read from file, is unknown to ``libtiff`` and an anonymous field has
|
||||
been auto-registered. Return is zero "0" if field is known to ``libtiff``.
|
||||
See :ref:`Tag_Auto_registration` for more information.
|
||||
|
||||
@@ -65,7 +68,8 @@ then return "4" or "8", respectively.
|
||||
|
||||
:c:func:`TIFFFieldSetGetCountSize` returns size of ``count`` parameter
|
||||
of :c:func:`TIFFSetField` and :c:func:`TIFFGetField` and also if it is
|
||||
required: 0=none, 2= :c:type:`uint16_t`, 4= :c:type:`uint32_t`
|
||||
required: 0=none, 2= :c:type:`uint16_t`, 4= :c:type:`uint32_t`.
|
||||
See also description of :c:func:`TIFFFieldReadCount`.
|
||||
|
||||
Diagnostics
|
||||
-----------
|
||||
@@ -75,4 +79,10 @@ None.
|
||||
See also
|
||||
--------
|
||||
|
||||
:doc:`TIFFFieldDataType` (3tiff),
|
||||
:doc:`TIFFFieldName` (3tiff),
|
||||
:doc:`TIFFFieldPassCount` (3tiff),
|
||||
:doc:`TIFFFieldReadCount` (3tiff),
|
||||
:doc:`TIFFFieldTag` (3tiff),
|
||||
:doc:`TIFFFieldWriteCount` (3tiff),
|
||||
:doc:`libtiff` (3tiff)
|
||||
|
||||
@@ -40,4 +40,10 @@ Return values
|
||||
See also
|
||||
--------
|
||||
|
||||
:doc:`TIFFFieldDataType` (3tiff),
|
||||
:doc:`TIFFFieldName` (3tiff),
|
||||
:doc:`TIFFFieldPassCount` (3tiff),
|
||||
:doc:`TIFFFieldQuery` (3tiff),
|
||||
:doc:`TIFFFieldTag` (3tiff),
|
||||
:doc:`TIFFFieldWriteCount` (3tiff),
|
||||
:doc:`libtiff` (3tiff)
|
||||
|
||||
@@ -31,4 +31,10 @@ Return values
|
||||
See also
|
||||
--------
|
||||
|
||||
:doc:`TIFFFieldDataType` (3tiff),
|
||||
:doc:`TIFFFieldName` (3tiff),
|
||||
:doc:`TIFFFieldPassCount` (3tiff),
|
||||
:doc:`TIFFFieldQuery` (3tiff),
|
||||
:doc:`TIFFFieldReadCount` (3tiff),
|
||||
:doc:`TIFFFieldWriteCount` (3tiff),
|
||||
:doc:`libtiff` (3tiff)
|
||||
|
||||
@@ -45,4 +45,10 @@ Return values
|
||||
See also
|
||||
--------
|
||||
|
||||
:doc:`TIFFFieldDataType` (3tiff),
|
||||
:doc:`TIFFFieldName` (3tiff),
|
||||
:doc:`TIFFFieldPassCount` (3tiff),
|
||||
:doc:`TIFFFieldQuery` (3tiff),
|
||||
:doc:`TIFFFieldReadCount` (3tiff),
|
||||
:doc:`TIFFFieldTag` (3tiff),
|
||||
:doc:`libtiff` (3tiff)
|
||||
|
||||
+19
-16
@@ -50,17 +50,19 @@ Description
|
||||
and returns a handle to be used in subsequent calls to routines in
|
||||
:program:`libtiff`. If the open operation fails, then
|
||||
:c:macro:`NULL` (0) is returned. The *mode* parameter specifies if
|
||||
the file is to be opened for reading (``r``), writing (``w``), or
|
||||
the file is to be opened for reading (``r``) or (``r+``), writing (``w``), or
|
||||
appending (``a``) and, optionally, whether to override certain
|
||||
default aspects of library operation (see below).
|
||||
default aspects of library operation (see below Options_).
|
||||
|
||||
The *mode* (``r``) opens only an **existing** file for reading and (``r+``)
|
||||
for reading and writing.
|
||||
When a file is opened for appending, existing data will not
|
||||
be touched; instead new data will be written as additional subfiles.
|
||||
If an existing file is opened for writing, all previous data is
|
||||
overwritten.
|
||||
|
||||
If a file is opened for reading, the first TIFF directory in the file
|
||||
is automatically read (also see :c:func:`TIFFSetDirectory` for reading
|
||||
directories other than the first).
|
||||
is automatically read.
|
||||
If a file is opened for writing or appending, a default directory
|
||||
is automatically created for writing subsequent data.
|
||||
This directory has all the default values specified in TIFF Revision 6.0:
|
||||
@@ -78,16 +80,13 @@ This directory has all the default values specified in TIFF Revision 6.0:
|
||||
To alter these values, or to define values for additional fields,
|
||||
:c:func:`TIFFSetField` must be used.
|
||||
|
||||
A file can also be opened for reading and writing with *mode* (``r+``).
|
||||
In this case, the first TIFF directory in the file is automatically read,
|
||||
but calls to :c:func:`TIFFSetField` are put into a fresh directory, which
|
||||
will be appended when the file is closed.
|
||||
|
||||
:c:func:`TIFFOpenW` opens a TIFF file with a Unicode filename, for read/writing.
|
||||
|
||||
:c:func:`TIFFFdOpen` is like :c:func:`TIFFOpen` except that it opens a
|
||||
TIFF file given an open file descriptor *fd*.
|
||||
The file's name and mode must reflect that of the open descriptor.
|
||||
Even for write-only mode, ``libtiff`` needs read permissions because
|
||||
some of its functions need to read back the partially written TIFF file.
|
||||
The object associated with the file descriptor **must support random access**.
|
||||
In order to close a TIFF file opened with :c:func:`TIFFFdOpen`
|
||||
first :c:func:`TIFFCleanup` should be called to free the internal
|
||||
@@ -95,8 +94,9 @@ TIFF structure without closing the file handle and afterwards the
|
||||
file should be closed using its file descriptor *fd*.
|
||||
|
||||
:c:func:`TIFFOpenExt` (added in libtiff 4.5) is like :c:func:`TIFFOpen`,
|
||||
but options, such as re-entrant error and warning handlers may be passed
|
||||
with the *opts* argument. The *opts* argument may be NULL.
|
||||
but options, such as re-entrant error and warning handlers and a limit in byte
|
||||
that libtiff internal memory allocation functions are allowed to request per call
|
||||
may be passed with the *opts* argument. The *opts* argument may be NULL.
|
||||
Refer to :doc:`TIFFOpenOptions` for allocating and filling the *opts* argument
|
||||
parameters. The allocated memory for :c:type:`TIFFOpenOptions`
|
||||
can be released straight after successful execution of the related
|
||||
@@ -106,9 +106,7 @@ can be released straight after successful execution of the related
|
||||
but opens a TIFF file with a Unicode filename.
|
||||
|
||||
:c:func:`TIFFFdOpenExt` (added in libtiff 4.5) is like :c:func:`TIFFFdOpen`,
|
||||
but options, such as re-entrant error and warning handlers may be passed
|
||||
with the *opts* argument. The *opts* argument may be NULL.
|
||||
Refer to :doc:`TIFFOpenOptions` for filling the *opts* argument.
|
||||
but options argument *opts* like for :c:func:`TIFFOpenExt` can be passed.
|
||||
|
||||
:c:func:`TIFFSetFileName` sets the file name in the tif-structure
|
||||
and returns the old file name.
|
||||
@@ -154,10 +152,15 @@ Options
|
||||
-------
|
||||
|
||||
The open mode parameter can include the following flags in
|
||||
addition to the ``r``, ``w``, and ``a`` flags.
|
||||
addition to the ``r``, ``r+``, ``w``, and ``a`` flags.
|
||||
Note however that option flags must follow the read-write-append
|
||||
specification.
|
||||
|
||||
Note 2: Also for ``w`` the file will be opened with *read access* rights
|
||||
because ``libtiff`` needs to read back the partially written TIFF file
|
||||
for some of its functions.
|
||||
|
||||
|
||||
``l``:
|
||||
|
||||
When creating a new file force information be written with
|
||||
@@ -322,5 +325,5 @@ See also
|
||||
|
||||
:doc:`libtiff` (3tiff),
|
||||
:doc:`TIFFClose` (3tiff),
|
||||
:doc:`TIFFStrileQuery`,
|
||||
:doc:`TIFFStrileQuery` (3tiff),
|
||||
:doc:`TIFFOpenOptions`
|
||||
@@ -18,6 +18,8 @@ Synopsis
|
||||
|
||||
.. c:function:: void TIFFOpenOptionsSetMaxSingleMemAlloc(TIFFOpenOptions* opts, tmsize_t max_single_mem_alloc)
|
||||
|
||||
.. c:function:: void TIFFOpenOptionsSetMaxCumulatedMemAlloc(TIFFOpenOptions* opts, tmsize_t max_cumulated_mem_alloc)
|
||||
|
||||
.. c:function:: void TIFFOpenOptionsSetErrorHandlerExtR(TIFFOpenOptions* opts, TIFFErrorHandlerExtR handler, void* errorhandler_user_data)
|
||||
|
||||
.. c:function:: void TIFFOpenOptionsSetWarningHandlerExtR(TIFFOpenOptions* opts, TIFFErrorHandlerExtR handler, void* warnhandler_user_data)
|
||||
@@ -38,11 +40,25 @@ opaque structure and returns a :c:type:`TIFFOpenOptions` pointer.
|
||||
:c:func:`TIFFOpenOptionsFree` releases the allocated memory for
|
||||
:c:type:`TIFFOpenOptions`. The allocated memory for :c:type:`TIFFOpenOptions`
|
||||
can be released straight after successful execution of the related
|
||||
TIFF open"Ext" functions like :c:func:`TIFFOpenExt`.
|
||||
TIFFOpen"Ext" functions like :c:func:`TIFFOpenExt`.
|
||||
|
||||
:c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc` sets parameter for the
|
||||
maximum single memory limit in byte that ``libtiff`` internal memory allocation
|
||||
functions are allowed to request per call.
|
||||
:c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc` (added in libtiff 4.5.0) sets
|
||||
the value for the maximum single memory limit in byte that ``libtiff`` internal
|
||||
memory allocation functions are allowed to request per call.
|
||||
|
||||
.. note::
|
||||
However, the ``libtiff`` external functions :c:func:`_TIFFmalloc`
|
||||
and :c:func:`_TIFFrealloc` **do not apply** this internal memory
|
||||
allocation limit set by :c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc`!
|
||||
|
||||
:c:func:`TIFFOpenOptionsSetMaxCumulatedMemAlloc` (added in libtiff 4.6.1) sets
|
||||
the maximum cumulated memory allocations in byte, for a given TIFF handle,
|
||||
that ``libtiff`` internal memory allocation functions are allowed.
|
||||
|
||||
.. note::
|
||||
However, the ``libtiff`` external functions :c:func:`_TIFFmalloc`
|
||||
and :c:func:`_TIFFrealloc` **do not apply** this internal memory
|
||||
allocation limit set by :c:func:`TIFFOpenOptionsSetMaxCumulatedMemAlloc`!
|
||||
|
||||
:c:func:`TIFFOpenOptionsSetErrorHandlerExtR` sets the function pointer to
|
||||
an application-specific and per-TIFF handle (re-entrant) error handler.
|
||||
@@ -55,6 +71,43 @@ The *errorhandler_user_data* argument may be NULL.
|
||||
:c:func:`TIFFOpenOptionsSetErrorHandlerExtR` but for the warning handler,
|
||||
which is invoked through :c:func:`TIFFWarningExtR`
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
::
|
||||
|
||||
#include "tiffio.h"
|
||||
|
||||
typedef struct MyErrorHandlerUserDataStruct
|
||||
{
|
||||
/* ... any user data structure ... */
|
||||
} MyErrorHandlerUserDataStruct;
|
||||
|
||||
static int myErrorHandler(TIFF *tiff, void *user_data, const char *module,
|
||||
const char *fmt, va_list ap)
|
||||
{
|
||||
MyErrorHandlerUserDataStruct *errorhandler_user_data =
|
||||
(MyErrorHandlerUserDataStruct *)user_data;
|
||||
/*... code of myErrorHandler ...*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
main()
|
||||
{
|
||||
tmsize_t limit = (256 * 1024 * 1024);
|
||||
MyErrorHandlerUserDataStruct user_data = { /* ... any data ... */};
|
||||
|
||||
TIFFOpenOptions *opts = TIFFOpenOptionsAlloc();
|
||||
TIFFOpenOptionsSetMaxSingleMemAlloc(opts, limit);
|
||||
TIFFOpenOptionsSetErrorHandlerExtR(opts, myErrorHandler, &user_data);
|
||||
TIFF *tif = TIFFOpenExt("foo.tif", "r", opts);
|
||||
TIFFOpenOptionsFree(opts);
|
||||
/* ... go on here ... */
|
||||
|
||||
TIFFClose(tif);
|
||||
}
|
||||
|
||||
Note
|
||||
----
|
||||
|
||||
|
||||
@@ -142,4 +142,5 @@ See also
|
||||
:doc:`TIFFquery` (3tiff),
|
||||
:doc:`TIFFWriteDirectory` (3tiff),
|
||||
:doc:`TIFFSetDirectory` (3tiff),
|
||||
:doc:`/multi_page`,
|
||||
:doc:`libtiff` (3tiff)
|
||||
|
||||
@@ -20,28 +20,15 @@ Description
|
||||
:c:func:`TIFFSetDirectory` changes the current directory and reads its
|
||||
contents with :c:func:`TIFFReadDirectory`. The parameter *dirnum*
|
||||
specifies the subfile/directory as an integer number, with the first
|
||||
directory numbered zero.
|
||||
directory numbered zero.
|
||||
:c:func:`TIFFSetDirectory()` only works with main-IFD chains because
|
||||
allways starts with the first main-IFD and thus is able to reset
|
||||
the SubIFD reading chain to the main-IFD chain.
|
||||
|
||||
:c:func:`TIFFSetSubDirectory` acts like :c:func:`TIFFSetDirectory`,
|
||||
except the directory is specified as a file offset instead of an index;
|
||||
this is required for accessing subdirectories linked through a
|
||||
``SubIFD`` tag.
|
||||
|
||||
In the case of several SubIFDs of a main image, there are two possibilities
|
||||
that are not even mutually exclusive.
|
||||
|
||||
a. The ``SubIFD`` tag contains an array with all offsets of the SubIFDs.
|
||||
b. The ``SubIFDs`` are concatenated with their ``NextIFD`` parameters
|
||||
to a SubIFD chain.
|
||||
|
||||
LibTiff does support SubIFD chains partially. When a ``SubIFD`` tag is
|
||||
activated with :c:func:`TIFFSetSubDirectory()`, :c:func:`TIFFReadDirectory()`
|
||||
is able to parse through the SubIFD chain. The *tif_curdir* is just
|
||||
incremented from its current value and thus gets arbitrary values
|
||||
when parsing through SubIFD chains.
|
||||
:c:func:`TIFFSetDirectory()` only works with main-IFD chains because
|
||||
allways starts with the first main-IFD and thus is able to reset
|
||||
the SubIFD reading chain to the main-IFD chain.
|
||||
``SubIFD`` tag. (see :ref:`MultiPage SubIFD <SubIFDAccess>`)
|
||||
|
||||
Directory query functions :c:func:`TIFFCurrentDirectory`,
|
||||
:c:func:`TIFFCurrentDirOffset`, :c:func:`TIFFLastDirectory` and
|
||||
@@ -80,4 +67,5 @@ See also
|
||||
:doc:`TIFFCustomDirectory` (3tiff),
|
||||
:doc:`TIFFWriteDirectory` (3tiff),
|
||||
:doc:`TIFFReadDirectory` (3tiff),
|
||||
:doc:`/multi_page`,
|
||||
:doc:`libtiff` (3tiff)
|
||||
|
||||
@@ -19,6 +19,12 @@ Description
|
||||
for user defined tags as an extender callback with ``libtiff``.
|
||||
A brief description can be found at :ref:`define_application_tags`.
|
||||
|
||||
.. note::
|
||||
|
||||
:c:func:`TIFFSetTagExtender` cannot be used to extend custom directories
|
||||
(for example EXIF, GPS or other custom directories).
|
||||
Only the TIFF directory can be extended with additional tags.
|
||||
|
||||
See also
|
||||
--------
|
||||
|
||||
|
||||
@@ -66,6 +66,11 @@ Diagnostics
|
||||
All error messages are directed to the :c:func:`TIFFErrorExtR` routine.
|
||||
Likewise, warning messages are directed to the :c:func:`TIFFWarningExtR` routine.
|
||||
|
||||
Note
|
||||
----
|
||||
|
||||
This functionality was introduced with libtiff 4.1.
|
||||
|
||||
See also
|
||||
--------
|
||||
|
||||
|
||||
@@ -24,9 +24,12 @@ Description
|
||||
-----------
|
||||
|
||||
:c:func:`TIFFWriteDirectory` will write the contents of the current
|
||||
directory to the file and setup to create a new subfile in the same
|
||||
file. Applications only need to call :c:func:`TIFFWriteDirectory`
|
||||
when writing multiple subfiles to a single TIFF file.
|
||||
directory (IFD) to the file and setup to create a new directory (IFD)
|
||||
using :c:func:`TIFFCreateDirectory`.
|
||||
Applications only need to call :c:func:`TIFFWriteDirectory`
|
||||
when writing multiple subfiles (images) to a single TIFF file.
|
||||
This is called "multi-page TIFF" or "multi-image TIFF"
|
||||
(see :doc:`/multi_page`).
|
||||
:c:func:`TIFFWriteDirectory` is automatically called by
|
||||
:c:func:`TIFFClose` and :c:func:`TIFFFlush` to write a modified
|
||||
directory if the file is open for writing.
|
||||
@@ -35,7 +38,8 @@ The :c:func:`TIFFRewriteDirectory` function operates similarly to
|
||||
:c:func:`TIFFWriteDirectory`, but can be called with directories
|
||||
previously read or written that already have an established location
|
||||
in the file. It will rewrite the directory, but instead of placing it
|
||||
at its old location (as :c:func:`TIFFWriteDirectory` would) it will
|
||||
at its old location (as :c:func:`TIFFWriteDirectory` would, if the size
|
||||
of the directory has not grown) it will
|
||||
place them at the end of the file, correcting the pointer from the
|
||||
preceding directory or file header to point to it's new location. This
|
||||
is particularly important in cases where the size of the directory and
|
||||
@@ -133,4 +137,5 @@ See also
|
||||
:doc:`TIFFSetDirectory` (3tiff),
|
||||
:doc:`TIFFReadDirectory` (3tiff),
|
||||
:doc:`TIFFError` (3tiff),
|
||||
:doc:`/multi_page`,
|
||||
:doc:`libtiff` (3tiff)
|
||||
|
||||
@@ -50,20 +50,39 @@ Description
|
||||
The following query routines return status information about the directory
|
||||
structure of an open TIFF file.
|
||||
|
||||
:c:func:`TIFFCurrentDirectory` returns the index of the current directory
|
||||
(directories are numbered starting at 0). This number is suitable for
|
||||
:c:func:`TIFFCurrentDirectory` returns the index of the current
|
||||
:ref:`Image File Directory (IFD) <ImageFileDirectory>`.
|
||||
Directories are numbered starting at 0. This number is suitable for
|
||||
use with the :c:func:`TIFFSetDirectory` routine.
|
||||
A value of 65535 (non-existing directory) is returned if the directory
|
||||
has not yet been written to the file after opening it.
|
||||
There are :ref:`IFDs <ImageFileDirectory>` in the file and an "active"
|
||||
:ref:`IFD <ImageFileDirectory>` in memory, from which fields
|
||||
are "set" and "get". The index of the current directory returned is:
|
||||
|
||||
a) 65535 (non-existing directory) if there is no IFD in the file after opening,
|
||||
or the state is unknown,
|
||||
or the last read (i.e. TIFFFetchDirectory()) failed,
|
||||
or a custom directory was written.
|
||||
b) IFD index of last IFD written in the file.
|
||||
In this case the active IFD is a new (empty) one and the current directory offset
|
||||
from TIFFCurrentDirOffset() is zero.
|
||||
If writing fails, the IFD index is not changed.
|
||||
c) IFD index of IFD read from file into memory (=active IFD),
|
||||
even if IFD is corrupt and TIFFReadDirectory() returns 0.
|
||||
Then the current directory offset is the offset of the IFD in the file.
|
||||
d) IFD index „0“, whenever a custom directory or an unchained SubIFD
|
||||
was read.
|
||||
|
||||
:c:func:`TIFFCurrentDirOffset` returns the file offset of the current
|
||||
directory (instead of an index).
|
||||
The file offset is suitable for use with the :c:func:`TIFFSetSubDirectory`
|
||||
routine. This is required for accessing subdirectories linked through a
|
||||
``SubIFD`` tag.
|
||||
``SubIFD`` tag. See also :ref:`SubIFD access <SubIFDAccess>`.
|
||||
|
||||
:c:func:`TIFFLastDirectory` returns a non-zero value if the current
|
||||
directory is the last directory in the file; otherwise zero is returned.
|
||||
A new (empty) directory in the memory (after :c:func:`TIFFWriteDirectory`
|
||||
or :c:func:`TIFFCreateDirectory`)
|
||||
also counts as the last directory, even if it has not yet been written to a file.
|
||||
|
||||
:c:func:`TIFFNumberOfDirectories` returns the number of directories in a
|
||||
file. Be aware that just created directories, which are not "written" to
|
||||
|
||||
+4
-325
@@ -329,6 +329,8 @@ will work.
|
||||
- releases the allocated memory for :c:type:`TIFFOpenOptions`
|
||||
* - :c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc`
|
||||
- limits the maximum single memory allocation within ``libtiff``
|
||||
* - :c:func:`TIFFOpenOptionsSetMaxCumulatedMemAlloc`
|
||||
- limits the maximum cumulated memory allocation within ``libtiff``
|
||||
* - :c:func:`TIFFOpenOptionsSetErrorHandlerExtR`
|
||||
- setup of a user-specific and per-TIFF handle (re-entrant) error handler
|
||||
* - :c:func:`TIFFOpenOptionsSetWarningHandlerExtR`
|
||||
@@ -574,331 +576,8 @@ will work.
|
||||
Tag usage
|
||||
---------
|
||||
|
||||
The table below lists the TIFF
|
||||
tags that are recognized and handled by the library.
|
||||
If no use is indicated in the table, then the library
|
||||
reads and writes the tag, but does not use it internally.
|
||||
Note that some tags are meaningful only when a particular
|
||||
compression scheme is being used; e.g. ``Group3Options``
|
||||
is only useful if ``Compression``
|
||||
is set to CCITT Group 3 encoding.
|
||||
Tags of this sort are considered *codec-specific*
|
||||
tags and the library does not recognize them except when the
|
||||
``Compression``
|
||||
tag has been previously set to the relevant compression scheme.
|
||||
|
||||
.. list-table:: libtiff supported tags
|
||||
:widths: 10 2 2 15
|
||||
:header-rows: 1
|
||||
|
||||
* - Tag name
|
||||
- Value
|
||||
- R/W
|
||||
- Library Use/Notes
|
||||
* - ``Artist``
|
||||
- 315
|
||||
- R/W
|
||||
-
|
||||
* - ``BadFaxLines``
|
||||
- 326
|
||||
- R/W
|
||||
-
|
||||
* - ``BitsPerSample``
|
||||
- 258
|
||||
- R/W
|
||||
- lots
|
||||
* - ``CellLength``
|
||||
- 265
|
||||
-
|
||||
- parsed but ignored
|
||||
* - ``CellWidth``
|
||||
- 264
|
||||
-
|
||||
- parsed but ignored
|
||||
* - ``CleanFaxData``
|
||||
- 327
|
||||
- R/W
|
||||
-
|
||||
* - ``ColorMap``
|
||||
- 320
|
||||
- R/W
|
||||
-
|
||||
* - ``ColorResponseUnit``
|
||||
- 300
|
||||
-
|
||||
- parsed but ignored
|
||||
* - ``Compression``
|
||||
- 259
|
||||
- R/W
|
||||
- choosing codec
|
||||
* - ``ConsecutiveBadFaxLines``
|
||||
- 328
|
||||
- R/W
|
||||
-
|
||||
* - ``Copyright``
|
||||
- 33432
|
||||
- R/W
|
||||
-
|
||||
* - ``DataType``
|
||||
- 32996
|
||||
- R
|
||||
- obsoleted by ``SampleFormat`` tag
|
||||
* - ``DateTime``
|
||||
- 306
|
||||
- R/W
|
||||
-
|
||||
* - ``DocumentName``
|
||||
- 269
|
||||
- R/W
|
||||
-
|
||||
* - ``DotRange``
|
||||
- 336
|
||||
- R/W
|
||||
-
|
||||
* - ``ExtraSamples``
|
||||
- 338
|
||||
- R/W
|
||||
- lots
|
||||
* - ``FaxRecvParams``
|
||||
- 34908
|
||||
- R/W
|
||||
-
|
||||
* - ``FaxSubAddress``
|
||||
- 34909
|
||||
- R/W
|
||||
-
|
||||
* - ``FaxRecvTime``
|
||||
- 34910
|
||||
- R/W
|
||||
-
|
||||
* - ``FillOrder``
|
||||
- 266
|
||||
- R/W
|
||||
- control bit order
|
||||
* - ``FreeByteCounts``
|
||||
- 289
|
||||
-
|
||||
- parsed but ignored
|
||||
* - ``FreeOffsets``
|
||||
- 288
|
||||
-
|
||||
- parsed but ignored
|
||||
* - ``GrayResponseCurve``
|
||||
- 291
|
||||
-
|
||||
- parsed but ignored
|
||||
* - ``GrayResponseUnit``
|
||||
- 290
|
||||
-
|
||||
- parsed but ignored
|
||||
* - ``Group3Options``
|
||||
- 292
|
||||
- R/W
|
||||
- used by Group 3 codec
|
||||
* - ``Group4Options``
|
||||
- 293
|
||||
- R/W
|
||||
-
|
||||
* - ``HostComputer``
|
||||
- 316
|
||||
- R/W
|
||||
-
|
||||
* - ``ImageDepth``
|
||||
- 32997
|
||||
- R/W
|
||||
- tile/strip calculations
|
||||
* - ``ImageDescription``
|
||||
- 270
|
||||
- R/W
|
||||
-
|
||||
* - ``ImageLength``
|
||||
- 257
|
||||
- R/W
|
||||
- lots
|
||||
* - ``ImageWidth``
|
||||
- 256
|
||||
- R/W
|
||||
- lots
|
||||
* - ``InkNames``
|
||||
- 333
|
||||
- R/W
|
||||
-
|
||||
* - ``InkSet``
|
||||
- 332
|
||||
- R/W
|
||||
-
|
||||
* - ``JPEGTables``
|
||||
- 347
|
||||
- R/W
|
||||
- used by JPEG codec
|
||||
* - ``Make``
|
||||
- 271
|
||||
- R/W
|
||||
-
|
||||
* - ``Matteing``
|
||||
- 32995
|
||||
- R
|
||||
- obsoleted by ExtraSamples tag
|
||||
* - ``MaxSampleValue``
|
||||
- 281
|
||||
- R/W
|
||||
-
|
||||
* - ``MinSampleValue``
|
||||
- 280
|
||||
- R/W
|
||||
-
|
||||
* - ``Model``
|
||||
- 272
|
||||
- R/W
|
||||
-
|
||||
* - ``NewSubFileType``
|
||||
- 254
|
||||
- R/W
|
||||
- called ``SubFileType`` in spec
|
||||
* - ``NumberOfInks``
|
||||
- 334
|
||||
- R/W
|
||||
-
|
||||
* - ``Orientation``
|
||||
- 274
|
||||
- R/W
|
||||
-
|
||||
* - ``PageName``
|
||||
- 285
|
||||
- R/W
|
||||
-
|
||||
* - ``PageNumber``
|
||||
- 297
|
||||
- R/W
|
||||
-
|
||||
* - ``PhotometricInterpretation``
|
||||
- 262
|
||||
- R/W
|
||||
- used by Group 3 and JPEG codecs
|
||||
* - ``PlanarConfiguration``
|
||||
- 284
|
||||
- R/W
|
||||
- data i/o
|
||||
* - ``Predictor``
|
||||
- 317
|
||||
- R/W
|
||||
- used by LZW and Deflate codecs
|
||||
* - ``PrimaryChromacities``
|
||||
- 319
|
||||
- R/W
|
||||
-
|
||||
* - ``ReferenceBlackWhite``
|
||||
- 532
|
||||
- R/W
|
||||
-
|
||||
* - ``ResolutionUnit``
|
||||
- 296
|
||||
- R/W
|
||||
- used by Group 3 codec
|
||||
* - ``RowsPerStrip``
|
||||
- 278
|
||||
- R/W
|
||||
- data i/o
|
||||
* - ``SampleFormat``
|
||||
- 339
|
||||
- R/W
|
||||
-
|
||||
* - ``SamplesPerPixel``
|
||||
- 277
|
||||
- R/W
|
||||
- lots
|
||||
* - ``SMinSampleValue``
|
||||
- 340
|
||||
- R/W
|
||||
-
|
||||
* - ``SMaxSampleValue``
|
||||
- 341
|
||||
- R/W
|
||||
-
|
||||
* - ``Software``
|
||||
- 305
|
||||
- R/W
|
||||
-
|
||||
* - ``StoNits``
|
||||
- 37439
|
||||
- R/W
|
||||
-
|
||||
* - ``StripByteCounts``
|
||||
- 279
|
||||
- R/W
|
||||
- data i/o
|
||||
* - ``StripOffsets``
|
||||
- 273
|
||||
- R/W
|
||||
- data i/o
|
||||
* - ``SubFileType``
|
||||
- 255
|
||||
- R/W
|
||||
- called ``OSubFileType`` in spec
|
||||
* - ``TargetPrinter``
|
||||
- 337
|
||||
- R/W
|
||||
-
|
||||
* - ``Thresholding``
|
||||
- 263
|
||||
- R/W
|
||||
-
|
||||
* - ``TileByteCounts``
|
||||
- 324
|
||||
- R/W
|
||||
- data i/o
|
||||
* - ``TileDepth``
|
||||
- 32998
|
||||
- R/W
|
||||
- tile/strip calculations
|
||||
* - ``TileLength``
|
||||
- 323
|
||||
- R/W
|
||||
- data i/o
|
||||
* - ``TileOffsets``
|
||||
- 324
|
||||
- R/W
|
||||
- data i/o
|
||||
* - ``TileWidth``
|
||||
- 322
|
||||
- R/W
|
||||
- data i/o
|
||||
* - ``TransferFunction``
|
||||
- 301
|
||||
- R/W
|
||||
-
|
||||
* - ``WhitePoint``
|
||||
- 318
|
||||
- R/W
|
||||
-
|
||||
* - ``XPosition``
|
||||
- 286
|
||||
- R/W
|
||||
-
|
||||
* - ``XResolution``
|
||||
- 282
|
||||
- R/W
|
||||
-
|
||||
* - ``YCbCrCoefficients``
|
||||
- 529
|
||||
- R/W
|
||||
- used by ``TIFFRGBAImage`` support
|
||||
* - ``YCbCrPositioning``
|
||||
- 531
|
||||
- R/W
|
||||
- tile/strip size calculations
|
||||
* - ``YCbCrSubsampling``
|
||||
- 530
|
||||
- R/W
|
||||
-
|
||||
* - ``YPosition``
|
||||
- 286
|
||||
- R/W
|
||||
-
|
||||
* - ``YResolution``
|
||||
- 283
|
||||
- R/W
|
||||
- used by Group 3 codec
|
||||
For a table of TIFF tags recognized by the library refer to
|
||||
:doc:`/specification/coverage`.
|
||||
|
||||
"Pseudo tags"
|
||||
-------------
|
||||
|
||||
+16
-3
@@ -10,9 +10,8 @@ LibTIFF - TIFF Library and Utilities
|
||||
===================== =====================================
|
||||
Home Page #1 http://www.simplesystems.org/libtiff/
|
||||
Home Page #2 https://libtiff.gitlab.io/libtiff/
|
||||
Home Page #3 http://libtiff.maptools.org/
|
||||
Latest Stable Release v4.5.0
|
||||
Master Download Site `download.osgeo.org <https://download.osgeo.org/libtiff/>`_
|
||||
Latest Stable Release v4.7.0
|
||||
Primary Download Site `download.osgeo.org <https://download.osgeo.org/libtiff/>`_
|
||||
Mailing List `tiff@lists.osgeo.org <tiff@lists.osgeo.org>`_
|
||||
List subscription http://lists.osgeo.org/mailman/listinfo/tiff/
|
||||
List archive http://www.awaresystems.be/imaging/tiff/tml.html
|
||||
@@ -35,6 +34,18 @@ your needs for reading and writing TIFF images.
|
||||
LibTIFF is portable software, supported on various operating systems including
|
||||
UNIX (Linux, BSD, MacOS X) and Windows.
|
||||
|
||||
.. note::
|
||||
|
||||
At libtiff v4.6.0, the source code for most TIFF tools (except tiffinfo,
|
||||
tiffdump, tiffcp and tiffset) has been moved to archive/ directory
|
||||
and was not built.
|
||||
tiff2ps and tiff2pdf source code has been moved in a unsupported category,
|
||||
no longer built by default, but were still part of the the source
|
||||
distribution.
|
||||
|
||||
With libtiff v4.7.0 those tools were restored.
|
||||
|
||||
|
||||
The following sections are included in this documentation:
|
||||
|
||||
.. toctree::
|
||||
@@ -46,10 +57,12 @@ The following sections are included in this documentation:
|
||||
build
|
||||
terms
|
||||
libtiff
|
||||
multi_page
|
||||
functions
|
||||
internals
|
||||
addingtags
|
||||
tools
|
||||
contrib
|
||||
rfcs/index
|
||||
project/index
|
||||
releases/index
|
||||
|
||||
+3
-5
@@ -189,11 +189,9 @@ as possible in two files: :file:`tiffcomp.h` and
|
||||
operating system-specific routines to do I/O and I/O-related operations.
|
||||
The UNIX (:file:`tif_unix.c`) code has had the most use.
|
||||
|
||||
Native CPU byte order is determined on the fly by
|
||||
the library and does not need to be specified.
|
||||
The :c:macro:`HOST_FILLORDER` and :c:macro:`HOST_BIGENDIAN`
|
||||
definitions are not currently used, but may be employed by
|
||||
codecs for optimization purposes.
|
||||
Native CPU byte order is determined through the :c:macro:`WORDS_BIGENDIAN`
|
||||
definition, which must be set to the appropriate value in :file:`tif_config.h`
|
||||
by the build system.
|
||||
|
||||
The following defines control general portability:
|
||||
|
||||
|
||||
+34
-2
@@ -90,11 +90,20 @@ compatibility on machines with a segmented architecture.
|
||||
:c:func:`realloc`, and :c:func:`free` routines in the C library.)
|
||||
|
||||
To deal with segmented pointer issues ``libtiff`` also provides
|
||||
:c:func:`_TIFFmemcpy`, :c:func:`_TIFFmemset`, and :c:func:`_TIFFmemmove`
|
||||
:c:func:`_TIFFmemcpy`, :c:func:`_TIFFmemset`, and :c:func:`_TIFFmemcmp`
|
||||
routines that mimic the equivalent ANSI C routines, but that are
|
||||
intended for use with memory allocated through :c:func:`_TIFFmalloc`
|
||||
and :c:func:`_TIFFrealloc`.
|
||||
|
||||
With ``libtiff`` 4.5 a method was introduced to limit the internal
|
||||
memory allocation that functions are allowed to request per call
|
||||
(see :c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc` and :c:func:`TIFFOpenExt`).
|
||||
|
||||
With ``libtiff`` 4.6.1 a method was introduced to limit the internal
|
||||
cumulated memory allocation that functions are allowed to request for a given
|
||||
TIFF handle
|
||||
(see :c:func:`TIFFOpenOptionsSetMaxCumulatedMemAlloc` and :c:func:`TIFFOpenExt`).
|
||||
|
||||
Error Handling
|
||||
--------------
|
||||
|
||||
@@ -106,6 +115,10 @@ routine that can be specified with a call to :c:func:`TIFFSetErrorHandler`.
|
||||
Likewise warning messages are directed to a single handler routine
|
||||
that can be specified with a call to :c:func:`TIFFSetWarningHandler`
|
||||
|
||||
Further application-specific and per-TIFF handle (re-entrant) error handler
|
||||
and warning handler can be set. Please refer to :doc:`/functions/TIFFError`
|
||||
and :doc:`/functions/TIFFOpenOptions`.
|
||||
|
||||
Basic File Handling
|
||||
-------------------
|
||||
|
||||
@@ -139,7 +152,7 @@ a ``"w"`` argument:
|
||||
main()
|
||||
{
|
||||
TIFF* tif = TIFFOpen("foo.tif", "w");
|
||||
... do stuff ...
|
||||
/* ... do stuff ... */
|
||||
TIFFClose(tif);
|
||||
}
|
||||
|
||||
@@ -157,6 +170,25 @@ to always call :c:func:`TIFFClose` or :c:func:`TIFFFlush` to flush any
|
||||
buffered information to a file. Note that if you call :c:func:`TIFFClose`
|
||||
you do not need to call :c:func:`TIFFFlush`.
|
||||
|
||||
.. warning::
|
||||
|
||||
In order to prevent out-of-memory issues when opening a TIFF file
|
||||
:c:func:`TIFFOpenExt` can be used and then the maximum single memory
|
||||
limit in bytes that ``libtiff`` internal memory allocation functions
|
||||
are allowed to request per call can be set with
|
||||
:c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc`.
|
||||
|
||||
Example
|
||||
|
||||
::
|
||||
|
||||
tmsize_t limit = (256 * 1024 * 1024);
|
||||
TIFFOpenOptions *opts = TIFFOpenOptionsAlloc();
|
||||
TIFFOpenOptionsSetMaxSingleMemAlloc(opts, limit);
|
||||
TIFF *tif = TIFFOpenExt("foo.tif", "w", opts);
|
||||
TIFFOpenOptionsFree(opts);
|
||||
/* ... go on here ... */
|
||||
|
||||
TIFF Directories
|
||||
----------------
|
||||
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
Multi Page / Multi Image TIFF
|
||||
=============================
|
||||
|
||||
There may be more than one :ref:`Image File Directory (IFD) <ImageFileDirectory>`
|
||||
in a TIFF file. Each IFD defines a :ref:`subfile <SubFile>`.
|
||||
|
||||
One potential use of *subfiles* is to describe related images,
|
||||
such as the pages of a facsimile transmission or reduced-resolution images
|
||||
of the first full-resolution image.
|
||||
Such files are also named "*multi-page* TIFF" or "*multi-image* TIFF".
|
||||
|
||||
There are two mechanisms for storing multiple images in a TIFF file:
|
||||
|
||||
1. A **main-IFD chain**, where the images are stored in linked IFDs (directories).
|
||||
This mechanism is widely used.
|
||||
2. A **SubIFD chain**, where additional images are stored within the SubIFD tag
|
||||
of a main-IFD. Such child images provide extra information for the parent image
|
||||
- such as a subsampled version of the parent image.
|
||||
SubIFD chains are rarely supported.
|
||||
For SubIFD refer also to
|
||||
`Adobe PageMaker® 6.0 TIFF Technical Notes <https://www.awaresystems.be/imaging/tiff/specification/TIFFPM6.pdf>`_
|
||||
|
||||
.. _SubIFDAccess:
|
||||
|
||||
Sub IFD chains
|
||||
--------------
|
||||
|
||||
In the case of several SubIFDs of a main image, there are two possibilities
|
||||
that are not even mutually exclusive.
|
||||
|
||||
a. The ``SubIFD`` tag contains an array with all offsets of the SubIFDs.
|
||||
This is called SubIFD tree and DNG recommends the use of SubIFD trees,
|
||||
as described in the TIFF-EP specification. SubIFD chains are not supported.
|
||||
b. The SubIFDs are concatenated with their ``NextIFD`` parameters
|
||||
to a SubIFD chain.
|
||||
|
||||
LibTiff does support SubIFD chains partially. When the first
|
||||
``SubIFD`` tag is activated and read with :c:func:`TIFFSetSubDirectory()`,
|
||||
the following can be parsed with :c:func:`TIFFReadDirectory()`.
|
||||
The *tif_curdir* is just incremented from its current value
|
||||
and thus gets arbitrary values when parsing through SubIFD chains.
|
||||
When the SubIFDs are not chained, each offset
|
||||
within the SubIFD array has to be activated and read individually.
|
||||
:c:func:`TIFFSetDirectory()` only works with main-IFD chains because
|
||||
always starts with the first main-IFD and thus is able to reset
|
||||
the SubIFD reading chain to the main-IFD chain.
|
||||
|
||||
Writing Multi Page TIFF
|
||||
-----------------------
|
||||
|
||||
The following example code shows how to write multi-page TIFF
|
||||
as main-IFD chain and as SubIFD chain.
|
||||
``libtiff`` writes SubIFDs as an array of IFDs that are not chained
|
||||
additionally, as Adobe PageMaker® 6.0 TIFF Technical Notes suggests.
|
||||
|
||||
.. highlight:: c
|
||||
|
||||
::
|
||||
|
||||
#include <tiffio.h>
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
TIFF *tiff;
|
||||
|
||||
/* Define the number of pages/images (main-IFDs) you are going to write */
|
||||
int number_of_images = 3;
|
||||
|
||||
/* Define the number of sub - IFDs you are going to write */
|
||||
#define NUMBER_OF_SUBIFDs 2
|
||||
int number_of_sub_IFDs = NUMBER_OF_SUBIFDs;
|
||||
toff_t sub_IFDs_offsets[NUMBER_OF_SUBIFDs] = {
|
||||
0UL}; /* array for SubIFD tag */
|
||||
int blnWriteSubIFD = 0;
|
||||
|
||||
if (!(tiff = TIFFOpen("multiPageTiff2.tif", "w")))
|
||||
return 1;
|
||||
|
||||
for (int i = 0; i < number_of_images; i++)
|
||||
{
|
||||
char pixel[1] = {128};
|
||||
|
||||
TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, 1);
|
||||
TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, 1);
|
||||
TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 1);
|
||||
TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8);
|
||||
TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
|
||||
|
||||
/* For the last but one multi-page image, add a SubIFD e.g. for a
|
||||
* thumbnail */
|
||||
if (number_of_images - 2 == i)
|
||||
blnWriteSubIFD = 1;
|
||||
|
||||
if (blnWriteSubIFD)
|
||||
{
|
||||
/* Now here is the trick: the next n directories written
|
||||
* will be sub-IFDs of the main-IFD (where n is number_of_sub_IFDs
|
||||
* specified when you set the TIFFTAG_SUBIFD field.
|
||||
* The SubIFD offset array sub_IFDs_offsets is filled automatically
|
||||
* with the proper offset values by the following number_of_sub_IFDs
|
||||
* TIFFWriteDirectory() calls and updated in the related main-IFD
|
||||
* with the last call.
|
||||
*/
|
||||
if (!TIFFSetField(tiff, TIFFTAG_SUBIFD, number_of_sub_IFDs,
|
||||
sub_IFDs_offsets))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Write dummy pixel to image */
|
||||
if (TIFFWriteScanline(tiff, pixel, 0, 0) < 0)
|
||||
return 1;
|
||||
/* Write image / directory to file */
|
||||
if (!TIFFWriteDirectory(tiff))
|
||||
return 1;
|
||||
|
||||
if (blnWriteSubIFD)
|
||||
{
|
||||
/* A SubIFD tag has been written for that main-IFD and this
|
||||
* triggers that previous TIFFWriteDirectory() to switch to the
|
||||
* SubIFD-chain for the next number_of_sub_IFDs writings.
|
||||
* Thus, only the thumbnail images need to be
|
||||
* set up and written to file using TIFFWriteDirectory().
|
||||
* The last of this TIFFWriteDirectory() calls will setup
|
||||
* the next fresh main-IFD.
|
||||
*/
|
||||
for (int i = 0; i < number_of_sub_IFDs; i++)
|
||||
{
|
||||
TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, 1);
|
||||
TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, 1);
|
||||
TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 1);
|
||||
TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8);
|
||||
TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
|
||||
/* SUBFILETYPE tag is not mandatory for SubIFD writing, but a
|
||||
* good idea to indicate thumbnails */
|
||||
if (!TIFFSetField(tiff, TIFFTAG_SUBFILETYPE,
|
||||
FILETYPE_REDUCEDIMAGE))
|
||||
return 1;
|
||||
|
||||
/* Write dummy pixel to thumbnail image */
|
||||
pixel[0] = 64;
|
||||
if (TIFFWriteScanline(tiff, pixel, 0, 0) < 0)
|
||||
return 1;
|
||||
/* Writes now in the SubIFD chain */
|
||||
if (!TIFFWriteDirectory(tiff))
|
||||
return 1;
|
||||
|
||||
blnWriteSubIFD = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
TIFFClose(tiff);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reading Multi Page TIFF
|
||||
-----------------------
|
||||
|
||||
For a reading example see code of `tools/tiffinfo.c` or below:
|
||||
|
||||
.. highlight:: c
|
||||
|
||||
::
|
||||
|
||||
/* Reading of multi-page and SubIFD images (subfiles) */
|
||||
if (!(tiff = TIFFOpen(filename, "r")))
|
||||
return 1;
|
||||
|
||||
tdir_t currentDirNumber = TIFFCurrentDirectory(tiff);
|
||||
|
||||
/* The first directory is already read through TIFFOpen() */
|
||||
int blnRead = 0;
|
||||
do
|
||||
{
|
||||
/*Check if there are SubIFD subfiles */
|
||||
void *ptr;
|
||||
if (TIFFGetField(tiff, TIFFTAG_SUBIFD, &number_of_sub_IFDs, &ptr))
|
||||
{
|
||||
/* Copy SubIFD array from pointer */
|
||||
memcpy(sub_IFDs_offsets, ptr,
|
||||
number_of_sub_IFDs * sizeof(sub_IFDs_offsets[0]));
|
||||
|
||||
for (int i = 0; i < number_of_sub_IFDs; i++)
|
||||
{
|
||||
/* Read first SubIFD directory */
|
||||
if (!TIFFSetSubDirectory(tiff, sub_IFDs_offsets[i]))
|
||||
return 1;
|
||||
/* Check if there is a SubIFD chain behind the first one from
|
||||
* the array, as specified by Adobe */
|
||||
while (TIFFReadDirectory(tiff))
|
||||
/* analyse subfile */
|
||||
;
|
||||
}
|
||||
/* Go back to main-IFD chain and re-read that main-IFD directory */
|
||||
if (!TIFFSetDirectory(tiff, currentDirNumber))
|
||||
return 1;
|
||||
}
|
||||
/* Read next main-IFD directory (subfile) */
|
||||
blnRead = TIFFReadDirectory(tiff);
|
||||
currentDirNumber = TIFFCurrentDirectory(tiff);
|
||||
} while (blnRead);
|
||||
TIFFClose(tiff);
|
||||
|
||||
|
||||
|
||||
|
||||
See also
|
||||
--------
|
||||
|
||||
:doc:`terms`,
|
||||
:doc:`/functions/TIFFSetDirectory` (3tiff),
|
||||
:doc:`/functions/TIFFWriteDirectory` (3tiff),
|
||||
`Adobe PageMaker® 6.0 TIFF Technical Notes <https://www.awaresystems.be/imaging/tiff/specification/TIFFPM6.pdf>`_,
|
||||
`Example from StackOverflow <https://stackoverflow.com/questions/11959617/in-a-tiff-create-a-sub-ifd-with-thumbnail-libtiff>`_
|
||||
@@ -23,4 +23,5 @@ Questions should be sent to the :doc:`mailinglist`.
|
||||
license
|
||||
mailinglist
|
||||
bugs
|
||||
psc
|
||||
acknowledgements
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
.. _psc:
|
||||
|
||||
Project Steering Committee
|
||||
==========================
|
||||
|
||||
As of April 2024, the project has been placed in the hands of a Project Steering Committee. This project steering committee operates under the rules of :ref:`rfc1_psc`, and is overall responsible for decisions related to the libtiff project. The current members are:
|
||||
|
||||
- Bob Friesenhahn (@bobfriesenhahn)
|
||||
- Su Laus (@Su_Laus)
|
||||
- Roger Leigh (@rleigh)
|
||||
- Timothy Lyanguzov (@theta682)
|
||||
- Olivier Paquet (@1-Olivier)
|
||||
- Leonard Rosenthol (@lrosenthol)
|
||||
- Even Rouault (@rouault)
|
||||
|
||||
Note that discussion of proposals to the PSC take place on the libtiff mailing list
|
||||
(tiff@lists.osgeo.org, requiring subscription at https://lists.osgeo.org/mailman/listinfo/tiff,
|
||||
archived at https://www.awaresystems.be/imaging/tiff/tml.html),
|
||||
and input from all subscribers is welcome. A list of past :ref:`rfcs` is available for review.
|
||||
@@ -7,6 +7,9 @@ LibTIFF releases.
|
||||
:maxdepth: 1
|
||||
:titlesonly:
|
||||
|
||||
v4.7.0
|
||||
v4.6.0
|
||||
v4.5.1
|
||||
v4.5.0
|
||||
v4.4.0
|
||||
v4.3.0
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
Changes in TIFF v4.5.1
|
||||
======================
|
||||
|
||||
.. table:: References
|
||||
:widths: auto
|
||||
|
||||
====================== ==========================================
|
||||
Current Version v4.5.1 (:tag:`v4.5.1`)
|
||||
Previous Version :doc:`v4.5.0 <v4.5.0>`
|
||||
Master Download Site `<https://download.osgeo.org/libtiff/>`_
|
||||
Master HTTP Site #1 `<http://www.simplesystems.org/libtiff/>`_
|
||||
Master HTTP Site #2 `<https://libtiff.gitlab.io/libtiff/>`_
|
||||
Master HTTP Site #3 `<http://libtiff.maptools.org/>`_
|
||||
====================== ==========================================
|
||||
|
||||
This document provides a summary of significant changes made to the
|
||||
software between the *previous* and *current* versions (see
|
||||
above). A fully-detailed change summary is provided by the :file:`ChangeLog` file
|
||||
included in the release package and by the Git commit history:
|
||||
|
||||
.. warning::
|
||||
|
||||
This version will be the last one supporting most TIFF tools (except tiffinfo,
|
||||
tiffdump, tiffcp and tiffset), whose maintenance will be discontinued, due
|
||||
to the lack of contributors able to address reported security issues.
|
||||
Starting with libtiff v4.6.0, their source code, at this time ,will still be
|
||||
available in the source distribution, but they will no longer be built by
|
||||
default, and issues related to them will no longer be accepted in the
|
||||
libtiff bug tracker.
|
||||
|
||||
|
||||
.. warning::
|
||||
|
||||
Some CMake related changes, in particular related to the CMake config file
|
||||
now installed, should be considered as a preview and may change in the next
|
||||
releases based on user feedback.
|
||||
See discussion in https://gitlab.com/libtiff/libtiff/-/merge_requests/496
|
||||
and https://gitlab.com/libtiff/libtiff/-/merge_requests/494
|
||||
|
||||
Major changes
|
||||
-------------
|
||||
|
||||
None
|
||||
|
||||
Software configuration changes
|
||||
------------------------------
|
||||
|
||||
* Definition of tags reformatted (clang-format off) for better
|
||||
readability of tag comments in tiff.h and tif_dirinfo.c
|
||||
|
||||
* Do not install libtiff-4.pc when tiff-install is reset.
|
||||
|
||||
* Add versioninfo resource files for DLL and tools
|
||||
compiled with Windows MSVC and MINGW.
|
||||
|
||||
* Disable clang-formatting for tif_config.h.cmake.in and
|
||||
tiffconf.h.cmake.in because sensitive for CMake scripts.
|
||||
|
||||
* CMake: make WebP component name compatible with upstream ConfigWebP.cmake
|
||||
|
||||
* CMake: make Findliblzma with upstream CMake config file
|
||||
|
||||
* CMake: FindDeflate.cmake: fix several errors (:issue:`526`).
|
||||
|
||||
* CMake: FindLERC.cmake: version string return added.
|
||||
|
||||
* CMake: export TiffConfig.cmake and TiffConfigVersion.cmake files
|
||||
|
||||
* CMake: fix export of INTERFACE_INCLUDE_DIRECTORIES
|
||||
|
||||
Library changes
|
||||
---------------
|
||||
|
||||
New/improved functionalities:
|
||||
|
||||
* Hardcode HOST_FILLORDER to FILLORDER_LSB2MSB and make 'H' flag of
|
||||
:c:func:`TIFFOpen` to warn and an alias of FILLORDER_MSB2LSB.
|
||||
:file:`tif_lerc.c`: use WORDS_BIGENDIAN instead of HOST_BIGENDIAN.
|
||||
|
||||
* Optimize relative seeking within :c:func:`TIFFSetDirectory`
|
||||
by using the learned list of IFD offsets.
|
||||
|
||||
* Improve internal IFD offset and directory number map handling.
|
||||
|
||||
* Behavior of :c:func:`TIFFOpen` mode "r+" in the Windows implementation
|
||||
adjusted to that of Linux.
|
||||
|
||||
API/ABI breaks:
|
||||
|
||||
* None
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* TIFFDirectory td_fieldsset type changed from unsigned long, which can
|
||||
be 32 or 64 bits, to uint32_t (fixes :issue:`484`).
|
||||
|
||||
* tif_ojpeg.c: checking for division by zero (fixes :issue:`554`).
|
||||
|
||||
* LZWDecode(): avoid crash when trying to read again from a strip whith
|
||||
a missing end-of-information marker (fixes :issue:`548`).
|
||||
|
||||
* Fixed runtime error: applying zero offset to null pointer
|
||||
in :c:func:`countInkNamesString`.
|
||||
|
||||
* Fixing crash in :c:func:`TIFFUnlinkDirectory` when called with
|
||||
directory number zero ("TIFFUnlinkDirectory(**0**)") as well as fixing
|
||||
incorrect behaviour when unlinking the first directory.
|
||||
|
||||
* tif_luv: check and correct for NaN data in :c:func:`uv_encode`
|
||||
(:issue:`530`).
|
||||
|
||||
* :c:func:`TIFFClose` avoid NULL pointer dereferencing
|
||||
(:issue:`515`).
|
||||
|
||||
* tif_hash_set.c: include tif_hash_set.h after tif_config.h
|
||||
to let a chance for GDAL symbol renaming trick.
|
||||
|
||||
* Fax3: fix failure to decode some fax3 number_of_images
|
||||
and add test for Fax3 decoding issues
|
||||
(:issue:`513`).
|
||||
|
||||
* :c:func:`TIFFSetDirectory` and :c:func:`TIFFWriteDirectorySec`
|
||||
avoid harmless unsigned-integer-overflow
|
||||
(due to gdal oss-fuzz #54311 and #54343).
|
||||
|
||||
* :file:`tif_ojpeg.c`: fix :issue:`554` by checking for division by zero
|
||||
in OJPEGWriteHeaderInfo().
|
||||
|
||||
* LZWDecode(): avoid crash when trying to read again from a strip whith
|
||||
a missing end-of-information marker (:issue:`548`).
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
* mention TIFFSetTagExtender() cannot add tags to custom directories.
|
||||
|
||||
* manpage: add multi page TIFF and SubIFDs description and read / write example.
|
||||
|
||||
Tools changes
|
||||
-------------
|
||||
|
||||
New/improved functionality:
|
||||
|
||||
* None
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* :program:`tiffcrop`: Consider error return of writeSelections() (fixes :issue:`553`).
|
||||
|
||||
* :program:`tiffcrop`: fix memory leak
|
||||
(:issue:`475`).
|
||||
|
||||
* :program:`tiffcrop`: do not reuse input buffer for subsequent images
|
||||
(:issue:`527`).
|
||||
|
||||
* :program:`tiffcrop`: Amend rotateImage() not to toggle the input
|
||||
(main) image width and length parameters when only cropped image
|
||||
sections are rotated. Remove buffptr from region structure
|
||||
because never used. Fixes
|
||||
:issue:`492`, :issue:`493`, :issue:`494`, :issue:`495`,
|
||||
:issue:`499`, :issue:`518`, :issue:`519`.
|
||||
|
||||
* :program:`tiffcrop`: correctly update buffersize after rotateImage()
|
||||
(:issue:`520`).
|
||||
|
||||
* :program:`tiffcrop`: added check for assumption on composite images. Fixes
|
||||
:issue:`496`, :issue:`497`, :issue:`498`, :issue:`500`, :issue:`501`.
|
||||
|
||||
* :program:`tiffmedian`: avoid zero num_colors
|
||||
(:issue:`477`).
|
||||
|
||||
* :program:`fax2ps`: fix buffer overflow in qsort function pcompar
|
||||
(:issue:`475`).
|
||||
|
||||
* :program:`tiffset`: get filesize to allocate only the required memory
|
||||
(:issue:`241`).
|
||||
|
||||
* :program:`tiffcrop`: fix :issue:`553` by considering error return of writeSelections().
|
||||
|
||||
* tif_ovrcache.c: check :c:func:`TIFFSetSubDirectory` return value (CID 1524573).
|
||||
|
||||
|
||||
Contributed software changes
|
||||
----------------------------
|
||||
|
||||
None
|
||||
@@ -0,0 +1,156 @@
|
||||
Changes in TIFF v4.6.0
|
||||
======================
|
||||
|
||||
.. table:: References
|
||||
:widths: auto
|
||||
|
||||
====================== ==========================================
|
||||
Current Version v4.6.0 (:tag:`v4.6.0`)
|
||||
Previous Version :doc:`v4.5.1 <v4.5.1>`
|
||||
Master Download Site `<https://download.osgeo.org/libtiff/>`_
|
||||
Master HTTP Site #1 `<http://www.simplesystems.org/libtiff/>`_
|
||||
Master HTTP Site #2 `<https://libtiff.gitlab.io/libtiff/>`_
|
||||
====================== ==========================================
|
||||
|
||||
This document provides a summary of significant changes made to the
|
||||
software between the *previous* and *current* versions (see
|
||||
above). A fully-detailed change summary is provided by the :file:`ChangeLog` file
|
||||
included in the release package and by the Git commit history:
|
||||
|
||||
Major changes
|
||||
-------------
|
||||
|
||||
.. warning::
|
||||
|
||||
This version removes a big number of utilities that have suffered from lack
|
||||
of maintenance over the years and were the source of various reported
|
||||
security issues.
|
||||
See "Removed functionality" below for the list of removed utilities.
|
||||
Starting with libtiff v4.6.0, the source code for most TIFF tools (except tiffinfo,
|
||||
tiffdump, tiffcp and tiffset) was discontinued, due to the lack of contributors
|
||||
able to address reported security issues.
|
||||
tiff2ps and tiff2pdf source code has been moved in a unsupported category,
|
||||
no longer built by default, but are still part of the the source
|
||||
distribution. Other retired utilities are in a archive/ directory, only
|
||||
available in the libtiff git repository.
|
||||
Issues related to unsupported and archived tools will no longer be accepted
|
||||
in the libtiff bug tracker.
|
||||
|
||||
|
||||
Software configuration changes
|
||||
------------------------------
|
||||
|
||||
* TiffConfig.cmake.in: set TIFF_INCLUDE_DIR, TIFF_INCLUDE_DIRS and
|
||||
TIFF_LIBRARIES for compatibility with FindTIFF.cmake as shipped by CMake
|
||||
(fixes :issue:`589`)
|
||||
|
||||
* Update CMake and autoconf scripts to consistently update LibTIFF version
|
||||
defines and references in various files when version definition in
|
||||
configure.ac has been changed.
|
||||
|
||||
- Move in tiffvers.h from libtiff source directory to libtiff build directory.
|
||||
- Remove unused version information from tif_config.h
|
||||
- With every CMake build the version defines (e.g. 4.5.1) within tiffvers.h
|
||||
are consistently updated from configure.ac. The version release-date is
|
||||
taken from file RELEASE-DATE.
|
||||
- The files VERSION and RELEASE-DATE are only updated with a special CMake
|
||||
target build: cmake --build . --target tiff_release.
|
||||
- For autotools, version information is updated from configure.ac with
|
||||
./autogen.sh. LIBTIFF_RELEASE_DATE is taken form file RELEASE-DATE.
|
||||
- ./configure generates tiffvers.h with the cached version information and
|
||||
LIBTIFF_RELEASE_DATE.
|
||||
- "make release" updates tiffvers.h and VERSION file with cached version info
|
||||
and RELEASE-DATE file and tiffves.h with the current date.
|
||||
|
||||
* CMake: fix build with -Dstrip-chopping=off (fixes :issue:`600`)
|
||||
|
||||
Library changes
|
||||
---------------
|
||||
|
||||
New/improved functionalities:
|
||||
|
||||
* Fix using ``__attribute__`` libtiff with clang-for-windows
|
||||
|
||||
API/ABI breaks:
|
||||
|
||||
* None
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* WebP decoder: validate WebP blob width, height, band count against TIFF
|
||||
parameters to avoid use of uninitialized variable, or decoding corrupted
|
||||
content without explicit error (fixes :issue:`581`, :issue:`582`).
|
||||
|
||||
* WebP codec: turn exact mode when creating lossless files to avoid altering
|
||||
R,G,B values in areas where alpha=0 (https://github.com/OSGeo/gdal/issues/8038)
|
||||
|
||||
* Fix TransferFunction writing of only two transfer functions.
|
||||
|
||||
* TIFFReadDirectoryCheckOrder: avoid integer overflow. When it occurs, it
|
||||
should be harmless in practice though
|
||||
(https://gitlab.com/libtiff/libtiff/-/merge_requests/512)
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
* TiffField functions documentation updated with return behaviour for not
|
||||
defined tags and determination of write-/read-count size.
|
||||
|
||||
Tools changes
|
||||
-------------
|
||||
|
||||
Removed functionality:
|
||||
|
||||
* The following tools are no longer compiled and have been moved to archive/tools:
|
||||
|
||||
- fax2ps
|
||||
- fax2tiff
|
||||
- pal2rgb
|
||||
- ppm2tiff
|
||||
- raw2tiff
|
||||
- rgb2ycbcr
|
||||
- thumbnail
|
||||
- tiff2bw
|
||||
- tiff2rgba
|
||||
- tiffcmp
|
||||
- tiffcrop
|
||||
- tiffdither
|
||||
- tiffgt
|
||||
- tiffmedian
|
||||
|
||||
* The following tools are no longer compiled by default: tiff2ps and tiff2pdf.
|
||||
They have been moved to tools/unsupported.
|
||||
They can be built by setting ``--enable-tools-unsupported`` for autoconf,
|
||||
or ``-Dtiff-tools-unsupported`` for CMake, but as the name imply, they are
|
||||
no longer supported by upstream. Packagers are suggested *not* to enable those
|
||||
options.
|
||||
|
||||
* tiffcp: remove -i option (ignore errors), because almost all
|
||||
fuzzer issues were consequential errors from ignored errors because of the
|
||||
"-i" option.
|
||||
|
||||
New/improved functionality:
|
||||
|
||||
* None
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* tiffset: fix #597: warning: comparison of integer expressions of different
|
||||
signedness. (fixes :issue:`597`)
|
||||
|
||||
* tiffcp: fix memory corruption (overflow) on hostile images
|
||||
(fixes :issue:`591`)
|
||||
|
||||
Test changes
|
||||
------------
|
||||
|
||||
* Add missing test_write_read_tags.c and test_transferfunction_write_read.c
|
||||
in tarball (fixes :issue:`585`) and correct "long" issue.
|
||||
|
||||
* Don't use "long" because can be int32_t or int64_t, depending on compiler and
|
||||
system.
|
||||
|
||||
Changes to contributed and unsupported tools
|
||||
--------------------------------------------
|
||||
|
||||
* raw2tiff: fix integer overflow and bypass of the check (fixes :issue:`592`)
|
||||
@@ -0,0 +1,211 @@
|
||||
Changes in TIFF v4.7.0
|
||||
======================
|
||||
|
||||
.. table:: References
|
||||
:widths: auto
|
||||
|
||||
====================== ==========================================
|
||||
Current Version v4.7.0 (:tag:`v4.7.0`)
|
||||
Previous Version :doc:`v4.6.0 <v4.6.0>`
|
||||
Primary Download Site `<https://download.osgeo.org/libtiff/>`_
|
||||
Home HTTP Site #1 `<http://www.simplesystems.org/libtiff/>`_
|
||||
Home HTTP Site #2 `<https://libtiff.gitlab.io/libtiff/>`_
|
||||
====================== ==========================================
|
||||
|
||||
This document provides a summary of significant changes made to the
|
||||
software between the *previous* and *current* versions (see
|
||||
above). A fully-detailed change summary is provided by the :file:`ChangeLog` file
|
||||
included in the release package and by the Git commit history.
|
||||
|
||||
Major changes
|
||||
-------------
|
||||
|
||||
This version restores in the default build the availability of the tools that
|
||||
had been dropped in v4.6.0 (cf :ref:`rfc2_restoring_needed_tools`)
|
||||
|
||||
Software configuration changes
|
||||
------------------------------
|
||||
|
||||
- autoconf build: configure.ac: avoid -Werror passed to CFLAGS to interfere with feature detection
|
||||
|
||||
- autoconf build: fix error when running make clean (fixes :issue:`630`)
|
||||
|
||||
- autoconf build: back off the minimum required automake version to 1.11
|
||||
|
||||
- autoconf.ac: fix detection of windows.h for mingw (fixes :issue:`605`)
|
||||
|
||||
- libtiff-4.pc: Fix `Requires.private` missing `Lerc`. It provides a `.pc` file starting from version 4
|
||||
(in autoconf builds, we assume that liblerc is at least version 4)
|
||||
|
||||
- CMake: Fix TIFF_INCLUDE_DIRS
|
||||
|
||||
- CMake: MinGW compilers don't need a .def file for shared library
|
||||
|
||||
- CMake: move libdeflate and Lerc to Requires.private
|
||||
|
||||
- CMake: enable resource compilation on all Windows.
|
||||
|
||||
Library changes
|
||||
---------------
|
||||
|
||||
New/improved functionalities:
|
||||
|
||||
- Add ``TIFFOpenOptionsSetMaxCumulatedMemAlloc()``. This function complements
|
||||
``TIFFOpenOptionsSetMaxSingleMemAlloc()`` to define the maximum cumulated
|
||||
memory allocations in byte, for a given TIFF handle, that libtiff internal
|
||||
memory allocation functions are allowed.
|
||||
|
||||
API/ABI breaks:
|
||||
|
||||
* None
|
||||
|
||||
Bug fixes:
|
||||
|
||||
- TIFFWriteDirectory(): Avoid overwriting following data if an IFD is enlarged.
|
||||
|
||||
- TIFFXYZToRGB: avoid integer overflow (fixes :issue:`644`)
|
||||
|
||||
- uv_decode() and uv_encode(): avoid potential out-of-bounds array index
|
||||
(fixes :issue:`645`)
|
||||
|
||||
- Fix cases where tif_curdir is set incorrectly.
|
||||
Fix cases where the current directory number (tif_curdir) is set inconsistently
|
||||
or incorrectly, depending on the previous history.
|
||||
|
||||
- TIFFRead[Scanline/EncodedStrip/EncodeTile]: 0-initialize output buffer if
|
||||
setupdecode fails ; most codecs: zero-initialize (not-yet-written parts of)
|
||||
output buffer if failure (fixes :issue:`375`)
|
||||
|
||||
- OJPEG: reset subsampling_convert_state=0 in OJPEGPreDecode (fixes :issue:`183`)
|
||||
|
||||
- ThunderRLE: fix failure when decoding last run. Bug seen with GhostPDL
|
||||
|
||||
- LERC codec: deal with issues with multi-band PlanarConfig=Contig and NaN values
|
||||
|
||||
- tif_fax3.c: error out after a number of times end-of-file has been reached
|
||||
(fixes :issue:`583`)
|
||||
|
||||
- LZW: avoid warning about misaligned address with UBSAN (fixes :issue:`616`)
|
||||
|
||||
- TIFFReadRGBAStrip/TIFFReadRGBATile: add more validation of col/row
|
||||
(fixes :issue:`622`, CVE-2023-52356)
|
||||
|
||||
- tif_dirread.c: only issue TIFFGetFileSize() for large enough RAM requests
|
||||
|
||||
- Avoid FPEs (division by zero) in tif_getimage.c.
|
||||
|
||||
- Avoiding FPE (division by zero) for TIFFhowmany_32() and TIFFhowmany_64() macros
|
||||
by checking for denominator not zero before macros are executed. (fixes :issue:`628`)
|
||||
|
||||
- Add non-zero check before division in TIFFComputeStrip()
|
||||
|
||||
- Fix wrong return of TIFFIsBigTIFF() in case byte-swapping is active
|
||||
|
||||
- Setting the TIFFFieldInfo field `set_field_type` should consider `field_writecount` not `field_readcount`
|
||||
|
||||
- Avoid memory leaks when using TIFFCreateDirectory() by releasing the allocated
|
||||
memory in the tif-structure.
|
||||
|
||||
- For non-terminated ASCII arrays, the buffer is first enlarged before a NULL is
|
||||
set at the end to avoid deleting the last character. (fixes :issue:`579`)
|
||||
|
||||
- Check return value of _TIFFCreateAnonField(). (fixes :issue:`624`, CVE-2024-7006)
|
||||
|
||||
- Prevent some out-of-memory attacks (https://gitlab.com/libtiff/libtiff/-/issues/614#note_1602683857)
|
||||
|
||||
- Ensure absolute seeking is forced independent of TIFFReadDirectory success. (fixes :issue:`618`)
|
||||
|
||||
- tif_dirinfo.c: re-enable TIFFTAG_EP_CFAREPEATPATTERNDIM and TIFFTAG_EP_CFAPATTERN tags (fixes :issue:`608`)
|
||||
|
||||
Other changes:
|
||||
|
||||
- Fix warnings with GCC 14
|
||||
|
||||
- tif_dir.c: Log source file, line number, and input tif for directory count error (fixes :issue:`627`)
|
||||
|
||||
- Last usage of get_field_type of TIFFField structure at TIFFWriteDirectorySec()
|
||||
changed to using set_field_type.
|
||||
|
||||
- tif_jpeg.c/tif_ojpeg.c: remove likely ifdef tricks related to old compilers or unusual setups
|
||||
|
||||
- Remove _TIFFUInt64ToFloat() and _TIFFUInt64ToDouble()
|
||||
|
||||
- Remove support for _MSC_VER < 1500.
|
||||
|
||||
- Use #ifdef _WIN32 to test for Windows, and tiffio.h: remove definition of __WIN32__
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
- Amend manpages for changes in current directory index behaviour
|
||||
|
||||
- Note on using TIFFFlush() before TIFFClose() to check that the data has been
|
||||
successfully written to the file. (fixes :issue:`506`)
|
||||
|
||||
- Update TIFF documentation about TIFFOpenOptions.rst and
|
||||
TIFFOpenOptionsSetMaxSingleMemAlloc() usage and some other small fixes
|
||||
(relates to CVE-2024-7006)
|
||||
|
||||
Tools changes
|
||||
-------------
|
||||
|
||||
Re-added tools:
|
||||
|
||||
- fax2ps
|
||||
- fax2tiff
|
||||
- pal2rgb
|
||||
- ppm2tiff
|
||||
- raw2tiff
|
||||
- rgb2ycbcr (not installed)
|
||||
- thumbnail (not installed)
|
||||
- tiff2bw
|
||||
- tiff2rgba
|
||||
- tiffcmp
|
||||
- tiffcrop
|
||||
- tiffdither
|
||||
- tiffgt
|
||||
- tiffmedian
|
||||
- tiff2ps
|
||||
- tiff2pdf
|
||||
|
||||
New/improved functionality:
|
||||
|
||||
- tiff2rgba: Add background gradient option for alpha compositing
|
||||
- tiffcp: -i flag restored
|
||||
|
||||
Bug fixes:
|
||||
|
||||
- tiffcrop: address Coverity scan issues 1605444, 1605445, and 16054
|
||||
- tiffcrop: Apply "Fix heap-buffer-overflow in function extractImageSection"
|
||||
- tiffcrop: fix buffer overflows, use after free (fixes :issue:`542`,
|
||||
:issue:`550`, :issue:`552`)
|
||||
- tiff2pdf: address Coverity scan issues
|
||||
- tiff2pdf: fix inconsistent PLANARCONFIG value for the input and output TIFF
|
||||
- tiff2pdf: fix issue with JPEG restart-interval marker when converting from
|
||||
JPEG-compressed files (fixes :issue:`539`)
|
||||
- tiff2pdf: red and blue were being swapped for RGBA decoding (fixes :issue:`253`)
|
||||
- tiff2pdf: fixes :issue:`596`
|
||||
- thumbnail: address Coverity scan issues
|
||||
- tiffcp: Add check for limitMalloc return to fix Coverity 1603334
|
||||
- tiffcp: preserve TIFFTAG_REFERENCEBLACKWHITE when doing YCbCr JPEG -> YCbCr JPEG
|
||||
- tiffcp: replace PHOTOMETRIC_YCBCR with PHOTOMETRIC_RGB when outputing to compression != JPEG (refs :issue:`571`)
|
||||
- tiffcp: do not copy tags YCBCRCOEFFICIENTS, YCBCRSUBSAMPLING, YCBCRPOSITIONING,
|
||||
REFERENCEBLACKWHITE. Only set YCBCRSUBSAMPLING when generating YCbCr JPEG
|
||||
- tiffcp: Check also codec of input image, not only from output image (fixes :issue:`606`)
|
||||
- Add some basic sanity checks for tiffcp and tiffcrop RGB->YCbCr JPEG conversions.
|
||||
- fax2ps and fax2tiff: memory leak fixes (fixes :issue:`476`)
|
||||
- tiffmedian: memory leak fixes (fixes :issue:`599`)
|
||||
- fax2tiff: fix EOFB interpretation (fixes :issue:`191`)
|
||||
- fax2tiff: fix issue with unreasonable width input (fixes :issue:`249`)
|
||||
- tiffcp and tiffcrop: fixes :issue:`228`
|
||||
- tiff2rgba: fixes :issue:`469`
|
||||
- tiffdither: fixes :issue:`473`
|
||||
- tiffdump: fix wrong printf formatter in error message (Coverity 1472932)
|
||||
- tiffset: avoid false positive Coverity Scan warning on 64-bit builds (Coverity 1518997)
|
||||
- tifcp/tiffset: use correct format specifiers
|
||||
|
||||
Changes to contributed and unsupported tools
|
||||
--------------------------------------------
|
||||
|
||||
- contrib/addtiffo: validate return of TIFFWriteEncodedXXXX() calls (Coverity 1024680)
|
||||
@@ -0,0 +1,14 @@
|
||||
.. _rfcs:
|
||||
|
||||
Request For Comments (RFCs)
|
||||
===========================
|
||||
|
||||
RFCs are the process through which major changes in the working or content
|
||||
of the libtiff project are conducted.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:titlesonly:
|
||||
|
||||
rfc1_psc
|
||||
rfc2_restoring_needed_tools
|
||||
@@ -0,0 +1,107 @@
|
||||
.. _rfc1_psc:
|
||||
|
||||
============================================
|
||||
RFC 1: Project Steering Committee Guidelines
|
||||
============================================
|
||||
|
||||
Author: Even Rouault
|
||||
|
||||
Contact: even.rouault at spatials.com
|
||||
|
||||
Status: Adopted
|
||||
|
||||
Summary
|
||||
-------
|
||||
|
||||
This document describes how the libtiff Project Steering Committee
|
||||
determines membership, and makes decisions on libtiff project issues.
|
||||
|
||||
In brief, the committee votes on proposals on the libtiff mailing list.
|
||||
Proposals are available for review for at least 5 business days, and a single
|
||||
veto is sufficient to delay progress though ultimately a majority of members can
|
||||
pass a proposal.
|
||||
|
||||
Detailed Process
|
||||
----------------
|
||||
|
||||
1. Proposals are written up and submitted on the libtiff mailing list
|
||||
for discussion and voting, by any interested party, not just
|
||||
committee members.
|
||||
2. Proposals need to be available for review for at least 5 business
|
||||
days before a final decision can be made.
|
||||
3. Respondents may vote "+1" to indicate support for the proposal and a
|
||||
willingness to support implementation.
|
||||
4. Respondents may vote "-1" to veto a proposal, but must provide clear
|
||||
reasoning and alternate approaches to resolving the problem within
|
||||
the voting delay.
|
||||
5. A vote of -0 indicates mild disagreement, but has no effect. A 0
|
||||
indicates no opinion. A +0 indicate mild support, but has no effect.
|
||||
6. Anyone may comment on proposals on the list, but only members of the
|
||||
Project Steering Committee's votes will be counted.
|
||||
7. A proposal will be accepted if it receives at least +2 (including the
|
||||
proposer) and no vetos (-1).
|
||||
8. If a proposal is vetoed, and it cannot be revised to satisfy all
|
||||
parties, then it can be resubmitted for an override vote in which a
|
||||
majority of all eligible voters indicating +1 is sufficient to pass
|
||||
it. Note that this is a majority of all committee members, not just
|
||||
those who actively vote.
|
||||
9. Upon completion of discussion and voting the proposer should
|
||||
announce whether they are proceeding (proposal accepted) or are
|
||||
withdrawing their proposal (vetoed).
|
||||
10. The Chair gets a vote.
|
||||
11. The Chair is responsible for keeping track of who is a member of the
|
||||
Project Steering Committee.
|
||||
12. Addition and removal of members from the committee, as well as
|
||||
selection of a Chair should be handled as a proposal to the
|
||||
committee.
|
||||
13. The Chair adjudicates in cases of disputes about voting.
|
||||
|
||||
When is Vote Required?
|
||||
----------------------
|
||||
|
||||
- Anything that could cause backward compatibility issues.
|
||||
- Adding, removing or modifying substantial amounts of code.
|
||||
- Changing inter-subsystem APIs.
|
||||
- Issues of procedure.
|
||||
- When releases should take place.
|
||||
- Anything that might be controversial
|
||||
|
||||
Observations
|
||||
------------
|
||||
|
||||
- The Chair is the ultimate adjudicator if things break down.
|
||||
- The absolute majority rule can be used to override an obstructionist
|
||||
veto, but it is intended that in normal circumstances vetoers need to
|
||||
be convinced to withdraw their veto. We are trying to reach
|
||||
consensus.
|
||||
- It is strongly recommended that proposals subject to a vote be discussed
|
||||
first on the mailing list to build consensus before proceeding to the vote.
|
||||
|
||||
Bootstrapping
|
||||
-------------
|
||||
|
||||
The initial members of the Project Steering Committee are:
|
||||
|
||||
- Bob Friesenhahn (@bobfriesenhahn)
|
||||
- Su Laus (@Su_Laus)
|
||||
- Roger Leigh (@rleigh)
|
||||
- Timothy Lyanguzov (@theta682)
|
||||
- Olivier Paquet (@1-Olivier)
|
||||
- Leonard Rosenthol (@lrosenthol)
|
||||
- Even Rouault (@rouault)
|
||||
|
||||
Even Rouault is declared initial Chair of the Project Steering Committee.
|
||||
|
||||
The current membership list can be found on the :ref:`psc` page.
|
||||
|
||||
Credits
|
||||
-------
|
||||
|
||||
This document is a direct adaptation from
|
||||
`GDAL Project Management Committee Guidelines <https://gdal.org/development/rfc/rfc1_pmc.html>`__,
|
||||
authored by Frank Warmerdam.
|
||||
|
||||
Voting history
|
||||
--------------
|
||||
|
||||
Adopted by +1 vote from all above mentionned initial members of the PSC.
|
||||
@@ -0,0 +1,62 @@
|
||||
.. _rfc2_restoring_needed_tools:
|
||||
|
||||
=====================================
|
||||
RFC 2: Restoring Needed LibTIFF Tools
|
||||
=====================================
|
||||
|
||||
Author: Su Laus
|
||||
|
||||
Contact: (@Su_Laus)
|
||||
|
||||
Status: Approved
|
||||
|
||||
Summary
|
||||
-------
|
||||
|
||||
The purpose of this RFC is to clarify if and which tools that were moved
|
||||
to the archive in libtiff 4.6.0 should be reactivated.
|
||||
|
||||
Prehistory
|
||||
----------
|
||||
|
||||
The tools in libtiff caused many vulnerabilities
|
||||
and CVEs that were attributed to the libtiff library itself.
|
||||
Trying to fix the security holes in the tools turned out to be a
|
||||
Sisyphean task (can never be done).
|
||||
Therefore, most of the tools in libtiff 4.6.0 were moved to the archive
|
||||
and the existing problems were closed with "wontfix-unmaintained".
|
||||
|
||||
It was later understood that some users depend on some of these archived tools.
|
||||
|
||||
Some problems with the tools have now been fixed
|
||||
(see e.g. https://gitlab.com/libtiff/libtiff/-/merge_requests/569).
|
||||
|
||||
Proposed procedure
|
||||
------------------
|
||||
|
||||
* All tools as of libtiff 4.5.1 shall be restored.
|
||||
* Bugfixes in MR !569 are applied in single merge requests for traceability
|
||||
and selectively as some changes might not be applicable.
|
||||
* Remove “wontfix-unmaintained” from closed issues, when fixed.
|
||||
* All issues related to utilities / tools shall get label “utility”.
|
||||
* The documentation and other references shall point to
|
||||
https://libtiff.gitlab.io/libtiff/.
|
||||
* After an initial merge has been applied for restoring the tools,
|
||||
the http://www.libtiff.org page shall be reset as a mirror of
|
||||
https://libtiff.gitlab.io/libtiff/.
|
||||
* Finally release as 4.7.0 when all known issues of the tools are closed.
|
||||
|
||||
References to previous contributions to the discussion
|
||||
------------------------------------------------------
|
||||
https://gitlab.com/libtiff/libtiff/-/issues/580 and related merge request,
|
||||
https://www.asmail.be/msg0054917226.html,
|
||||
https://www.asmail.be/msg0055015786.html,
|
||||
https://gitlab.com/libtiff/libtiff/-/merge_requests/569,
|
||||
and discussion in https://gitlab.com/libtiff/libtiff/-/merge_requests/581
|
||||
|
||||
Voting history
|
||||
--------------
|
||||
|
||||
+1 from PSC members @bobfriesenhahn, @1-Olivier, @Su_Laus
|
||||
|
||||
+0 from PSC members @theta682 and @rouault
|
||||
+1166
-51
File diff suppressed because it is too large
Load Diff
@@ -35,6 +35,31 @@ Codec:
|
||||
Software that implements the decoding and encoding algorithms
|
||||
of a compression scheme.
|
||||
|
||||
.. _ImageFileDirectory:
|
||||
|
||||
Image File Directory (IFD):
|
||||
An Image File Directory - in short also *directory* -
|
||||
contains information about the image,
|
||||
as well as pointers (offsets) to the actual image data
|
||||
within the on-disk file.
|
||||
An IFD points either to the next IFD or shows with a ''0''
|
||||
that it is the last IFD in the IFD-chain.
|
||||
|
||||
Multi Images per TIFF file:
|
||||
There may be more than one IFD in a TIFF file.
|
||||
Each IFD defines a *subfile*.
|
||||
One potential use of *subfiles* is to describe related images,
|
||||
such as the pages of a facsimile transmission.
|
||||
Such files are also named "*multi-page* TIFF" or "*multi-image* TIFF".
|
||||
Refer also to :doc:`/multi_page`.
|
||||
|
||||
.. _SubFile:
|
||||
|
||||
Subfile:
|
||||
*Subfile* is a term in the TIFF 6.0 specification for
|
||||
an image and its associated *Image File Directory (IFD)*
|
||||
in a TIFF file containing one or more images.
|
||||
|
||||
In order to better understand how TIFF works (and consequently this
|
||||
software) it is important to recognize the distinction between the
|
||||
physical organization of image data as it is stored in a TIFF and how
|
||||
|
||||
@@ -100,7 +100,7 @@ Options
|
||||
|
||||
.. option:: -d
|
||||
|
||||
Do not compress (decompress).
|
||||
Do not compress (decompress) - except monochrome to CCITT Group 4.
|
||||
|
||||
.. option:: -i
|
||||
|
||||
|
||||
@@ -59,6 +59,11 @@ Options
|
||||
Drop the alpha component from the output file, producing a pure RGB file.
|
||||
Currently this does not work if the :option:`-b` flag is also in effect.
|
||||
|
||||
.. option:: -B
|
||||
|
||||
Use this value as the background when doing alpha compositing (dropping the
|
||||
alpha component).
|
||||
|
||||
.. option:: -M size
|
||||
|
||||
Set maximum memory allocation size (in MiB). The default is 256MiB.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tiff2cmp
|
||||
========
|
||||
tiffcmp
|
||||
=======
|
||||
|
||||
.. program:: tiffcmp
|
||||
|
||||
|
||||
+52
-9
@@ -23,17 +23,21 @@
|
||||
# OF THIS SOFTWARE.
|
||||
|
||||
# Generate headers
|
||||
# and update configuration settings and package / version information.
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tif_config.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tif_config.h
|
||||
@ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tiffconf.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tiffconf.h
|
||||
@ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tiffvers.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tiffvers.h
|
||||
@ONLY)
|
||||
|
||||
set(tiff_public_HEADERS
|
||||
tiff.h
|
||||
tiffio.h
|
||||
tiffvers.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tiffvers.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tiffconf.h)
|
||||
|
||||
set(tiff_private_HEADERS
|
||||
@@ -46,7 +50,7 @@ set(tiff_private_HEADERS
|
||||
|
||||
|
||||
add_library(tiff libtiff.def)
|
||||
add_library(TIFF::TIFF ALIAS tiff)
|
||||
add_library(TIFF::tiff ALIAS tiff)
|
||||
|
||||
target_sources(tiff PRIVATE
|
||||
${tiff_public_HEADERS}
|
||||
@@ -94,20 +98,40 @@ target_sources(tiff PRIVATE
|
||||
tif_zip.c
|
||||
tif_zstd.c)
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16)
|
||||
set_property(SOURCE tif_jpeg.c tif_jpeg12.c PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
|
||||
endif ()
|
||||
|
||||
# For all files (but tif_open.c, tif_unix.c and tif_win32.c), forbid the use
|
||||
# of _TIFFmalloc/_TIFFfree and require the use of their "Ext" versions
|
||||
target_compile_definitions(tiff PRIVATE TIFF_DO_NOT_USE_NON_EXT_ALLOC_FUNCTIONS)
|
||||
set_property(SOURCE tif_open.c APPEND PROPERTY COMPILE_DEFINITIONS ALLOW_TIFF_NON_EXT_ALLOC_FUNCTIONS)
|
||||
|
||||
if(USE_WIN32_FILEIO)
|
||||
target_sources(tiff PRIVATE tif_win32.c)
|
||||
set_property(SOURCE tif_win32.c APPEND PROPERTY COMPILE_DEFINITIONS ALLOW_TIFF_NON_EXT_ALLOC_FUNCTIONS)
|
||||
else()
|
||||
target_sources(tiff PRIVATE tif_unix.c)
|
||||
set_property(SOURCE tif_unix.c APPEND PROPERTY COMPILE_DEFINITIONS ALLOW_TIFF_NON_EXT_ALLOC_FUNCTIONS)
|
||||
endif()
|
||||
|
||||
target_include_directories(tiff
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
PRIVATE
|
||||
${TIFF_INCLUDES}
|
||||
)
|
||||
|
||||
# Windows specific resource preparation
|
||||
if (WIN32)
|
||||
message(STATUS "Include resource version information for LibTIFF")
|
||||
target_sources(tiff PRIVATE tif_win32_versioninfo.rc)
|
||||
source_group("Resource Files" FILES tif_win32_versioninfo.rc)
|
||||
endif ()
|
||||
|
||||
|
||||
set(tiff_libs_private_list "") # cmake list
|
||||
set(tiff_requires_private "") # cmake string
|
||||
|
||||
@@ -117,7 +141,11 @@ if(ZIP_SUPPORT)
|
||||
endif()
|
||||
if(ZIP_SUPPORT AND LIBDEFLATE_SUPPORT)
|
||||
target_link_libraries(tiff PRIVATE Deflate::Deflate)
|
||||
list(APPEND tiff_libs_private_list "${Deflate_LIBRARY}")
|
||||
if(Deflate_VERSION_STRING VERSION_GREATER_EQUAL "1.9")
|
||||
string(APPEND tiff_requires_private " libdeflate")
|
||||
else()
|
||||
list(APPEND tiff_libs_private_list "${Deflate_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
if(JPEG_SUPPORT)
|
||||
target_link_libraries(tiff PRIVATE JPEG::JPEG)
|
||||
@@ -135,13 +163,17 @@ if(JBIG_SUPPORT)
|
||||
endif()
|
||||
if(LERC_SUPPORT)
|
||||
target_link_libraries(tiff PRIVATE LERC::LERC)
|
||||
list(APPEND tiff_libs_private_list "${LERC_LIBRARY}")
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
set_target_properties(tiff PROPERTIES COMPILE_DEFINITIONS LERC_STATIC)
|
||||
if(LERC_VERSION_STRING VERSION_GREATER_EQUAL "4.0")
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
set_target_properties(tiff PROPERTIES COMPILE_DEFINITIONS LERC_STATIC)
|
||||
endif()
|
||||
string(APPEND tiff_requires_private " Lerc")
|
||||
else()
|
||||
list(APPEND tiff_libs_private_list "${LERC_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
if(LZMA_SUPPORT)
|
||||
target_link_libraries(tiff PRIVATE LibLZMA::LibLZMA)
|
||||
target_link_libraries(tiff PRIVATE liblzma::liblzma)
|
||||
string(APPEND tiff_requires_private " liblzma")
|
||||
endif()
|
||||
if(ZSTD_SUPPORT)
|
||||
@@ -149,7 +181,7 @@ if(ZSTD_SUPPORT)
|
||||
string(APPEND tiff_requires_private " libzstd")
|
||||
endif()
|
||||
if(WEBP_SUPPORT)
|
||||
target_link_libraries(tiff PRIVATE WebP::WebP)
|
||||
target_link_libraries(tiff PRIVATE WebP::webp)
|
||||
string(APPEND tiff_requires_private " libwebp")
|
||||
endif()
|
||||
if(CMath_LIBRARY)
|
||||
@@ -189,6 +221,17 @@ if(tiff-install)
|
||||
NAMESPACE TIFF::
|
||||
DESTINATION ${TIFF_CONFIGDIR}
|
||||
)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
TiffConfigVersion.cmake
|
||||
VERSION ${LIBTIFF_VERSION}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TiffConfigVersion.cmake DESTINATION ${TIFF_CONFIGDIR})
|
||||
|
||||
configure_file(${PROJECT_SOURCE_DIR}/cmake/TiffConfig.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/TiffConfig.cmake @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TiffConfig.cmake DESTINATION ${TIFF_CONFIGDIR})
|
||||
endif()
|
||||
|
||||
if(CXX_SUPPORT)
|
||||
@@ -196,7 +239,7 @@ if(CXX_SUPPORT)
|
||||
tiffio.hxx)
|
||||
|
||||
# No .def file for this library.
|
||||
if (WIN32)
|
||||
if (WIN32 AND NOT MINGW)
|
||||
add_library(tiffxx STATIC ../placeholder.h)
|
||||
else()
|
||||
add_library(tiffxx ../placeholder.h)
|
||||
|
||||
+3
-1
@@ -32,8 +32,10 @@ EXTRA_DIST = \
|
||||
libtiff.def \
|
||||
libtiff.map \
|
||||
libtiffxx.map \
|
||||
tiffvers.h.cmake.in \
|
||||
tif_config.h.cmake.in \
|
||||
tiffconf.h.cmake.in
|
||||
tiffconf.h.cmake.in \
|
||||
tif_win32_versioninfo.rc
|
||||
|
||||
libtiffinclude_HEADERS = \
|
||||
tiff.h \
|
||||
|
||||
@@ -85,6 +85,7 @@ EXPORTS TIFFAccessTagMethods
|
||||
TIFFOpenWExt
|
||||
TIFFOpenOptionsAlloc
|
||||
TIFFOpenOptionsFree
|
||||
TIFFOpenOptionsSetMaxCumulatedMemAlloc
|
||||
TIFFOpenOptionsSetMaxSingleMemAlloc
|
||||
TIFFOpenOptionsSetErrorHandlerExtR
|
||||
TIFFOpenOptionsSetWarningHandlerExtR
|
||||
|
||||
@@ -214,3 +214,7 @@ LIBTIFF_4.5 {
|
||||
TIFFOpenOptionsSetErrorHandlerExtR;
|
||||
TIFFOpenOptionsSetWarningHandlerExtR;
|
||||
} LIBTIFF_4.4;
|
||||
|
||||
LIBTIFF_4.6.1 {
|
||||
TIFFOpenOptionsSetMaxCumulatedMemAlloc;
|
||||
} LIBTIFF_4.5;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Initialise fax decoder tables
|
||||
/* Initialize fax decoder tables
|
||||
* Decoder support is derived, with permission, from the code
|
||||
* in Frank Cringle's viewfax program;
|
||||
* Copyright (C) 1990, 1995 Frank D. Cringle.
|
||||
@@ -194,7 +194,7 @@ void WriteTable(FILE *fd, const TIFFFaxTabEnt *T, int Size, const char *name)
|
||||
fprintf(fd, "\n};\n");
|
||||
}
|
||||
|
||||
/* initialise the huffman code tables */
|
||||
/* initialize the huffman code tables */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fd;
|
||||
|
||||
@@ -385,53 +385,6 @@ int TIFFGetFieldDefaulted(TIFF *tif, uint32_t tag, ...)
|
||||
return (ok);
|
||||
}
|
||||
|
||||
struct _Int64Parts
|
||||
{
|
||||
int32_t low, high;
|
||||
};
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct _Int64Parts part;
|
||||
int64_t value;
|
||||
} _Int64;
|
||||
|
||||
float _TIFFUInt64ToFloat(uint64_t ui64)
|
||||
{
|
||||
_Int64 i;
|
||||
|
||||
i.value = ui64;
|
||||
if (i.part.high >= 0)
|
||||
{
|
||||
return (float)i.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
long double df;
|
||||
df = (long double)i.value;
|
||||
df += 18446744073709551616.0; /* adding 2**64 */
|
||||
return (float)df;
|
||||
}
|
||||
}
|
||||
|
||||
double _TIFFUInt64ToDouble(uint64_t ui64)
|
||||
{
|
||||
_Int64 i;
|
||||
|
||||
i.value = ui64;
|
||||
if (i.part.high >= 0)
|
||||
{
|
||||
return (double)i.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
long double df;
|
||||
df = (long double)i.value;
|
||||
df += 18446744073709551616.0; /* adding 2**64 */
|
||||
return (double)df;
|
||||
}
|
||||
}
|
||||
|
||||
float _TIFFClampDoubleToFloat(double val)
|
||||
{
|
||||
if (val > FLT_MAX)
|
||||
|
||||
+34
-6
@@ -51,8 +51,7 @@ void TIFFCleanup(TIFF *tif)
|
||||
(*tif->tif_cleanup)(tif);
|
||||
TIFFFreeDirectory(tif);
|
||||
|
||||
TIFFHashSetDestroy(tif->tif_map_dir_offset_to_number);
|
||||
TIFFHashSetDestroy(tif->tif_map_dir_number_to_offset);
|
||||
_TIFFCleanupIFDOffsetAndNumberMaps(tif);
|
||||
|
||||
/*
|
||||
* Clean up client info links.
|
||||
@@ -111,9 +110,35 @@ void TIFFCleanup(TIFF *tif)
|
||||
_TIFFfreeExt(tif, tif->tif_fieldscompat);
|
||||
}
|
||||
|
||||
if (tif->tif_cur_cumulated_mem_alloc != 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, "TIFFCleanup",
|
||||
"tif_cur_cumulated_mem_alloc = %" PRIu64 " whereas it "
|
||||
"should be 0",
|
||||
(uint64_t)tif->tif_cur_cumulated_mem_alloc);
|
||||
}
|
||||
|
||||
_TIFFfreeExt(NULL, tif);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _TIFFCleanupIFDOffsetAndNumberMaps() */
|
||||
/************************************************************************/
|
||||
|
||||
void _TIFFCleanupIFDOffsetAndNumberMaps(TIFF *tif)
|
||||
{
|
||||
if (tif->tif_map_dir_offset_to_number)
|
||||
{
|
||||
TIFFHashSetDestroy(tif->tif_map_dir_offset_to_number);
|
||||
tif->tif_map_dir_offset_to_number = NULL;
|
||||
}
|
||||
if (tif->tif_map_dir_number_to_offset)
|
||||
{
|
||||
TIFFHashSetDestroy(tif->tif_map_dir_number_to_offset);
|
||||
tif->tif_map_dir_number_to_offset = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* TIFFClose() */
|
||||
/************************************************************************/
|
||||
@@ -130,9 +155,12 @@ void TIFFCleanup(TIFF *tif)
|
||||
|
||||
void TIFFClose(TIFF *tif)
|
||||
{
|
||||
TIFFCloseProc closeproc = tif->tif_closeproc;
|
||||
thandle_t fd = tif->tif_clientdata;
|
||||
if (tif != NULL)
|
||||
{
|
||||
TIFFCloseProc closeproc = tif->tif_closeproc;
|
||||
thandle_t fd = tif->tif_clientdata;
|
||||
|
||||
TIFFCleanup(tif);
|
||||
(void)(*closeproc)(fd);
|
||||
TIFFCleanup(tif);
|
||||
(void)(*closeproc)(fd);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -89,7 +89,7 @@ void TIFFCIELab16ToXYZ(TIFFCIELabToRGB *cielab, uint32_t l, int32_t a,
|
||||
void TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z,
|
||||
uint32_t *r, uint32_t *g, uint32_t *b)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
float Yr, Yg, Yb;
|
||||
float *matrix = &cielab->display.d_mat[0][0];
|
||||
|
||||
@@ -109,16 +109,16 @@ void TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z,
|
||||
Yb = TIFFmin(Yb, cielab->display.d_YCB);
|
||||
|
||||
/* Turn luminosity to colour value. */
|
||||
i = (int)((Yr - cielab->display.d_Y0R) / cielab->rstep);
|
||||
i = TIFFmin(cielab->range, i);
|
||||
i = (size_t)((Yr - cielab->display.d_Y0R) / cielab->rstep);
|
||||
i = TIFFmin((size_t)cielab->range, i);
|
||||
*r = RINT(cielab->Yr2r[i]);
|
||||
|
||||
i = (int)((Yg - cielab->display.d_Y0G) / cielab->gstep);
|
||||
i = TIFFmin(cielab->range, i);
|
||||
i = (size_t)((Yg - cielab->display.d_Y0G) / cielab->gstep);
|
||||
i = TIFFmin((size_t)cielab->range, i);
|
||||
*g = RINT(cielab->Yg2g[i]);
|
||||
|
||||
i = (int)((Yb - cielab->display.d_Y0B) / cielab->bstep);
|
||||
i = TIFFmin(cielab->range, i);
|
||||
i = (size_t)((Yb - cielab->display.d_Y0B) / cielab->bstep);
|
||||
i = TIFFmin((size_t)cielab->range, i);
|
||||
*b = RINT(cielab->Yb2b[i]);
|
||||
|
||||
/* Clip output. */
|
||||
@@ -135,7 +135,7 @@ void TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z,
|
||||
int TIFFCIELabToRGBInit(TIFFCIELabToRGB *cielab, const TIFFDisplay *display,
|
||||
float *refWhite)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
double dfGamma;
|
||||
|
||||
cielab->range = CIELABTORGB_TABLE_RANGE;
|
||||
@@ -146,7 +146,7 @@ int TIFFCIELabToRGBInit(TIFFCIELabToRGB *cielab, const TIFFDisplay *display,
|
||||
dfGamma = 1.0 / cielab->display.d_gammaR;
|
||||
cielab->rstep =
|
||||
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
|
||||
for (i = 0; i <= cielab->range; i++)
|
||||
for (i = 0; i <= (size_t)cielab->range; i++)
|
||||
{
|
||||
cielab->Yr2r[i] = cielab->display.d_Vrwr *
|
||||
((float)pow((double)i / cielab->range, dfGamma));
|
||||
@@ -156,7 +156,7 @@ int TIFFCIELabToRGBInit(TIFFCIELabToRGB *cielab, const TIFFDisplay *display,
|
||||
dfGamma = 1.0 / cielab->display.d_gammaG;
|
||||
cielab->gstep =
|
||||
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
|
||||
for (i = 0; i <= cielab->range; i++)
|
||||
for (i = 0; i <= (size_t)cielab->range; i++)
|
||||
{
|
||||
cielab->Yg2g[i] = cielab->display.d_Vrwg *
|
||||
((float)pow((double)i / cielab->range, dfGamma));
|
||||
@@ -166,7 +166,7 @@ int TIFFCIELabToRGBInit(TIFFCIELabToRGB *cielab, const TIFFDisplay *display,
|
||||
dfGamma = 1.0 / cielab->display.d_gammaB;
|
||||
cielab->bstep =
|
||||
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
|
||||
for (i = 0; i <= cielab->range; i++)
|
||||
for (i = 0; i <= (size_t)cielab->range; i++)
|
||||
{
|
||||
cielab->Yb2b[i] = cielab->display.d_Vrwb *
|
||||
((float)pow((double)i / cielab->range, dfGamma));
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/* clang-format off */
|
||||
/* clang-format disabled because CMake scripts are very sensitive to the
|
||||
* formatting of this file. configure_file variables of type "@VAR@" are
|
||||
* modified by clang-format and won't be substituted.
|
||||
*/
|
||||
|
||||
/* libtiff/tif_config.h.cmake.in. Not generated, but originated from autoheader. */
|
||||
/* This file must be kept up-to-date with needed substitutions from libtiff/tif_config.h.in. */
|
||||
|
||||
@@ -94,23 +100,17 @@
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "@PACKAGE_NAME@"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "@PACKAGE_STRING@"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "@PACKAGE_TARNAME@"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL "@PACKAGE_URL@"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||
|
||||
/* Size of size_t */
|
||||
#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@
|
||||
|
||||
/* Default size of the strip in bytes (when strip chopping enabled) */
|
||||
#define STRIP_SIZE_DEFAULT @STRIP_SIZE_DEFAULT@
|
||||
#cmakedefine STRIP_SIZE_DEFAULT @STRIP_SIZE_DEFAULT@
|
||||
|
||||
/** Maximum number of TIFF IFDs that libtiff can iterate through in a file. */
|
||||
#define TIFF_MAX_DIR_COUNT @TIFF_MAX_DIR_COUNT@
|
||||
@@ -118,9 +118,6 @@
|
||||
/* define to use win32 IO system */
|
||||
#cmakedefine USE_WIN32_FILEIO 1
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "@PACKAGE_VERSION@"
|
||||
|
||||
/* Support WEBP compression */
|
||||
#cmakedefine WEBP_SUPPORT 1
|
||||
|
||||
@@ -156,3 +153,5 @@
|
||||
#else
|
||||
# error "Unsupported size_t size; please submit a bug report"
|
||||
#endif
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/* clang-format off */
|
||||
/* clang-format disabled because CMake scripts are very sensitive to the
|
||||
* formatting of this file. configure_file variables of type "@VAR@" are
|
||||
* modified by clang-format and won't be substituted.
|
||||
*/
|
||||
|
||||
/* libtiff/tif_config.h.in. Not generated, but originated from autoheader. */
|
||||
|
||||
#include "tiffconf.h"
|
||||
@@ -97,18 +103,12 @@
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#undef SIZEOF_SIZE_T
|
||||
|
||||
@@ -121,9 +121,6 @@
|
||||
/* define to use win32 IO system */
|
||||
#undef USE_WIN32_FILEIO
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Support webp compression */
|
||||
#undef WEBP_SUPPORT
|
||||
|
||||
@@ -172,3 +169,5 @@
|
||||
#else
|
||||
# error "Unsupported size_t size; please submit a bug report"
|
||||
#endif
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
+193
-60
@@ -192,11 +192,11 @@ static int setExtraSamples(TIFF *tif, va_list ap, uint32_t *v)
|
||||
static uint16_t countInkNamesString(TIFF *tif, uint32_t slen, const char *s)
|
||||
{
|
||||
uint16_t i = 0;
|
||||
const char *ep = s + slen;
|
||||
const char *cp = s;
|
||||
|
||||
if (slen > 0)
|
||||
{
|
||||
const char *ep = s + slen;
|
||||
const char *cp = s;
|
||||
do
|
||||
{
|
||||
for (; cp < ep && *cp != '\0'; cp++)
|
||||
@@ -211,7 +211,7 @@ static uint16_t countInkNamesString(TIFF *tif, uint32_t slen, const char *s)
|
||||
}
|
||||
bad:
|
||||
TIFFErrorExtR(tif, "TIFFSetField",
|
||||
"%s: Invalid InkNames value; no NUL at given buffer end "
|
||||
"%s: Invalid InkNames value; no null at given buffer end "
|
||||
"location %" PRIu32 ", after %" PRIu16 " ink",
|
||||
tif->tif_name, slen, i);
|
||||
return (0);
|
||||
@@ -806,14 +806,13 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
|
||||
if (tv->count == 0)
|
||||
{
|
||||
status = 0;
|
||||
TIFFErrorExtR(tif, module,
|
||||
"%s: Null count for \"%s\" (type "
|
||||
"%d, writecount %d, passcount %d)",
|
||||
tif->tif_name, fip->field_name,
|
||||
fip->field_type, fip->field_writecount,
|
||||
fip->field_passcount);
|
||||
goto end;
|
||||
TIFFWarningExtR(tif, module,
|
||||
"%s: Null count for \"%s\" (type "
|
||||
"%d, writecount %d, passcount %d)",
|
||||
tif->tif_name, fip->field_name,
|
||||
fip->field_type, fip->field_writecount,
|
||||
fip->field_passcount);
|
||||
break;
|
||||
}
|
||||
|
||||
tv->value = _TIFFCheckMalloc(tif, tv->count, tv_size,
|
||||
@@ -1621,7 +1620,7 @@ void TIFFFreeDirectory(TIFF *tif)
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
int i;
|
||||
|
||||
_TIFFmemset(td->td_fieldsset, 0, FIELD_SETLONGS);
|
||||
_TIFFmemset(td->td_fieldsset, 0, sizeof(td->td_fieldsset));
|
||||
CleanupField(td_sminsamplevalue);
|
||||
CleanupField(td_smaxsamplevalue);
|
||||
CleanupField(td_colormap[0]);
|
||||
@@ -1652,6 +1651,17 @@ void TIFFFreeDirectory(TIFF *tif)
|
||||
|
||||
_TIFFmemset(&(td->td_stripoffset_entry), 0, sizeof(TIFFDirEntry));
|
||||
_TIFFmemset(&(td->td_stripbytecount_entry), 0, sizeof(TIFFDirEntry));
|
||||
|
||||
/* Reset some internal parameters for IFD data size checking. */
|
||||
tif->tif_dir.td_dirdatasize_read = 0;
|
||||
tif->tif_dir.td_dirdatasize_write = 0;
|
||||
if (tif->tif_dir.td_dirdatasize_offsets != NULL)
|
||||
{
|
||||
_TIFFfreeExt(tif, tif->tif_dir.td_dirdatasize_offsets);
|
||||
tif->tif_dir.td_dirdatasize_offsets = NULL;
|
||||
tif->tif_dir.td_dirdatasize_Noffsets = 0;
|
||||
}
|
||||
tif->tif_dir.td_iswrittentofile = FALSE;
|
||||
}
|
||||
#undef CleanupField
|
||||
|
||||
@@ -1676,18 +1686,23 @@ TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc extender)
|
||||
*/
|
||||
int TIFFCreateDirectory(TIFF *tif)
|
||||
{
|
||||
/* Free previously allocated memory and setup default values. */
|
||||
TIFFFreeDirectory(tif);
|
||||
TIFFDefaultDirectory(tif);
|
||||
tif->tif_diroff = 0;
|
||||
tif->tif_nextdiroff = 0;
|
||||
tif->tif_curoff = 0;
|
||||
tif->tif_row = (uint32_t)-1;
|
||||
tif->tif_curstrip = (uint32_t)-1;
|
||||
tif->tif_dir.td_iswrittentofile = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TIFFCreateCustomDirectory(TIFF *tif, const TIFFFieldArray *infoarray)
|
||||
{
|
||||
/* Free previously allocated memory and setup default values. */
|
||||
TIFFFreeDirectory(tif);
|
||||
TIFFDefaultDirectory(tif);
|
||||
|
||||
/*
|
||||
@@ -1702,6 +1717,12 @@ int TIFFCreateCustomDirectory(TIFF *tif, const TIFFFieldArray *infoarray)
|
||||
tif->tif_curoff = 0;
|
||||
tif->tif_row = (uint32_t)-1;
|
||||
tif->tif_curstrip = (uint32_t)-1;
|
||||
/* invalidate directory index */
|
||||
tif->tif_curdir = TIFF_NON_EXISTENT_DIR_NUMBER;
|
||||
/* invalidate IFD loop lists */
|
||||
_TIFFCleanupIFDOffsetAndNumberMaps(tif);
|
||||
/* To be able to return from SubIFD or custom-IFD to main-IFD */
|
||||
tif->tif_setdirectory_force_absolute = TRUE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1842,7 +1863,9 @@ static int TIFFAdvanceDirectory(TIFF *tif, uint64_t *nextdiroff, uint64_t *off,
|
||||
if (((uint64_t)poffa != poff) || (poffb < poffa) ||
|
||||
(poffb < (tmsize_t)sizeof(uint16_t)) || (poffb > tif->tif_size))
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Error fetching directory count");
|
||||
TIFFErrorExtR(tif, module,
|
||||
"%s:%d: %s: Error fetching directory count",
|
||||
__FILE__, __LINE__, tif->tif_name);
|
||||
*nextdiroff = 0;
|
||||
return (0);
|
||||
}
|
||||
@@ -1871,14 +1894,18 @@ static int TIFFAdvanceDirectory(TIFF *tif, uint64_t *nextdiroff, uint64_t *off,
|
||||
uint16_t dircount16;
|
||||
if (poff > (uint64_t)TIFF_TMSIZE_T_MAX - sizeof(uint64_t))
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Error fetching directory count");
|
||||
TIFFErrorExtR(tif, module,
|
||||
"%s:%d: %s: Error fetching directory count",
|
||||
__FILE__, __LINE__, tif->tif_name);
|
||||
return (0);
|
||||
}
|
||||
poffa = (tmsize_t)poff;
|
||||
poffb = poffa + sizeof(uint64_t);
|
||||
if (poffb > tif->tif_size)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Error fetching directory count");
|
||||
TIFFErrorExtR(tif, module,
|
||||
"%s:%d: %s: Error fetching directory count",
|
||||
__FILE__, __LINE__, tif->tif_name);
|
||||
return (0);
|
||||
}
|
||||
_TIFFmemcpy(&dircount64, tif->tif_base + poffa, sizeof(uint64_t));
|
||||
@@ -1920,8 +1947,9 @@ static int TIFFAdvanceDirectory(TIFF *tif, uint64_t *nextdiroff, uint64_t *off,
|
||||
if (!SeekOK(tif, *nextdiroff) ||
|
||||
!ReadOK(tif, &dircount, sizeof(uint16_t)))
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "%s: Error fetching directory count",
|
||||
tif->tif_name);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"%s:%d: %s: Error fetching directory count",
|
||||
__FILE__, __LINE__, tif->tif_name);
|
||||
return (0);
|
||||
}
|
||||
if (tif->tif_flags & TIFF_SWAB)
|
||||
@@ -1947,15 +1975,18 @@ static int TIFFAdvanceDirectory(TIFF *tif, uint64_t *nextdiroff, uint64_t *off,
|
||||
if (!SeekOK(tif, *nextdiroff) ||
|
||||
!ReadOK(tif, &dircount64, sizeof(uint64_t)))
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "%s: Error fetching directory count",
|
||||
tif->tif_name);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"%s:%d: %s: Error fetching directory count",
|
||||
__FILE__, __LINE__, tif->tif_name);
|
||||
return (0);
|
||||
}
|
||||
if (tif->tif_flags & TIFF_SWAB)
|
||||
TIFFSwabLong8(&dircount64);
|
||||
if (dircount64 > 0xFFFF)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Error fetching directory count");
|
||||
TIFFErrorExtR(tif, module,
|
||||
"%s:%d: %s: Error fetching directory count",
|
||||
__FILE__, __LINE__, tif->tif_name);
|
||||
return (0);
|
||||
}
|
||||
dircount16 = (uint16_t)dircount64;
|
||||
@@ -2012,6 +2043,8 @@ tdir_t TIFFNumberOfDirectories(TIFF *tif)
|
||||
{
|
||||
++n;
|
||||
}
|
||||
/* Update number of main-IFDs in file. */
|
||||
tif->tif_curdircount = n;
|
||||
return (n);
|
||||
}
|
||||
|
||||
@@ -2022,30 +2055,91 @@ tdir_t TIFFNumberOfDirectories(TIFF *tif)
|
||||
int TIFFSetDirectory(TIFF *tif, tdir_t dirn)
|
||||
{
|
||||
uint64_t nextdiroff;
|
||||
tdir_t nextdirnum;
|
||||
tdir_t nextdirnum = 0;
|
||||
tdir_t n;
|
||||
|
||||
if (!(tif->tif_flags & TIFF_BIGTIFF))
|
||||
nextdiroff = tif->tif_header.classic.tiff_diroff;
|
||||
else
|
||||
nextdiroff = tif->tif_header.big.tiff_diroff;
|
||||
nextdirnum = 0;
|
||||
for (n = dirn; n > 0 && nextdiroff != 0; n--)
|
||||
if (!TIFFAdvanceDirectory(tif, &nextdiroff, NULL, &nextdirnum))
|
||||
return (0);
|
||||
/* If the n-th directory could not be reached (does not exist),
|
||||
* return here without touching anything further. */
|
||||
if (nextdiroff == 0 || n > 0)
|
||||
return (0);
|
||||
if (tif->tif_setdirectory_force_absolute)
|
||||
{
|
||||
/* tif_setdirectory_force_absolute=1 will force parsing the main IFD
|
||||
* chain from the beginning, thus IFD directory list needs to be cleared
|
||||
* from possible SubIFD offsets.
|
||||
*/
|
||||
_TIFFCleanupIFDOffsetAndNumberMaps(tif); /* invalidate IFD loop lists */
|
||||
}
|
||||
|
||||
tif->tif_nextdiroff = nextdiroff;
|
||||
/*
|
||||
* Set curdir to the actual directory index. The
|
||||
* -1 is because TIFFReadDirectory will increment
|
||||
* tif_curdir after successfully reading the directory.
|
||||
*/
|
||||
tif->tif_curdir = (dirn - n) - 1;
|
||||
return (TIFFReadDirectory(tif));
|
||||
/* Even faster path, if offset is available within IFD loop hash list. */
|
||||
if (!tif->tif_setdirectory_force_absolute &&
|
||||
_TIFFGetOffsetFromDirNumber(tif, dirn, &nextdiroff))
|
||||
{
|
||||
/* Set parameters for following TIFFReadDirectory() below. */
|
||||
tif->tif_nextdiroff = nextdiroff;
|
||||
tif->tif_curdir = dirn;
|
||||
/* Reset to relative stepping */
|
||||
tif->tif_setdirectory_force_absolute = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Fast path when we just advance relative to the current directory:
|
||||
* start at the current dir offset and continue to seek from there.
|
||||
* Check special cases when relative is not allowed:
|
||||
* - jump back from SubIFD or custom directory
|
||||
* - right after TIFFWriteDirectory() jump back to that directory
|
||||
* using TIFFSetDirectory() */
|
||||
const int relative = (dirn >= tif->tif_curdir) &&
|
||||
(tif->tif_diroff != 0) &&
|
||||
!tif->tif_setdirectory_force_absolute;
|
||||
|
||||
if (relative)
|
||||
{
|
||||
nextdiroff = tif->tif_diroff;
|
||||
dirn -= tif->tif_curdir;
|
||||
nextdirnum = tif->tif_curdir;
|
||||
}
|
||||
else if (!(tif->tif_flags & TIFF_BIGTIFF))
|
||||
nextdiroff = tif->tif_header.classic.tiff_diroff;
|
||||
else
|
||||
nextdiroff = tif->tif_header.big.tiff_diroff;
|
||||
|
||||
/* Reset to relative stepping */
|
||||
tif->tif_setdirectory_force_absolute = FALSE;
|
||||
|
||||
for (n = dirn; n > 0 && nextdiroff != 0; n--)
|
||||
if (!TIFFAdvanceDirectory(tif, &nextdiroff, NULL, &nextdirnum))
|
||||
return (0);
|
||||
/* If the n-th directory could not be reached (does not exist),
|
||||
* return here without touching anything further. */
|
||||
if (nextdiroff == 0 || n > 0)
|
||||
return (0);
|
||||
|
||||
tif->tif_nextdiroff = nextdiroff;
|
||||
|
||||
/* Set curdir to the actual directory index. */
|
||||
if (relative)
|
||||
tif->tif_curdir += dirn - n;
|
||||
else
|
||||
tif->tif_curdir = dirn - n;
|
||||
}
|
||||
|
||||
/* The -1 decrement is because TIFFReadDirectory will increment
|
||||
* tif_curdir after successfully reading the directory. */
|
||||
if (tif->tif_curdir == 0)
|
||||
tif->tif_curdir = TIFF_NON_EXISTENT_DIR_NUMBER;
|
||||
else
|
||||
tif->tif_curdir--;
|
||||
|
||||
tdir_t curdir = tif->tif_curdir;
|
||||
|
||||
int retval = TIFFReadDirectory(tif);
|
||||
|
||||
if (!retval && tif->tif_curdir == curdir)
|
||||
{
|
||||
/* If tif_curdir has not be incremented, TIFFFetchDirectory() in
|
||||
* TIFFReadDirectory() has failed and tif_curdir shall be set
|
||||
* specifically. */
|
||||
tif->tif_curdir = TIFF_NON_EXISTENT_DIR_NUMBER;
|
||||
}
|
||||
return (retval);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2070,8 +2164,11 @@ int TIFFSetSubDirectory(TIFF *tif, uint64_t diroff)
|
||||
int8_t probablySubIFD = 0;
|
||||
if (diroff == 0)
|
||||
{
|
||||
/* Special case to invalidate the tif_lastdiroff member. */
|
||||
/* Special case to set tif_diroff=0, which is done in
|
||||
* TIFFReadDirectory() below to indicate that the currently read IFD is
|
||||
* treated as a new, fresh IFD. */
|
||||
tif->tif_curdir = TIFF_NON_EXISTENT_DIR_NUMBER;
|
||||
tif->tif_dir.td_iswrittentofile = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2081,30 +2178,40 @@ int TIFFSetSubDirectory(TIFF *tif, uint64_t diroff)
|
||||
probablySubIFD = 1;
|
||||
}
|
||||
/* -1 because TIFFReadDirectory() will increment tif_curdir. */
|
||||
tif->tif_curdir =
|
||||
curdir == 0 ? TIFF_NON_EXISTENT_DIR_NUMBER : curdir - 1;
|
||||
if (curdir >= 1)
|
||||
tif->tif_curdir = curdir - 1;
|
||||
else
|
||||
tif->tif_curdir = TIFF_NON_EXISTENT_DIR_NUMBER;
|
||||
}
|
||||
curdir = tif->tif_curdir;
|
||||
|
||||
tif->tif_nextdiroff = diroff;
|
||||
retval = TIFFReadDirectory(tif);
|
||||
/* If failed, curdir was not incremented in TIFFReadDirectory(), so set it
|
||||
* back. */
|
||||
if (!retval)
|
||||
|
||||
/* tif_curdir is incremented in TIFFReadDirectory(), but if it has not been
|
||||
* incremented, TIFFFetchDirectory() has failed there and tif_curdir shall
|
||||
* be set specifically. */
|
||||
if (!retval && diroff != 0 && tif->tif_curdir == curdir)
|
||||
{
|
||||
if (tif->tif_curdir == TIFF_NON_EXISTENT_DIR_NUMBER)
|
||||
tif->tif_curdir = 0;
|
||||
else
|
||||
tif->tif_curdir++;
|
||||
tif->tif_curdir = TIFF_NON_EXISTENT_DIR_NUMBER;
|
||||
}
|
||||
if (retval && probablySubIFD)
|
||||
|
||||
if (probablySubIFD)
|
||||
{
|
||||
/* Reset IFD list to start new one for SubIFD chain and also start
|
||||
* SubIFD chain with tif_curdir=0. */
|
||||
tif->tif_dirnumber = 0;
|
||||
tif->tif_curdir = 0; /* first directory of new chain */
|
||||
/* add this offset to new IFD list */
|
||||
_TIFFCheckDirNumberAndOffset(tif, tif->tif_curdir, diroff);
|
||||
if (retval)
|
||||
{
|
||||
/* Reset IFD list to start new one for SubIFD chain and also start
|
||||
* SubIFD chain with tif_curdir=0 for IFD loop checking. */
|
||||
/* invalidate IFD loop lists */
|
||||
_TIFFCleanupIFDOffsetAndNumberMaps(tif);
|
||||
tif->tif_curdir = 0; /* first directory of new chain */
|
||||
/* add this offset to new IFD list */
|
||||
_TIFFCheckDirNumberAndOffset(tif, tif->tif_curdir, diroff);
|
||||
}
|
||||
/* To be able to return from SubIFD or custom-IFD to main-IFD */
|
||||
tif->tif_setdirectory_force_absolute = TRUE;
|
||||
}
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
@@ -2139,6 +2246,13 @@ int TIFFUnlinkDirectory(TIFF *tif, tdir_t dirn)
|
||||
"Can not unlink directory in read-only file");
|
||||
return (0);
|
||||
}
|
||||
if (dirn == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"For TIFFUnlinkDirectory() first directory starts with "
|
||||
"number 1 and not 0");
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* Go to the directory before the one we want
|
||||
* to unlink and nab the offset of the link
|
||||
@@ -2193,14 +2307,27 @@ int TIFFUnlinkDirectory(TIFF *tif, tdir_t dirn)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Need local swap because nextdir has to be used unswapped below. */
|
||||
uint64_t nextdir64 = nextdir;
|
||||
if (tif->tif_flags & TIFF_SWAB)
|
||||
TIFFSwabLong8(&nextdir);
|
||||
if (!WriteOK(tif, &nextdir, sizeof(uint64_t)))
|
||||
TIFFSwabLong8(&nextdir64);
|
||||
if (!WriteOK(tif, &nextdir64, sizeof(uint64_t)))
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Error writing directory link");
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
/* For dirn=1 (first directory) also update the libtiff internal
|
||||
* base offset variables. */
|
||||
if (dirn == 1)
|
||||
{
|
||||
if (!(tif->tif_flags & TIFF_BIGTIFF))
|
||||
tif->tif_header.classic.tiff_diroff = (uint32_t)nextdir;
|
||||
else
|
||||
tif->tif_header.big.tiff_diroff = nextdir;
|
||||
}
|
||||
|
||||
/*
|
||||
* Leave directory state setup safely. We don't have
|
||||
* facilities for doing inserting and removing directories,
|
||||
@@ -2227,5 +2354,11 @@ int TIFFUnlinkDirectory(TIFF *tif, tdir_t dirn)
|
||||
tif->tif_curoff = 0;
|
||||
tif->tif_row = (uint32_t)-1;
|
||||
tif->tif_curstrip = (uint32_t)-1;
|
||||
tif->tif_curdir = TIFF_NON_EXISTENT_DIR_NUMBER;
|
||||
if (tif->tif_curdircount > 0)
|
||||
tif->tif_curdircount--;
|
||||
else
|
||||
tif->tif_curdircount = TIFF_NON_EXISTENT_DIR_NUMBER;
|
||||
_TIFFCleanupIFDOffsetAndNumberMaps(tif); /* invalidate IFD loop lists */
|
||||
return (1);
|
||||
}
|
||||
|
||||
+39
-9
@@ -65,14 +65,20 @@ typedef struct
|
||||
tif_dirread.c */
|
||||
} TIFFDirEntry;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint64_t offset;
|
||||
uint64_t length;
|
||||
} TIFFEntryOffsetAndLength; /* auxiliary for evaluating size of IFD data */
|
||||
|
||||
/*
|
||||
* Internal format of a TIFF directory entry.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
#define FIELD_SETLONGS 4
|
||||
#define FIELDSET_ITEMS 4
|
||||
/* bit vector of fields that are set */
|
||||
unsigned long td_fieldsset[FIELD_SETLONGS];
|
||||
uint32_t td_fieldsset[FIELDSET_ITEMS];
|
||||
|
||||
uint32_t td_imagewidth, td_imagelength, td_imagedepth;
|
||||
uint32_t td_tilewidth, td_tilelength, td_tiledepth;
|
||||
@@ -115,6 +121,9 @@ typedef struct
|
||||
#ifdef STRIPBYTECOUNTSORTED_UNUSED
|
||||
int td_stripbytecountsorted; /* is the bytecount array sorted ascending? */
|
||||
#endif
|
||||
/* Be aware that the parameters of td_stripoffset_entry and
|
||||
* td_stripbytecount_entry are swapped but tdir_offset is not
|
||||
* and has to be swapped when used. */
|
||||
TIFFDirEntry td_stripoffset_entry; /* for deferred loading */
|
||||
TIFFDirEntry td_stripbytecount_entry; /* for deferred loading */
|
||||
uint16_t td_nsubifd;
|
||||
@@ -135,6 +144,24 @@ typedef struct
|
||||
|
||||
unsigned char
|
||||
td_deferstrilearraywriting; /* see TIFFDeferStrileArrayWriting() */
|
||||
|
||||
unsigned char
|
||||
td_iswrittentofile; /* indicates if current IFD is present on file */
|
||||
|
||||
/* LibTIFF writes all data that does not fit into the IFD entries directly
|
||||
* after the IFD tag entry part. When reading, only the IFD data directly
|
||||
* and continuously behind the IFD tags is taken into account for the IFD
|
||||
* data size.*/
|
||||
uint64_t td_dirdatasize_write; /* auxiliary for evaluating size of IFD data
|
||||
to be written */
|
||||
uint64_t td_dirdatasize_read; /* auxiliary for evaluating size of IFD data
|
||||
read from file */
|
||||
uint32_t td_dirdatasize_Noffsets; /* auxiliary counter for
|
||||
tif_dir.td_dirdatasize_offsets array */
|
||||
TIFFEntryOffsetAndLength
|
||||
*td_dirdatasize_offsets; /* auxiliary array for all offsets of IFD tag
|
||||
entries with data outside the IFD tag
|
||||
entries. */
|
||||
} TIFFDirectory;
|
||||
|
||||
/*
|
||||
@@ -202,9 +229,9 @@ typedef struct
|
||||
*/
|
||||
#define FIELD_PSEUDO 0
|
||||
|
||||
#define FIELD_LAST (32 * FIELD_SETLONGS - 1)
|
||||
#define FIELD_LAST (32 * FIELDSET_ITEMS - 1)
|
||||
|
||||
#define BITn(n) (((unsigned long)1L) << ((n)&0x1f))
|
||||
#define BITn(n) (((uint32_t)1L) << ((n)&0x1f))
|
||||
#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
|
||||
#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
|
||||
#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
|
||||
@@ -308,11 +335,10 @@ extern "C"
|
||||
TIFFDataType field_type; /* type of associated data */
|
||||
uint32_t
|
||||
field_anonymous; /* if true, this is a unknown / anonymous tag */
|
||||
TIFFSetGetFieldType
|
||||
set_field_type; /* type to be passed to TIFFSetField */
|
||||
TIFFSetGetFieldType
|
||||
get_field_type; /* type to be passed to TIFFGetField */
|
||||
unsigned short field_bit; /* bit in fieldsset bit vector */
|
||||
TIFFSetGetFieldType set_field_type; /* type to be passed to TIFFSetField
|
||||
and TIFFGetField*/
|
||||
TIFFSetGetFieldType get_field_type; /* not used */
|
||||
unsigned short field_bit; /* bit in fieldsset bit vector */
|
||||
unsigned char field_oktochange; /* if true, can change while writing */
|
||||
unsigned char field_passcount; /* if true, pass dir count on set */
|
||||
char *field_name; /* ASCII name */
|
||||
@@ -329,6 +355,10 @@ extern "C"
|
||||
uint64_t diroff);
|
||||
extern int _TIFFGetDirNumberFromOffset(TIFF *tif, uint64_t diroff,
|
||||
tdir_t *dirn);
|
||||
extern int _TIFFGetOffsetFromDirNumber(TIFF *tif, tdir_t dirn,
|
||||
uint64_t *diroff);
|
||||
extern int _TIFFRemoveEntryFromDirectoryListByOffset(TIFF *tif,
|
||||
uint64_t diroff);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
+409
-590
File diff suppressed because it is too large
Load Diff
+801
-98
File diff suppressed because it is too large
Load Diff
+407
-191
File diff suppressed because it is too large
Load Diff
+56
-4
@@ -41,6 +41,14 @@
|
||||
#include "t4.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef EOF_REACHED_COUNT_THRESHOLD
|
||||
/* Arbitrary threshold to avoid corrupted single-strip files with extremely
|
||||
* large imageheight to cause apparently endless looping, such as in
|
||||
* https://gitlab.com/libtiff/libtiff/-/issues/583
|
||||
*/
|
||||
#define EOF_REACHED_COUNT_THRESHOLD 8192
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compression+decompression state blocks are
|
||||
* derived from this ``base state'' block.
|
||||
@@ -77,6 +85,8 @@ typedef struct
|
||||
uint32_t data; /* current i/o byte/word */
|
||||
int bit; /* current i/o bit in byte */
|
||||
int EOLcnt; /* count of EOL codes recognized */
|
||||
int eofReachedCount; /* number of times decode has been called with
|
||||
EOF already reached */
|
||||
TIFFFaxFillFunc fill; /* fill routine */
|
||||
uint32_t *runs; /* b&w runs for current/previous row */
|
||||
uint32_t nruns; /* size of the refruns / curruns arrays */
|
||||
@@ -120,6 +130,7 @@ typedef struct
|
||||
int EOLcnt; /* # EOL codes recognized */ \
|
||||
const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */ \
|
||||
const TIFFFaxTabEnt *TabEnt
|
||||
|
||||
#define DECLARE_STATE_2D(tif, sp, mod) \
|
||||
DECLARE_STATE(tif, sp, mod); \
|
||||
int b1; /* next change on prev line */ \
|
||||
@@ -162,6 +173,7 @@ static int Fax3PreDecode(TIFF *tif, uint16_t s)
|
||||
sp->bit = 0; /* force initial read */
|
||||
sp->data = 0;
|
||||
sp->EOLcnt = 0; /* force initial scan for EOL */
|
||||
sp->eofReachedCount = 0;
|
||||
/*
|
||||
* Decoder assumes lsb-to-msb bit order. Note that we select
|
||||
* this here rather than in Fax3SetupState so that viewers can
|
||||
@@ -232,7 +244,12 @@ static void Fax3PrematureEOF(const char *module, TIFF *tif, uint32_t line,
|
||||
line, isTiled(tif) ? "tile" : "strip",
|
||||
(isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip), a0);
|
||||
}
|
||||
#define prematureEOF(a0) Fax3PrematureEOF(module, tif, sp->line, a0)
|
||||
#define prematureEOF(a0) \
|
||||
do \
|
||||
{ \
|
||||
Fax3PrematureEOF(module, tif, sp->line, a0); \
|
||||
++sp->eofReachedCount; \
|
||||
} while (0)
|
||||
|
||||
#define Nop
|
||||
|
||||
@@ -252,6 +269,14 @@ static int Fax3Decode1D(TIFF *tif, uint8_t *buf, tmsize_t occ, uint16_t s)
|
||||
TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
|
||||
return (-1);
|
||||
}
|
||||
if (sp->eofReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
|
||||
{
|
||||
TIFFErrorExtR(
|
||||
tif, module,
|
||||
"End of file has already been reached %d times within that strip",
|
||||
sp->eofReachedCount);
|
||||
return (-1);
|
||||
}
|
||||
CACHE_STATE(tif, sp);
|
||||
thisrun = sp->curruns;
|
||||
while (occ > 0)
|
||||
@@ -302,6 +327,14 @@ static int Fax3Decode2D(TIFF *tif, uint8_t *buf, tmsize_t occ, uint16_t s)
|
||||
TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
|
||||
return (-1);
|
||||
}
|
||||
if (sp->eofReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
|
||||
{
|
||||
TIFFErrorExtR(
|
||||
tif, module,
|
||||
"End of file has already been reached %d times within that strip",
|
||||
sp->eofReachedCount);
|
||||
return (-1);
|
||||
}
|
||||
CACHE_STATE(tif, sp);
|
||||
while (occ > 0)
|
||||
{
|
||||
@@ -536,8 +569,12 @@ static int Fax3SetupState(TIFF *tif)
|
||||
|
||||
TIFFroundup and TIFFSafeMultiply return zero on integer overflow
|
||||
*/
|
||||
dsp->runs = (uint32_t *)NULL;
|
||||
dsp->nruns = TIFFroundup_32(rowpixels, 32);
|
||||
if (dsp->runs != NULL)
|
||||
{
|
||||
_TIFFfreeExt(tif, dsp->runs);
|
||||
dsp->runs = (uint32_t *)NULL;
|
||||
}
|
||||
dsp->nruns = TIFFroundup_32(rowpixels + 1, 32);
|
||||
if (needsRefLine)
|
||||
{
|
||||
dsp->nruns = TIFFSafeMultiply(uint32_t, dsp->nruns, 2);
|
||||
@@ -578,6 +615,10 @@ static int Fax3SetupState(TIFF *tif)
|
||||
* is referenced. The reference line must
|
||||
* be initialized to be ``white'' (done elsewhere).
|
||||
*/
|
||||
if (esp->refline != NULL)
|
||||
{
|
||||
_TIFFfreeExt(tif, esp->refline);
|
||||
}
|
||||
esp->refline = (unsigned char *)_TIFFmallocExt(tif, rowbytes);
|
||||
if (esp->refline == NULL)
|
||||
{
|
||||
@@ -1514,7 +1555,16 @@ static int Fax4Decode(TIFF *tif, uint8_t *buf, tmsize_t occ, uint16_t s)
|
||||
TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
|
||||
return (-1);
|
||||
}
|
||||
if (sp->eofReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
|
||||
{
|
||||
TIFFErrorExtR(
|
||||
tif, module,
|
||||
"End of file has already been reached %d times within that strip",
|
||||
sp->eofReachedCount);
|
||||
return (-1);
|
||||
}
|
||||
CACHE_STATE(tif, sp);
|
||||
int start = sp->line;
|
||||
while (occ > 0)
|
||||
{
|
||||
a0 = 0;
|
||||
@@ -1563,7 +1613,9 @@ static int Fax4Decode(TIFF *tif, uint8_t *buf, tmsize_t occ, uint16_t s)
|
||||
}
|
||||
(*sp->fill)(buf, thisrun, pa, lastx);
|
||||
UNCACHE_STATE(tif, sp);
|
||||
return (sp->line ? 1 : -1); /* don't error on badly-terminated strips */
|
||||
return (sp->line != start
|
||||
? 1
|
||||
: -1); /* don't error on badly-terminated strips */
|
||||
}
|
||||
UNCACHE_STATE(tif, sp);
|
||||
return (1);
|
||||
|
||||
@@ -760,6 +760,12 @@ static int gtTileContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
||||
toskew = -(int32_t)(tw - w);
|
||||
}
|
||||
|
||||
if (tw == 0 || th == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "tile width or height is zero");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Leftmost tile is clipped on left side if col_offset > 0.
|
||||
*/
|
||||
@@ -916,6 +922,12 @@ static int gtTileSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
||||
break;
|
||||
}
|
||||
|
||||
if (tw == 0 || th == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "tile width or height is zero");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Leftmost tile is clipped on left side if col_offset > 0.
|
||||
*/
|
||||
@@ -1092,6 +1104,11 @@ static int gtStripContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
||||
}
|
||||
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
||||
if (rowsperstrip == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "rowsperstrip is zero");
|
||||
return (0);
|
||||
}
|
||||
|
||||
scanline = TIFFScanlineSize(tif);
|
||||
fromskew = (w < imagewidth ? imagewidth - w : 0);
|
||||
@@ -1216,6 +1233,12 @@ static int gtStripSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
||||
}
|
||||
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
||||
if (rowsperstrip == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "rowsperstrip is zero");
|
||||
return (0);
|
||||
}
|
||||
|
||||
scanline = TIFFScanlineSize(tif);
|
||||
fromskew = (w < imagewidth ? imagewidth - w : 0);
|
||||
for (row = 0; row < h; row += nrow)
|
||||
@@ -3213,6 +3236,13 @@ int TIFFReadRGBAStripExt(TIFF *tif, uint32_t row, uint32_t *raster,
|
||||
}
|
||||
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
||||
|
||||
if (rowsperstrip == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "rowsperstrip is zero");
|
||||
return (0);
|
||||
}
|
||||
|
||||
if ((row % rowsperstrip) != 0)
|
||||
{
|
||||
TIFFErrorExtR(
|
||||
@@ -3224,6 +3254,13 @@ int TIFFReadRGBAStripExt(TIFF *tif, uint32_t row, uint32_t *raster,
|
||||
if (TIFFRGBAImageOK(tif, emsg) &&
|
||||
TIFFRGBAImageBegin(&img, tif, stop_on_error, emsg))
|
||||
{
|
||||
if (row >= img.height)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
"Invalid row passed to TIFFReadRGBAStrip().");
|
||||
TIFFRGBAImageEnd(&img);
|
||||
return (0);
|
||||
}
|
||||
|
||||
img.row_offset = row;
|
||||
img.col_offset = 0;
|
||||
@@ -3282,6 +3319,13 @@ int TIFFReadRGBATileExt(TIFF *tif, uint32_t col, uint32_t row, uint32_t *raster,
|
||||
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_TILEWIDTH, &tile_xsize);
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_TILELENGTH, &tile_ysize);
|
||||
if (tile_xsize == 0 || tile_ysize == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
"tile_xsize or tile_ysize is zero");
|
||||
return (0);
|
||||
}
|
||||
|
||||
if ((col % tile_xsize) != 0 || (row % tile_ysize) != 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
@@ -3301,6 +3345,14 @@ int TIFFReadRGBATileExt(TIFF *tif, uint32_t col, uint32_t row, uint32_t *raster,
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (col >= img.width || row >= img.height)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
"Invalid row/col passed to TIFFReadRGBATile().");
|
||||
TIFFRGBAImageEnd(&img);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* The TIFFRGBAImageGet() function doesn't allow us to get off the
|
||||
* edge of the image, even to fill an otherwise valid tile. So we
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "tif_config.h"
|
||||
|
||||
#include "tif_hash_set.h"
|
||||
|
||||
#include <assert.h>
|
||||
@@ -144,7 +146,7 @@ TIFFHashSet *TIFFHashSetNew(TIFFHashSetHashFunc fnHashFunc,
|
||||
set->fnEqualFunc = fnEqualFunc ? fnEqualFunc : TIFFHashSetEqualPointer;
|
||||
set->fnFreeEltFunc = fnFreeEltFunc;
|
||||
set->nSize = 0;
|
||||
set->tabList = (TIFFList **)(calloc(sizeof(TIFFList *), 53));
|
||||
set->tabList = (TIFFList **)(calloc(53, sizeof(TIFFList *)));
|
||||
if (set->tabList == NULL)
|
||||
{
|
||||
free(set);
|
||||
@@ -161,7 +163,6 @@ TIFFHashSet *TIFFHashSetNew(TIFFHashSetHashFunc fnHashFunc,
|
||||
return set;
|
||||
}
|
||||
|
||||
#ifdef notdef
|
||||
/************************************************************************/
|
||||
/* TIFFHashSetSize() */
|
||||
/************************************************************************/
|
||||
@@ -181,7 +182,6 @@ int TIFFHashSetSize(const TIFFHashSet *set)
|
||||
assert(set != NULL);
|
||||
return set->nSize;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* TIFFHashSetGetNewListElt() */
|
||||
@@ -367,7 +367,7 @@ static bool TIFFHashSetRehash(TIFFHashSet *set)
|
||||
{
|
||||
int nNewAllocatedSize = anPrimes[set->nIndiceAllocatedSize];
|
||||
TIFFList **newTabList =
|
||||
(TIFFList **)(calloc(sizeof(TIFFList *), nNewAllocatedSize));
|
||||
(TIFFList **)(calloc(nNewAllocatedSize, sizeof(TIFFList *)));
|
||||
if (newTabList == NULL)
|
||||
return false;
|
||||
#ifdef HASH_DEBUG
|
||||
|
||||
@@ -71,11 +71,11 @@ extern "C"
|
||||
|
||||
void TIFFHashSetDestroy(TIFFHashSet *set);
|
||||
|
||||
int TIFFHashSetSize(const TIFFHashSet *set);
|
||||
|
||||
#ifdef notused
|
||||
void TIFFHashSetClear(TIFFHashSet *set);
|
||||
|
||||
int TIFFHashSetSize(const TIFFHashSet *set);
|
||||
|
||||
/** TIFFHashSetIterEltFunc */
|
||||
typedef int (*TIFFHashSetIterEltFunc)(void *elt, void *user_data);
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ static int JBIGDecode(TIFF *tif, uint8_t *buffer, tmsize_t size, uint16_t s)
|
||||
jbg_strerror(decodeStatus)
|
||||
#endif
|
||||
);
|
||||
memset(buffer, 0, (size_t)size);
|
||||
jbg_dec_free(&decoder);
|
||||
return 0;
|
||||
}
|
||||
@@ -99,6 +100,7 @@ static int JBIGDecode(TIFF *tif, uint8_t *buffer, tmsize_t size, uint16_t s)
|
||||
decodedSize = jbg_dec_getsize(&decoder);
|
||||
if ((tmsize_t)decodedSize < size)
|
||||
{
|
||||
memset(buffer + decodedSize, 0, (size_t)(size - decodedSize));
|
||||
TIFFWarningExtR(tif, "JBIG",
|
||||
"Only decoded %lu bytes, whereas %" TIFF_SSIZE_FORMAT
|
||||
" requested",
|
||||
|
||||
+38
-40
@@ -73,43 +73,6 @@ int TIFFReInitJPEG_12(TIFF *tif, const JPEGOtherSettings *otherSettings,
|
||||
int scheme, int is_encode);
|
||||
int TIFFJPEGIsFullStripRequired_12(TIFF *tif);
|
||||
|
||||
/* We undefine FAR to avoid conflict with JPEG definition */
|
||||
|
||||
#ifdef FAR
|
||||
#undef FAR
|
||||
#endif
|
||||
|
||||
/*
|
||||
Libjpeg's jmorecfg.h defines INT16 and INT32, but only if XMD_H is
|
||||
not defined. Unfortunately, the MinGW and Borland compilers include
|
||||
a typedef for INT32, which causes a conflict. MSVC does not include
|
||||
a conflicting typedef given the headers which are included.
|
||||
*/
|
||||
#if defined(__BORLANDC__) || defined(__MINGW32__)
|
||||
#define XMD_H 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
The windows RPCNDR.H file defines boolean, but defines it with the
|
||||
unsigned char size. You should compile JPEG library using appropriate
|
||||
definitions in jconfig.h header, but many users compile library in wrong
|
||||
way. That causes errors of the following type:
|
||||
|
||||
"JPEGLib: JPEG parameter struct mismatch: library thinks size is 432,
|
||||
caller expects 464"
|
||||
|
||||
For such users we will fix the problem here. See install.doc file from
|
||||
the JPEG library distribution for details.
|
||||
*/
|
||||
|
||||
/* Define "boolean" as unsigned char, not int, per Windows custom. */
|
||||
#if defined(__WIN32__) && !defined(__MINGW32__)
|
||||
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
|
||||
typedef unsigned char boolean;
|
||||
#endif
|
||||
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
|
||||
#endif
|
||||
|
||||
#include "jerror.h"
|
||||
#include "jpeglib.h"
|
||||
|
||||
@@ -125,18 +88,18 @@ typedef unsigned char boolean;
|
||||
* 16bit value?
|
||||
*/
|
||||
|
||||
/* HAVE_JPEGTURBO_DUAL_MODE_8_12 is defined for libjpeg-turbo >= 2.2 which
|
||||
/* HAVE_JPEGTURBO_DUAL_MODE_8_12 is defined for libjpeg-turbo >= 3.0 which
|
||||
* adds a dual-mode 8/12 bit API in the same library.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_JPEGTURBO_DUAL_MODE_8_12)
|
||||
#define JPEG_DUAL_MODE_8_12
|
||||
/* Start by undefining BITS_IN_JSAMPLE which is always set to 8 in libjpeg-turbo
|
||||
* >= 2.2 Cf
|
||||
* >= 3.0 Cf
|
||||
* https://github.com/libjpeg-turbo/libjpeg-turbo/commit/8b9bc4b9635a2a047fb23ebe70c9acd728d3f99b
|
||||
*/
|
||||
#undef BITS_IN_JSAMPLE
|
||||
/* libjpeg-turbo >= 2.2 adds J12xxxx datatypes for the 12-bit mode. */
|
||||
/* libjpeg-turbo >= 3.0 adds J12xxxx datatypes for the 12-bit mode. */
|
||||
#if defined(FROM_TIF_JPEG_12)
|
||||
#define BITS_IN_JSAMPLE 12
|
||||
#define TIFF_JSAMPLE J12SAMPLE
|
||||
@@ -182,9 +145,20 @@ typedef unsigned char boolean;
|
||||
#define LONGJMP(jbuf, code) longjmp(jbuf, code)
|
||||
#define JMP_BUF jmp_buf
|
||||
|
||||
#ifndef TIFF_jpeg_destination_mgr_defined
|
||||
#define TIFF_jpeg_destination_mgr_defined
|
||||
typedef struct jpeg_destination_mgr jpeg_destination_mgr;
|
||||
#endif
|
||||
|
||||
#ifndef TIFF_jpeg_source_mgr_defined
|
||||
#define TIFF_jpeg_source_mgr_defined
|
||||
typedef struct jpeg_source_mgr jpeg_source_mgr;
|
||||
#endif
|
||||
|
||||
#ifndef TIFF_jpeg_error_mgr_defined
|
||||
#define TIFF_jpeg_error_mgr_defined
|
||||
typedef struct jpeg_error_mgr jpeg_error_mgr;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* State block for each open TIFF file using
|
||||
@@ -1241,6 +1215,12 @@ int TIFFJPEGIsFullStripRequired(TIFF *tif)
|
||||
* For PC 2, scale down the expected strip/tile size
|
||||
* to match a downsampled component
|
||||
*/
|
||||
if (sp->h_sampling == 0 || sp->v_sampling == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"JPEG horizontal or vertical sampling is zero");
|
||||
return (0);
|
||||
}
|
||||
segment_width = TIFFhowmany_32(segment_width, sp->h_sampling);
|
||||
segment_height = TIFFhowmany_32(segment_height, sp->v_sampling);
|
||||
}
|
||||
@@ -1471,7 +1451,10 @@ static int JPEGDecode(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s)
|
||||
sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
|
||||
|
||||
if (sp->bytesperline == 0)
|
||||
{
|
||||
memset(buf, 0, (size_t)cc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
nrows = cc / sp->bytesperline;
|
||||
if (cc % sp->bytesperline)
|
||||
@@ -1492,7 +1475,10 @@ static int JPEGDecode(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s)
|
||||
JSAMPROW bufptr = (JSAMPROW)buf;
|
||||
|
||||
if (TIFFjpeg_read_scanlines(sp, &bufptr, 1) != 1)
|
||||
{
|
||||
memset(buf, 0, (size_t)cc);
|
||||
return (0);
|
||||
}
|
||||
|
||||
++tif->tif_row;
|
||||
buf += sp->bytesperline;
|
||||
@@ -1526,7 +1512,10 @@ static int JPEGDecode(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s)
|
||||
sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
|
||||
|
||||
if (sp->bytesperline == 0)
|
||||
{
|
||||
memset(buf, 0, (size_t)cc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
nrows = cc / sp->bytesperline;
|
||||
if (cc % sp->bytesperline)
|
||||
@@ -1562,7 +1551,10 @@ static int JPEGDecode(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s)
|
||||
* for 12bit data, which we need to repack.
|
||||
*/
|
||||
if (TIFFjpeg_read_scanlines(sp, &line_work_buf, 1) != 1)
|
||||
{
|
||||
memset(buf, 0, (size_t)cc);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (sp->cinfo.d.data_precision == 12)
|
||||
{
|
||||
@@ -2190,6 +2182,12 @@ static int JPEGPreEncode(TIFF *tif, uint16_t s)
|
||||
/* for PC 2, scale down the strip/tile size
|
||||
* to match a downsampled component
|
||||
*/
|
||||
if (sp->h_sampling == 0 || sp->v_sampling == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"JPEG horizontal or vertical sampling is zero");
|
||||
return (0);
|
||||
}
|
||||
segment_width = TIFFhowmany_32(segment_width, sp->h_sampling);
|
||||
segment_height = TIFFhowmany_32(segment_height, sp->v_sampling);
|
||||
}
|
||||
|
||||
+443
-108
@@ -71,6 +71,9 @@ typedef struct
|
||||
uint8_t *uncompressed_buffer;
|
||||
unsigned int uncompressed_offset;
|
||||
|
||||
uint8_t *uncompressed_buffer_multiband;
|
||||
unsigned int uncompressed_buffer_multiband_alloc;
|
||||
|
||||
unsigned int mask_size;
|
||||
uint8_t *mask_buffer;
|
||||
|
||||
@@ -86,9 +89,9 @@ typedef struct
|
||||
TIFFVSetMethod vsetparent; /* super-class method */
|
||||
} LERCState;
|
||||
|
||||
#define LState(tif) ((LERCState *)(tif)->tif_data)
|
||||
#define DecoderState(tif) LState(tif)
|
||||
#define EncoderState(tif) LState(tif)
|
||||
#define GetLERCState(tif) ((LERCState *)(tif)->tif_data)
|
||||
#define LERCDecoderState(tif) GetLERCState(tif)
|
||||
#define LERCEncoderState(tif) GetLERCState(tif)
|
||||
|
||||
static int LERCEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s);
|
||||
static int LERCDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s);
|
||||
@@ -101,7 +104,7 @@ static int LERCFixupTags(TIFF *tif)
|
||||
|
||||
static int LERCSetupDecode(TIFF *tif)
|
||||
{
|
||||
LERCState *sp = DecoderState(tif);
|
||||
LERCState *sp = LERCDecoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
|
||||
@@ -168,7 +171,7 @@ static int GetLercDataType(TIFF *tif)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int SetupUncompressedBuffer(TIFF *tif, LERCState *sp, const char *module)
|
||||
static int SetupBuffers(TIFF *tif, LERCState *sp, const char *module)
|
||||
{
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
uint64_t new_size_64;
|
||||
@@ -202,8 +205,9 @@ static int SetupUncompressedBuffer(TIFF *tif, LERCState *sp, const char *module)
|
||||
sp->uncompressed_size = new_size;
|
||||
|
||||
/* add some margin as we are going to use it also to store deflate/zstd
|
||||
* compressed data */
|
||||
new_alloc_64 = 100 + new_size_64 + new_size_64 / 3;
|
||||
* compressed data. We also need extra margin when writing very small
|
||||
* rasters with one mask per band. */
|
||||
new_alloc_64 = 256 + new_size_64 + new_size_64 / 3;
|
||||
#ifdef ZSTD_SUPPORT
|
||||
{
|
||||
size_t zstd_max = ZSTD_compressBound((size_t)new_size_64);
|
||||
@@ -243,11 +247,17 @@ static int SetupUncompressedBuffer(TIFF *tif, LERCState *sp, const char *module)
|
||||
td->td_sampleinfo[td->td_extrasamples - 1] == EXTRASAMPLE_UNASSALPHA &&
|
||||
GetLercDataType(tif) == 1) ||
|
||||
(td->td_sampleformat == SAMPLEFORMAT_IEEEFP &&
|
||||
(td->td_planarconfig == PLANARCONFIG_SEPARATE ||
|
||||
td->td_samplesperpixel == 1) &&
|
||||
(td->td_bitspersample == 32 || td->td_bitspersample == 64)))
|
||||
{
|
||||
unsigned int mask_size = sp->segment_width * sp->segment_height;
|
||||
#if LERC_AT_LEAST_VERSION(3, 0, 0)
|
||||
if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP &&
|
||||
td->td_planarconfig == PLANARCONFIG_CONTIG)
|
||||
{
|
||||
/* We may need one mask per band */
|
||||
mask_size *= td->td_samplesperpixel;
|
||||
}
|
||||
#endif
|
||||
if (sp->mask_size < mask_size)
|
||||
{
|
||||
void *mask_buffer =
|
||||
@@ -277,9 +287,9 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
static const char module[] = "LERCPreDecode";
|
||||
lerc_status lerc_ret;
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
LERCState *sp = DecoderState(tif);
|
||||
LERCState *sp = LERCDecoderState(tif);
|
||||
int lerc_data_type;
|
||||
unsigned int infoArray[8];
|
||||
unsigned int infoArray[9];
|
||||
unsigned nomask_bands = td->td_samplesperpixel;
|
||||
int ndims;
|
||||
int use_mask = 0;
|
||||
@@ -295,7 +305,7 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
if (lerc_data_type < 0)
|
||||
return 0;
|
||||
|
||||
if (!SetupUncompressedBuffer(tif, sp, module))
|
||||
if (!SetupBuffers(tif, sp, module))
|
||||
return 0;
|
||||
|
||||
if (sp->additional_compression != LERC_ADD_COMPRESSION_NONE)
|
||||
@@ -400,7 +410,7 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
}
|
||||
|
||||
lerc_ret =
|
||||
lerc_getBlobInfo(lerc_data, lerc_data_size, infoArray, NULL, 8, 0);
|
||||
lerc_getBlobInfo(lerc_data, lerc_data_size, infoArray, NULL, 9, 0);
|
||||
if (lerc_ret != 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "lerc_getBlobInfo() failed");
|
||||
@@ -418,18 +428,16 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
use_mask = 1;
|
||||
nomask_bands--;
|
||||
}
|
||||
else if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP &&
|
||||
(td->td_planarconfig == PLANARCONFIG_SEPARATE ||
|
||||
td->td_samplesperpixel == 1) &&
|
||||
(td->td_bitspersample == 32 || td->td_bitspersample == 64))
|
||||
else if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP)
|
||||
{
|
||||
use_mask = 1;
|
||||
}
|
||||
|
||||
ndims = td->td_planarconfig == PLANARCONFIG_CONTIG ? nomask_bands : 1;
|
||||
|
||||
/* Info returned in infoArray is { version, dataType, nDim, nCols,
|
||||
nRows, nBands, nValidPixels, blobSize } */
|
||||
/* Info returned in infoArray is { version, dataType, nDim/nDepth, nCols,
|
||||
nRows, nBands, nValidPixels, blobSize,
|
||||
and starting with liblerc 3.0 nRequestedMasks } */
|
||||
if (infoArray[0] != (unsigned)sp->lerc_version)
|
||||
{
|
||||
TIFFWarningExtR(tif, module,
|
||||
@@ -442,12 +450,29 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
infoArray[1], lerc_data_type);
|
||||
return 0;
|
||||
}
|
||||
if (infoArray[2] != (unsigned)ndims)
|
||||
|
||||
const unsigned nFoundDims = infoArray[2];
|
||||
#if LERC_AT_LEAST_VERSION(3, 0, 0)
|
||||
if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP &&
|
||||
td->td_planarconfig == PLANARCONFIG_CONTIG &&
|
||||
td->td_samplesperpixel > 1)
|
||||
{
|
||||
if (nFoundDims != 1 && nFoundDims != (unsigned)ndims)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected nDim: %d. Expected: 1 or %d",
|
||||
nFoundDims, ndims);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (nFoundDims != (unsigned)ndims)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected nDim: %d. Expected: %d",
|
||||
infoArray[2], ndims);
|
||||
nFoundDims, ndims);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (infoArray[3] != sp->segment_width)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected nCols: %d. Expected: %du",
|
||||
@@ -460,12 +485,38 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
infoArray[4], sp->segment_height);
|
||||
return 0;
|
||||
}
|
||||
if (infoArray[5] != 1)
|
||||
|
||||
const unsigned nFoundBands = infoArray[5];
|
||||
if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP &&
|
||||
td->td_planarconfig == PLANARCONFIG_CONTIG &&
|
||||
td->td_samplesperpixel > 1 && nFoundDims == 1)
|
||||
{
|
||||
#if !LERC_AT_LEAST_VERSION(3, 0, 0)
|
||||
if (nFoundBands == td->td_samplesperpixel)
|
||||
{
|
||||
TIFFErrorExtR(
|
||||
tif, module,
|
||||
"Unexpected nBands: %d. This file may have been generated with "
|
||||
"a liblerc version >= 3.0, with one mask per band, and is not "
|
||||
"supported by this older version of liblerc",
|
||||
nFoundBands);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (nFoundBands != td->td_samplesperpixel)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected nBands: %d. Expected: %d",
|
||||
nFoundBands, td->td_samplesperpixel);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (nFoundBands != 1)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected nBands: %d. Expected: %d",
|
||||
infoArray[5], 1);
|
||||
nFoundBands, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (infoArray[7] != lerc_data_size)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Unexpected blobSize: %d. Expected: %u",
|
||||
@@ -473,13 +524,75 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
lerc_ret = lerc_decode(lerc_data, lerc_data_size,
|
||||
int nRequestedMasks = use_mask ? 1 : 0;
|
||||
#if LERC_AT_LEAST_VERSION(3, 0, 0)
|
||||
use_mask ? 1 : 0,
|
||||
const int nFoundMasks = infoArray[8];
|
||||
if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP &&
|
||||
td->td_planarconfig == PLANARCONFIG_CONTIG &&
|
||||
td->td_samplesperpixel > 1 && nFoundDims == 1)
|
||||
{
|
||||
if (nFoundMasks != 0 && nFoundMasks != td->td_samplesperpixel)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Unexpected nFoundMasks: %d. Expected: 0 or %d",
|
||||
nFoundMasks, td->td_samplesperpixel);
|
||||
return 0;
|
||||
}
|
||||
nRequestedMasks = nFoundMasks;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nFoundMasks != 0 && nFoundMasks != 1)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Unexpected nFoundMasks: %d. Expected: 0 or 1",
|
||||
nFoundMasks);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP && nFoundMasks == 0)
|
||||
{
|
||||
nRequestedMasks = 0;
|
||||
use_mask = 0;
|
||||
}
|
||||
#endif
|
||||
use_mask ? sp->mask_buffer : NULL, ndims,
|
||||
sp->segment_width, sp->segment_height, 1,
|
||||
lerc_data_type, sp->uncompressed_buffer);
|
||||
|
||||
const unsigned nb_pixels = sp->segment_width * sp->segment_height;
|
||||
|
||||
#if LERC_AT_LEAST_VERSION(3, 0, 0)
|
||||
if (nRequestedMasks > 1)
|
||||
{
|
||||
unsigned int num_bytes_needed =
|
||||
nb_pixels * td->td_samplesperpixel * (td->td_bitspersample / 8);
|
||||
if (sp->uncompressed_buffer_multiband_alloc < num_bytes_needed)
|
||||
{
|
||||
_TIFFfreeExt(tif, sp->uncompressed_buffer_multiband);
|
||||
sp->uncompressed_buffer_multiband =
|
||||
_TIFFmallocExt(tif, num_bytes_needed);
|
||||
if (!sp->uncompressed_buffer_multiband)
|
||||
{
|
||||
sp->uncompressed_buffer_multiband_alloc = 0;
|
||||
return 0;
|
||||
}
|
||||
sp->uncompressed_buffer_multiband_alloc = num_bytes_needed;
|
||||
}
|
||||
lerc_ret = lerc_decode(lerc_data, lerc_data_size, nRequestedMasks,
|
||||
sp->mask_buffer, nFoundDims, sp->segment_width,
|
||||
sp->segment_height, nFoundBands, lerc_data_type,
|
||||
sp->uncompressed_buffer_multiband);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
lerc_ret =
|
||||
lerc_decode(lerc_data, lerc_data_size,
|
||||
#if LERC_AT_LEAST_VERSION(3, 0, 0)
|
||||
nRequestedMasks,
|
||||
#endif
|
||||
use_mask ? sp->mask_buffer : NULL, nFoundDims,
|
||||
sp->segment_width, sp->segment_height, nFoundBands,
|
||||
lerc_data_type, sp->uncompressed_buffer);
|
||||
}
|
||||
if (lerc_ret != 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "lerc_decode() failed");
|
||||
@@ -515,9 +628,8 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
}
|
||||
else if (use_mask && td->td_sampleformat == SAMPLEFORMAT_IEEEFP)
|
||||
{
|
||||
const unsigned nb_pixels = sp->segment_width * sp->segment_height;
|
||||
unsigned i;
|
||||
#if HOST_BIGENDIAN
|
||||
#if WORDS_BIGENDIAN
|
||||
const unsigned char nan_bytes[] = {0x7f, 0xc0, 0, 0};
|
||||
#else
|
||||
const unsigned char nan_bytes[] = {0, 0, 0xc0, 0x7f};
|
||||
@@ -525,23 +637,104 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
float nan_float32;
|
||||
memcpy(&nan_float32, nan_bytes, 4);
|
||||
|
||||
if (td->td_bitspersample == 32)
|
||||
if (td->td_planarconfig == PLANARCONFIG_SEPARATE ||
|
||||
td->td_samplesperpixel == 1)
|
||||
{
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
if (td->td_bitspersample == 32)
|
||||
{
|
||||
if (sp->mask_buffer[i] == 0)
|
||||
((float *)sp->uncompressed_buffer)[i] = nan_float32;
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
if (sp->mask_buffer[i] == 0)
|
||||
((float *)sp->uncompressed_buffer)[i] = nan_float32;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const double nan_float64 = nan_float32;
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
if (sp->mask_buffer[i] == 0)
|
||||
((double *)sp->uncompressed_buffer)[i] = nan_float64;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (nRequestedMasks == 1)
|
||||
{
|
||||
assert(nFoundDims == td->td_samplesperpixel);
|
||||
assert(nFoundBands == 1);
|
||||
|
||||
unsigned k = 0;
|
||||
if (td->td_bitspersample == 32)
|
||||
{
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
for (int j = 0; j < td->td_samplesperpixel; j++)
|
||||
{
|
||||
if (sp->mask_buffer[i] == 0)
|
||||
((float *)sp->uncompressed_buffer)[k] = nan_float32;
|
||||
++k;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const double nan_float64 = nan_float32;
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
for (int j = 0; j < td->td_samplesperpixel; j++)
|
||||
{
|
||||
if (sp->mask_buffer[i] == 0)
|
||||
((double *)sp->uncompressed_buffer)[k] =
|
||||
nan_float64;
|
||||
++k;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#if LERC_AT_LEAST_VERSION(3, 0, 0)
|
||||
else
|
||||
{
|
||||
const double nan_float64 = nan_float32;
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
assert(nRequestedMasks == td->td_samplesperpixel);
|
||||
assert(nFoundDims == 1);
|
||||
assert(nFoundBands == td->td_samplesperpixel);
|
||||
|
||||
unsigned k = 0;
|
||||
if (td->td_bitspersample == 32)
|
||||
{
|
||||
if (sp->mask_buffer[i] == 0)
|
||||
((double *)sp->uncompressed_buffer)[i] = nan_float64;
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
for (int j = 0; j < td->td_samplesperpixel; j++)
|
||||
{
|
||||
if (sp->mask_buffer[i + j * nb_pixels] == 0)
|
||||
((float *)sp->uncompressed_buffer)[k] = nan_float32;
|
||||
else
|
||||
((float *)sp->uncompressed_buffer)[k] =
|
||||
((float *)sp->uncompressed_buffer_multiband)
|
||||
[i + j * nb_pixels];
|
||||
++k;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const double nan_float64 = nan_float32;
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
for (int j = 0; j < td->td_samplesperpixel; j++)
|
||||
{
|
||||
if (sp->mask_buffer[i + j * nb_pixels] == 0)
|
||||
((double *)sp->uncompressed_buffer)[k] =
|
||||
nan_float64;
|
||||
else
|
||||
((double *)sp->uncompressed_buffer)[k] =
|
||||
((double *)sp->uncompressed_buffer_multiband)
|
||||
[i + j * nb_pixels];
|
||||
++k;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -553,7 +746,7 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
||||
static int LERCDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
||||
{
|
||||
static const char module[] = "LERCDecode";
|
||||
LERCState *sp = DecoderState(tif);
|
||||
LERCState *sp = LERCDecoderState(tif);
|
||||
|
||||
(void)s;
|
||||
assert(sp != NULL);
|
||||
@@ -561,6 +754,7 @@ static int LERCDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
||||
|
||||
if (sp->uncompressed_buffer == 0)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module, "Uncompressed buffer not allocated");
|
||||
return 0;
|
||||
}
|
||||
@@ -568,6 +762,7 @@ static int LERCDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
||||
if ((uint64_t)sp->uncompressed_offset + (uint64_t)occ >
|
||||
sp->uncompressed_size)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module, "Too many bytes read");
|
||||
return 0;
|
||||
}
|
||||
@@ -580,7 +775,7 @@ static int LERCDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
||||
|
||||
static int LERCSetupEncode(TIFF *tif)
|
||||
{
|
||||
LERCState *sp = EncoderState(tif);
|
||||
LERCState *sp = LERCEncoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
if (sp->state & LSTATE_INIT_DECODE)
|
||||
@@ -599,7 +794,7 @@ static int LERCSetupEncode(TIFF *tif)
|
||||
static int LERCPreEncode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
static const char module[] = "LERCPreEncode";
|
||||
LERCState *sp = EncoderState(tif);
|
||||
LERCState *sp = LERCEncoderState(tif);
|
||||
int lerc_data_type;
|
||||
|
||||
(void)s;
|
||||
@@ -611,7 +806,7 @@ static int LERCPreEncode(TIFF *tif, uint16_t s)
|
||||
if (lerc_data_type < 0)
|
||||
return 0;
|
||||
|
||||
if (!SetupUncompressedBuffer(tif, sp, module))
|
||||
if (!SetupBuffers(tif, sp, module))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
@@ -623,7 +818,7 @@ static int LERCPreEncode(TIFF *tif, uint16_t s)
|
||||
static int LERCEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
||||
{
|
||||
static const char module[] = "LERCEncode";
|
||||
LERCState *sp = EncoderState(tif);
|
||||
LERCState *sp = LERCEncoderState(tif);
|
||||
|
||||
(void)s;
|
||||
assert(sp != NULL);
|
||||
@@ -649,8 +844,7 @@ static int LERCPostEncode(TIFF *tif)
|
||||
{
|
||||
lerc_status lerc_ret;
|
||||
static const char module[] = "LERCPostEncode";
|
||||
LERCState *sp = EncoderState(tif);
|
||||
unsigned int numBytes = 0;
|
||||
LERCState *sp = LERCEncoderState(tif);
|
||||
unsigned int numBytesWritten = 0;
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
int use_mask = 0;
|
||||
@@ -662,6 +856,9 @@ static int LERCPostEncode(TIFF *tif)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mask_count = 1;
|
||||
const unsigned nb_pixels = sp->segment_width * sp->segment_height;
|
||||
|
||||
/* Extract alpha mask (if containing only 0 and 255 values, */
|
||||
/* and compact array of regular bands */
|
||||
if (td->td_planarconfig == PLANARCONFIG_CONTIG && td->td_extrasamples > 0 &&
|
||||
@@ -673,7 +870,6 @@ static int LERCPostEncode(TIFF *tif)
|
||||
const unsigned src_stride =
|
||||
td->td_samplesperpixel * (td->td_bitspersample / 8);
|
||||
unsigned i = 0;
|
||||
const unsigned nb_pixels = sp->segment_width * sp->segment_height;
|
||||
|
||||
use_mask = 1;
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
@@ -710,46 +906,78 @@ static int LERCPostEncode(TIFF *tif)
|
||||
}
|
||||
}
|
||||
else if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP &&
|
||||
(td->td_planarconfig == PLANARCONFIG_SEPARATE ||
|
||||
dst_nbands == 1) &&
|
||||
(td->td_bitspersample == 32 || td->td_bitspersample == 64))
|
||||
{
|
||||
/* Check for NaN values */
|
||||
unsigned i;
|
||||
const unsigned nb_pixels = sp->segment_width * sp->segment_height;
|
||||
if (td->td_bitspersample == 32)
|
||||
{
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
if (td->td_planarconfig == PLANARCONFIG_CONTIG && dst_nbands > 1)
|
||||
{
|
||||
const float val = ((float *)sp->uncompressed_buffer)[i];
|
||||
if (val != val)
|
||||
unsigned k = 0;
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
use_mask = 1;
|
||||
break;
|
||||
int count_nan = 0;
|
||||
for (int j = 0; j < td->td_samplesperpixel; ++j)
|
||||
{
|
||||
const float val = ((float *)sp->uncompressed_buffer)[k];
|
||||
++k;
|
||||
if (val != val)
|
||||
{
|
||||
++count_nan;
|
||||
}
|
||||
}
|
||||
if (count_nan > 0)
|
||||
{
|
||||
use_mask = 1;
|
||||
if (count_nan < td->td_samplesperpixel)
|
||||
{
|
||||
mask_count = td->td_samplesperpixel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
const float val = ((float *)sp->uncompressed_buffer)[i];
|
||||
if (val != val)
|
||||
{
|
||||
use_mask = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
const double val = ((double *)sp->uncompressed_buffer)[i];
|
||||
if (val != val)
|
||||
{
|
||||
use_mask = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (use_mask)
|
||||
{
|
||||
if (td->td_bitspersample == 32)
|
||||
if (td->td_planarconfig == PLANARCONFIG_CONTIG && dst_nbands > 1)
|
||||
{
|
||||
unsigned k = 0;
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
const float val = ((float *)sp->uncompressed_buffer)[i];
|
||||
sp->mask_buffer[i] = (val == val) ? 255 : 0;
|
||||
int count_nan = 0;
|
||||
for (int j = 0; j < td->td_samplesperpixel; ++j)
|
||||
{
|
||||
const double val =
|
||||
((double *)sp->uncompressed_buffer)[k];
|
||||
++k;
|
||||
if (val != val)
|
||||
{
|
||||
++count_nan;
|
||||
}
|
||||
}
|
||||
if (count_nan > 0)
|
||||
{
|
||||
use_mask = 1;
|
||||
if (count_nan < td->td_samplesperpixel)
|
||||
{
|
||||
mask_count = td->td_samplesperpixel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -757,62 +985,168 @@ static int LERCPostEncode(TIFF *tif)
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
const double val = ((double *)sp->uncompressed_buffer)[i];
|
||||
sp->mask_buffer[i] = (val == val) ? 255 : 0;
|
||||
if (val != val)
|
||||
{
|
||||
use_mask = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (use_mask)
|
||||
{
|
||||
if (mask_count > 1)
|
||||
{
|
||||
#if LERC_AT_LEAST_VERSION(3, 0, 0)
|
||||
unsigned int num_bytes_needed =
|
||||
nb_pixels * dst_nbands * (td->td_bitspersample / 8);
|
||||
if (sp->uncompressed_buffer_multiband_alloc < num_bytes_needed)
|
||||
{
|
||||
_TIFFfreeExt(tif, sp->uncompressed_buffer_multiband);
|
||||
sp->uncompressed_buffer_multiband =
|
||||
_TIFFmallocExt(tif, num_bytes_needed);
|
||||
if (!sp->uncompressed_buffer_multiband)
|
||||
{
|
||||
sp->uncompressed_buffer_multiband_alloc = 0;
|
||||
return 0;
|
||||
}
|
||||
sp->uncompressed_buffer_multiband_alloc = num_bytes_needed;
|
||||
}
|
||||
|
||||
unsigned k = 0;
|
||||
if (td->td_bitspersample == 32)
|
||||
{
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
for (int j = 0; j < td->td_samplesperpixel; ++j)
|
||||
{
|
||||
const float val =
|
||||
((float *)sp->uncompressed_buffer)[k];
|
||||
((float *)sp->uncompressed_buffer_multiband)
|
||||
[i + j * nb_pixels] = val;
|
||||
++k;
|
||||
sp->mask_buffer[i + j * nb_pixels] =
|
||||
(val == val) ? 255 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
for (int j = 0; j < td->td_samplesperpixel; ++j)
|
||||
{
|
||||
const double val =
|
||||
((double *)sp->uncompressed_buffer)[k];
|
||||
((double *)sp->uncompressed_buffer_multiband)
|
||||
[i + j * nb_pixels] = val;
|
||||
++k;
|
||||
sp->mask_buffer[i + j * nb_pixels] =
|
||||
(val == val) ? 255 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
TIFFErrorExtR(tif, module,
|
||||
"lerc_encode() would need to create one mask per "
|
||||
"sample, but this requires liblerc >= 3.0");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
else if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
|
||||
dst_nbands > 1)
|
||||
{
|
||||
if (td->td_bitspersample == 32)
|
||||
{
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
const float val =
|
||||
((float *)sp->uncompressed_buffer)[i * dst_nbands];
|
||||
sp->mask_buffer[i] = (val == val) ? 255 : 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
const double val =
|
||||
((double *)sp->uncompressed_buffer)[i * dst_nbands];
|
||||
sp->mask_buffer[i] = (val == val) ? 255 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (td->td_bitspersample == 32)
|
||||
{
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
const float val = ((float *)sp->uncompressed_buffer)[i];
|
||||
sp->mask_buffer[i] = (val == val) ? 255 : 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nb_pixels; i++)
|
||||
{
|
||||
const double val =
|
||||
((double *)sp->uncompressed_buffer)[i];
|
||||
sp->mask_buffer[i] = (val == val) ? 255 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
lerc_ret = lerc_computeCompressedSize(
|
||||
sp->uncompressed_buffer,
|
||||
sp->lerc_version,
|
||||
GetLercDataType(tif),
|
||||
td->td_planarconfig == PLANARCONFIG_CONTIG ?
|
||||
dst_nbands : 1,
|
||||
sp->segment_width,
|
||||
sp->segment_height,
|
||||
1,
|
||||
use_mask ? sp->mask_buffer : NULL,
|
||||
sp->maxzerror,
|
||||
&numBytes);
|
||||
if( lerc_ret != 0 )
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"lerc_computeCompressedSize() failed");
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
numBytes = sp->uncompressed_alloc;
|
||||
unsigned int estimated_compressed_size = sp->uncompressed_alloc;
|
||||
#if LERC_AT_LEAST_VERSION(3, 0, 0)
|
||||
if (mask_count > 1)
|
||||
{
|
||||
estimated_compressed_size += nb_pixels * mask_count / 8;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sp->compressed_size < numBytes)
|
||||
if (sp->compressed_size < estimated_compressed_size)
|
||||
{
|
||||
_TIFFfreeExt(tif, sp->compressed_buffer);
|
||||
sp->compressed_buffer = _TIFFmallocExt(tif, numBytes);
|
||||
sp->compressed_buffer = _TIFFmallocExt(tif, estimated_compressed_size);
|
||||
if (!sp->compressed_buffer)
|
||||
{
|
||||
sp->compressed_size = 0;
|
||||
return 0;
|
||||
}
|
||||
sp->compressed_size = numBytes;
|
||||
sp->compressed_size = estimated_compressed_size;
|
||||
}
|
||||
|
||||
lerc_ret = lerc_encodeForVersion(
|
||||
sp->uncompressed_buffer, sp->lerc_version, GetLercDataType(tif),
|
||||
td->td_planarconfig == PLANARCONFIG_CONTIG ? dst_nbands : 1,
|
||||
sp->segment_width, sp->segment_height, 1,
|
||||
#if LERC_AT_LEAST_VERSION(3, 0, 0)
|
||||
use_mask ? 1 : 0,
|
||||
if (mask_count > 1)
|
||||
{
|
||||
lerc_ret = lerc_encodeForVersion(
|
||||
sp->uncompressed_buffer_multiband, sp->lerc_version,
|
||||
GetLercDataType(tif), 1, sp->segment_width, sp->segment_height,
|
||||
dst_nbands, dst_nbands, sp->mask_buffer, sp->maxzerror,
|
||||
sp->compressed_buffer, sp->compressed_size, &numBytesWritten);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
use_mask ? sp->mask_buffer : NULL, sp->maxzerror, sp->compressed_buffer,
|
||||
sp->compressed_size, &numBytesWritten);
|
||||
{
|
||||
lerc_ret = lerc_encodeForVersion(
|
||||
sp->uncompressed_buffer, sp->lerc_version, GetLercDataType(tif),
|
||||
td->td_planarconfig == PLANARCONFIG_CONTIG ? dst_nbands : 1,
|
||||
sp->segment_width, sp->segment_height, 1,
|
||||
#if LERC_AT_LEAST_VERSION(3, 0, 0)
|
||||
use_mask ? 1 : 0,
|
||||
#endif
|
||||
use_mask ? sp->mask_buffer : NULL, sp->maxzerror,
|
||||
sp->compressed_buffer, sp->compressed_size, &numBytesWritten);
|
||||
}
|
||||
if (lerc_ret != 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "lerc_encode() failed");
|
||||
return 0;
|
||||
}
|
||||
assert(numBytesWritten < numBytes);
|
||||
assert(numBytesWritten < estimated_compressed_size);
|
||||
|
||||
if (sp->additional_compression == LERC_ADD_COMPRESSION_DEFLATE)
|
||||
{
|
||||
@@ -950,7 +1284,7 @@ static int LERCPostEncode(TIFF *tif)
|
||||
|
||||
static void LERCCleanup(TIFF *tif)
|
||||
{
|
||||
LERCState *sp = LState(tif);
|
||||
LERCState *sp = GetLERCState(tif);
|
||||
|
||||
assert(sp != 0);
|
||||
|
||||
@@ -958,6 +1292,7 @@ static void LERCCleanup(TIFF *tif)
|
||||
tif->tif_tagmethods.vsetfield = sp->vsetparent;
|
||||
|
||||
_TIFFfreeExt(tif, sp->uncompressed_buffer);
|
||||
_TIFFfreeExt(tif, sp->uncompressed_buffer_multiband);
|
||||
_TIFFfreeExt(tif, sp->compressed_buffer);
|
||||
_TIFFfreeExt(tif, sp->mask_buffer);
|
||||
|
||||
@@ -995,7 +1330,7 @@ static const TIFFField LERCFields[] = {
|
||||
|
||||
static int LERCVSetFieldBase(TIFF *tif, uint32_t tag, ...)
|
||||
{
|
||||
LERCState *sp = LState(tif);
|
||||
LERCState *sp = GetLERCState(tif);
|
||||
int ret;
|
||||
va_list ap;
|
||||
va_start(ap, tag);
|
||||
@@ -1007,7 +1342,7 @@ static int LERCVSetFieldBase(TIFF *tif, uint32_t tag, ...)
|
||||
static int LERCVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
{
|
||||
static const char module[] = "LERCVSetField";
|
||||
LERCState *sp = LState(tif);
|
||||
LERCState *sp = GetLERCState(tif);
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
@@ -1115,7 +1450,7 @@ static int LERCVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
|
||||
static int LERCVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
{
|
||||
LERCState *sp = LState(tif);
|
||||
LERCState *sp = GetLERCState(tif);
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
@@ -1163,7 +1498,7 @@ int TIFFInitLERC(TIFF *tif, int scheme)
|
||||
tif->tif_data = (uint8_t *)_TIFFcallocExt(tif, 1, sizeof(LERCState));
|
||||
if (tif->tif_data == NULL)
|
||||
goto bad;
|
||||
sp = LState(tif);
|
||||
sp = GetLERCState(tif);
|
||||
|
||||
/*
|
||||
* Override parent get/set field methods.
|
||||
|
||||
+12
-3
@@ -951,7 +951,15 @@ static
|
||||
int
|
||||
uv_encode(double u, double v, int em) /* encode (u',v') coordinates */
|
||||
{
|
||||
register int vi, ui;
|
||||
unsigned int vi;
|
||||
int ui;
|
||||
|
||||
/* check for NaN */
|
||||
if (u != u || v != v)
|
||||
{
|
||||
u = U_NEU;
|
||||
v = V_NEU;
|
||||
}
|
||||
|
||||
if (v < UV_VSTART)
|
||||
return oog_encode(u, v);
|
||||
@@ -973,8 +981,9 @@ static
|
||||
int
|
||||
uv_decode(double *up, double *vp, int c) /* decode (u',v') index */
|
||||
{
|
||||
int upper, lower;
|
||||
register int ui, vi;
|
||||
unsigned int upper, lower;
|
||||
int ui;
|
||||
unsigned int vi;
|
||||
|
||||
if (c < 0 || c >= UV_NDIVS)
|
||||
return (-1);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user