mirror of
https://github.com/zebrajr/opencv.git
synced 2025-12-06 00:19:46 +01:00
Compare commits
322 Commits
b3cb517cac
...
833918781e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
833918781e | ||
|
|
e7d046f31a | ||
|
|
34f6c0764e | ||
|
|
b5e96d76eb | ||
|
|
75598e5377 | ||
|
|
b644754226 | ||
|
|
19c41c2936 | ||
|
|
aeea707262 | ||
|
|
387afc4eb4 | ||
|
|
4e94116e7a | ||
|
|
14aae55450 | ||
|
|
8f3976ae97 | ||
|
|
bb45afec28 | ||
|
|
aa939b3932 | ||
|
|
4f6dd148e6 | ||
|
|
80fef356ec | ||
|
|
d5cdad7629 | ||
|
|
acc76304d5 | ||
|
|
c4763279eb | ||
|
|
e9bded6ff3 | ||
|
|
7994f88ecb | ||
|
|
f699d3c777 | ||
|
|
2ba688f23c | ||
|
|
9ee9a47302 | ||
|
|
ebb5b3037e | ||
|
|
e69eeb1558 | ||
|
|
8f3f1cd193 | ||
|
|
9a82458c43 | ||
|
|
0e88b49a53 | ||
|
|
5d54e90fa4 | ||
|
|
edfa999b93 | ||
|
|
5755d4f224 | ||
|
|
939e58f260 | ||
|
|
b88c3dff4f | ||
|
|
659106a99d | ||
|
|
9282afa0c7 | ||
|
|
255d1d2b0c | ||
|
|
6f9f8f49dd | ||
|
|
6f040337e9 | ||
|
|
79793e169e | ||
|
|
3492b71dfb | ||
|
|
95354f044c | ||
|
|
ceb197b7de | ||
|
|
6dbf7612f9 | ||
|
|
691b1bdc05 | ||
|
|
ca7f668e6a | ||
|
|
3c3a26b6ab | ||
|
|
744d5ecd14 | ||
|
|
64bb4ad035 | ||
|
|
a9148b88f3 | ||
|
|
3372286c7b | ||
|
|
89e767b0d9 | ||
|
|
cb659575e8 | ||
|
|
15d3c56548 | ||
|
|
0ff1452400 | ||
|
|
b99c604d02 | ||
|
|
a3814ea237 | ||
|
|
8ff2d29804 | ||
|
|
5c1c39afc1 | ||
|
|
61705ea280 | ||
|
|
fac647aaeb | ||
|
|
5b1d325530 | ||
|
|
a7943cef60 | ||
|
|
b7bc18670b | ||
|
|
6d4be10c44 | ||
|
|
dac243bd26 | ||
|
|
16c8308674 | ||
|
|
1fdff6da75 | ||
|
|
1f5d695df3 | ||
|
|
1fe128f7b5 | ||
|
|
ec015d48d6 | ||
|
|
307442b30b | ||
|
|
08b84558a2 | ||
|
|
b3f6c86d47 | ||
|
|
eed87abbcf | ||
|
|
ae86b400cc | ||
|
|
efea09120b | ||
|
|
3a21ed56e3 | ||
|
|
8e0c0dc347 | ||
|
|
646e94aad4 | ||
|
|
7e3550dff8 | ||
|
|
9196edd299 | ||
|
|
ee41f46b46 | ||
|
|
9663b582a2 | ||
|
|
b28d9bef1d | ||
|
|
54b03cc2f8 | ||
|
|
2352436a61 | ||
|
|
98a70539cc | ||
|
|
b52feed94d | ||
|
|
3d3e962652 | ||
|
|
65cb3fd86c | ||
|
|
e22c1065ec | ||
|
|
443d0ae63f | ||
|
|
d9572861d1 | ||
|
|
92e2c67896 | ||
|
|
f51f2f6797 | ||
|
|
e41ce4dbf4 | ||
|
|
a56877a016 | ||
|
|
ca35ed2f1c | ||
|
|
518735b509 | ||
|
|
6d889ee74c | ||
|
|
2ae5a1ee27 | ||
|
|
e4a7bab00e | ||
|
|
d9556920dc | ||
|
|
0e9c3b5a3b | ||
|
|
ad22d482e6 | ||
|
|
ad560f69f4 | ||
|
|
ff9da98c7c | ||
|
|
3e404004e0 | ||
|
|
81b66cf972 | ||
|
|
7a4bd85299 | ||
|
|
86df531554 | ||
|
|
f81240f57b | ||
|
|
fb68223b5c | ||
|
|
28d410cecf | ||
|
|
719b86bd1d | ||
|
|
0986022bcb | ||
|
|
ba19416730 | ||
|
|
1e37d84e3a | ||
|
|
0b84a54a65 | ||
|
|
90c444abd3 | ||
|
|
319e8e7a43 | ||
|
|
32c6aee53d | ||
|
|
d9c0ee234f | ||
|
|
13a2919ec0 | ||
|
|
920040d72e | ||
|
|
52ae1cfc29 | ||
|
|
a7ff9087f9 | ||
|
|
078563288e | ||
|
|
eab6d5741a | ||
|
|
7a1ec54c43 | ||
|
|
9909d0a7d2 | ||
|
|
c27f5a3905 | ||
|
|
056e761bbc | ||
|
|
ae4b4c210d | ||
|
|
84dc1e93c5 | ||
|
|
fa134b95fd | ||
|
|
fe874b8f36 | ||
|
|
850919e10b | ||
|
|
a8afdee984 | ||
|
|
88fb0bad69 | ||
|
|
2762ffe7cc | ||
|
|
c5bb6a014a | ||
|
|
d33999cb6e | ||
|
|
f4538f5020 | ||
|
|
252403bbf2 | ||
|
|
a0639446cc | ||
|
|
2ecc22fe03 | ||
|
|
84d391aac4 | ||
|
|
75d9ac3964 | ||
|
|
a783a1e2d8 | ||
|
|
f0888a10e8 | ||
|
|
12efb8499d | ||
|
|
e31ff00104 | ||
|
|
03fbfc7014 | ||
|
|
a1f1afa693 | ||
|
|
8d1ec466f0 | ||
|
|
29c73c1d2a | ||
|
|
a265947356 | ||
|
|
9f88e9ae31 | ||
|
|
96fdbc58e1 | ||
|
|
13846de9f6 | ||
|
|
bbd8c4cc12 | ||
|
|
243f74cc8c | ||
|
|
8496706216 | ||
|
|
52bed3cd78 | ||
|
|
ca053bb8ab | ||
|
|
dbd984a9f6 | ||
|
|
83e352dc48 | ||
|
|
1dd06eb0da | ||
|
|
3dec85df71 | ||
|
|
8dc4ad3ff3 | ||
|
|
fb37e14cbf | ||
|
|
7ab4e1bf56 | ||
|
|
e323e05446 | ||
|
|
eebb15683f | ||
|
|
615ceefd0c | ||
|
|
07cf36cbb0 | ||
|
|
48b75bc029 | ||
|
|
4ba3d472ec | ||
|
|
8e20ec2f26 | ||
|
|
603d7ded88 | ||
|
|
2ab4bd3405 | ||
|
|
7835c214eb | ||
|
|
e4fabe393c | ||
|
|
84ca221184 | ||
|
|
ac9d0e0d0d | ||
|
|
ec9b8de3fa | ||
|
|
32bd8c9632 | ||
|
|
6efca656b8 | ||
|
|
15e3cf3cc5 | ||
|
|
ab8a1fa280 | ||
|
|
e2d87defd1 | ||
|
|
f54286b672 | ||
|
|
4813d1cd32 | ||
|
|
f59a955bea | ||
|
|
8366a2e506 | ||
|
|
f734de08ca | ||
|
|
1342ca2f95 | ||
|
|
61a3d7d25d | ||
|
|
10ce4d406d | ||
|
|
468de9b367 | ||
|
|
69b2024a3d | ||
|
|
4c024c35fb | ||
|
|
0a1a07d62e | ||
|
|
875c112f9a | ||
|
|
09309523da | ||
|
|
824cbf51ec | ||
|
|
1ecdb39fde | ||
|
|
deaf58689a | ||
|
|
d19dd94dee | ||
|
|
9cdd525bc5 | ||
|
|
3001db4776 | ||
|
|
478040c408 | ||
|
|
d53531500a | ||
|
|
6a5884c04f | ||
|
|
8d426718c6 | ||
|
|
c48dad1d9d | ||
|
|
d5f1a5d9e8 | ||
|
|
2d60f3c63b | ||
|
|
1cdb76c8e3 | ||
|
|
d75323f8a5 | ||
|
|
49486f61fb | ||
|
|
6b55ae0319 | ||
|
|
7a0d6559c3 | ||
|
|
66e5fce928 | ||
|
|
677c4ee42f | ||
|
|
43112409ef | ||
|
|
27867cc72c | ||
|
|
5ee8919139 | ||
|
|
3ff2ce3291 | ||
|
|
64ef095314 | ||
|
|
d9e2b4c650 | ||
|
|
611d69aae1 | ||
|
|
d2d90dd1cd | ||
|
|
f6697558ce | ||
|
|
856a497209 | ||
|
|
117801e136 | ||
|
|
1d45a63598 | ||
|
|
029030095c | ||
|
|
2e54a1f14f | ||
|
|
83309580f4 | ||
|
|
e9f1da7e8e | ||
|
|
c363303d0a | ||
|
|
42ec439d5a | ||
|
|
5ee1a53d1e | ||
|
|
359a005d82 | ||
|
|
288471f559 | ||
|
|
91be7d3ce6 | ||
|
|
a55eca9fb5 | ||
|
|
77d2a5868a | ||
|
|
0fac0e760f | ||
|
|
e392b3843e | ||
|
|
ba70d1104f | ||
|
|
7dfd1226ce | ||
|
|
6ed29bdd39 | ||
|
|
a122f83374 | ||
|
|
c3400603d0 | ||
|
|
4629299163 | ||
|
|
54fe519ae0 | ||
|
|
afe5b226b4 | ||
|
|
1950c4dbb9 | ||
|
|
2ffca501e7 | ||
|
|
850b686f8a | ||
|
|
89289ecaa5 | ||
|
|
3259863924 | ||
|
|
7f4c89c7cc | ||
|
|
f24f6b8d4e | ||
|
|
98ed06c339 | ||
|
|
23d812187e | ||
|
|
9bb20c0174 | ||
|
|
a4a253ea2b | ||
|
|
7cb7a6fd20 | ||
|
|
972e135479 | ||
|
|
1c53fd3777 | ||
|
|
210203090e | ||
|
|
bbaed6f377 | ||
|
|
d1b4b46dc6 | ||
|
|
0755c512e7 | ||
|
|
37a3eddd53 | ||
|
|
30130cdc86 | ||
|
|
f09de671be | ||
|
|
40e3aee3d6 | ||
|
|
c0fdb1145e | ||
|
|
664230091e | ||
|
|
8ffcd60538 | ||
|
|
c5ef3948cf | ||
|
|
1f674dcdb4 | ||
|
|
287dad8102 | ||
|
|
d750d43aa2 | ||
|
|
b395a2e307 | ||
|
|
452882c007 | ||
|
|
fcc76c120f | ||
|
|
85b45656fa | ||
|
|
bbe2f50b5d | ||
|
|
6b4f5b48b1 | ||
|
|
809090f203 | ||
|
|
4b69cc53e6 | ||
|
|
b13704b583 | ||
|
|
7ca36d9c50 | ||
|
|
ebfee90c30 | ||
|
|
62b36495cc | ||
|
|
d6864cdd22 | ||
|
|
b9cab7e4af | ||
|
|
d97e926f70 | ||
|
|
a503070e01 | ||
|
|
beeda17483 | ||
|
|
987548d041 | ||
|
|
aef6ae4872 | ||
|
|
9e18169959 | ||
|
|
a2c381a82b | ||
|
|
e258f2595e | ||
|
|
0ccbd21c0a | ||
|
|
17d94277f0 | ||
|
|
5205e26663 | ||
|
|
cd0699a338 | ||
|
|
4033043488 | ||
|
|
e92cfb35f6 | ||
|
|
a39f61b6e1 | ||
|
|
e1f6e85c88 | ||
|
|
ce1398882d | ||
|
|
ab0a818c84 |
201
3rdparty/dlpack/LICENSE
vendored
Normal file
201
3rdparty/dlpack/LICENSE
vendored
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2017 by Contributors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
366
3rdparty/dlpack/include/dlpack/dlpack.h
vendored
Normal file
366
3rdparty/dlpack/include/dlpack/dlpack.h
vendored
Normal file
|
|
@ -0,0 +1,366 @@
|
|||
/*!
|
||||
* Copyright (c) 2017 by Contributors
|
||||
* \file dlpack.h
|
||||
* \brief The common header of DLPack.
|
||||
*/
|
||||
#ifndef DLPACK_DLPACK_H_
|
||||
#define DLPACK_DLPACK_H_
|
||||
|
||||
/**
|
||||
* \brief Compatibility with C++
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#define DLPACK_EXTERN_C extern "C"
|
||||
#else
|
||||
#define DLPACK_EXTERN_C
|
||||
#endif
|
||||
|
||||
/*! \brief The current major version of dlpack */
|
||||
#define DLPACK_MAJOR_VERSION 1
|
||||
|
||||
/*! \brief The current minor version of dlpack */
|
||||
#define DLPACK_MINOR_VERSION 1
|
||||
|
||||
/*! \brief DLPACK_DLL prefix for windows */
|
||||
#ifdef _WIN32
|
||||
#ifdef DLPACK_EXPORTS
|
||||
#define DLPACK_DLL __declspec(dllexport)
|
||||
#else
|
||||
#define DLPACK_DLL __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define DLPACK_DLL
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief The DLPack version.
|
||||
*
|
||||
* A change in major version indicates that we have changed the
|
||||
* data layout of the ABI - DLManagedTensorVersioned.
|
||||
*
|
||||
* A change in minor version indicates that we have added new
|
||||
* code, such as a new device type, but the ABI is kept the same.
|
||||
*
|
||||
* If an obtained DLPack tensor has a major version that disagrees
|
||||
* with the version number specified in this header file
|
||||
* (i.e. major != DLPACK_MAJOR_VERSION), the consumer must call the deleter
|
||||
* (and it is safe to do so). It is not safe to access any other fields
|
||||
* as the memory layout will have changed.
|
||||
*
|
||||
* In the case of a minor version mismatch, the tensor can be safely used as
|
||||
* long as the consumer knows how to interpret all fields. Minor version
|
||||
* updates indicate the addition of enumeration values.
|
||||
*/
|
||||
typedef struct {
|
||||
/*! \brief DLPack major version. */
|
||||
uint32_t major;
|
||||
/*! \brief DLPack minor version. */
|
||||
uint32_t minor;
|
||||
} DLPackVersion;
|
||||
|
||||
/*!
|
||||
* \brief The device type in DLDevice.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
typedef enum : int32_t {
|
||||
#else
|
||||
typedef enum {
|
||||
#endif
|
||||
/*! \brief CPU device */
|
||||
kDLCPU = 1,
|
||||
/*! \brief CUDA GPU device */
|
||||
kDLCUDA = 2,
|
||||
/*!
|
||||
* \brief Pinned CUDA CPU memory by cudaMallocHost
|
||||
*/
|
||||
kDLCUDAHost = 3,
|
||||
/*! \brief OpenCL devices. */
|
||||
kDLOpenCL = 4,
|
||||
/*! \brief Vulkan buffer for next generation graphics. */
|
||||
kDLVulkan = 7,
|
||||
/*! \brief Metal for Apple GPU. */
|
||||
kDLMetal = 8,
|
||||
/*! \brief Verilog simulator buffer */
|
||||
kDLVPI = 9,
|
||||
/*! \brief ROCm GPUs for AMD GPUs */
|
||||
kDLROCM = 10,
|
||||
/*!
|
||||
* \brief Pinned ROCm CPU memory allocated by hipMallocHost
|
||||
*/
|
||||
kDLROCMHost = 11,
|
||||
/*!
|
||||
* \brief Reserved extension device type,
|
||||
* used for quickly test extension device
|
||||
* The semantics can differ depending on the implementation.
|
||||
*/
|
||||
kDLExtDev = 12,
|
||||
/*!
|
||||
* \brief CUDA managed/unified memory allocated by cudaMallocManaged
|
||||
*/
|
||||
kDLCUDAManaged = 13,
|
||||
/*!
|
||||
* \brief Unified shared memory allocated on a oneAPI non-partititioned
|
||||
* device. Call to oneAPI runtime is required to determine the device
|
||||
* type, the USM allocation type and the sycl context it is bound to.
|
||||
*
|
||||
*/
|
||||
kDLOneAPI = 14,
|
||||
/*! \brief GPU support for next generation WebGPU standard. */
|
||||
kDLWebGPU = 15,
|
||||
/*! \brief Qualcomm Hexagon DSP */
|
||||
kDLHexagon = 16,
|
||||
/*! \brief Microsoft MAIA devices */
|
||||
kDLMAIA = 17,
|
||||
} DLDeviceType;
|
||||
|
||||
/*!
|
||||
* \brief A Device for Tensor and operator.
|
||||
*/
|
||||
typedef struct {
|
||||
/*! \brief The device type used in the device. */
|
||||
DLDeviceType device_type;
|
||||
/*!
|
||||
* \brief The device index.
|
||||
* For vanilla CPU memory, pinned memory, or managed memory, this is set to 0.
|
||||
*/
|
||||
int32_t device_id;
|
||||
} DLDevice;
|
||||
|
||||
/*!
|
||||
* \brief The type code options DLDataType.
|
||||
*/
|
||||
typedef enum {
|
||||
/*! \brief signed integer */
|
||||
kDLInt = 0U,
|
||||
/*! \brief unsigned integer */
|
||||
kDLUInt = 1U,
|
||||
/*! \brief IEEE floating point */
|
||||
kDLFloat = 2U,
|
||||
/*!
|
||||
* \brief Opaque handle type, reserved for testing purposes.
|
||||
* Frameworks need to agree on the handle data type for the exchange to be well-defined.
|
||||
*/
|
||||
kDLOpaqueHandle = 3U,
|
||||
/*! \brief bfloat16 */
|
||||
kDLBfloat = 4U,
|
||||
/*!
|
||||
* \brief complex number
|
||||
* (C/C++/Python layout: compact struct per complex number)
|
||||
*/
|
||||
kDLComplex = 5U,
|
||||
/*! \brief boolean */
|
||||
kDLBool = 6U,
|
||||
/*! \brief FP8 data types */
|
||||
kDLFloat8_e3m4 = 7U,
|
||||
kDLFloat8_e4m3 = 8U,
|
||||
kDLFloat8_e4m3b11fnuz = 9U,
|
||||
kDLFloat8_e4m3fn = 10U,
|
||||
kDLFloat8_e4m3fnuz = 11U,
|
||||
kDLFloat8_e5m2 = 12U,
|
||||
kDLFloat8_e5m2fnuz = 13U,
|
||||
kDLFloat8_e8m0fnu = 14U,
|
||||
/*! \brief FP6 data types
|
||||
* Setting bits != 6 is currently unspecified, and the producer must ensure it is set
|
||||
* while the consumer must stop importing if the value is unexpected.
|
||||
*/
|
||||
kDLFloat6_e2m3fn = 15U,
|
||||
kDLFloat6_e3m2fn = 16U,
|
||||
/*! \brief FP4 data types
|
||||
* Setting bits != 4 is currently unspecified, and the producer must ensure it is set
|
||||
* while the consumer must stop importing if the value is unexpected.
|
||||
*/
|
||||
kDLFloat4_e2m1fn = 17U,
|
||||
} DLDataTypeCode;
|
||||
|
||||
/*!
|
||||
* \brief The data type the tensor can hold. The data type is assumed to follow the
|
||||
* native endian-ness. An explicit error message should be raised when attempting to
|
||||
* export an array with non-native endianness
|
||||
*
|
||||
* Examples
|
||||
* - float: type_code = 2, bits = 32, lanes = 1
|
||||
* - float4(vectorized 4 float): type_code = 2, bits = 32, lanes = 4
|
||||
* - int8: type_code = 0, bits = 8, lanes = 1
|
||||
* - std::complex<float>: type_code = 5, bits = 64, lanes = 1
|
||||
* - bool: type_code = 6, bits = 8, lanes = 1 (as per common array library convention, the underlying storage size of bool is 8 bits)
|
||||
* - float8_e4m3: type_code = 8, bits = 8, lanes = 1 (packed in memory)
|
||||
* - float6_e3m2fn: type_code = 16, bits = 6, lanes = 1 (packed in memory)
|
||||
* - float4_e2m1fn: type_code = 17, bits = 4, lanes = 1 (packed in memory)
|
||||
*
|
||||
* When a sub-byte type is packed, DLPack requires the data to be in little bit-endian, i.e.,
|
||||
* for a packed data set D ((D >> (i * bits)) && bit_mask) stores the i-th element.
|
||||
*/
|
||||
typedef struct {
|
||||
/*!
|
||||
* \brief Type code of base types.
|
||||
* We keep it uint8_t instead of DLDataTypeCode for minimal memory
|
||||
* footprint, but the value should be one of DLDataTypeCode enum values.
|
||||
* */
|
||||
uint8_t code;
|
||||
/*!
|
||||
* \brief Number of bits, common choices are 8, 16, 32.
|
||||
*/
|
||||
uint8_t bits;
|
||||
/*! \brief Number of lanes in the type, used for vector types. */
|
||||
uint16_t lanes;
|
||||
} DLDataType;
|
||||
|
||||
/*!
|
||||
* \brief Plain C Tensor object, does not manage memory.
|
||||
*/
|
||||
typedef struct {
|
||||
/*!
|
||||
* \brief The data pointer points to the allocated data. This will be CUDA
|
||||
* device pointer or cl_mem handle in OpenCL. It may be opaque on some device
|
||||
* types. This pointer is always aligned to 256 bytes as in CUDA. The
|
||||
* `byte_offset` field should be used to point to the beginning of the data.
|
||||
*
|
||||
* Note that as of Nov 2021, multiply libraries (CuPy, PyTorch, TensorFlow,
|
||||
* TVM, perhaps others) do not adhere to this 256 byte aligment requirement
|
||||
* on CPU/CUDA/ROCm, and always use `byte_offset=0`. This must be fixed
|
||||
* (after which this note will be updated); at the moment it is recommended
|
||||
* to not rely on the data pointer being correctly aligned.
|
||||
*
|
||||
* For given DLTensor, the size of memory required to store the contents of
|
||||
* data is calculated as follows:
|
||||
*
|
||||
* \code{.c}
|
||||
* static inline size_t GetDataSize(const DLTensor* t) {
|
||||
* size_t size = 1;
|
||||
* for (tvm_index_t i = 0; i < t->ndim; ++i) {
|
||||
* size *= t->shape[i];
|
||||
* }
|
||||
* size *= (t->dtype.bits * t->dtype.lanes + 7) / 8;
|
||||
* return size;
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* Note that if the tensor is of size zero, then the data pointer should be
|
||||
* set to `NULL`.
|
||||
*/
|
||||
void* data;
|
||||
/*! \brief The device of the tensor */
|
||||
DLDevice device;
|
||||
/*! \brief Number of dimensions */
|
||||
int32_t ndim;
|
||||
/*! \brief The data type of the pointer*/
|
||||
DLDataType dtype;
|
||||
/*! \brief The shape of the tensor */
|
||||
int64_t* shape;
|
||||
/*!
|
||||
* \brief strides of the tensor (in number of elements, not bytes)
|
||||
* can be NULL, indicating tensor is compact and row-majored.
|
||||
*/
|
||||
int64_t* strides;
|
||||
/*! \brief The offset in bytes to the beginning pointer to data */
|
||||
uint64_t byte_offset;
|
||||
} DLTensor;
|
||||
|
||||
/*!
|
||||
* \brief C Tensor object, manage memory of DLTensor. This data structure is
|
||||
* intended to facilitate the borrowing of DLTensor by another framework. It is
|
||||
* not meant to transfer the tensor. When the borrowing framework doesn't need
|
||||
* the tensor, it should call the deleter to notify the host that the resource
|
||||
* is no longer needed.
|
||||
*
|
||||
* \note This data structure is used as Legacy DLManagedTensor
|
||||
* in DLPack exchange and is deprecated after DLPack v0.8
|
||||
* Use DLManagedTensorVersioned instead.
|
||||
* This data structure may get renamed or deleted in future versions.
|
||||
*
|
||||
* \sa DLManagedTensorVersioned
|
||||
*/
|
||||
typedef struct DLManagedTensor {
|
||||
/*! \brief DLTensor which is being memory managed */
|
||||
DLTensor dl_tensor;
|
||||
/*! \brief the context of the original host framework of DLManagedTensor in
|
||||
* which DLManagedTensor is used in the framework. It can also be NULL.
|
||||
*/
|
||||
void * manager_ctx;
|
||||
/*!
|
||||
* \brief Destructor - this should be called
|
||||
* to destruct the manager_ctx which backs the DLManagedTensor. It can be
|
||||
* NULL if there is no way for the caller to provide a reasonable destructor.
|
||||
* The destructor deletes the argument self as well.
|
||||
*/
|
||||
void (*deleter)(struct DLManagedTensor * self);
|
||||
} DLManagedTensor;
|
||||
|
||||
// bit masks used in in the DLManagedTensorVersioned
|
||||
|
||||
/*! \brief bit mask to indicate that the tensor is read only. */
|
||||
#define DLPACK_FLAG_BITMASK_READ_ONLY (1UL << 0UL)
|
||||
|
||||
/*!
|
||||
* \brief bit mask to indicate that the tensor is a copy made by the producer.
|
||||
*
|
||||
* If set, the tensor is considered solely owned throughout its lifetime by the
|
||||
* consumer, until the producer-provided deleter is invoked.
|
||||
*/
|
||||
#define DLPACK_FLAG_BITMASK_IS_COPIED (1UL << 1UL)
|
||||
|
||||
/*
|
||||
* \brief bit mask to indicate that whether a sub-byte type is packed or padded.
|
||||
*
|
||||
* The default for sub-byte types (ex: fp4/fp6) is assumed packed. This flag can
|
||||
* be set by the producer to signal that a tensor of sub-byte type is padded.
|
||||
*/
|
||||
#define DLPACK_FLAG_BITMASK_IS_SUBBYTE_TYPE_PADDED (1UL << 2UL)
|
||||
|
||||
/*!
|
||||
* \brief A versioned and managed C Tensor object, manage memory of DLTensor.
|
||||
*
|
||||
* This data structure is intended to facilitate the borrowing of DLTensor by
|
||||
* another framework. It is not meant to transfer the tensor. When the borrowing
|
||||
* framework doesn't need the tensor, it should call the deleter to notify the
|
||||
* host that the resource is no longer needed.
|
||||
*
|
||||
* \note This is the current standard DLPack exchange data structure.
|
||||
*/
|
||||
struct DLManagedTensorVersioned {
|
||||
/*!
|
||||
* \brief The API and ABI version of the current managed Tensor
|
||||
*/
|
||||
DLPackVersion version;
|
||||
/*!
|
||||
* \brief the context of the original host framework.
|
||||
*
|
||||
* Stores DLManagedTensorVersioned is used in the
|
||||
* framework. It can also be NULL.
|
||||
*/
|
||||
void *manager_ctx;
|
||||
/*!
|
||||
* \brief Destructor.
|
||||
*
|
||||
* This should be called to destruct manager_ctx which holds the DLManagedTensorVersioned.
|
||||
* It can be NULL if there is no way for the caller to provide a reasonable
|
||||
* destructor. The destructor deletes the argument self as well.
|
||||
*/
|
||||
void (*deleter)(struct DLManagedTensorVersioned *self);
|
||||
/*!
|
||||
* \brief Additional bitmask flags information about the tensor.
|
||||
*
|
||||
* By default the flags should be set to 0.
|
||||
*
|
||||
* \note Future ABI changes should keep everything until this field
|
||||
* stable, to ensure that deleter can be correctly called.
|
||||
*
|
||||
* \sa DLPACK_FLAG_BITMASK_READ_ONLY
|
||||
* \sa DLPACK_FLAG_BITMASK_IS_COPIED
|
||||
*/
|
||||
uint64_t flags;
|
||||
/*! \brief DLTensor which is being memory managed */
|
||||
DLTensor dl_tensor;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // DLPACK_EXTERN_C
|
||||
#endif
|
||||
#endif // DLPACK_DLPACK_H_
|
||||
14
3rdparty/fastcv/fastcv.cmake
vendored
14
3rdparty/fastcv/fastcv.cmake
vendored
|
|
@ -1,23 +1,23 @@
|
|||
function(download_fastcv root_dir)
|
||||
|
||||
# Commit SHA in the opencv_3rdparty repo
|
||||
set(FASTCV_COMMIT "abe340d0fb7f19fa9315080e3c8616642e98a296")
|
||||
set(FASTCV_COMMIT "9e8d42b6d7e769548d70b2e5674e263b056de8b4")
|
||||
|
||||
# Define actual FastCV versions
|
||||
if(ANDROID)
|
||||
if(AARCH64)
|
||||
message(STATUS "Download FastCV for Android aarch64")
|
||||
set(FCV_PACKAGE_NAME "fastcv_android_aarch64_2025_04_29.tgz")
|
||||
set(FCV_PACKAGE_HASH "d9172a9a3e5d92d080a4192cc5691001")
|
||||
set(FCV_PACKAGE_NAME "fastcv_android_aarch64_2025_07_09.tgz")
|
||||
set(FCV_PACKAGE_HASH "8b9497858cf3c3502a0be4369d06ebf8")
|
||||
else()
|
||||
message(STATUS "Download FastCV for Android armv7")
|
||||
set(FCV_PACKAGE_NAME "fastcv_android_arm32_2025_04_29.tgz")
|
||||
set(FCV_PACKAGE_HASH "246b5253233391cd2c74d01d49aee9c3")
|
||||
set(FCV_PACKAGE_NAME "fastcv_android_arm32_2025_07_09.tgz")
|
||||
set(FCV_PACKAGE_HASH "e0e6009c9f2f2b96140cd6a639c7383f")
|
||||
endif()
|
||||
elseif(UNIX AND NOT APPLE AND NOT IOS AND NOT XROS)
|
||||
if(AARCH64)
|
||||
set(FCV_PACKAGE_NAME "fastcv_linux_aarch64_2025_04_29.tgz")
|
||||
set(FCV_PACKAGE_HASH "e2ce60e25c8e4113a7af2bd243118f4c")
|
||||
set(FCV_PACKAGE_NAME "fastcv_linux_aarch64_2025_07_09.tgz")
|
||||
set(FCV_PACKAGE_HASH "05e254e0eb3c13fa23eb7213f0fe6d82")
|
||||
else()
|
||||
message("FastCV: fastcv lib for 32-bit Linux is not supported for now!")
|
||||
endif()
|
||||
|
|
|
|||
10
3rdparty/ffmpeg/ffmpeg.cmake
vendored
10
3rdparty/ffmpeg/ffmpeg.cmake
vendored
|
|
@ -1,8 +1,8 @@
|
|||
# Binaries branch name: ffmpeg/4.x_20241226
|
||||
# Binaries were created for OpenCV: 09892c9d1706f40342bda0bc404580f63492d9f8
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "d63d7c154c57242bf2283be61166be2bd30ec47e")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "642b94d032a8292b07550126934173f6")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "a8c3560c8f20e1ae465bef81580fa92c")
|
||||
# Binaries branch name: ffmpeg/4.x_20250625
|
||||
# Binaries were created for OpenCV: e9f1da7e8e977a65b8bf8fe7ea8b92eef9171f19
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "ea9240e39bc0d6a69d2b1f0ba4513bdc7612a41e")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "2821ea672a11147a70974d760a54e9bc")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "e5c6936240201064b15bcecf1816e8f4")
|
||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "8862c87496e2e8c375965e1277dee1c7")
|
||||
|
||||
function(download_win_ffmpeg script_var)
|
||||
|
|
|
|||
22
3rdparty/ippicv/ippicv.cmake
vendored
22
3rdparty/ippicv/ippicv.cmake
vendored
|
|
@ -2,7 +2,7 @@ function(download_ippicv root_var)
|
|||
set(${root_var} "" PARENT_SCOPE)
|
||||
|
||||
# Commit SHA in the opencv_3rdparty repo
|
||||
set(IPPICV_COMMIT "d1cbea44d326eb0421fedcdd16de4630fd8c7ed0")
|
||||
set(IPPICV_COMMIT "c934a2a15a6df020446ac3dfa07e3acf72b63a8f")
|
||||
# Define actual ICV versions
|
||||
if(APPLE)
|
||||
set(IPPICV_COMMIT "0cc4aa06bf2bef4b05d237c69a5a96b9cd0cb85a")
|
||||
|
|
@ -14,19 +14,25 @@ function(download_ippicv root_var)
|
|||
set(OPENCV_ICV_PLATFORM "linux")
|
||||
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_lnx")
|
||||
if(X86_64)
|
||||
set(OPENCV_ICV_NAME "ippicv_2022.0.0_lnx_intel64_20240904_general.tgz")
|
||||
set(OPENCV_ICV_HASH "63717ee0f918ad72fb5a737992a206d1")
|
||||
set(OPENCV_ICV_NAME "ippicv_2022.2.0_lnx_intel64_20250730_general.tgz")
|
||||
set(OPENCV_ICV_HASH "55d18247d8ef707f009b94f69d77b948")
|
||||
else()
|
||||
set(IPPICV_COMMIT "7f55c0c26be418d494615afca15218566775c725")
|
||||
set(OPENCV_ICV_NAME "ippicv_2021.12.0_lnx_ia32_20240425_general.tgz")
|
||||
set(OPENCV_ICV_HASH "85ffa2b9ed7802b93c23fa27b0097d36")
|
||||
if(ANDROID)
|
||||
set(IPPICV_COMMIT "c7c6d527dde5fee7cb914ee9e4e20f7436aab3a1")
|
||||
set(OPENCV_ICV_NAME "ippicv_2021.10.1_lnx_ia32_20231206_general.tgz")
|
||||
set(OPENCV_ICV_HASH "d9510f3ce08f6074aac472a5c19a3b53")
|
||||
else()
|
||||
set(IPPICV_COMMIT "7f55c0c26be418d494615afca15218566775c725")
|
||||
set(OPENCV_ICV_NAME "ippicv_2021.12.0_lnx_ia32_20240425_general.tgz")
|
||||
set(OPENCV_ICV_HASH "85ffa2b9ed7802b93c23fa27b0097d36")
|
||||
endif()
|
||||
endif()
|
||||
elseif(WIN32 AND NOT ARM)
|
||||
set(OPENCV_ICV_PLATFORM "windows")
|
||||
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_win")
|
||||
if(X86_64)
|
||||
set(OPENCV_ICV_NAME "ippicv_2022.0.0_win_intel64_20240904_general.zip")
|
||||
set(OPENCV_ICV_HASH "3a6eca7cc3bce7159eb1443c6fca4e31")
|
||||
set(OPENCV_ICV_NAME "ippicv_2022.2.0_win_intel64_20250730_general.zip")
|
||||
set(OPENCV_ICV_HASH "7c0973976ab0716bc33f03a76a50017f")
|
||||
else()
|
||||
set(IPPICV_COMMIT "7f55c0c26be418d494615afca15218566775c725")
|
||||
set(OPENCV_ICV_NAME "ippicv_2021.12.0_win_ia32_20240425_general.zip")
|
||||
|
|
|
|||
33
3rdparty/libpng/CHANGES
vendored
33
3rdparty/libpng/CHANGES
vendored
|
|
@ -6196,6 +6196,39 @@ Version 1.6.43 [February 23, 2024]
|
|||
consistency verification and text linting.
|
||||
Added version consistency verification to pngtest.c also.
|
||||
|
||||
Version 1.6.44 [September 12, 2024]
|
||||
Hardened calculations in chroma handling to prevent overflows, and
|
||||
relaxed a constraint in cHRM validation to accomodate the standard
|
||||
ACES AP1 set of color primaries.
|
||||
(Contributed by John Bowler)
|
||||
Removed the ASM implementation of ARM Neon optimizations and updated
|
||||
the build accordingly. Only the remaining C implementation shall be
|
||||
used from now on, thus ensuring the support of the PAC/BTI security
|
||||
features on ARM64.
|
||||
(Contributed by Ross Burton and John Bowler)
|
||||
Fixed the pickup of the PNG_HARDWARE_OPTIMIZATIONS option in the
|
||||
CMake build on FreeBSD/amd64. This is an important performance fix
|
||||
on this platform.
|
||||
Applied various fixes and improvements to the CMake build.
|
||||
(Contributed by Eric Riff, Benjamin Buch and Erik Scholz)
|
||||
Added fuzzing targets for the simplified read API.
|
||||
(Contributed by Mikhail Khachayants)
|
||||
Fixed a build error involving pngtest.c under a custom config.
|
||||
This was a regression introduced in a code cleanup in libpng-1.6.43.
|
||||
(Contributed by Ben Wagner)
|
||||
Fixed and improved the config files for AppVeyor CI and Travis CI.
|
||||
|
||||
Version 1.6.45 [January 7, 2025]
|
||||
Added support for the cICP chunk.
|
||||
(Contributed by Lucas Chollet and John Bowler)
|
||||
Adjusted and improved various checks in colorspace calculations.
|
||||
(Contributed by John Bowler)
|
||||
Rearranged the write order of colorspace chunks for better conformance
|
||||
with the PNG v3 draft specification.
|
||||
(Contributed by John Bowler)
|
||||
Raised the minimum required CMake version from 3.6 to 3.14.
|
||||
Forked off a development branch for libpng version 1.8.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
|
||||
Subscription is required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
|
|
|
|||
8
3rdparty/libpng/CMakeLists.txt
vendored
8
3rdparty/libpng/CMakeLists.txt
vendored
|
|
@ -55,8 +55,12 @@ if(TARGET_ARCH MATCHES "^(ARM|arm|aarch)")
|
|||
elseif(NOT PNG_ARM_NEON STREQUAL "off")
|
||||
list(APPEND lib_srcs arm/arm_init.c arm/filter_neon_intrinsics.c arm/palette_neon_intrinsics.c)
|
||||
if(NOT MSVC)
|
||||
enable_language(ASM)
|
||||
list(APPEND lib_srcs arm/filter_neon.S)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
|
||||
message(STATUS "Skipping arm/filter_neon.S on QNX")
|
||||
else()
|
||||
enable_language(ASM)
|
||||
list(APPEND lib_srcs arm/filter_neon.S)
|
||||
endif()
|
||||
endif()
|
||||
if(PNG_ARM_NEON STREQUAL "on")
|
||||
add_definitions(-DPNG_ARM_NEON_OPT=2)
|
||||
|
|
|
|||
4
3rdparty/libpng/LICENSE
vendored
4
3rdparty/libpng/LICENSE
vendored
|
|
@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
|||
PNG Reference Library License version 2
|
||||
---------------------------------------
|
||||
|
||||
* Copyright (c) 1995-2024 The PNG Reference Library Authors.
|
||||
* Copyright (c) 2018-2024 Cosmin Truta.
|
||||
* Copyright (c) 1995-2025 The PNG Reference Library Authors.
|
||||
* Copyright (c) 2018-2025 Cosmin Truta.
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||
* Copyright (c) 1996-1997 Andreas Dilger.
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
|
|
|||
4
3rdparty/libpng/README
vendored
4
3rdparty/libpng/README
vendored
|
|
@ -1,4 +1,4 @@
|
|||
README for libpng version 1.6.43
|
||||
README for libpng version 1.6.45
|
||||
================================
|
||||
|
||||
See the note about version numbers near the top of `png.h`.
|
||||
|
|
@ -157,8 +157,6 @@ Files included in this distribution
|
|||
"PNG: The Definitive Guide" by Greg Roelofs,
|
||||
O'Reilly, 1999
|
||||
libtests/ => Test programs
|
||||
oss-fuzz/ => Files used by the OSS-Fuzz project for fuzz-testing
|
||||
libpng
|
||||
pngexif/ => Program to inspect the EXIF information in PNG files
|
||||
pngminim/ => Minimal decoder, encoder, and progressive decoder
|
||||
programs demonstrating the use of pngusr.dfa
|
||||
|
|
|
|||
1
3rdparty/libpng/arm/arm_init.c
vendored
1
3rdparty/libpng/arm/arm_init.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* arm_init.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
|
|
|
|||
267
3rdparty/libpng/arm/filter_neon.S
vendored
267
3rdparty/libpng/arm/filter_neon.S
vendored
|
|
@ -1,253 +1,60 @@
|
|||
|
||||
/* filter_neon.S - NEON optimised filter functions
|
||||
/* filter_neon.S - placeholder file
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2014,2017 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Copyright (c) 2024 Cosmin Truta
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
/* IMPORTANT NOTE:
|
||||
*
|
||||
* Historically, the hand-coded assembler implementation of Neon optimizations
|
||||
* in this module had not been in sync with the intrinsics-based implementation
|
||||
* in filter_neon_intrinsics.c and palette_neon_intrinsics.c, at least since
|
||||
* the introduction of riffled palette optimizations. Moreover, the assembler
|
||||
* code used to work on 32-bit ARM only, and it caused problems, even if empty,
|
||||
* on 64-bit ARM.
|
||||
*
|
||||
* All references to this module from our internal build scripts and projects
|
||||
* have been removed.
|
||||
*
|
||||
* For the external projects that might still expect this module to be present,
|
||||
* we leave this stub in place, for the remaining lifetime of libpng-1.6.x.
|
||||
* Everything should continue to function normally, as long as there are no
|
||||
* deliberate attempts to use the old hand-made assembler code. A build error
|
||||
* will be raised otherwise.
|
||||
*/
|
||||
|
||||
/* This is required to get the symbol renames, which are #defines, and the
|
||||
* definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION.
|
||||
*/
|
||||
#define PNG_VERSION_INFO_ONLY
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
/* Assembler NEON support - only works for 32-bit ARM (i.e. it does not work for
|
||||
* ARM64). The code in arm/filter_neon_intrinsics.c supports ARM64, however it
|
||||
* only works if -mfpu=neon is specified on the GCC command line. See pngpriv.h
|
||||
* for the logic which sets PNG_USE_ARM_NEON_ASM:
|
||||
*/
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */
|
||||
|
||||
#if PNG_ARM_NEON_OPT > 0
|
||||
|
||||
#ifdef __ELF__
|
||||
# define ELF
|
||||
#if defined(__clang__)
|
||||
#define GNUC_VERSION 0 /* not gcc, although it might pretend to be */
|
||||
#elif defined(__GNUC__)
|
||||
#define GNUC_MAJOR (__GNUC__ + 0)
|
||||
#define GNUC_MINOR (__GNUC_MINOR__ + 0)
|
||||
#define GNUC_PATCHLEVEL (__GNUC_PATCHLEVEL__ + 0)
|
||||
#define GNUC_VERSION (GNUC_MAJOR * 10000 + GNUC_MINOR * 100 + GNUC_PATCHLEVEL)
|
||||
#else
|
||||
# define ELF @
|
||||
#define GNUC_VERSION 0 /* not gcc */
|
||||
#endif
|
||||
|
||||
.arch armv7-a
|
||||
.fpu neon
|
||||
#if (GNUC_VERSION > 0) && (GNUC_VERSION < 40300)
|
||||
#error "PNG_ARM_NEON is not supported with gcc versions earlier than 4.3.0"
|
||||
#elif GNUC_VERSION == 40504
|
||||
#error "PNG_ARM_NEON is not supported with gcc version 4.5.4"
|
||||
#else
|
||||
#error "Please use 'arm/*_neon_intrinsics.c' for PNG_ARM_NEON support"
|
||||
#endif
|
||||
|
||||
.macro func name, export=0
|
||||
.macro endfunc
|
||||
ELF .size \name, . - \name
|
||||
.endfunc
|
||||
.purgem endfunc
|
||||
.endm
|
||||
.text
|
||||
|
||||
/* Explicitly specifying alignment here because some versions of
|
||||
* GAS don't align code correctly. This is harmless in correctly
|
||||
* written versions of GAS.
|
||||
*/
|
||||
.align 2
|
||||
|
||||
.if \export
|
||||
.global \name
|
||||
.endif
|
||||
ELF .type \name, STT_FUNC
|
||||
.func \name
|
||||
\name:
|
||||
.endm
|
||||
|
||||
func png_read_filter_row_sub4_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vadd.u8 d0, d3, d4
|
||||
vadd.u8 d1, d0, d5
|
||||
vadd.u8 d2, d1, d6
|
||||
vadd.u8 d3, d2, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r3, r3, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_sub3_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
mov r0, r1
|
||||
mov r2, #3
|
||||
mov r12, #12
|
||||
vld1.8 {q11}, [r0], r12
|
||||
1:
|
||||
vext.8 d5, d22, d23, #3
|
||||
vadd.u8 d0, d3, d22
|
||||
vext.8 d6, d22, d23, #6
|
||||
vadd.u8 d1, d0, d5
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], r12
|
||||
vst1.32 {d0[0]}, [r1,:32], r2
|
||||
vadd.u8 d2, d1, d6
|
||||
vst1.32 {d1[0]}, [r1], r2
|
||||
vadd.u8 d3, d2, d7
|
||||
vst1.32 {d2[0]}, [r1], r2
|
||||
vst1.32 {d3[0]}, [r1], r2
|
||||
subs r3, r3, #12
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_up_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
1:
|
||||
vld1.8 {q0}, [r1,:128]
|
||||
vld1.8 {q1}, [r2,:128]!
|
||||
vadd.u8 q0, q0, q1
|
||||
vst1.8 {q0}, [r1,:128]!
|
||||
subs r3, r3, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_avg4_neon, export=1
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
|
||||
vhadd.u8 d0, d3, d16
|
||||
vadd.u8 d0, d0, d4
|
||||
vhadd.u8 d1, d0, d17
|
||||
vadd.u8 d1, d1, d5
|
||||
vhadd.u8 d2, d1, d18
|
||||
vadd.u8 d2, d2, d6
|
||||
vhadd.u8 d3, d2, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r12, r12, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_avg3_neon, export=1
|
||||
push {r4,lr}
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
mov r0, r1
|
||||
mov r4, #3
|
||||
mov lr, #12
|
||||
vld1.8 {q11}, [r0], lr
|
||||
1:
|
||||
vld1.8 {q10}, [r2], lr
|
||||
vext.8 d5, d22, d23, #3
|
||||
vhadd.u8 d0, d3, d20
|
||||
vext.8 d17, d20, d21, #3
|
||||
vadd.u8 d0, d0, d22
|
||||
vext.8 d6, d22, d23, #6
|
||||
vhadd.u8 d1, d0, d17
|
||||
vext.8 d18, d20, d21, #6
|
||||
vadd.u8 d1, d1, d5
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], lr
|
||||
vst1.32 {d0[0]}, [r1,:32], r4
|
||||
vhadd.u8 d2, d1, d18
|
||||
vst1.32 {d1[0]}, [r1], r4
|
||||
vext.8 d19, d21, d21, #1
|
||||
vadd.u8 d2, d2, d6
|
||||
vhadd.u8 d3, d2, d19
|
||||
vst1.32 {d2[0]}, [r1], r4
|
||||
vadd.u8 d3, d3, d7
|
||||
vst1.32 {d3[0]}, [r1], r4
|
||||
subs r12, r12, #12
|
||||
bgt 1b
|
||||
|
||||
pop {r4,pc}
|
||||
endfunc
|
||||
|
||||
.macro paeth rx, ra, rb, rc
|
||||
vaddl.u8 q12, \ra, \rb @ a + b
|
||||
vaddl.u8 q15, \rc, \rc @ 2*c
|
||||
vabdl.u8 q13, \rb, \rc @ pa
|
||||
vabdl.u8 q14, \ra, \rc @ pb
|
||||
vabd.u16 q15, q12, q15 @ pc
|
||||
vcle.u16 q12, q13, q14 @ pa <= pb
|
||||
vcle.u16 q13, q13, q15 @ pa <= pc
|
||||
vcle.u16 q14, q14, q15 @ pb <= pc
|
||||
vand q12, q12, q13 @ pa <= pb && pa <= pc
|
||||
vmovn.u16 d28, q14
|
||||
vmovn.u16 \rx, q12
|
||||
vbsl d28, \rb, \rc
|
||||
vbsl \rx, \ra, d28
|
||||
.endm
|
||||
|
||||
func png_read_filter_row_paeth4_neon, export=1
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
vmov.i8 d20, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
|
||||
paeth d0, d3, d16, d20
|
||||
vadd.u8 d0, d0, d4
|
||||
paeth d1, d0, d17, d16
|
||||
vadd.u8 d1, d1, d5
|
||||
paeth d2, d1, d18, d17
|
||||
vadd.u8 d2, d2, d6
|
||||
paeth d3, d2, d19, d18
|
||||
vmov d20, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r12, r12, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_paeth3_neon, export=1
|
||||
push {r4,lr}
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
vmov.i8 d4, #0
|
||||
mov r0, r1
|
||||
mov r4, #3
|
||||
mov lr, #12
|
||||
vld1.8 {q11}, [r0], lr
|
||||
1:
|
||||
vld1.8 {q10}, [r2], lr
|
||||
paeth d0, d3, d20, d4
|
||||
vext.8 d5, d22, d23, #3
|
||||
vadd.u8 d0, d0, d22
|
||||
vext.8 d17, d20, d21, #3
|
||||
paeth d1, d0, d17, d20
|
||||
vst1.32 {d0[0]}, [r1,:32], r4
|
||||
vext.8 d6, d22, d23, #6
|
||||
vadd.u8 d1, d1, d5
|
||||
vext.8 d18, d20, d21, #6
|
||||
paeth d2, d1, d18, d17
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], lr
|
||||
vst1.32 {d1[0]}, [r1], r4
|
||||
vadd.u8 d2, d2, d6
|
||||
vext.8 d19, d21, d21, #1
|
||||
paeth d3, d2, d19, d18
|
||||
vst1.32 {d2[0]}, [r1], r4
|
||||
vmov d4, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst1.32 {d3[0]}, [r1], r4
|
||||
subs r12, r12, #12
|
||||
bgt 1b
|
||||
|
||||
pop {r4,pc}
|
||||
endfunc
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 (assembler) */
|
||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 */
|
||||
#endif /* READ */
|
||||
|
|
|
|||
1
3rdparty/libpng/arm/filter_neon_intrinsics.c
vendored
1
3rdparty/libpng/arm/filter_neon_intrinsics.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* palette_neon_intrinsics.c - NEON optimised palette expansion functions
|
||||
*
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
|
|
@ -64,7 +63,7 @@ png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
|
|||
{
|
||||
png_uint_32 row_width = row_info->width;
|
||||
const png_uint_32 *riffled_palette =
|
||||
(const png_uint_32 *)png_ptr->riffled_palette;
|
||||
png_aligncastconst(png_const_uint_32p, png_ptr->riffled_palette);
|
||||
const png_uint_32 pixels_per_chunk = 4;
|
||||
png_uint_32 i;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* filter_sse2_intrinsics.c - SSE2 optimized filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
|
|
|
|||
1
3rdparty/libpng/intel/intel_init.c
vendored
1
3rdparty/libpng/intel/intel_init.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* intel_init.c - SSE2 optimized filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
|
|
|
|||
45
3rdparty/libpng/mips/filter_msa_intrinsics.c
vendored
45
3rdparty/libpng/mips/filter_msa_intrinsics.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* filter_msa_intrinsics.c - MSA optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
|
|
@ -47,7 +46,7 @@
|
|||
uint8_t *psrc_lw_m = (uint8_t *) (psrc); \
|
||||
uint32_t val_m; \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"lw %[val_m], %[psrc_lw_m] \n\t" \
|
||||
\
|
||||
: [val_m] "=r" (val_m) \
|
||||
|
|
@ -62,7 +61,7 @@
|
|||
uint8_t *pdst_sh_m = (uint8_t *) (pdst); \
|
||||
uint16_t val_m = (val); \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"sh %[val_m], %[pdst_sh_m] \n\t" \
|
||||
\
|
||||
: [pdst_sh_m] "=m" (*pdst_sh_m) \
|
||||
|
|
@ -75,7 +74,7 @@
|
|||
uint8_t *pdst_sw_m = (uint8_t *) (pdst); \
|
||||
uint32_t val_m = (val); \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"sw %[val_m], %[pdst_sw_m] \n\t" \
|
||||
\
|
||||
: [pdst_sw_m] "=m" (*pdst_sw_m) \
|
||||
|
|
@ -83,20 +82,20 @@
|
|||
); \
|
||||
}
|
||||
|
||||
#if (__mips == 64)
|
||||
#if __mips == 64
|
||||
#define SD(val, pdst) \
|
||||
{ \
|
||||
uint8_t *pdst_sd_m = (uint8_t *) (pdst); \
|
||||
uint64_t val_m = (val); \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"sd %[val_m], %[pdst_sd_m] \n\t" \
|
||||
\
|
||||
: [pdst_sd_m] "=m" (*pdst_sd_m) \
|
||||
: [val_m] "r" (val_m) \
|
||||
); \
|
||||
}
|
||||
#else
|
||||
#else
|
||||
#define SD(val, pdst) \
|
||||
{ \
|
||||
uint8_t *pdst_sd_m = (uint8_t *) (pdst); \
|
||||
|
|
@ -108,17 +107,17 @@
|
|||
SW(val0_m, pdst_sd_m); \
|
||||
SW(val1_m, pdst_sd_m + 4); \
|
||||
}
|
||||
#endif
|
||||
#endif /* __mips == 64 */
|
||||
#else
|
||||
#define MSA_SRLI_B(a, b) (a >> b)
|
||||
|
||||
#if (__mips_isa_rev >= 6)
|
||||
#if __mips_isa_rev >= 6
|
||||
#define LW(psrc) \
|
||||
( { \
|
||||
uint8_t *psrc_lw_m = (uint8_t *) (psrc); \
|
||||
uint32_t val_m; \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"lw %[val_m], %[psrc_lw_m] \n\t" \
|
||||
\
|
||||
: [val_m] "=r" (val_m) \
|
||||
|
|
@ -133,7 +132,7 @@
|
|||
uint8_t *pdst_sh_m = (uint8_t *) (pdst); \
|
||||
uint16_t val_m = (val); \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"sh %[val_m], %[pdst_sh_m] \n\t" \
|
||||
\
|
||||
: [pdst_sh_m] "=m" (*pdst_sh_m) \
|
||||
|
|
@ -146,7 +145,7 @@
|
|||
uint8_t *pdst_sw_m = (uint8_t *) (pdst); \
|
||||
uint32_t val_m = (val); \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"sw %[val_m], %[pdst_sw_m] \n\t" \
|
||||
\
|
||||
: [pdst_sw_m] "=m" (*pdst_sw_m) \
|
||||
|
|
@ -154,20 +153,20 @@
|
|||
); \
|
||||
}
|
||||
|
||||
#if (__mips == 64)
|
||||
#if __mips == 64
|
||||
#define SD(val, pdst) \
|
||||
{ \
|
||||
uint8_t *pdst_sd_m = (uint8_t *) (pdst); \
|
||||
uint64_t val_m = (val); \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"sd %[val_m], %[pdst_sd_m] \n\t" \
|
||||
\
|
||||
: [pdst_sd_m] "=m" (*pdst_sd_m) \
|
||||
: [val_m] "r" (val_m) \
|
||||
); \
|
||||
}
|
||||
#else
|
||||
#else
|
||||
#define SD(val, pdst) \
|
||||
{ \
|
||||
uint8_t *pdst_sd_m = (uint8_t *) (pdst); \
|
||||
|
|
@ -179,14 +178,14 @@
|
|||
SW(val0_m, pdst_sd_m); \
|
||||
SW(val1_m, pdst_sd_m + 4); \
|
||||
}
|
||||
#endif
|
||||
#else // !(__mips_isa_rev >= 6)
|
||||
#endif /* __mips == 64 */
|
||||
#else
|
||||
#define LW(psrc) \
|
||||
( { \
|
||||
uint8_t *psrc_lw_m = (uint8_t *) (psrc); \
|
||||
uint32_t val_m; \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"ulw %[val_m], %[psrc_lw_m] \n\t" \
|
||||
\
|
||||
: [val_m] "=r" (val_m) \
|
||||
|
|
@ -201,7 +200,7 @@
|
|||
uint8_t *pdst_sh_m = (uint8_t *) (pdst); \
|
||||
uint16_t val_m = (val); \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"ush %[val_m], %[pdst_sh_m] \n\t" \
|
||||
\
|
||||
: [pdst_sh_m] "=m" (*pdst_sh_m) \
|
||||
|
|
@ -214,7 +213,7 @@
|
|||
uint8_t *pdst_sw_m = (uint8_t *) (pdst); \
|
||||
uint32_t val_m = (val); \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"usw %[val_m], %[pdst_sw_m] \n\t" \
|
||||
\
|
||||
: [pdst_sw_m] "=m" (*pdst_sw_m) \
|
||||
|
|
@ -222,7 +221,7 @@
|
|||
); \
|
||||
}
|
||||
|
||||
#define SD(val, pdst) \
|
||||
#define SD(val, pdst) \
|
||||
{ \
|
||||
uint8_t *pdst_sd_m = (uint8_t *) (pdst); \
|
||||
uint32_t val0_m, val1_m; \
|
||||
|
|
@ -238,14 +237,14 @@
|
|||
{ \
|
||||
uint8_t *pdst_m = (uint8_t *) (pdst); \
|
||||
\
|
||||
asm volatile ( \
|
||||
__asm__ volatile ( \
|
||||
"usw $0, %[pdst_m] \n\t" \
|
||||
\
|
||||
: [pdst_m] "=m" (*pdst_m) \
|
||||
: \
|
||||
); \
|
||||
}
|
||||
#endif // (__mips_isa_rev >= 6)
|
||||
#endif /* __mips_isa_rev >= 6 */
|
||||
#endif
|
||||
|
||||
#define LD_B(RTYPE, psrc) *((RTYPE *) (psrc))
|
||||
|
|
|
|||
1
3rdparty/libpng/mips/mips_init.c
vendored
1
3rdparty/libpng/mips/mips_init.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* mips_init.c - MSA optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
|
|
|
|||
268
3rdparty/libpng/png.c
vendored
268
3rdparty/libpng/png.c
vendored
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
* Copyright (c) 2018-2025 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
|
@ -14,7 +13,7 @@
|
|||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_43 Your_png_h_is_not_version_1_6_43;
|
||||
typedef png_libpng_version_1_6_45 Your_png_h_is_not_version_1_6_45;
|
||||
|
||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||
* of the PNG file signature. If the PNG data is embedded into another
|
||||
|
|
@ -794,8 +793,8 @@ png_get_copyright(png_const_structrp png_ptr)
|
|||
return PNG_STRING_COPYRIGHT
|
||||
#else
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.43" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 2018-2024 Cosmin Truta" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.45" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
|
||||
PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
|
|
@ -1203,6 +1202,68 @@ png_colorspace_sync(png_const_structrp png_ptr, png_inforp info_ptr)
|
|||
#endif /* GAMMA */
|
||||
|
||||
#ifdef PNG_COLORSPACE_SUPPORTED
|
||||
static png_int_32
|
||||
png_fp_add(png_int_32 addend0, png_int_32 addend1, int *error)
|
||||
{
|
||||
/* Safely add two fixed point values setting an error flag and returning 0.5
|
||||
* on overflow.
|
||||
* IMPLEMENTATION NOTE: ANSI requires signed overflow not to occur, therefore
|
||||
* relying on addition of two positive values producing a negative one is not
|
||||
* safe.
|
||||
*/
|
||||
if (addend0 > 0)
|
||||
{
|
||||
if (0x7fffffff - addend0 >= addend1)
|
||||
return addend0+addend1;
|
||||
}
|
||||
else if (addend0 < 0)
|
||||
{
|
||||
if (-0x7fffffff - addend0 <= addend1)
|
||||
return addend0+addend1;
|
||||
}
|
||||
else
|
||||
return addend1;
|
||||
|
||||
*error = 1;
|
||||
return PNG_FP_1/2;
|
||||
}
|
||||
|
||||
static png_int_32
|
||||
png_fp_sub(png_int_32 addend0, png_int_32 addend1, int *error)
|
||||
{
|
||||
/* As above but calculate addend0-addend1. */
|
||||
if (addend1 > 0)
|
||||
{
|
||||
if (-0x7fffffff + addend1 <= addend0)
|
||||
return addend0-addend1;
|
||||
}
|
||||
else if (addend1 < 0)
|
||||
{
|
||||
if (0x7fffffff + addend1 >= addend0)
|
||||
return addend0-addend1;
|
||||
}
|
||||
else
|
||||
return addend0;
|
||||
|
||||
*error = 1;
|
||||
return PNG_FP_1/2;
|
||||
}
|
||||
|
||||
static int
|
||||
png_safe_add(png_int_32 *addend0_and_result, png_int_32 addend1,
|
||||
png_int_32 addend2)
|
||||
{
|
||||
/* Safely add three integers. Returns 0 on success, 1 on overflow. Does not
|
||||
* set the result on overflow.
|
||||
*/
|
||||
int error = 0;
|
||||
int result = png_fp_add(*addend0_and_result,
|
||||
png_fp_add(addend1, addend2, &error),
|
||||
&error);
|
||||
if (!error) *addend0_and_result = result;
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Added at libpng-1.5.5 to support read and write of true CIEXYZ values for
|
||||
* cHRM, as opposed to using chromaticities. These internal APIs return
|
||||
* non-zero on a parameter error. The X, Y and Z values are required to be
|
||||
|
|
@ -1211,38 +1272,60 @@ png_colorspace_sync(png_const_structrp png_ptr, png_inforp info_ptr)
|
|||
static int
|
||||
png_xy_from_XYZ(png_xy *xy, const png_XYZ *XYZ)
|
||||
{
|
||||
png_int_32 d, dwhite, whiteX, whiteY;
|
||||
png_int_32 d, dred, dgreen, dblue, dwhite, whiteX, whiteY;
|
||||
|
||||
d = XYZ->red_X + XYZ->red_Y + XYZ->red_Z;
|
||||
if (png_muldiv(&xy->redx, XYZ->red_X, PNG_FP_1, d) == 0)
|
||||
/* 'd' in each of the blocks below is just X+Y+Z for each component,
|
||||
* x, y and z are X,Y,Z/(X+Y+Z).
|
||||
*/
|
||||
d = XYZ->red_X;
|
||||
if (png_safe_add(&d, XYZ->red_Y, XYZ->red_Z))
|
||||
return 1;
|
||||
if (png_muldiv(&xy->redy, XYZ->red_Y, PNG_FP_1, d) == 0)
|
||||
dred = d;
|
||||
if (png_muldiv(&xy->redx, XYZ->red_X, PNG_FP_1, dred) == 0)
|
||||
return 1;
|
||||
if (png_muldiv(&xy->redy, XYZ->red_Y, PNG_FP_1, dred) == 0)
|
||||
return 1;
|
||||
|
||||
d = XYZ->green_X;
|
||||
if (png_safe_add(&d, XYZ->green_Y, XYZ->green_Z))
|
||||
return 1;
|
||||
dgreen = d;
|
||||
if (png_muldiv(&xy->greenx, XYZ->green_X, PNG_FP_1, dgreen) == 0)
|
||||
return 1;
|
||||
if (png_muldiv(&xy->greeny, XYZ->green_Y, PNG_FP_1, dgreen) == 0)
|
||||
return 1;
|
||||
|
||||
d = XYZ->blue_X;
|
||||
if (png_safe_add(&d, XYZ->blue_Y, XYZ->blue_Z))
|
||||
return 1;
|
||||
dblue = d;
|
||||
if (png_muldiv(&xy->bluex, XYZ->blue_X, PNG_FP_1, dblue) == 0)
|
||||
return 1;
|
||||
if (png_muldiv(&xy->bluey, XYZ->blue_Y, PNG_FP_1, dblue) == 0)
|
||||
return 1;
|
||||
|
||||
/* The reference white is simply the sum of the end-point (X,Y,Z) vectors so
|
||||
* the fillowing calculates (X+Y+Z) of the reference white (media white,
|
||||
* encoding white) itself:
|
||||
*/
|
||||
d = dblue;
|
||||
if (png_safe_add(&d, dred, dgreen))
|
||||
return 1;
|
||||
dwhite = d;
|
||||
whiteX = XYZ->red_X;
|
||||
whiteY = XYZ->red_Y;
|
||||
|
||||
d = XYZ->green_X + XYZ->green_Y + XYZ->green_Z;
|
||||
if (png_muldiv(&xy->greenx, XYZ->green_X, PNG_FP_1, d) == 0)
|
||||
return 1;
|
||||
if (png_muldiv(&xy->greeny, XYZ->green_Y, PNG_FP_1, d) == 0)
|
||||
return 1;
|
||||
dwhite += d;
|
||||
whiteX += XYZ->green_X;
|
||||
whiteY += XYZ->green_Y;
|
||||
|
||||
d = XYZ->blue_X + XYZ->blue_Y + XYZ->blue_Z;
|
||||
if (png_muldiv(&xy->bluex, XYZ->blue_X, PNG_FP_1, d) == 0)
|
||||
return 1;
|
||||
if (png_muldiv(&xy->bluey, XYZ->blue_Y, PNG_FP_1, d) == 0)
|
||||
return 1;
|
||||
dwhite += d;
|
||||
whiteX += XYZ->blue_X;
|
||||
whiteY += XYZ->blue_Y;
|
||||
|
||||
/* The reference white is simply the sum of the end-point (X,Y,Z) vectors,
|
||||
* thus:
|
||||
/* Find the white X,Y values from the sum of the red, green and blue X,Y
|
||||
* values.
|
||||
*/
|
||||
d = XYZ->red_X;
|
||||
if (png_safe_add(&d, XYZ->green_X, XYZ->blue_X))
|
||||
return 1;
|
||||
whiteX = d;
|
||||
|
||||
d = XYZ->red_Y;
|
||||
if (png_safe_add(&d, XYZ->green_Y, XYZ->blue_Y))
|
||||
return 1;
|
||||
whiteY = d;
|
||||
|
||||
if (png_muldiv(&xy->whitex, whiteX, PNG_FP_1, dwhite) == 0)
|
||||
return 1;
|
||||
if (png_muldiv(&xy->whitey, whiteY, PNG_FP_1, dwhite) == 0)
|
||||
|
|
@ -1261,15 +1344,24 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
|
|||
* have end points with 0 tristimulus values (these are impossible end
|
||||
* points, but they are used to cover the possible colors). We check
|
||||
* xy->whitey against 5, not 0, to avoid a possible integer overflow.
|
||||
*
|
||||
* The limits here will *not* accept ACES AP0, where bluey is -7700
|
||||
* (-0.0770) because the PNG spec itself requires the xy values to be
|
||||
* unsigned. whitey is also required to be 5 or more to avoid overflow.
|
||||
*
|
||||
* Instead the upper limits have been relaxed to accomodate ACES AP1 where
|
||||
* redz ends up as -600 (-0.006). ProPhotoRGB was already "in range."
|
||||
* The new limit accomodates the AP0 and AP1 ranges for z but not AP0 redy.
|
||||
*/
|
||||
if (xy->redx < 0 || xy->redx > PNG_FP_1) return 1;
|
||||
if (xy->redy < 0 || xy->redy > PNG_FP_1-xy->redx) return 1;
|
||||
if (xy->greenx < 0 || xy->greenx > PNG_FP_1) return 1;
|
||||
if (xy->greeny < 0 || xy->greeny > PNG_FP_1-xy->greenx) return 1;
|
||||
if (xy->bluex < 0 || xy->bluex > PNG_FP_1) return 1;
|
||||
if (xy->bluey < 0 || xy->bluey > PNG_FP_1-xy->bluex) return 1;
|
||||
if (xy->whitex < 0 || xy->whitex > PNG_FP_1) return 1;
|
||||
if (xy->whitey < 5 || xy->whitey > PNG_FP_1-xy->whitex) return 1;
|
||||
const png_fixed_point fpLimit = PNG_FP_1+(PNG_FP_1/10);
|
||||
if (xy->redx < 0 || xy->redx > fpLimit) return 1;
|
||||
if (xy->redy < 0 || xy->redy > fpLimit-xy->redx) return 1;
|
||||
if (xy->greenx < 0 || xy->greenx > fpLimit) return 1;
|
||||
if (xy->greeny < 0 || xy->greeny > fpLimit-xy->greenx) return 1;
|
||||
if (xy->bluex < 0 || xy->bluex > fpLimit) return 1;
|
||||
if (xy->bluey < 0 || xy->bluey > fpLimit-xy->bluex) return 1;
|
||||
if (xy->whitex < 0 || xy->whitex > fpLimit) return 1;
|
||||
if (xy->whitey < 5 || xy->whitey > fpLimit-xy->whitex) return 1;
|
||||
|
||||
/* The reverse calculation is more difficult because the original tristimulus
|
||||
* value had 9 independent values (red,green,blue)x(X,Y,Z) however only 8
|
||||
|
|
@ -1414,18 +1506,23 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
|
|||
* (green-x - blue-x)*(red-y - blue-y)-(green-y - blue-y)*(red-x - blue-x)
|
||||
*
|
||||
* Accuracy:
|
||||
* The input values have 5 decimal digits of accuracy. The values are all in
|
||||
* the range 0 < value < 1, so simple products are in the same range but may
|
||||
* need up to 10 decimal digits to preserve the original precision and avoid
|
||||
* underflow. Because we are using a 32-bit signed representation we cannot
|
||||
* match this; the best is a little over 9 decimal digits, less than 10.
|
||||
* The input values have 5 decimal digits of accuracy.
|
||||
*
|
||||
* In the previous implementation the values were all in the range 0 < value
|
||||
* < 1, so simple products are in the same range but may need up to 10
|
||||
* decimal digits to preserve the original precision and avoid underflow.
|
||||
* Because we are using a 32-bit signed representation we cannot match this;
|
||||
* the best is a little over 9 decimal digits, less than 10.
|
||||
*
|
||||
* This range has now been extended to allow values up to 1.1, or 110,000 in
|
||||
* fixed point.
|
||||
*
|
||||
* The approach used here is to preserve the maximum precision within the
|
||||
* signed representation. Because the red-scale calculation above uses the
|
||||
* difference between two products of values that must be in the range -1..+1
|
||||
* it is sufficient to divide the product by 7; ceil(100,000/32767*2). The
|
||||
* factor is irrelevant in the calculation because it is applied to both
|
||||
* numerator and denominator.
|
||||
* difference between two products of values that must be in the range
|
||||
* -1.1..+1.1 it is sufficient to divide the product by 8;
|
||||
* ceil(121,000/32767*2). The factor is irrelevant in the calculation
|
||||
* because it is applied to both numerator and denominator.
|
||||
*
|
||||
* Note that the values of the differences of the products of the
|
||||
* chromaticities in the above equations tend to be small, for example for
|
||||
|
|
@ -1447,49 +1544,61 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
|
|||
* Adobe Wide Gamut RGB
|
||||
* 0.258728243040113 0.724682314948566 0.016589442011321
|
||||
*/
|
||||
/* By the argument, above overflow should be impossible here. The return
|
||||
* value of 2 indicates an internal error to the caller.
|
||||
int error = 0;
|
||||
|
||||
/* By the argument above overflow should be impossible here, however the
|
||||
* code now simply returns a failure code. The xy subtracts in the arguments
|
||||
* to png_muldiv are *not* checked for overflow because the checks at the
|
||||
* start guarantee they are in the range 0..110000 and png_fixed_point is a
|
||||
* 32-bit signed number.
|
||||
*/
|
||||
if (png_muldiv(&left, xy->greenx-xy->bluex, xy->redy - xy->bluey, 7) == 0)
|
||||
return 2;
|
||||
if (png_muldiv(&right, xy->greeny-xy->bluey, xy->redx - xy->bluex, 7) == 0)
|
||||
return 2;
|
||||
denominator = left - right;
|
||||
if (png_muldiv(&left, xy->greenx-xy->bluex, xy->redy - xy->bluey, 8) == 0)
|
||||
return 1;
|
||||
if (png_muldiv(&right, xy->greeny-xy->bluey, xy->redx - xy->bluex, 8) == 0)
|
||||
return 1;
|
||||
denominator = png_fp_sub(left, right, &error);
|
||||
if (error) return 1;
|
||||
|
||||
/* Now find the red numerator. */
|
||||
if (png_muldiv(&left, xy->greenx-xy->bluex, xy->whitey-xy->bluey, 7) == 0)
|
||||
return 2;
|
||||
if (png_muldiv(&right, xy->greeny-xy->bluey, xy->whitex-xy->bluex, 7) == 0)
|
||||
return 2;
|
||||
if (png_muldiv(&left, xy->greenx-xy->bluex, xy->whitey-xy->bluey, 8) == 0)
|
||||
return 1;
|
||||
if (png_muldiv(&right, xy->greeny-xy->bluey, xy->whitex-xy->bluex, 8) == 0)
|
||||
return 1;
|
||||
|
||||
/* Overflow is possible here and it indicates an extreme set of PNG cHRM
|
||||
* chunk values. This calculation actually returns the reciprocal of the
|
||||
* scale value because this allows us to delay the multiplication of white-y
|
||||
* into the denominator, which tends to produce a small number.
|
||||
*/
|
||||
if (png_muldiv(&red_inverse, xy->whitey, denominator, left-right) == 0 ||
|
||||
if (png_muldiv(&red_inverse, xy->whitey, denominator,
|
||||
png_fp_sub(left, right, &error)) == 0 || error ||
|
||||
red_inverse <= xy->whitey /* r+g+b scales = white scale */)
|
||||
return 1;
|
||||
|
||||
/* Similarly for green_inverse: */
|
||||
if (png_muldiv(&left, xy->redy-xy->bluey, xy->whitex-xy->bluex, 7) == 0)
|
||||
return 2;
|
||||
if (png_muldiv(&right, xy->redx-xy->bluex, xy->whitey-xy->bluey, 7) == 0)
|
||||
return 2;
|
||||
if (png_muldiv(&green_inverse, xy->whitey, denominator, left-right) == 0 ||
|
||||
if (png_muldiv(&left, xy->redy-xy->bluey, xy->whitex-xy->bluex, 8) == 0)
|
||||
return 1;
|
||||
if (png_muldiv(&right, xy->redx-xy->bluex, xy->whitey-xy->bluey, 8) == 0)
|
||||
return 1;
|
||||
if (png_muldiv(&green_inverse, xy->whitey, denominator,
|
||||
png_fp_sub(left, right, &error)) == 0 || error ||
|
||||
green_inverse <= xy->whitey)
|
||||
return 1;
|
||||
|
||||
/* And the blue scale, the checks above guarantee this can't overflow but it
|
||||
* can still produce 0 for extreme cHRM values.
|
||||
*/
|
||||
blue_scale = png_reciprocal(xy->whitey) - png_reciprocal(red_inverse) -
|
||||
png_reciprocal(green_inverse);
|
||||
if (blue_scale <= 0)
|
||||
blue_scale = png_fp_sub(png_fp_sub(png_reciprocal(xy->whitey),
|
||||
png_reciprocal(red_inverse), &error),
|
||||
png_reciprocal(green_inverse), &error);
|
||||
if (error || blue_scale <= 0)
|
||||
return 1;
|
||||
|
||||
|
||||
/* And fill in the png_XYZ: */
|
||||
/* And fill in the png_XYZ. Again the subtracts are safe because of the
|
||||
* checks on the xy values at the start (the subtracts just calculate the
|
||||
* corresponding z values.)
|
||||
*/
|
||||
if (png_muldiv(&XYZ->red_X, xy->redx, PNG_FP_1, red_inverse) == 0)
|
||||
return 1;
|
||||
if (png_muldiv(&XYZ->red_Y, xy->redy, PNG_FP_1, red_inverse) == 0)
|
||||
|
|
@ -1520,25 +1629,14 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
|
|||
static int
|
||||
png_XYZ_normalize(png_XYZ *XYZ)
|
||||
{
|
||||
png_int_32 Y;
|
||||
png_int_32 Y, Ytemp;
|
||||
|
||||
if (XYZ->red_Y < 0 || XYZ->green_Y < 0 || XYZ->blue_Y < 0 ||
|
||||
XYZ->red_X < 0 || XYZ->green_X < 0 || XYZ->blue_X < 0 ||
|
||||
XYZ->red_Z < 0 || XYZ->green_Z < 0 || XYZ->blue_Z < 0)
|
||||
/* Normalize by scaling so the sum of the end-point Y values is PNG_FP_1. */
|
||||
Ytemp = XYZ->red_Y;
|
||||
if (png_safe_add(&Ytemp, XYZ->green_Y, XYZ->blue_Y))
|
||||
return 1;
|
||||
|
||||
/* Normalize by scaling so the sum of the end-point Y values is PNG_FP_1.
|
||||
* IMPLEMENTATION NOTE: ANSI requires signed overflow not to occur, therefore
|
||||
* relying on addition of two positive values producing a negative one is not
|
||||
* safe.
|
||||
*/
|
||||
Y = XYZ->red_Y;
|
||||
if (0x7fffffff - Y < XYZ->green_X)
|
||||
return 1;
|
||||
Y += XYZ->green_Y;
|
||||
if (0x7fffffff - Y < XYZ->blue_X)
|
||||
return 1;
|
||||
Y += XYZ->blue_Y;
|
||||
Y = Ytemp;
|
||||
|
||||
if (Y != PNG_FP_1)
|
||||
{
|
||||
|
|
|
|||
47
3rdparty/libpng/png.h
vendored
47
3rdparty/libpng/png.h
vendored
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.43
|
||||
* libpng version 1.6.45
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
* Copyright (c) 2018-2025 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
|
@ -15,7 +14,7 @@
|
|||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.6.35, July 2018:
|
||||
* Glenn Randers-Pehrson
|
||||
* libpng versions 1.6.36, December 2018, through 1.6.43, February 2024:
|
||||
* libpng versions 1.6.36, December 2018, through 1.6.45, January 2025:
|
||||
* Cosmin Truta
|
||||
* See also "Contributing Authors", below.
|
||||
*/
|
||||
|
|
@ -27,8 +26,8 @@
|
|||
* PNG Reference Library License version 2
|
||||
* ---------------------------------------
|
||||
*
|
||||
* * Copyright (c) 1995-2024 The PNG Reference Library Authors.
|
||||
* * Copyright (c) 2018-2024 Cosmin Truta.
|
||||
* * Copyright (c) 1995-2025 The PNG Reference Library Authors.
|
||||
* * Copyright (c) 2018-2025 Cosmin Truta.
|
||||
* * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||
* * Copyright (c) 1996-1997 Andreas Dilger.
|
||||
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
|
@ -239,7 +238,7 @@
|
|||
* ...
|
||||
* 1.5.30 15 10530 15.so.15.30[.0]
|
||||
* ...
|
||||
* 1.6.43 16 10643 16.so.16.43[.0]
|
||||
* 1.6.45 16 10645 16.so.16.45[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major and
|
||||
* minor numbers; the shared-library major version number will be used for
|
||||
|
|
@ -275,7 +274,7 @@
|
|||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.43"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.45"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
|
||||
|
||||
/* The versions of shared library builds should stay in sync, going forward */
|
||||
|
|
@ -286,18 +285,18 @@
|
|||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 6
|
||||
#define PNG_LIBPNG_VER_RELEASE 43
|
||||
#define PNG_LIBPNG_VER_RELEASE 45
|
||||
|
||||
/* This should be zero for a public release, or non-zero for a
|
||||
* development version.
|
||||
*/
|
||||
#define PNG_LIBPNG_VER_BUILD 0
|
||||
#define PNG_LIBPNG_VER_BUILD 0
|
||||
|
||||
/* Release Status */
|
||||
#define PNG_LIBPNG_BUILD_ALPHA 1
|
||||
#define PNG_LIBPNG_BUILD_BETA 2
|
||||
#define PNG_LIBPNG_BUILD_RC 3
|
||||
#define PNG_LIBPNG_BUILD_STABLE 4
|
||||
#define PNG_LIBPNG_BUILD_ALPHA 1
|
||||
#define PNG_LIBPNG_BUILD_BETA 2
|
||||
#define PNG_LIBPNG_BUILD_RC 3
|
||||
#define PNG_LIBPNG_BUILD_STABLE 4
|
||||
#define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
|
||||
|
||||
/* Release-Specific Flags */
|
||||
|
|
@ -317,7 +316,7 @@
|
|||
* From version 1.0.1 it is:
|
||||
* XXYYZZ, where XX=major, YY=minor, ZZ=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10643 /* 1.6.43 */
|
||||
#define PNG_LIBPNG_VER 10645 /* 1.6.45 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
|
|
@ -427,7 +426,7 @@ extern "C" {
|
|||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef char* png_libpng_version_1_6_43;
|
||||
typedef char* png_libpng_version_1_6_45;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
|
|
@ -745,6 +744,7 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
|
|||
#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
|
||||
#define PNG_INFO_cICP 0x20000U
|
||||
|
||||
/* This is used for the transformation routines, as some of them
|
||||
* change these values for the row. It also should enable using
|
||||
|
|
@ -824,7 +824,7 @@ typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp,
|
|||
* your compiler. This may be very difficult - try using a different compiler
|
||||
* to build the library!
|
||||
*/
|
||||
PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
|
||||
PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), (jmp_buf, int), typedef);
|
||||
#endif
|
||||
|
||||
/* Transform masks for the high-level interface */
|
||||
|
|
@ -1974,6 +1974,17 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
|
|||
png_fixed_point int_blue_Z))
|
||||
#endif
|
||||
|
||||
#ifdef PNG_cICP_SUPPORTED
|
||||
PNG_EXPORT(250, png_uint_32, png_get_cICP, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, png_bytep colour_primaries,
|
||||
png_bytep transfer_function, png_bytep matrix_coefficients,
|
||||
png_bytep video_full_range_flag));
|
||||
PNG_EXPORT(251, void, png_set_cICP, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, png_byte colour_primaries,
|
||||
png_byte transfer_function, png_byte matrix_coefficients,
|
||||
png_byte video_full_range_flag));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, png_bytep *exif));
|
||||
|
|
@ -3238,7 +3249,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
|
|||
* one to use is one more than this.)
|
||||
*/
|
||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||
PNG_EXPORT_LAST_ORDINAL(249);
|
||||
PNG_EXPORT_LAST_ORDINAL(251);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
11
3rdparty/libpng/pngconf.h
vendored
11
3rdparty/libpng/pngconf.h
vendored
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
/* pngconf.h - machine-configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.43
|
||||
* libpng version 1.6.45
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
* Copyright (c) 2018-2025 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
|
@ -88,7 +87,7 @@
|
|||
|
||||
/* The PNGARG macro was used in versions of libpng prior to 1.6.0 to protect
|
||||
* against legacy (pre ISOC90) compilers that did not understand function
|
||||
* prototypes. It is not required for modern C compilers.
|
||||
* prototypes. [Deprecated.]
|
||||
*/
|
||||
#ifndef PNGARG
|
||||
# define PNGARG(arglist) arglist
|
||||
|
|
@ -298,7 +297,7 @@
|
|||
|
||||
#ifndef PNG_EXPORTA
|
||||
# define PNG_EXPORTA(ordinal, type, name, args, attributes) \
|
||||
PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), PNGARG(args), \
|
||||
PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), args, \
|
||||
PNG_LINKAGE_API attributes)
|
||||
#endif
|
||||
|
||||
|
|
@ -316,7 +315,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef PNG_CALLBACK
|
||||
# define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args)
|
||||
# define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) args
|
||||
#endif
|
||||
|
||||
/* Support for compiler specific function attributes. These are used
|
||||
|
|
|
|||
1
3rdparty/libpng/pngdebug.h
vendored
1
3rdparty/libpng/pngdebug.h
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
|
|
|
|||
10
3rdparty/libpng/pngerror.c
vendored
10
3rdparty/libpng/pngerror.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
|
|
@ -20,13 +19,14 @@
|
|||
|
||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||
|
||||
static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
|
||||
png_const_charp error_message)),PNG_NORETURN);
|
||||
static PNG_FUNCTION(void /* PRIVATE */,
|
||||
png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
||||
PNG_NORETURN);
|
||||
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
static void /* PRIVATE */
|
||||
png_default_warning PNGARG((png_const_structrp png_ptr,
|
||||
png_const_charp warning_message));
|
||||
png_default_warning(png_const_structrp png_ptr,
|
||||
png_const_charp warning_message);
|
||||
#endif /* WARNINGS */
|
||||
|
||||
/* This function is called whenever there is a fatal error. This function
|
||||
|
|
|
|||
26
3rdparty/libpng/pngget.c
vendored
26
3rdparty/libpng/pngget.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
|
|
@ -785,6 +784,31 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_cICP_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_cICP(png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, png_bytep colour_primaries,
|
||||
png_bytep transfer_function, png_bytep matrix_coefficients,
|
||||
png_bytep video_full_range_flag)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "cICP");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_cICP) != 0 &&
|
||||
colour_primaries != NULL && transfer_function != NULL &&
|
||||
matrix_coefficients != NULL && video_full_range_flag != NULL)
|
||||
{
|
||||
*colour_primaries = info_ptr->cicp_colour_primaries;
|
||||
*transfer_function = info_ptr->cicp_transfer_function;
|
||||
*matrix_coefficients = info_ptr->cicp_matrix_coefficients;
|
||||
*video_full_range_flag = info_ptr->cicp_video_full_range_flag;
|
||||
return (PNG_INFO_cICP);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
|
|
|
|||
9
3rdparty/libpng/pnginfo.h
vendored
9
3rdparty/libpng/pnginfo.h
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pnginfo.h - header file for PNG reference library
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
|
|
@ -101,6 +100,14 @@ struct png_info_def
|
|||
png_colorspace colorspace;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_cICP_SUPPORTED
|
||||
/* cICP chunk data */
|
||||
png_byte cicp_colour_primaries;
|
||||
png_byte cicp_transfer_function;
|
||||
png_byte cicp_matrix_coefficients;
|
||||
png_byte cicp_video_full_range_flag;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_iCCP_SUPPORTED
|
||||
/* iCCP chunk data. */
|
||||
png_charp iccp_name; /* profile name */
|
||||
|
|
|
|||
12
3rdparty/libpng/pnglibconf.h
vendored
12
3rdparty/libpng/pnglibconf.h
vendored
|
|
@ -1,8 +1,8 @@
|
|||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* libpng version 1.6.37 */
|
||||
/* libpng version 1.6.45 */
|
||||
|
||||
/* Copyright (c) 2018-2019 Cosmin Truta */
|
||||
/* Copyright (c) 2018-2025 Cosmin Truta */
|
||||
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
|
||||
|
||||
/* This code is released under the libpng license. */
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
#define PNG_COLORSPACE_SUPPORTED
|
||||
#define PNG_CONSOLE_IO_SUPPORTED
|
||||
#define PNG_CONVERT_tIME_SUPPORTED
|
||||
/*#undef PNG_DISABLE_ADLER32_CHECK_SUPPORTED*/
|
||||
#define PNG_EASY_ACCESS_SUPPORTED
|
||||
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
|
||||
#define PNG_ERROR_TEXT_SUPPORTED
|
||||
|
|
@ -41,6 +42,10 @@
|
|||
#define PNG_INCH_CONVERSIONS_SUPPORTED
|
||||
#define PNG_INFO_IMAGE_SUPPORTED
|
||||
#define PNG_IO_STATE_SUPPORTED
|
||||
/*#undef PNG_MIPS_MMI_API_SUPPORTED*/
|
||||
/*#undef PNG_MIPS_MMI_CHECK_SUPPORTED*/
|
||||
/*#undef PNG_MIPS_MSA_API_SUPPORTED*/
|
||||
/*#undef PNG_MIPS_MSA_CHECK_SUPPORTED*/
|
||||
#define PNG_MNG_FEATURES_SUPPORTED
|
||||
#define PNG_POINTER_INDEXING_SUPPORTED
|
||||
/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/
|
||||
|
|
@ -83,6 +88,7 @@
|
|||
#define PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||
#define PNG_READ_bKGD_SUPPORTED
|
||||
#define PNG_READ_cHRM_SUPPORTED
|
||||
#define PNG_READ_cICP_SUPPORTED
|
||||
#define PNG_READ_eXIf_SUPPORTED
|
||||
#define PNG_READ_gAMA_SUPPORTED
|
||||
#define PNG_READ_hIST_SUPPORTED
|
||||
|
|
@ -153,6 +159,7 @@
|
|||
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
#define PNG_WRITE_bKGD_SUPPORTED
|
||||
#define PNG_WRITE_cHRM_SUPPORTED
|
||||
#define PNG_WRITE_cICP_SUPPORTED
|
||||
#define PNG_WRITE_eXIf_SUPPORTED
|
||||
#define PNG_WRITE_gAMA_SUPPORTED
|
||||
#define PNG_WRITE_hIST_SUPPORTED
|
||||
|
|
@ -171,6 +178,7 @@
|
|||
#define PNG_WRITE_zTXt_SUPPORTED
|
||||
#define PNG_bKGD_SUPPORTED
|
||||
#define PNG_cHRM_SUPPORTED
|
||||
#define PNG_cICP_SUPPORTED
|
||||
#define PNG_eXIf_SUPPORTED
|
||||
#define PNG_gAMA_SUPPORTED
|
||||
#define PNG_hIST_SUPPORTED
|
||||
|
|
|
|||
1
3rdparty/libpng/pngmem.c
vendored
1
3rdparty/libpng/pngmem.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
|
|
|
|||
45
3rdparty/libpng/pngpread.c
vendored
45
3rdparty/libpng/pngpread.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
|
|
@ -32,6 +31,21 @@ if (png_ptr->push_length + 4 > png_ptr->buffer_size) \
|
|||
if (png_ptr->buffer_size < N) \
|
||||
{ png_push_save_buffer(png_ptr); return; }
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* Arrays to facilitate interlacing - use pass (0 - 6) as index. */
|
||||
|
||||
/* Start of interlace block */
|
||||
static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
/* Offset to next interlace block */
|
||||
static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
/* Start of interlace block in the y direction */
|
||||
static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
|
||||
/* Offset to next interlace block in the y direction */
|
||||
static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
/* TODO: Move these arrays to a common utility module to avoid duplication. */
|
||||
#endif
|
||||
|
||||
void PNGAPI
|
||||
png_process_data(png_structrp png_ptr, png_inforp info_ptr,
|
||||
png_bytep buffer, size_t buffer_size)
|
||||
|
|
@ -294,6 +308,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef PNG_READ_cICP_SUPPORTED
|
||||
else if (png_ptr->chunk_name == png_cICP)
|
||||
{
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_cICP(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
else if (png_ptr->chunk_name == png_eXIf)
|
||||
|
|
@ -976,27 +998,6 @@ png_push_process_row(png_structrp png_ptr)
|
|||
void /* PRIVATE */
|
||||
png_read_push_finish_row(png_structrp png_ptr)
|
||||
{
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* Start of interlace block */
|
||||
static const png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
||||
|
||||
/* Offset to next interlace block */
|
||||
static const png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
/* Start of interlace block in the y direction */
|
||||
static const png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||
|
||||
/* Offset to next interlace block in the y direction */
|
||||
static const png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
/* Height of interlace block. This is not currently used - if you need
|
||||
* it, uncomment it here and in png.h
|
||||
static const png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
*/
|
||||
#endif
|
||||
|
||||
png_ptr->row_number++;
|
||||
if (png_ptr->row_number < png_ptr->num_rows)
|
||||
return;
|
||||
|
|
|
|||
54
3rdparty/libpng/pngpriv.h
vendored
54
3rdparty/libpng/pngpriv.h
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
|
|
@ -140,47 +139,6 @@
|
|||
* callbacks to do this.
|
||||
*/
|
||||
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon
|
||||
|
||||
/* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used
|
||||
* if possible - if __ARM_NEON__ is set and the compiler version is not known
|
||||
* to be broken. This is controlled by PNG_ARM_NEON_IMPLEMENTATION which can
|
||||
* be:
|
||||
*
|
||||
* 1 The intrinsics code (the default with __ARM_NEON__)
|
||||
* 2 The hand coded assembler (the default without __ARM_NEON__)
|
||||
*
|
||||
* It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however
|
||||
* this is *NOT* supported and may cease to work even after a minor revision
|
||||
* to libpng. It *is* valid to do this for testing purposes, e.g. speed
|
||||
* testing or a new compiler, but the results should be communicated to the
|
||||
* libpng implementation list for incorporation in the next minor release.
|
||||
*/
|
||||
# ifndef PNG_ARM_NEON_IMPLEMENTATION
|
||||
# if defined(__ARM_NEON__) || defined(__ARM_NEON)
|
||||
# if defined(__clang__)
|
||||
/* At present it is unknown by the libpng developers which versions
|
||||
* of clang support the intrinsics, however some or perhaps all
|
||||
* versions do not work with the assembler so this may be
|
||||
* irrelevant, so just use the default (do nothing here.)
|
||||
*/
|
||||
# elif defined(__GNUC__)
|
||||
/* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to
|
||||
* work, so if this *is* GCC, or G++, look for a version >4.5
|
||||
*/
|
||||
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
|
||||
# define PNG_ARM_NEON_IMPLEMENTATION 2
|
||||
# endif /* no GNUC support */
|
||||
# endif /* __GNUC__ */
|
||||
# else /* !defined __ARM_NEON__ */
|
||||
/* The 'intrinsics' code simply won't compile without this -mfpu=neon:
|
||||
*/
|
||||
# if !defined(__aarch64__) && !defined(_M_ARM64)
|
||||
/* The assembler code currently does not work on ARM64 */
|
||||
# define PNG_ARM_NEON_IMPLEMENTATION 2
|
||||
# endif /* __aarch64__ */
|
||||
# endif /* __ARM_NEON__ */
|
||||
# endif /* !PNG_ARM_NEON_IMPLEMENTATION */
|
||||
|
||||
# ifndef PNG_ARM_NEON_IMPLEMENTATION
|
||||
/* Use the intrinsics code by default. */
|
||||
# define PNG_ARM_NEON_IMPLEMENTATION 1
|
||||
|
|
@ -876,6 +834,7 @@
|
|||
#define png_PLTE PNG_U32( 80, 76, 84, 69)
|
||||
#define png_bKGD PNG_U32( 98, 75, 71, 68)
|
||||
#define png_cHRM PNG_U32( 99, 72, 82, 77)
|
||||
#define png_cICP PNG_U32( 99, 73, 67, 80)
|
||||
#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */
|
||||
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
|
||||
#define png_gAMA PNG_U32(103, 65, 77, 65)
|
||||
|
|
@ -1172,6 +1131,12 @@ PNG_INTERNAL_FUNCTION(void,png_write_cHRM_fixed,(png_structrp png_ptr,
|
|||
/* The xy value must have been previously validated */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_cICP_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_write_cICP,(png_structrp png_ptr,
|
||||
png_byte colour_primaries, png_byte transfer_function,
|
||||
png_byte matrix_coefficients, png_byte video_full_range_flag), PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_sRGB_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr,
|
||||
int intent),PNG_EMPTY);
|
||||
|
|
@ -1515,6 +1480,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr,
|
|||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_cICP_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_cICP,(png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
|
|
|
|||
13
3rdparty/libpng/pngread.c
vendored
13
3rdparty/libpng/pngread.c
vendored
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
* Copyright (c) 2018-2025 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
|
@ -175,6 +174,11 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
|
|||
png_handle_cHRM(png_ptr, info_ptr, length);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_cICP_SUPPORTED
|
||||
else if (chunk_name == png_cICP)
|
||||
png_handle_cICP(png_ptr, info_ptr, length);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
else if (chunk_name == png_eXIf)
|
||||
png_handle_eXIf(png_ptr, info_ptr, length);
|
||||
|
|
@ -852,6 +856,11 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
|
|||
png_handle_cHRM(png_ptr, info_ptr, length);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_cICP_SUPPORTED
|
||||
else if (chunk_name == png_cICP)
|
||||
png_handle_cICP(png_ptr, info_ptr, length);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
else if (chunk_name == png_eXIf)
|
||||
png_handle_eXIf(png_ptr, info_ptr, length);
|
||||
|
|
|
|||
1
3rdparty/libpng/pngrio.c
vendored
1
3rdparty/libpng/pngrio.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
|
|
|
|||
1
3rdparty/libpng/pngrtran.c
vendored
1
3rdparty/libpng/pngrtran.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
|
|
|
|||
89
3rdparty/libpng/pngrutil.c
vendored
89
3rdparty/libpng/pngrutil.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
|
|
@ -18,6 +17,21 @@
|
|||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* Arrays to facilitate interlacing - use pass (0 - 6) as index. */
|
||||
|
||||
/* Start of interlace block */
|
||||
static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
/* Offset to next interlace block */
|
||||
static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
/* Start of interlace block in the y direction */
|
||||
static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
|
||||
/* Offset to next interlace block in the y direction */
|
||||
static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
/* TODO: Move these arrays to a common utility module to avoid duplication. */
|
||||
#endif
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
|
||||
{
|
||||
|
|
@ -2032,6 +2046,47 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_cICP_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_handle_cICP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
{
|
||||
png_byte buf[4];
|
||||
|
||||
png_debug(1, "in png_handle_cICP");
|
||||
|
||||
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
|
||||
png_chunk_error(png_ptr, "missing IHDR");
|
||||
|
||||
else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "out of place");
|
||||
return;
|
||||
}
|
||||
|
||||
else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cICP) != 0)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "duplicate");
|
||||
return;
|
||||
}
|
||||
|
||||
else if (length != 4)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
png_crc_read(png_ptr, buf, 4);
|
||||
|
||||
if (png_crc_finish(png_ptr, 0) != 0)
|
||||
return;
|
||||
|
||||
png_set_cICP(png_ptr, info_ptr, buf[0], buf[1], buf[2], buf[3]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
|
|
@ -3684,10 +3739,6 @@ void /* PRIVATE */
|
|||
png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
png_uint_32 transformations /* Because these may affect the byte layout */)
|
||||
{
|
||||
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
/* Offset to next interlace block */
|
||||
static const unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
png_debug(1, "in png_do_read_interlace");
|
||||
if (row != NULL && row_info != NULL)
|
||||
{
|
||||
|
|
@ -4325,20 +4376,6 @@ png_read_finish_IDAT(png_structrp png_ptr)
|
|||
void /* PRIVATE */
|
||||
png_read_finish_row(png_structrp png_ptr)
|
||||
{
|
||||
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* Start of interlace block */
|
||||
static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
|
||||
/* Offset to next interlace block */
|
||||
static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
/* Start of interlace block in the y direction */
|
||||
static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
|
||||
|
||||
/* Offset to next interlace block in the y direction */
|
||||
static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
png_debug(1, "in png_read_finish_row");
|
||||
png_ptr->row_number++;
|
||||
if (png_ptr->row_number < png_ptr->num_rows)
|
||||
|
|
@ -4390,20 +4427,6 @@ png_read_finish_row(png_structrp png_ptr)
|
|||
void /* PRIVATE */
|
||||
png_read_start_row(png_structrp png_ptr)
|
||||
{
|
||||
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* Start of interlace block */
|
||||
static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
|
||||
/* Offset to next interlace block */
|
||||
static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
/* Start of interlace block in the y direction */
|
||||
static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
|
||||
|
||||
/* Offset to next interlace block in the y direction */
|
||||
static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
unsigned int max_pixel_depth;
|
||||
size_t row_bytes;
|
||||
|
||||
|
|
|
|||
30
3rdparty/libpng/pngset.c
vendored
30
3rdparty/libpng/pngset.c
vendored
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
* Copyright (c) 2018-2025 Cosmin Truta
|
||||
* Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
|
@ -134,6 +133,32 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
|
|||
|
||||
#endif /* cHRM */
|
||||
|
||||
#ifdef PNG_cICP_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_cICP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
png_byte colour_primaries, png_byte transfer_function,
|
||||
png_byte matrix_coefficients, png_byte video_full_range_flag)
|
||||
{
|
||||
png_debug1(1, "in %s storage function", "cICP");
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
info_ptr->cicp_colour_primaries = colour_primaries;
|
||||
info_ptr->cicp_transfer_function = transfer_function;
|
||||
info_ptr->cicp_matrix_coefficients = matrix_coefficients;
|
||||
info_ptr->cicp_video_full_range_flag = video_full_range_flag;
|
||||
|
||||
if (info_ptr->cicp_matrix_coefficients != 0)
|
||||
{
|
||||
png_warning(png_ptr, "Invalid cICP matrix coefficients");
|
||||
return;
|
||||
}
|
||||
|
||||
info_ptr->valid |= PNG_INFO_cICP;
|
||||
}
|
||||
#endif /* cICP */
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
|
|
@ -1395,6 +1420,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
|||
static const png_byte chunks_to_ignore[] = {
|
||||
98, 75, 71, 68, '\0', /* bKGD */
|
||||
99, 72, 82, 77, '\0', /* cHRM */
|
||||
99, 73, 67, 80, '\0', /* cICP */
|
||||
101, 88, 73, 102, '\0', /* eXIf */
|
||||
103, 65, 77, 65, '\0', /* gAMA */
|
||||
104, 73, 83, 84, '\0', /* hIST */
|
||||
|
|
|
|||
1
3rdparty/libpng/pngstruct.h
vendored
1
3rdparty/libpng/pngstruct.h
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngstruct.h - header file for PNG reference library
|
||||
*
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
|
|
|
|||
1
3rdparty/libpng/pngtrans.c
vendored
1
3rdparty/libpng/pngtrans.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
|
|
|
|||
1
3rdparty/libpng/pngwio.c
vendored
1
3rdparty/libpng/pngwio.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngwio.c - functions for data output
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
|
|
|
|||
85
3rdparty/libpng/pngwrite.c
vendored
85
3rdparty/libpng/pngwrite.c
vendored
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
* Copyright (c) 2018-2025 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
|
@ -128,29 +127,61 @@ png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
|
|||
* the application continues writing the PNG. So check the 'invalid'
|
||||
* flag here too.
|
||||
*/
|
||||
#ifdef PNG_GAMMA_SUPPORTED
|
||||
# ifdef PNG_WRITE_gAMA_SUPPORTED
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_gAMA) != 0 &&
|
||||
(info_ptr->valid & PNG_INFO_gAMA) != 0)
|
||||
png_write_gAMA_fixed(png_ptr, info_ptr->colorspace.gamma);
|
||||
# endif
|
||||
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
/* Write unknown chunks first; PNG v3 establishes a precedence order
|
||||
* for colourspace chunks. It is certain therefore that new
|
||||
* colourspace chunks will have a precedence and very likely it will be
|
||||
* higher than all known so far. Writing the unknown chunks here is
|
||||
* most likely to present the chunks in the most convenient order.
|
||||
*
|
||||
* FUTURE: maybe write chunks in the order the app calls png_set_chnk
|
||||
* to give the app control.
|
||||
*/
|
||||
write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_IHDR);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_sBIT_SUPPORTED
|
||||
/* PNG v3: a streaming app will need to see this before cICP because
|
||||
* the information is helpful in handling HLG encoding (which is
|
||||
* natively 10 bits but gets expanded to 16 in PNG.)
|
||||
*
|
||||
* The app shouldn't care about the order ideally, but it might have
|
||||
* no choice. In PNG v3, apps are allowed to reject PNGs where the
|
||||
* APNG chunks are out of order so it behooves libpng to be nice here.
|
||||
*/
|
||||
if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
|
||||
png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
|
||||
#endif
|
||||
|
||||
/* PNG v3: the July 2004 version of the TR introduced the concept of colour
|
||||
* space priority. As above it therefore behooves libpng to write the colour
|
||||
* space chunks in the priority order so that a streaming app need not buffer
|
||||
* them.
|
||||
*/
|
||||
#ifdef PNG_COLORSPACE_SUPPORTED
|
||||
/* Write only one of sRGB or an ICC profile. If a profile was supplied
|
||||
* and it matches one of the known sRGB ones issue a warning.
|
||||
# ifdef PNG_WRITE_cICP_SUPPORTED /* Priority 4 */
|
||||
if ((info_ptr->valid & PNG_INFO_cICP) != 0)
|
||||
{
|
||||
png_write_cICP(png_ptr,
|
||||
info_ptr->cicp_colour_primaries,
|
||||
info_ptr->cicp_transfer_function,
|
||||
info_ptr->cicp_matrix_coefficients,
|
||||
info_ptr->cicp_video_full_range_flag);
|
||||
}
|
||||
# endif
|
||||
|
||||
/* PNG v3 change: it is now permitted to write both sRGB and ICC profiles,
|
||||
* however because the libpng code auto-generates an sRGB for the
|
||||
* corresponding ICC profiles and because PNG v2 disallowed this we need
|
||||
* to only write one.
|
||||
*
|
||||
* Remove the PNG v2 warning about writing an sRGB ICC profile as well
|
||||
* because it's invalid with PNG v3.
|
||||
*/
|
||||
# ifdef PNG_WRITE_iCCP_SUPPORTED
|
||||
# ifdef PNG_WRITE_iCCP_SUPPORTED /* Priority 3 */
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
(info_ptr->valid & PNG_INFO_iCCP) != 0)
|
||||
{
|
||||
# ifdef PNG_WRITE_sRGB_SUPPORTED
|
||||
if ((info_ptr->valid & PNG_INFO_sRGB) != 0)
|
||||
png_app_warning(png_ptr,
|
||||
"profile matches sRGB but writing iCCP instead");
|
||||
# endif
|
||||
|
||||
png_write_iCCP(png_ptr, info_ptr->iccp_name,
|
||||
info_ptr->iccp_profile);
|
||||
}
|
||||
|
|
@ -159,20 +190,24 @@ png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
|
|||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef PNG_WRITE_sRGB_SUPPORTED
|
||||
# ifdef PNG_WRITE_sRGB_SUPPORTED /* Priority 2 */
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
(info_ptr->valid & PNG_INFO_sRGB) != 0)
|
||||
png_write_sRGB(png_ptr, info_ptr->colorspace.rendering_intent);
|
||||
# endif /* WRITE_sRGB */
|
||||
#endif /* COLORSPACE */
|
||||
|
||||
#ifdef PNG_WRITE_sBIT_SUPPORTED
|
||||
if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
|
||||
png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
|
||||
#ifdef PNG_GAMMA_SUPPORTED
|
||||
# ifdef PNG_WRITE_gAMA_SUPPORTED /* Priority 1 */
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_gAMA) != 0 &&
|
||||
(info_ptr->valid & PNG_INFO_gAMA) != 0)
|
||||
png_write_gAMA_fixed(png_ptr, info_ptr->colorspace.gamma);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_COLORSPACE_SUPPORTED
|
||||
# ifdef PNG_WRITE_cHRM_SUPPORTED
|
||||
# ifdef PNG_WRITE_cHRM_SUPPORTED /* Also priority 1 */
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0 &&
|
||||
(info_ptr->valid & PNG_INFO_cHRM) != 0)
|
||||
|
|
@ -180,10 +215,6 @@ png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_IHDR);
|
||||
#endif
|
||||
|
||||
png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1
3rdparty/libpng/pngwtran.c
vendored
1
3rdparty/libpng/pngwtran.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
|
|
|
|||
82
3rdparty/libpng/pngwutil.c
vendored
82
3rdparty/libpng/pngwutil.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Copyright (c) 2018-2024 Cosmin Truta
|
||||
|
|
@ -9,12 +8,30 @@
|
|||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
* This file contains routines that are only called from within
|
||||
* libpng itself during the course of writing an image.
|
||||
*/
|
||||
|
||||
#include "pngpriv.h"
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Arrays to facilitate interlacing - use pass (0 - 6) as index. */
|
||||
|
||||
/* Start of interlace block */
|
||||
static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
/* Offset to next interlace block */
|
||||
static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
/* Start of interlace block in the y direction */
|
||||
static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
|
||||
/* Offset to next interlace block in the y direction */
|
||||
static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
/* TODO: Move these arrays to a common utility module to avoid duplication. */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED
|
||||
/* Place a 32-bit number into a buffer in PNG byte order. We work
|
||||
* with unsigned numbers for convenience, although one supported
|
||||
|
|
@ -1471,6 +1488,29 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_cICP_SUPPORTED
|
||||
/* Write the cICP data */
|
||||
void /* PRIVATE */
|
||||
png_write_cICP(png_structrp png_ptr,
|
||||
png_byte colour_primaries, png_byte transfer_function,
|
||||
png_byte matrix_coefficients, png_byte video_full_range_flag)
|
||||
{
|
||||
png_byte buf[4];
|
||||
|
||||
png_debug(1, "in png_write_cICP");
|
||||
|
||||
png_write_chunk_header(png_ptr, png_cICP, 4);
|
||||
|
||||
buf[0] = colour_primaries;
|
||||
buf[1] = transfer_function;
|
||||
buf[2] = matrix_coefficients;
|
||||
buf[3] = video_full_range_flag;
|
||||
png_write_chunk_data(png_ptr, buf, 4);
|
||||
|
||||
png_write_chunk_end(png_ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_eXIf_SUPPORTED
|
||||
/* Write the Exif data */
|
||||
void /* PRIVATE */
|
||||
|
|
@ -1889,22 +1929,6 @@ png_write_tIME(png_structrp png_ptr, png_const_timep mod_time)
|
|||
void /* PRIVATE */
|
||||
png_write_start_row(png_structrp png_ptr)
|
||||
{
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* Start of interlace block */
|
||||
static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
|
||||
/* Offset to next interlace block */
|
||||
static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
/* Start of interlace block in the y direction */
|
||||
static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
|
||||
|
||||
/* Offset to next interlace block in the y direction */
|
||||
static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
#endif
|
||||
|
||||
png_alloc_size_t buf_size;
|
||||
int usr_pixel_depth;
|
||||
|
||||
|
|
@ -2004,22 +2028,6 @@ png_write_start_row(png_structrp png_ptr)
|
|||
void /* PRIVATE */
|
||||
png_write_finish_row(png_structrp png_ptr)
|
||||
{
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* Start of interlace block */
|
||||
static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
|
||||
/* Offset to next interlace block */
|
||||
static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
/* Start of interlace block in the y direction */
|
||||
static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
|
||||
|
||||
/* Offset to next interlace block in the y direction */
|
||||
static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
#endif
|
||||
|
||||
png_debug(1, "in png_write_finish_row");
|
||||
|
||||
/* Next row */
|
||||
|
|
@ -2095,14 +2103,6 @@ png_write_finish_row(png_structrp png_ptr)
|
|||
void /* PRIVATE */
|
||||
png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
{
|
||||
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* Start of interlace block */
|
||||
static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
|
||||
/* Offset to next interlace block */
|
||||
static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
png_debug(1, "in png_do_write_interlace");
|
||||
|
||||
/* We don't have to do anything on the last pass (6) */
|
||||
|
|
|
|||
1
3rdparty/libpng/powerpc/powerpc_init.c
vendored
1
3rdparty/libpng/powerpc/powerpc_init.c
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* powerpc_init.c - POWERPC optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
|
|
|
|||
6
3rdparty/libtiff/CMakeLists.txt
vendored
6
3rdparty/libtiff/CMakeLists.txt
vendored
|
|
@ -358,8 +358,8 @@ if(LIBLZMA_LIBRARIES)
|
|||
endif()
|
||||
|
||||
set(LIBTIFF_MAJOR_VERSION "4")
|
||||
set(LIBTIFF_MINOR_VERSION "6")
|
||||
set(LIBTIFF_MICRO_VERSION "0")
|
||||
set(LIBTIFF_MINOR_VERSION "7")
|
||||
set(LIBTIFF_MICRO_VERSION "1")
|
||||
set(LIBTIFF_VERSION "${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}")
|
||||
file(READ "RELEASE-DATE" LIBTIFF_RELEASE_DATE content)
|
||||
|
||||
|
|
@ -480,4 +480,4 @@ if(NOT BUILD_SHARED_LIBS)
|
|||
ocv_install_target(${TIFF_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
|
||||
endif()
|
||||
|
||||
ocv_install_3rdparty_licenses(libtiff COPYRIGHT)
|
||||
ocv_install_3rdparty_licenses(libtiff LICENSE.md)
|
||||
|
|
|
|||
21
3rdparty/libtiff/COPYRIGHT
vendored
21
3rdparty/libtiff/COPYRIGHT
vendored
|
|
@ -1,21 +0,0 @@
|
|||
Copyright (c) 1988-1997 Sam Leffler
|
||||
Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and
|
||||
its documentation for any purpose is hereby granted without fee, provided
|
||||
that (i) the above copyright notices and this permission notice appear in
|
||||
all copies of the software and related documentation, and (ii) the names of
|
||||
Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
publicity relating to the software without the specific, prior written
|
||||
permission of Sam Leffler and Silicon Graphics.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
OF THIS SOFTWARE.
|
||||
2920
3rdparty/libtiff/ChangeLog
vendored
2920
3rdparty/libtiff/ChangeLog
vendored
File diff suppressed because it is too large
Load Diff
49
3rdparty/libtiff/LICENSE.md
vendored
Normal file
49
3rdparty/libtiff/LICENSE.md
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# LibTIFF license
|
||||
|
||||
Copyright © 1988-1997 Sam Leffler\
|
||||
Copyright © 1991-1997 Silicon Graphics, Inc.
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and
|
||||
its documentation for any purpose is hereby granted without fee, provided
|
||||
that (i) the above copyright notices and this permission notice appear in
|
||||
all copies of the software and related documentation, and (ii) the names of
|
||||
Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
publicity relating to the software without the specific, prior written
|
||||
permission of Sam Leffler and Silicon Graphics.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
OF THIS SOFTWARE.
|
||||
|
||||
# Lempel-Ziv & Welch Compression (tif_lzw.c) license
|
||||
The code of tif_lzw.c is derived from the compress program whose code is
|
||||
derived from software contributed to Berkeley by James A. Woods,
|
||||
derived from original work by Spencer Thomas and Joseph Orost.
|
||||
|
||||
The original Berkeley copyright notice appears below in its entirety:
|
||||
|
||||
Copyright (c) 1985, 1986 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
James A. Woods, derived from original work by Spencer Thomas
|
||||
and Joseph Orost.
|
||||
|
||||
Redistribution and use in source and binary forms are permitted
|
||||
provided that the above copyright notice and this paragraph are
|
||||
duplicated in all such forms and that any documentation,
|
||||
advertising materials, and other materials related to such
|
||||
distribution and use acknowledge that the software was developed
|
||||
by the University of California, Berkeley. The name of the
|
||||
University may not be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
2
3rdparty/libtiff/RELEASE-DATE
vendored
2
3rdparty/libtiff/RELEASE-DATE
vendored
|
|
@ -1 +1 @@
|
|||
20230908
|
||||
20250911
|
||||
|
|
|
|||
52
3rdparty/libtiff/tif_aux.c
vendored
52
3rdparty/libtiff/tif_aux.c
vendored
|
|
@ -131,7 +131,10 @@ static int TIFFDefaultTransferFunction(TIFF *tif, TIFFDirectory *td)
|
|||
tmsize_t i, n, nbytes;
|
||||
|
||||
tf[0] = tf[1] = tf[2] = 0;
|
||||
if (td->td_bitspersample >= sizeof(tmsize_t) * 8 - 2)
|
||||
// Do not try to generate a default TransferFunction beyond 24 bits.
|
||||
// This otherwise leads to insane amounts, resulting in denial of service
|
||||
// See https://github.com/OSGeo/gdal/issues/10875
|
||||
if (td->td_bitspersample > 24)
|
||||
return 0;
|
||||
|
||||
n = ((tmsize_t)1) << td->td_bitspersample;
|
||||
|
|
@ -385,53 +388,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)
|
||||
|
|
|
|||
9
3rdparty/libtiff/tif_close.c
vendored
9
3rdparty/libtiff/tif_close.c
vendored
|
|
@ -48,7 +48,6 @@ void TIFFCleanup(TIFF *tif)
|
|||
*/
|
||||
if (tif->tif_mode != O_RDONLY)
|
||||
TIFFFlush(tif);
|
||||
(*tif->tif_cleanup)(tif);
|
||||
TIFFFreeDirectory(tif);
|
||||
|
||||
_TIFFCleanupIFDOffsetAndNumberMaps(tif);
|
||||
|
|
@ -110,6 +109,14 @@ 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
22
3rdparty/libtiff/tif_color.c
vendored
22
3rdparty/libtiff/tif_color.c
vendored
|
|
@ -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));
|
||||
|
|
|
|||
28
3rdparty/libtiff/tif_config.h.cmake.in
vendored
28
3rdparty/libtiff/tif_config.h.cmake.in
vendored
|
|
@ -40,6 +40,18 @@
|
|||
/* Define to 1 if you have the `getopt' function. */
|
||||
#cmakedefine HAVE_GETOPT 1
|
||||
|
||||
/* Define to 1 if you have the <GLUT/glut.h> header file. */
|
||||
#cmakedefine HAVE_GLUT_GLUT_H 1
|
||||
|
||||
/* Define to 1 if you have the <GL/glut.h> header file. */
|
||||
#cmakedefine HAVE_GL_GLUT_H 1
|
||||
|
||||
/* Define to 1 if you have the <GL/glu.h> header file. */
|
||||
#cmakedefine HAVE_GL_GLU_H 1
|
||||
|
||||
/* Define to 1 if you have the <GL/gl.h> header file. */
|
||||
#cmakedefine HAVE_GL_GL_H 1
|
||||
|
||||
/* Define to 1 if you have the <io.h> header file. */
|
||||
#cmakedefine HAVE_IO_H 1
|
||||
|
||||
|
|
@ -49,6 +61,12 @@
|
|||
/* Define to 1 if you have the `mmap' function. */
|
||||
#cmakedefine HAVE_MMAP 1
|
||||
|
||||
/* Define to 1 if you have the <OpenGL/glu.h> header file. */
|
||||
#cmakedefine HAVE_OPENGL_GLU_H 1
|
||||
|
||||
/* Define to 1 if you have the <OpenGL/gl.h> header file. */
|
||||
#cmakedefine HAVE_OPENGL_GL_H 1
|
||||
|
||||
/* Define to 1 if you have the `setmode' function. */
|
||||
#cmakedefine HAVE_SETMODE 1
|
||||
|
||||
|
|
@ -62,11 +80,17 @@
|
|||
#cmakedefine HAVE_UNISTD_H 1
|
||||
|
||||
/* 8/12 bit libjpeg dual mode enabled */
|
||||
#cmakedefine JPEG_DUAL_MODE_8_12 1 1
|
||||
#cmakedefine JPEG_DUAL_MODE_8_12 1
|
||||
|
||||
/* 8/12 bit dual mode JPEG built into libjpeg-turbo 3.0+ */
|
||||
#cmakedefine HAVE_JPEGTURBO_DUAL_MODE_8_12 1
|
||||
|
||||
/* Support LERC compression */
|
||||
#cmakedefine LERC_SUPPORT 1
|
||||
|
||||
/* Define to 1 when building a static libtiff with LERC enabled. */
|
||||
#cmakedefine LERC_STATIC
|
||||
|
||||
/* 12bit libjpeg primary include file with path */
|
||||
#define LIBJPEG_12_PATH "@LIBJPEG_12_PATH@"
|
||||
|
||||
|
|
@ -115,7 +139,7 @@
|
|||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
# undef WORDS_BIGENDIAN
|
||||
# cmakedefine WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
168
3rdparty/libtiff/tif_dir.c
vendored
168
3rdparty/libtiff/tif_dir.c
vendored
|
|
@ -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);
|
||||
|
|
@ -723,10 +723,9 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
{
|
||||
TIFFTagValue *new_customValues;
|
||||
|
||||
td->td_customValueCount++;
|
||||
new_customValues = (TIFFTagValue *)_TIFFreallocExt(
|
||||
tif, td->td_customValues,
|
||||
sizeof(TIFFTagValue) * td->td_customValueCount);
|
||||
sizeof(TIFFTagValue) * (td->td_customValueCount + 1));
|
||||
if (!new_customValues)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
|
|
@ -737,6 +736,7 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
goto end;
|
||||
}
|
||||
|
||||
td->td_customValueCount++;
|
||||
td->td_customValues = new_customValues;
|
||||
|
||||
tv = td->td_customValues + (td->td_customValueCount - 1);
|
||||
|
|
@ -748,8 +748,8 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
/*
|
||||
* Set custom value ... save a copy of the custom tag value.
|
||||
*/
|
||||
/*--: Rational2Double: For Rationals evaluate "set_field_type" to
|
||||
* determine internal storage size. */
|
||||
/*--: Rational2Double: For Rationals evaluate "set_get_field_type"
|
||||
* to determine internal storage size. */
|
||||
tv_size = TIFFFieldSetGetSize(fip);
|
||||
if (tv_size == 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,
|
||||
|
|
@ -843,7 +842,7 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
fip->field_writecount == TIFF_SPP || tv->count > 1)
|
||||
{
|
||||
/*--: Rational2Double: For Rationals tv_size is set above to
|
||||
* 4 or 8 according to fip->set_field_type! */
|
||||
* 4 or 8 according to fip->set_get_field_type! */
|
||||
_TIFFmemcpy(tv->value, va_arg(ap, void *),
|
||||
tv->count * tv_size);
|
||||
/* Test here for too big values for LONG8, SLONG8 in
|
||||
|
|
@ -978,7 +977,8 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
case TIFF_RATIONAL:
|
||||
case TIFF_SRATIONAL:
|
||||
/*-- Rational2Double: For Rationals tv_size is set
|
||||
* above to 4 or 8 according to fip->set_field_type!
|
||||
* above to 4 or 8 according to
|
||||
* fip->set_get_field_type!
|
||||
*/
|
||||
{
|
||||
if (tv_size == 8)
|
||||
|
|
@ -996,11 +996,11 @@ static int _TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
* default. */
|
||||
if (tv_size != 4)
|
||||
{
|
||||
TIFFErrorExtR(
|
||||
tif, module,
|
||||
"Rational2Double: .set_field_type "
|
||||
"in not 4 but %d",
|
||||
tv_size);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Rational2Double: "
|
||||
".set_get_field_type "
|
||||
"in not 4 but %d",
|
||||
tv_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1527,7 +1527,7 @@ static int _TIFFVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
case TIFF_SRATIONAL:
|
||||
{
|
||||
/*-- Rational2Double: For Rationals evaluate
|
||||
* "set_field_type" to determine internal
|
||||
* "set_get_field_type" to determine internal
|
||||
* storage size and return value size. */
|
||||
int tv_size = TIFFFieldSetGetSize(fip);
|
||||
if (tv_size == 8)
|
||||
|
|
@ -1545,11 +1545,11 @@ static int _TIFFVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
* default. */
|
||||
if (tv_size != 4)
|
||||
{
|
||||
TIFFErrorExtR(
|
||||
tif, "_TIFFVGetField",
|
||||
"Rational2Double: .set_field_type "
|
||||
"in not 4 but %d",
|
||||
tv_size);
|
||||
TIFFErrorExtR(tif, "_TIFFVGetField",
|
||||
"Rational2Double: "
|
||||
".set_get_field_type "
|
||||
"in not 4 but %d",
|
||||
tv_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1621,6 +1621,7 @@ void TIFFFreeDirectory(TIFF *tif)
|
|||
TIFFDirectory *td = &tif->tif_dir;
|
||||
int i;
|
||||
|
||||
(*tif->tif_cleanup)(tif);
|
||||
_TIFFmemset(td->td_fieldsset, 0, sizeof(td->td_fieldsset));
|
||||
CleanupField(td_sminsamplevalue);
|
||||
CleanupField(td_smaxsamplevalue);
|
||||
|
|
@ -1652,6 +1653,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 +1688,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);
|
||||
|
||||
/*
|
||||
|
|
@ -1848,7 +1865,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);
|
||||
}
|
||||
|
|
@ -1877,14 +1896,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));
|
||||
|
|
@ -1926,8 +1949,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)
|
||||
|
|
@ -1953,15 +1977,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;
|
||||
|
|
@ -2018,6 +2045,8 @@ tdir_t TIFFNumberOfDirectories(TIFF *tif)
|
|||
{
|
||||
++n;
|
||||
}
|
||||
/* Update number of main-IFDs in file. */
|
||||
tif->tif_curdircount = n;
|
||||
return (n);
|
||||
}
|
||||
|
||||
|
|
@ -2100,7 +2129,19 @@ int TIFFSetDirectory(TIFF *tif, tdir_t dirn)
|
|||
tif->tif_curdir = TIFF_NON_EXISTENT_DIR_NUMBER;
|
||||
else
|
||||
tif->tif_curdir--;
|
||||
return (TIFFReadDirectory(tif));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -2125,8 +2166,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
|
||||
{
|
||||
|
|
@ -2136,32 +2180,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, but leave it for diroff==0. */
|
||||
if (!retval && diroff != 0)
|
||||
|
||||
/* 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. */
|
||||
_TIFFCleanupIFDOffsetAndNumberMaps(tif); /* invalidate IFD loop lists */
|
||||
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 */
|
||||
retval = _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);
|
||||
}
|
||||
|
||||
|
|
@ -2257,9 +2309,11 @@ 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);
|
||||
|
|
@ -2283,12 +2337,12 @@ int TIFFUnlinkDirectory(TIFF *tif, tdir_t dirn)
|
|||
* means that the caller can only append to the directory
|
||||
* chain.
|
||||
*/
|
||||
(*tif->tif_cleanup)(tif);
|
||||
if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)
|
||||
{
|
||||
_TIFFfreeExt(tif, tif->tif_rawdata);
|
||||
tif->tif_rawdata = NULL;
|
||||
tif->tif_rawcc = 0;
|
||||
tif->tif_rawcp = NULL;
|
||||
tif->tif_rawdataoff = 0;
|
||||
tif->tif_rawdataloaded = 0;
|
||||
}
|
||||
|
|
@ -2303,6 +2357,10 @@ int TIFFUnlinkDirectory(TIFF *tif, tdir_t dirn)
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
45
3rdparty/libtiff/tif_dir.h
vendored
45
3rdparty/libtiff/tif_dir.h
vendored
|
|
@ -65,6 +65,12 @@ 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.
|
||||
*/
|
||||
|
|
@ -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;
|
||||
|
||||
/*
|
||||
|
|
@ -302,16 +329,14 @@ extern "C"
|
|||
|
||||
struct _TIFFField
|
||||
{
|
||||
uint32_t field_tag; /* field's tag */
|
||||
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
|
||||
short field_writecount; /* write count/TIFF_VARIABLE */
|
||||
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 */
|
||||
uint32_t field_tag; /* field's tag */
|
||||
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
|
||||
short field_writecount; /* write count/TIFF_VARIABLE */
|
||||
TIFFDataType field_type; /* type of associated data */
|
||||
uint32_t field_anonymous; /* if true, this is a unknown /
|
||||
anonymous tag */
|
||||
TIFFSetGetFieldType set_get_field_type; /* type to be passed to
|
||||
TIFFSetField, TIFFGetField */
|
||||
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 */
|
||||
|
|
|
|||
833
3rdparty/libtiff/tif_dirinfo.c
vendored
833
3rdparty/libtiff/tif_dirinfo.c
vendored
|
|
@ -54,10 +54,10 @@ static const TIFFFieldArray gpsFieldArray;
|
|||
/*--: Rational2Double: --
|
||||
* The Rational2Double upgraded libtiff functionality allows the definition and
|
||||
* achievement of true double-precision accuracy for TIFF tags of RATIONAL type
|
||||
* and field_bit=FIELD_CUSTOM using the set_field_type = TIFF_SETGET_DOUBLE.
|
||||
* and field_bit=FIELD_CUSTOM using the set_get_field_type = TIFF_SETGET_DOUBLE.
|
||||
* Unfortunately, that changes the old implemented interface for TIFFGetField().
|
||||
* In order to keep the old TIFFGetField() interface behavior those tags have to
|
||||
* be redefined with set_field_type = TIFF_SETGET_FLOAT!
|
||||
* be redefined with set_get_field_type = TIFF_SETGET_FLOAT!
|
||||
*
|
||||
* Rational custom arrays are already defined as _Cxx_FLOAT, thus can stay.
|
||||
*
|
||||
|
|
@ -65,281 +65,281 @@ static const TIFFFieldArray gpsFieldArray;
|
|||
|
||||
/* clang-format off */ /* for better readability of tag comments */
|
||||
static const TIFFField tiffFields[] = {
|
||||
{TIFFTAG_SUBFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_SUBFILETYPE, 1, 0, "SubfileType", NULL},
|
||||
{TIFFTAG_OSUBFILETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "OldSubfileType", NULL},
|
||||
{TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_IMAGEDIMENSIONS, 0, 0, "ImageWidth", NULL},
|
||||
{TIFFTAG_IMAGELENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_IMAGEDIMENSIONS, 1, 0, "ImageLength", NULL},
|
||||
{TIFFTAG_BITSPERSAMPLE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_BITSPERSAMPLE, 0, 0, "BitsPerSample", NULL},
|
||||
{TIFFTAG_COMPRESSION, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_COMPRESSION, 0, 0, "Compression", NULL},
|
||||
{TIFFTAG_PHOTOMETRIC, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_PHOTOMETRIC, 0, 0, "PhotometricInterpretation", NULL},
|
||||
{TIFFTAG_THRESHHOLDING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_THRESHHOLDING, 1, 0, "Threshholding", NULL},
|
||||
{TIFFTAG_CELLWIDTH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CellWidth", NULL},
|
||||
{TIFFTAG_CELLLENGTH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CellLength", NULL},
|
||||
{TIFFTAG_FILLORDER, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_FILLORDER, 0, 0, "FillOrder", NULL},
|
||||
{TIFFTAG_DOCUMENTNAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DocumentName", NULL},
|
||||
{TIFFTAG_IMAGEDESCRIPTION, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageDescription", NULL},
|
||||
{TIFFTAG_MAKE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Make", NULL},
|
||||
{TIFFTAG_MODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Model", NULL},
|
||||
{TIFFTAG_STRIPOFFSETS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPOFFSETS, 0, 0, "StripOffsets", NULL},
|
||||
{TIFFTAG_ORIENTATION, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_ORIENTATION, 0, 0, "Orientation", NULL},
|
||||
{TIFFTAG_SAMPLESPERPIXEL, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_SAMPLESPERPIXEL, 0, 0, "SamplesPerPixel", NULL},
|
||||
{TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_ROWSPERSTRIP, 0, 0, "RowsPerStrip", NULL},
|
||||
{TIFFTAG_STRIPBYTECOUNTS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPBYTECOUNTS, 0, 0, "StripByteCounts", NULL},
|
||||
{TIFFTAG_MINSAMPLEVALUE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_MINSAMPLEVALUE, 1, 0, "MinSampleValue", NULL},
|
||||
{TIFFTAG_MAXSAMPLEVALUE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_MAXSAMPLEVALUE, 1, 0, "MaxSampleValue", NULL},
|
||||
{TIFFTAG_XRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_RESOLUTION, 1, 0, "XResolution", NULL},
|
||||
{TIFFTAG_YRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_RESOLUTION, 1, 0, "YResolution", NULL},
|
||||
{TIFFTAG_PLANARCONFIG, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_PLANARCONFIG, 0, 0, "PlanarConfiguration", NULL},
|
||||
{TIFFTAG_PAGENAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PageName", NULL},
|
||||
{TIFFTAG_XPOSITION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_POSITION, 1, 0, "XPosition", NULL},
|
||||
{TIFFTAG_YPOSITION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_POSITION, 1, 0, "YPosition", NULL},
|
||||
{TIFFTAG_FREEOFFSETS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 0, 0, "FreeOffsets", NULL},
|
||||
{TIFFTAG_FREEBYTECOUNTS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 0, 0, "FreeByteCounts", NULL},
|
||||
{TIFFTAG_GRAYRESPONSEUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "GrayResponseUnit", NULL},
|
||||
{TIFFTAG_GRAYRESPONSECURVE, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "GrayResponseCurve", NULL},
|
||||
{TIFFTAG_RESOLUTIONUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_RESOLUTIONUNIT, 1, 0, "ResolutionUnit", NULL},
|
||||
{TIFFTAG_PAGENUMBER, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_PAGENUMBER, 1, 0, "PageNumber", NULL},
|
||||
{TIFFTAG_COLORRESPONSEUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "ColorResponseUnit", NULL},
|
||||
{TIFFTAG_TRANSFERFUNCTION, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_OTHER, TIFF_SETGET_UNDEFINED, FIELD_TRANSFERFUNCTION, 1, 0, "TransferFunction", NULL},
|
||||
{TIFFTAG_SOFTWARE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Software", NULL},
|
||||
{TIFFTAG_DATETIME, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateTime", NULL},
|
||||
{TIFFTAG_ARTIST, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Artist", NULL},
|
||||
{TIFFTAG_HOSTCOMPUTER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "HostComputer", NULL},
|
||||
{TIFFTAG_WHITEPOINT, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "WhitePoint", NULL},
|
||||
{TIFFTAG_PRIMARYCHROMATICITIES, 6, 6, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PrimaryChromaticities", NULL},
|
||||
{TIFFTAG_COLORMAP, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_OTHER, TIFF_SETGET_UNDEFINED, FIELD_COLORMAP, 1, 0, "ColorMap", NULL},
|
||||
{TIFFTAG_HALFTONEHINTS, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_HALFTONEHINTS, 1, 0, "HalftoneHints", NULL},
|
||||
{TIFFTAG_TILEWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_TILEDIMENSIONS, 0, 0, "TileWidth", NULL},
|
||||
{TIFFTAG_TILELENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_TILEDIMENSIONS, 0, 0, "TileLength", NULL},
|
||||
{TIFFTAG_TILEOFFSETS, -1, 1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPOFFSETS, 0, 0, "TileOffsets", NULL},
|
||||
{TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPBYTECOUNTS, 0, 0, "TileByteCounts", NULL},
|
||||
{TIFFTAG_SUBIFD, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, TIFF_SETGET_UNDEFINED, FIELD_SUBIFD, 1, 1, "SubIFD", (TIFFFieldArray *)&tiffFieldArray},
|
||||
{TIFFTAG_INKSET, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "InkSet", NULL},
|
||||
{TIFFTAG_INKNAMES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_C16_ASCII, TIFF_SETGET_UNDEFINED, FIELD_INKNAMES, 1, 1, "InkNames", NULL},
|
||||
{TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_NUMBEROFINKS, 1, 0, "NumberOfInks", NULL},
|
||||
{TIFFTAG_DOTRANGE, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "DotRange", NULL},
|
||||
{TIFFTAG_TARGETPRINTER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TargetPrinter", NULL},
|
||||
{TIFFTAG_EXTRASAMPLES, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_EXTRASAMPLES, 0, 1, "ExtraSamples", NULL},
|
||||
{TIFFTAG_SAMPLEFORMAT, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_SAMPLEFORMAT, 0, 0, "SampleFormat", NULL},
|
||||
{TIFFTAG_SMINSAMPLEVALUE, -2, -1, TIFF_ANY, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_SMINSAMPLEVALUE, 1, 0, "SMinSampleValue", NULL},
|
||||
{TIFFTAG_SMAXSAMPLEVALUE, -2, -1, TIFF_ANY, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_SMAXSAMPLEVALUE, 1, 0, "SMaxSampleValue", NULL},
|
||||
{TIFFTAG_CLIPPATH, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ClipPath", NULL},
|
||||
{TIFFTAG_XCLIPPATHUNITS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "XClipPathUnits", NULL},
|
||||
{TIFFTAG_YCLIPPATHUNITS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "YClipPathUnits", NULL},
|
||||
{TIFFTAG_YCBCRCOEFFICIENTS, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "YCbCrCoefficients", NULL},
|
||||
{TIFFTAG_YCBCRSUBSAMPLING, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_YCBCRSUBSAMPLING, 0, 0, "YCbCrSubsampling", NULL},
|
||||
{TIFFTAG_YCBCRPOSITIONING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_YCBCRPOSITIONING, 0, 0, "YCbCrPositioning", NULL},
|
||||
{TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_REFBLACKWHITE, 1, 0, "ReferenceBlackWhite", NULL},
|
||||
{TIFFTAG_XMLPACKET, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "XMLPacket", NULL},
|
||||
{TIFFTAG_SUBFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_SUBFILETYPE, 1, 0, "SubfileType", NULL},
|
||||
{TIFFTAG_OSUBFILETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "OldSubfileType", NULL},
|
||||
{TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_IMAGEDIMENSIONS, 0, 0, "ImageWidth", NULL},
|
||||
{TIFFTAG_IMAGELENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_IMAGEDIMENSIONS, 1, 0, "ImageLength", NULL},
|
||||
{TIFFTAG_BITSPERSAMPLE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_BITSPERSAMPLE, 0, 0, "BitsPerSample", NULL},
|
||||
{TIFFTAG_COMPRESSION, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_COMPRESSION, 0, 0, "Compression", NULL},
|
||||
{TIFFTAG_PHOTOMETRIC, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_PHOTOMETRIC, 0, 0, "PhotometricInterpretation", NULL},
|
||||
{TIFFTAG_THRESHHOLDING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_THRESHHOLDING, 1, 0, "Threshholding", NULL},
|
||||
{TIFFTAG_CELLWIDTH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "CellWidth", NULL},
|
||||
{TIFFTAG_CELLLENGTH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "CellLength", NULL},
|
||||
{TIFFTAG_FILLORDER, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_FILLORDER, 0, 0, "FillOrder", NULL},
|
||||
{TIFFTAG_DOCUMENTNAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "DocumentName", NULL},
|
||||
{TIFFTAG_IMAGEDESCRIPTION, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "ImageDescription", NULL},
|
||||
{TIFFTAG_MAKE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "Make", NULL},
|
||||
{TIFFTAG_MODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "Model", NULL},
|
||||
{TIFFTAG_STRIPOFFSETS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, FIELD_STRIPOFFSETS, 0, 0, "StripOffsets", NULL},
|
||||
{TIFFTAG_ORIENTATION, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_ORIENTATION, 0, 0, "Orientation", NULL},
|
||||
{TIFFTAG_SAMPLESPERPIXEL, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_SAMPLESPERPIXEL, 0, 0, "SamplesPerPixel", NULL},
|
||||
{TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_ROWSPERSTRIP, 0, 0, "RowsPerStrip", NULL},
|
||||
{TIFFTAG_STRIPBYTECOUNTS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, FIELD_STRIPBYTECOUNTS, 0, 0, "StripByteCounts", NULL},
|
||||
{TIFFTAG_MINSAMPLEVALUE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_MINSAMPLEVALUE, 1, 0, "MinSampleValue", NULL},
|
||||
{TIFFTAG_MAXSAMPLEVALUE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_MAXSAMPLEVALUE, 1, 0, "MaxSampleValue", NULL},
|
||||
{TIFFTAG_XRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_RESOLUTION, 1, 0, "XResolution", NULL},
|
||||
{TIFFTAG_YRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_RESOLUTION, 1, 0, "YResolution", NULL},
|
||||
{TIFFTAG_PLANARCONFIG, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_PLANARCONFIG, 0, 0, "PlanarConfiguration", NULL},
|
||||
{TIFFTAG_PAGENAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "PageName", NULL},
|
||||
{TIFFTAG_XPOSITION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_POSITION, 1, 0, "XPosition", NULL},
|
||||
{TIFFTAG_YPOSITION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_POSITION, 1, 0, "YPosition", NULL},
|
||||
{TIFFTAG_FREEOFFSETS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 0, 0, "FreeOffsets", NULL},
|
||||
{TIFFTAG_FREEBYTECOUNTS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 0, 0, "FreeByteCounts", NULL},
|
||||
{TIFFTAG_GRAYRESPONSEUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "GrayResponseUnit", NULL},
|
||||
{TIFFTAG_GRAYRESPONSECURVE, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "GrayResponseCurve", NULL},
|
||||
{TIFFTAG_RESOLUTIONUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_RESOLUTIONUNIT, 1, 0, "ResolutionUnit", NULL},
|
||||
{TIFFTAG_PAGENUMBER, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, FIELD_PAGENUMBER, 1, 0, "PageNumber", NULL},
|
||||
{TIFFTAG_COLORRESPONSEUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "ColorResponseUnit", NULL},
|
||||
{TIFFTAG_TRANSFERFUNCTION, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_OTHER, FIELD_TRANSFERFUNCTION, 1, 0, "TransferFunction", NULL},
|
||||
{TIFFTAG_SOFTWARE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "Software", NULL},
|
||||
{TIFFTAG_DATETIME, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "DateTime", NULL},
|
||||
{TIFFTAG_ARTIST, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "Artist", NULL},
|
||||
{TIFFTAG_HOSTCOMPUTER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "HostComputer", NULL},
|
||||
{TIFFTAG_WHITEPOINT, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "WhitePoint", NULL},
|
||||
{TIFFTAG_PRIMARYCHROMATICITIES, 6, 6, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "PrimaryChromaticities", NULL},
|
||||
{TIFFTAG_COLORMAP, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_OTHER, FIELD_COLORMAP, 1, 0, "ColorMap", NULL},
|
||||
{TIFFTAG_HALFTONEHINTS, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, FIELD_HALFTONEHINTS, 1, 0, "HalftoneHints", NULL},
|
||||
{TIFFTAG_TILEWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_TILEDIMENSIONS, 0, 0, "TileWidth", NULL},
|
||||
{TIFFTAG_TILELENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_TILEDIMENSIONS, 0, 0, "TileLength", NULL},
|
||||
{TIFFTAG_TILEOFFSETS, -1, 1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, FIELD_STRIPOFFSETS, 0, 0, "TileOffsets", NULL},
|
||||
{TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, FIELD_STRIPBYTECOUNTS, 0, 0, "TileByteCounts", NULL},
|
||||
{TIFFTAG_SUBIFD, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, FIELD_SUBIFD, 1, 1, "SubIFD", (TIFFFieldArray *)&tiffFieldArray},
|
||||
{TIFFTAG_INKSET, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 0, 0, "InkSet", NULL},
|
||||
{TIFFTAG_INKNAMES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_C16_ASCII, FIELD_INKNAMES, 1, 1, "InkNames", NULL},
|
||||
{TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_NUMBEROFINKS, 1, 0, "NumberOfInks", NULL},
|
||||
{TIFFTAG_DOTRANGE, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, FIELD_CUSTOM, 0, 0, "DotRange", NULL},
|
||||
{TIFFTAG_TARGETPRINTER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "TargetPrinter", NULL},
|
||||
{TIFFTAG_EXTRASAMPLES, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, FIELD_EXTRASAMPLES, 0, 1, "ExtraSamples", NULL},
|
||||
{TIFFTAG_SAMPLEFORMAT, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_SAMPLEFORMAT, 0, 0, "SampleFormat", NULL},
|
||||
{TIFFTAG_SMINSAMPLEVALUE, -2, -1, TIFF_ANY, 0, TIFF_SETGET_DOUBLE, FIELD_SMINSAMPLEVALUE, 1, 0, "SMinSampleValue", NULL},
|
||||
{TIFFTAG_SMAXSAMPLEVALUE, -2, -1, TIFF_ANY, 0, TIFF_SETGET_DOUBLE, FIELD_SMAXSAMPLEVALUE, 1, 0, "SMaxSampleValue", NULL},
|
||||
{TIFFTAG_CLIPPATH, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 0, 1, "ClipPath", NULL},
|
||||
{TIFFTAG_XCLIPPATHUNITS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 0, 0, "XClipPathUnits", NULL},
|
||||
{TIFFTAG_YCLIPPATHUNITS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 0, 0, "YClipPathUnits", NULL},
|
||||
{TIFFTAG_YCBCRCOEFFICIENTS, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 0, 0, "YCbCrCoefficients", NULL},
|
||||
{TIFFTAG_YCBCRSUBSAMPLING, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, FIELD_YCBCRSUBSAMPLING, 0, 0, "YCbCrSubsampling", NULL},
|
||||
{TIFFTAG_YCBCRPOSITIONING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_YCBCRPOSITIONING, 0, 0, "YCbCrPositioning", NULL},
|
||||
{TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_REFBLACKWHITE, 1, 0, "ReferenceBlackWhite", NULL},
|
||||
{TIFFTAG_XMLPACKET, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "XMLPacket", NULL},
|
||||
/* begin SGI tags */
|
||||
{TIFFTAG_MATTEING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_EXTRASAMPLES, 0, 0, "Matteing", NULL},
|
||||
{TIFFTAG_DATATYPE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_SAMPLEFORMAT, 0, 0, "DataType", NULL},
|
||||
{TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_IMAGEDEPTH, 0, 0, "ImageDepth", NULL},
|
||||
{TIFFTAG_TILEDEPTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_TILEDEPTH, 0, 0, "TileDepth", NULL},
|
||||
{TIFFTAG_MATTEING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_EXTRASAMPLES, 0, 0, "Matteing", NULL},
|
||||
{TIFFTAG_DATATYPE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_SAMPLEFORMAT, 0, 0, "DataType", NULL},
|
||||
{TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_IMAGEDEPTH, 0, 0, "ImageDepth", NULL},
|
||||
{TIFFTAG_TILEDEPTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_TILEDEPTH, 0, 0, "TileDepth", NULL},
|
||||
/* end SGI tags */
|
||||
/* begin Pixar tags */
|
||||
{TIFFTAG_PIXAR_IMAGEFULLWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageFullWidth", NULL},
|
||||
{TIFFTAG_PIXAR_IMAGEFULLLENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageFullLength", NULL},
|
||||
{TIFFTAG_PIXAR_TEXTUREFORMAT, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TextureFormat", NULL},
|
||||
{TIFFTAG_PIXAR_WRAPMODES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TextureWrapModes", NULL},
|
||||
{TIFFTAG_PIXAR_FOVCOT, 1, 1, TIFF_FLOAT, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FieldOfViewCotangent", NULL},
|
||||
{TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN, 16, 16, TIFF_FLOAT, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MatrixWorldToScreen", NULL},
|
||||
{TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA, 16, 16, TIFF_FLOAT, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MatrixWorldToCamera", NULL},
|
||||
{TIFFTAG_COPYRIGHT, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Copyright", NULL},
|
||||
{TIFFTAG_PIXAR_IMAGEFULLWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "ImageFullWidth", NULL},
|
||||
{TIFFTAG_PIXAR_IMAGEFULLLENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "ImageFullLength", NULL},
|
||||
{TIFFTAG_PIXAR_TEXTUREFORMAT, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "TextureFormat", NULL},
|
||||
{TIFFTAG_PIXAR_WRAPMODES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "TextureWrapModes", NULL},
|
||||
{TIFFTAG_PIXAR_FOVCOT, 1, 1, TIFF_FLOAT, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "FieldOfViewCotangent", NULL},
|
||||
{TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN, 16, 16, TIFF_FLOAT, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "MatrixWorldToScreen", NULL},
|
||||
{TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA, 16, 16, TIFF_FLOAT, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "MatrixWorldToCamera", NULL},
|
||||
{TIFFTAG_COPYRIGHT, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "Copyright", NULL},
|
||||
/* end Pixar tags */
|
||||
{TIFFTAG_RICHTIFFIPTC, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "RichTIFFIPTC", NULL},
|
||||
{TIFFTAG_PHOTOSHOP, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "Photoshop", NULL},
|
||||
{TIFFTAG_RICHTIFFIPTC, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "RichTIFFIPTC", NULL},
|
||||
{TIFFTAG_PHOTOSHOP, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "Photoshop", NULL},
|
||||
/*--: EXIFIFD and GPSIFD specified as TIFF_LONG by Aware-Systems and not TIFF_IFD8 as in original LibTiff. However, for IFD-like tags,
|
||||
* libtiff uses the data type TIFF_IFD8 in tiffFields[]-tag definition combined with a special handling procedure in order to write either
|
||||
* a 32-bit value and the TIFF_IFD type-id into ClassicTIFF files or a 64-bit value and the TIFF_IFD8 type-id into BigTIFF files. */
|
||||
{TIFFTAG_EXIFIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EXIFIFDOffset", (TIFFFieldArray *)&exifFieldArray},
|
||||
{TIFFTAG_ICCPROFILE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ICC Profile", NULL},
|
||||
{TIFFTAG_GPSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "GPSIFDOffset", (TIFFFieldArray *)&gpsFieldArray},
|
||||
{TIFFTAG_FAXRECVPARAMS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_CUSTOM, TRUE, FALSE, "FaxRecvParams", NULL},
|
||||
{TIFFTAG_FAXSUBADDRESS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_ASCII, FIELD_CUSTOM, TRUE, FALSE, "FaxSubAddress", NULL},
|
||||
{TIFFTAG_FAXRECVTIME, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_CUSTOM, TRUE, FALSE, "FaxRecvTime", NULL},
|
||||
{TIFFTAG_FAXDCS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_ASCII, FIELD_CUSTOM, TRUE, FALSE, "FaxDcs", NULL},
|
||||
{TIFFTAG_STONITS, 1, 1, TIFF_DOUBLE, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "StoNits", NULL},
|
||||
{TIFFTAG_IMAGESOURCEDATA, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "Adobe Photoshop Document Data Block", NULL},
|
||||
{TIFFTAG_INTEROPERABILITYIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "InteroperabilityIFDOffset", NULL},
|
||||
{TIFFTAG_EXIFIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, FIELD_CUSTOM, 1, 0, "EXIFIFDOffset", (TIFFFieldArray *)&exifFieldArray},
|
||||
{TIFFTAG_ICCPROFILE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "ICC Profile", NULL},
|
||||
{TIFFTAG_GPSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, FIELD_CUSTOM, 1, 0, "GPSIFDOffset", (TIFFFieldArray *)&gpsFieldArray},
|
||||
{TIFFTAG_FAXRECVPARAMS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, TRUE, FALSE, "FaxRecvParams", NULL},
|
||||
{TIFFTAG_FAXSUBADDRESS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, TRUE, FALSE, "FaxSubAddress", NULL},
|
||||
{TIFFTAG_FAXRECVTIME, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, TRUE, FALSE, "FaxRecvTime", NULL},
|
||||
{TIFFTAG_FAXDCS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, TRUE, FALSE, "FaxDcs", NULL},
|
||||
{TIFFTAG_STONITS, 1, 1, TIFF_DOUBLE, 0, TIFF_SETGET_DOUBLE, FIELD_CUSTOM, 0, 0, "StoNits", NULL},
|
||||
{TIFFTAG_IMAGESOURCEDATA, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "Adobe Photoshop Document Data Block", NULL},
|
||||
{TIFFTAG_INTEROPERABILITYIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, FIELD_CUSTOM, 0, 0, "InteroperabilityIFDOffset", NULL},
|
||||
/* begin DNG tags */
|
||||
{TIFFTAG_DNGVERSION, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DNGVersion", NULL},
|
||||
{TIFFTAG_DNGBACKWARDVERSION, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DNGBackwardVersion", NULL},
|
||||
{TIFFTAG_UNIQUECAMERAMODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "UniqueCameraModel", NULL},
|
||||
{TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "LocalizedCameraModel", NULL},
|
||||
{TIFFTAG_CFAPLANECOLOR, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CFAPlaneColor", NULL},
|
||||
{TIFFTAG_CFALAYOUT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CFALayout", NULL},
|
||||
{TIFFTAG_LINEARIZATIONTABLE, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "LinearizationTable", NULL},
|
||||
{TIFFTAG_BLACKLEVELREPEATDIM, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BlackLevelRepeatDim", NULL},
|
||||
{TIFFTAG_BLACKLEVEL, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "BlackLevel", NULL},
|
||||
{TIFFTAG_BLACKLEVELDELTAH, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "BlackLevelDeltaH", NULL},
|
||||
{TIFFTAG_BLACKLEVELDELTAV, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "BlackLevelDeltaV", NULL},
|
||||
{TIFFTAG_WHITELEVEL, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "WhiteLevel", NULL},
|
||||
{TIFFTAG_DEFAULTSCALE, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DefaultScale", NULL},
|
||||
{TIFFTAG_BESTQUALITYSCALE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BestQualityScale", NULL},
|
||||
{TIFFTAG_DEFAULTCROPORIGIN, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DefaultCropOrigin", NULL},
|
||||
{TIFFTAG_DEFAULTCROPSIZE, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DefaultCropSize", NULL},
|
||||
{TIFFTAG_COLORMATRIX1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ColorMatrix1", NULL},
|
||||
{TIFFTAG_COLORMATRIX2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ColorMatrix2", NULL},
|
||||
{TIFFTAG_CAMERACALIBRATION1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CameraCalibration1", NULL},
|
||||
{TIFFTAG_CAMERACALIBRATION2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CameraCalibration2", NULL},
|
||||
{TIFFTAG_REDUCTIONMATRIX1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ReductionMatrix1", NULL},
|
||||
{TIFFTAG_REDUCTIONMATRIX2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ReductionMatrix2", NULL},
|
||||
{TIFFTAG_ANALOGBALANCE, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AnalogBalance", NULL},
|
||||
{TIFFTAG_ASSHOTNEUTRAL, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AsShotNeutral", NULL},
|
||||
{TIFFTAG_ASSHOTWHITEXY, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "AsShotWhiteXY", NULL},
|
||||
{TIFFTAG_BASELINEEXPOSURE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BaselineExposure", NULL},
|
||||
{TIFFTAG_BASELINENOISE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BaselineNoise", NULL},
|
||||
{TIFFTAG_BASELINESHARPNESS, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BaselineSharpness", NULL},
|
||||
{TIFFTAG_BAYERGREENSPLIT, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BayerGreenSplit", NULL},
|
||||
{TIFFTAG_LINEARRESPONSELIMIT, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LinearResponseLimit", NULL},
|
||||
{TIFFTAG_CAMERASERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CameraSerialNumber", NULL},
|
||||
{TIFFTAG_LENSINFO, 4, 4, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensInfo", NULL},
|
||||
{TIFFTAG_CHROMABLURRADIUS, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ChromaBlurRadius", NULL},
|
||||
{TIFFTAG_ANTIALIASSTRENGTH, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "AntiAliasStrength", NULL},
|
||||
{TIFFTAG_SHADOWSCALE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ShadowScale", NULL},
|
||||
{TIFFTAG_DNGPRIVATEDATA, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "DNGPrivateData", NULL},
|
||||
{TIFFTAG_MAKERNOTESAFETY, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MakerNoteSafety", NULL},
|
||||
{TIFFTAG_CALIBRATIONILLUMINANT1, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CalibrationIlluminant1", NULL},
|
||||
{TIFFTAG_CALIBRATIONILLUMINANT2, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CalibrationIlluminant2", NULL},
|
||||
{TIFFTAG_RAWDATAUNIQUEID, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RawDataUniqueID", NULL},
|
||||
{TIFFTAG_ORIGINALRAWFILENAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OriginalRawFileName", NULL},
|
||||
{TIFFTAG_ORIGINALRAWFILEDATA, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OriginalRawFileData", NULL},
|
||||
{TIFFTAG_ACTIVEAREA, 4, 4, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ActiveArea", NULL},
|
||||
{TIFFTAG_MASKEDAREAS, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "MaskedAreas", NULL},
|
||||
{TIFFTAG_ASSHOTICCPROFILE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AsShotICCProfile", NULL},
|
||||
{TIFFTAG_ASSHOTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AsShotPreProfileMatrix", NULL},
|
||||
{TIFFTAG_CURRENTICCPROFILE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CurrentICCProfile", NULL},
|
||||
{TIFFTAG_CURRENTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CurrentPreProfileMatrix", NULL},
|
||||
{TIFFTAG_PERSAMPLE, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "PerSample", NULL},
|
||||
{TIFFTAG_DNGVERSION, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "DNGVersion", NULL},
|
||||
{TIFFTAG_DNGBACKWARDVERSION, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "DNGBackwardVersion", NULL},
|
||||
{TIFFTAG_UNIQUECAMERAMODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "UniqueCameraModel", NULL},
|
||||
{TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "LocalizedCameraModel", NULL},
|
||||
{TIFFTAG_CFAPLANECOLOR, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "CFAPlaneColor", NULL},
|
||||
{TIFFTAG_CFALAYOUT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "CFALayout", NULL},
|
||||
{TIFFTAG_LINEARIZATIONTABLE, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, FIELD_CUSTOM, 1, 1, "LinearizationTable", NULL},
|
||||
{TIFFTAG_BLACKLEVELREPEATDIM, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, FIELD_CUSTOM, 1, 0, "BlackLevelRepeatDim", NULL},
|
||||
{TIFFTAG_BLACKLEVEL, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "BlackLevel", NULL},
|
||||
{TIFFTAG_BLACKLEVELDELTAH, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "BlackLevelDeltaH", NULL},
|
||||
{TIFFTAG_BLACKLEVELDELTAV, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "BlackLevelDeltaV", NULL},
|
||||
{TIFFTAG_WHITELEVEL, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, FIELD_CUSTOM, 1, 1, "WhiteLevel", NULL},
|
||||
{TIFFTAG_DEFAULTSCALE, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "DefaultScale", NULL},
|
||||
{TIFFTAG_BESTQUALITYSCALE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "BestQualityScale", NULL},
|
||||
{TIFFTAG_DEFAULTCROPORIGIN, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "DefaultCropOrigin", NULL},
|
||||
{TIFFTAG_DEFAULTCROPSIZE, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "DefaultCropSize", NULL},
|
||||
{TIFFTAG_COLORMATRIX1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ColorMatrix1", NULL},
|
||||
{TIFFTAG_COLORMATRIX2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ColorMatrix2", NULL},
|
||||
{TIFFTAG_CAMERACALIBRATION1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "CameraCalibration1", NULL},
|
||||
{TIFFTAG_CAMERACALIBRATION2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "CameraCalibration2", NULL},
|
||||
{TIFFTAG_REDUCTIONMATRIX1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ReductionMatrix1", NULL},
|
||||
{TIFFTAG_REDUCTIONMATRIX2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ReductionMatrix2", NULL},
|
||||
{TIFFTAG_ANALOGBALANCE, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "AnalogBalance", NULL},
|
||||
{TIFFTAG_ASSHOTNEUTRAL, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "AsShotNeutral", NULL},
|
||||
{TIFFTAG_ASSHOTWHITEXY, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "AsShotWhiteXY", NULL},
|
||||
{TIFFTAG_BASELINEEXPOSURE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "BaselineExposure", NULL},
|
||||
{TIFFTAG_BASELINENOISE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "BaselineNoise", NULL},
|
||||
{TIFFTAG_BASELINESHARPNESS, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "BaselineSharpness", NULL},
|
||||
{TIFFTAG_BAYERGREENSPLIT, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "BayerGreenSplit", NULL},
|
||||
{TIFFTAG_LINEARRESPONSELIMIT, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "LinearResponseLimit", NULL},
|
||||
{TIFFTAG_CAMERASERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "CameraSerialNumber", NULL},
|
||||
{TIFFTAG_LENSINFO, 4, 4, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "LensInfo", NULL},
|
||||
{TIFFTAG_CHROMABLURRADIUS, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "ChromaBlurRadius", NULL},
|
||||
{TIFFTAG_ANTIALIASSTRENGTH, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "AntiAliasStrength", NULL},
|
||||
{TIFFTAG_SHADOWSCALE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "ShadowScale", NULL},
|
||||
{TIFFTAG_DNGPRIVATEDATA, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "DNGPrivateData", NULL},
|
||||
{TIFFTAG_MAKERNOTESAFETY, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "MakerNoteSafety", NULL},
|
||||
{TIFFTAG_CALIBRATIONILLUMINANT1, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "CalibrationIlluminant1", NULL},
|
||||
{TIFFTAG_CALIBRATIONILLUMINANT2, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "CalibrationIlluminant2", NULL},
|
||||
{TIFFTAG_RAWDATAUNIQUEID, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "RawDataUniqueID", NULL},
|
||||
{TIFFTAG_ORIGINALRAWFILENAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "OriginalRawFileName", NULL},
|
||||
{TIFFTAG_ORIGINALRAWFILEDATA, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "OriginalRawFileData", NULL},
|
||||
{TIFFTAG_ACTIVEAREA, 4, 4, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, FIELD_CUSTOM, 1, 0, "ActiveArea", NULL},
|
||||
{TIFFTAG_MASKEDAREAS, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, FIELD_CUSTOM, 1, 1, "MaskedAreas", NULL},
|
||||
{TIFFTAG_ASSHOTICCPROFILE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "AsShotICCProfile", NULL},
|
||||
{TIFFTAG_ASSHOTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "AsShotPreProfileMatrix", NULL},
|
||||
{TIFFTAG_CURRENTICCPROFILE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "CurrentICCProfile", NULL},
|
||||
{TIFFTAG_CURRENTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "CurrentPreProfileMatrix", NULL},
|
||||
{TIFFTAG_PERSAMPLE, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "PerSample", NULL},
|
||||
#if 0
|
||||
/* TODO: revert above #if 0 for TIFF 4.6.0 */
|
||||
|
||||
/* begin DNG 1.2.0.0 tags */
|
||||
{TIFFTAG_COLORIMETRICREFERENCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ColorimetricReference", NULL},
|
||||
{TIFFTAG_CAMERACALIBRATIONSIGNATURE, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CameraCalibrationSignature", NULL},
|
||||
{TIFFTAG_PROFILECALIBRATIONSIGNATURE, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileCalibrationSignature", NULL},
|
||||
{TIFFTAG_EXTRACAMERAPROFILES, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ExtraCameraProfiles", NULL},
|
||||
{TIFFTAG_ASSHOTPROFILENAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AsShotProfileName", NULL},
|
||||
{TIFFTAG_NOISEREDUCTIONAPPLIED, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "NoiseReductionApplied", NULL},
|
||||
{TIFFTAG_PROFILENAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileName", NULL},
|
||||
{TIFFTAG_PROFILEHUESATMAPDIMS, 3, 3, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileHueSatMapDims", NULL},
|
||||
{TIFFTAG_PROFILEHUESATMAPDATA1, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileHueSatMapData1", NULL},
|
||||
{TIFFTAG_PROFILEHUESATMAPDATA2, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileHueSatMapData2", NULL},
|
||||
{TIFFTAG_PROFILETONECURVE, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileToneCurve", NULL},
|
||||
{TIFFTAG_PROFILEEMBEDPOLICY, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileEmbedPolicy", NULL},
|
||||
{TIFFTAG_PROFILECOPYRIGHT, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileCopyright", NULL},
|
||||
{TIFFTAG_FORWARDMATRIX1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ForwardMatrix1", NULL},
|
||||
{TIFFTAG_FORWARDMATRIX2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ForwardMatrix2", NULL},
|
||||
{TIFFTAG_PREVIEWAPPLICATIONNAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "PreviewApplicationName", NULL},
|
||||
{TIFFTAG_PREVIEWAPPLICATIONVERSION, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "PreviewApplicationVersion", NULL},
|
||||
{TIFFTAG_PREVIEWSETTINGSNAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "PreviewSettingsName", NULL},
|
||||
{TIFFTAG_PREVIEWSETTINGSDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PreviewSettingsDigest", NULL},
|
||||
{TIFFTAG_PREVIEWCOLORSPACE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PreviewColorSpace", NULL},
|
||||
{TIFFTAG_PREVIEWDATETIME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PreviewDateTime", NULL},
|
||||
{TIFFTAG_RAWIMAGEDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RawImageDigest", NULL},
|
||||
{TIFFTAG_ORIGINALRAWFILEDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OriginalRawFileDigest", NULL},
|
||||
{TIFFTAG_SUBTILEBLOCKSIZE, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubTileBlockSize", NULL},
|
||||
{TIFFTAG_ROWINTERLEAVEFACTOR, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RowInterleaveFactor", NULL},
|
||||
{TIFFTAG_PROFILELOOKTABLEDIMS, 3, 3, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileLookTableDims", NULL},
|
||||
{TIFFTAG_PROFILELOOKTABLEDATA, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileLookTableData", NULL},
|
||||
{TIFFTAG_COLORIMETRICREFERENCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "ColorimetricReference", NULL},
|
||||
{TIFFTAG_CAMERACALIBRATIONSIGNATURE, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "CameraCalibrationSignature", NULL},
|
||||
{TIFFTAG_PROFILECALIBRATIONSIGNATURE, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "ProfileCalibrationSignature", NULL},
|
||||
{TIFFTAG_EXTRACAMERAPROFILES, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, FIELD_CUSTOM, 1, 1, "ExtraCameraProfiles", NULL},
|
||||
{TIFFTAG_ASSHOTPROFILENAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "AsShotProfileName", NULL},
|
||||
{TIFFTAG_NOISEREDUCTIONAPPLIED, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "NoiseReductionApplied", NULL},
|
||||
{TIFFTAG_PROFILENAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "ProfileName", NULL},
|
||||
{TIFFTAG_PROFILEHUESATMAPDIMS, 3, 3, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, FIELD_CUSTOM, 1, 0, "ProfileHueSatMapDims", NULL},
|
||||
{TIFFTAG_PROFILEHUESATMAPDATA1, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ProfileHueSatMapData1", NULL},
|
||||
{TIFFTAG_PROFILEHUESATMAPDATA2, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ProfileHueSatMapData2", NULL},
|
||||
{TIFFTAG_PROFILETONECURVE, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ProfileToneCurve", NULL},
|
||||
{TIFFTAG_PROFILEEMBEDPOLICY, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "ProfileEmbedPolicy", NULL},
|
||||
{TIFFTAG_PROFILECOPYRIGHT, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "ProfileCopyright", NULL},
|
||||
{TIFFTAG_FORWARDMATRIX1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ForwardMatrix1", NULL},
|
||||
{TIFFTAG_FORWARDMATRIX2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ForwardMatrix2", NULL},
|
||||
{TIFFTAG_PREVIEWAPPLICATIONNAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "PreviewApplicationName", NULL},
|
||||
{TIFFTAG_PREVIEWAPPLICATIONVERSION, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "PreviewApplicationVersion", NULL},
|
||||
{TIFFTAG_PREVIEWSETTINGSNAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "PreviewSettingsName", NULL},
|
||||
{TIFFTAG_PREVIEWSETTINGSDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "PreviewSettingsDigest", NULL},
|
||||
{TIFFTAG_PREVIEWCOLORSPACE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "PreviewColorSpace", NULL},
|
||||
{TIFFTAG_PREVIEWDATETIME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "PreviewDateTime", NULL},
|
||||
{TIFFTAG_RAWIMAGEDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "RawImageDigest", NULL},
|
||||
{TIFFTAG_ORIGINALRAWFILEDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "OriginalRawFileDigest", NULL},
|
||||
{TIFFTAG_SUBTILEBLOCKSIZE, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, FIELD_CUSTOM, 1, 0, "SubTileBlockSize", NULL},
|
||||
{TIFFTAG_ROWINTERLEAVEFACTOR, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "RowInterleaveFactor", NULL},
|
||||
{TIFFTAG_PROFILELOOKTABLEDIMS, 3, 3, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, FIELD_CUSTOM, 1, 0, "ProfileLookTableDims", NULL},
|
||||
{TIFFTAG_PROFILELOOKTABLEDATA, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ProfileLookTableData", NULL},
|
||||
/* begin DNG 1.3.0.0 tags */
|
||||
{TIFFTAG_OPCODELIST1, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OpcodeList1", NULL},
|
||||
{TIFFTAG_OPCODELIST2, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OpcodeList2", NULL},
|
||||
{TIFFTAG_OPCODELIST3, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OpcodeList3", NULL},
|
||||
{TIFFTAG_NOISEPROFILE, -1, -1, TIFF_DOUBLE, 0, TIFF_SETGET_C16_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "NoiseProfile", NULL},
|
||||
{TIFFTAG_OPCODELIST1, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "OpcodeList1", NULL},
|
||||
{TIFFTAG_OPCODELIST2, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "OpcodeList2", NULL},
|
||||
{TIFFTAG_OPCODELIST3, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "OpcodeList3", NULL},
|
||||
{TIFFTAG_NOISEPROFILE, -1, -1, TIFF_DOUBLE, 0, TIFF_SETGET_C16_DOUBLE, FIELD_CUSTOM, 1, 1, "NoiseProfile", NULL},
|
||||
/* begin DNG 1.4.0.0 tags */
|
||||
{TIFFTAG_DEFAULTUSERCROP, 4, 4, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DefaultUserCrop", NULL},
|
||||
{TIFFTAG_DEFAULTBLACKRENDER, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DefaultBlackRender", NULL},
|
||||
{TIFFTAG_BASELINEEXPOSUREOFFSET, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BaselineExposureOffset", NULL},
|
||||
{TIFFTAG_PROFILELOOKTABLEENCODING, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileLookTableEncoding", NULL},
|
||||
{TIFFTAG_PROFILEHUESATMAPENCODING, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileHueSatMapEncoding", NULL},
|
||||
{TIFFTAG_ORIGINALDEFAULTFINALSIZE, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OriginalDefaultFinalSize", NULL},
|
||||
{TIFFTAG_ORIGINALBESTQUALITYFINALSIZE, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OriginalBestQualityFinalSize", NULL},
|
||||
{TIFFTAG_ORIGINALDEFAULTCROPSIZE, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OriginalDefaultCropSize", NULL}, /* could also be rational */
|
||||
{TIFFTAG_NEWRAWIMAGEDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "NewRawImageDigest", NULL},
|
||||
{TIFFTAG_RAWTOPREVIEWGAIN, 1, 1, TIFF_DOUBLE, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RawToPreviewGain", NULL},
|
||||
{TIFFTAG_DEFAULTUSERCROP, 4, 4, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "DefaultUserCrop", NULL},
|
||||
{TIFFTAG_DEFAULTBLACKRENDER, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "DefaultBlackRender", NULL},
|
||||
{TIFFTAG_BASELINEEXPOSUREOFFSET, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "BaselineExposureOffset", NULL},
|
||||
{TIFFTAG_PROFILELOOKTABLEENCODING, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "ProfileLookTableEncoding", NULL},
|
||||
{TIFFTAG_PROFILEHUESATMAPENCODING, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "ProfileHueSatMapEncoding", NULL},
|
||||
{TIFFTAG_ORIGINALDEFAULTFINALSIZE, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, FIELD_CUSTOM, 1, 0, "OriginalDefaultFinalSize", NULL},
|
||||
{TIFFTAG_ORIGINALBESTQUALITYFINALSIZE, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, FIELD_CUSTOM, 1, 0, "OriginalBestQualityFinalSize", NULL},
|
||||
{TIFFTAG_ORIGINALDEFAULTCROPSIZE, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "OriginalDefaultCropSize", NULL}, /* could also be rational */
|
||||
{TIFFTAG_NEWRAWIMAGEDIGEST, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "NewRawImageDigest", NULL},
|
||||
{TIFFTAG_RAWTOPREVIEWGAIN, 1, 1, TIFF_DOUBLE, 0, TIFF_SETGET_DOUBLE, FIELD_CUSTOM, 1, 0, "RawToPreviewGain", NULL},
|
||||
/* begin DNG 1.5.0.0 tags */
|
||||
{TIFFTAG_DEPTHFORMAT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DepthFormat", NULL},
|
||||
{TIFFTAG_DEPTHNEAR, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DepthNear", NULL},
|
||||
{TIFFTAG_DEPTHFAR, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DepthFar", NULL},
|
||||
{TIFFTAG_DEPTHUNITS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DepthUnits", NULL},
|
||||
{TIFFTAG_DEPTHMEASURETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DepthMeasureType", NULL},
|
||||
{TIFFTAG_ENHANCEPARAMS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EnhanceParams", NULL},
|
||||
{TIFFTAG_DEPTHFORMAT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "DepthFormat", NULL},
|
||||
{TIFFTAG_DEPTHNEAR, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "DepthNear", NULL},
|
||||
{TIFFTAG_DEPTHFAR, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "DepthFar", NULL},
|
||||
{TIFFTAG_DEPTHUNITS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "DepthUnits", NULL},
|
||||
{TIFFTAG_DEPTHMEASURETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "DepthMeasureType", NULL},
|
||||
{TIFFTAG_ENHANCEPARAMS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "EnhanceParams", NULL},
|
||||
/* begin DNG 1.6.0.0 tags */
|
||||
{TIFFTAG_PROFILEGAINTABLEMAP, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileGainTableMap", NULL},
|
||||
{TIFFTAG_SEMANTICNAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SemanticName", NULL},
|
||||
{TIFFTAG_SEMANTICINSTANCEID, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SemanticInstanceID", NULL},
|
||||
{TIFFTAG_MASKSUBAREA, 4, 4, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MaskSubArea", NULL},
|
||||
{TIFFTAG_RGBTABLES, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "RGBTables", NULL},
|
||||
{TIFFTAG_CALIBRATIONILLUMINANT3, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CalibrationIlluminant3", NULL},
|
||||
{TIFFTAG_COLORMATRIX3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ColorMatrix3", NULL},
|
||||
{TIFFTAG_CAMERACALIBRATION3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CameraCalibration3", NULL},
|
||||
{TIFFTAG_REDUCTIONMATRIX3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ReductionMatrix3", NULL},
|
||||
{TIFFTAG_PROFILEHUESATMAPDATA3, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProfileHueSatMapData3", NULL},
|
||||
{TIFFTAG_FORWARDMATRIX3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ForwardMatrix3", NULL},
|
||||
{TIFFTAG_ILLUMINANTDATA1, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "IlluminantData1", NULL},
|
||||
{TIFFTAG_ILLUMINANTDATA2, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "IlluminantData2", NULL},
|
||||
{TIFFTAG_ILLUMINANTDATA3, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "IlluminantData3", NULL},
|
||||
{TIFFTAG_PROFILEGAINTABLEMAP, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "ProfileGainTableMap", NULL},
|
||||
{TIFFTAG_SEMANTICNAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "SemanticName", NULL},
|
||||
{TIFFTAG_SEMANTICINSTANCEID, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "SemanticInstanceID", NULL},
|
||||
{TIFFTAG_MASKSUBAREA, 4, 4, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, FIELD_CUSTOM, 1, 0, "MaskSubArea", NULL},
|
||||
{TIFFTAG_RGBTABLES, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "RGBTables", NULL},
|
||||
{TIFFTAG_CALIBRATIONILLUMINANT3, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "CalibrationIlluminant3", NULL},
|
||||
{TIFFTAG_COLORMATRIX3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ColorMatrix3", NULL},
|
||||
{TIFFTAG_CAMERACALIBRATION3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "CameraCalibration3", NULL},
|
||||
{TIFFTAG_REDUCTIONMATRIX3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ReductionMatrix3", NULL},
|
||||
{TIFFTAG_PROFILEHUESATMAPDATA3, -1, -1, TIFF_FLOAT, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ProfileHueSatMapData3", NULL},
|
||||
{TIFFTAG_FORWARDMATRIX3, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "ForwardMatrix3", NULL},
|
||||
{TIFFTAG_ILLUMINANTDATA1, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "IlluminantData1", NULL},
|
||||
{TIFFTAG_ILLUMINANTDATA2, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "IlluminantData2", NULL},
|
||||
{TIFFTAG_ILLUMINANTDATA3, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "IlluminantData3", NULL},
|
||||
/* end DNG tags */
|
||||
#endif
|
||||
/* begin TIFF/EP tags */
|
||||
{TIFFTAG_EP_CFAREPEATPATTERNDIM, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP CFARepeatPatternDim", NULL},
|
||||
{TIFFTAG_EP_CFAPATTERN, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP CFAPattern", NULL},
|
||||
{TIFFTAG_EP_CFAREPEATPATTERNDIM, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, FIELD_CUSTOM, 1, 0, "EP CFARepeatPatternDim", NULL},
|
||||
{TIFFTAG_EP_CFAPATTERN, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "EP CFAPattern", NULL},
|
||||
#if 0
|
||||
/* TIFFTAG_EP_BATTERYLEVEL can be RATIONAL or ASCII.
|
||||
* LibTiff defines it as ASCII and converts RATIONAL to an ASCII string. */
|
||||
{TIFFTAG_EP_BATTERYLEVEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP BatteryLevel", NULL},
|
||||
{TIFFTAG_EP_INTERLACE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP Interlace", NULL},
|
||||
{TIFFTAG_EP_BATTERYLEVEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "EP BatteryLevel", NULL},
|
||||
{TIFFTAG_EP_INTERLACE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "EP Interlace", NULL},
|
||||
/* TIFFTAG_EP_IPTC_NAA and TIFFTAG_RICHTIFFIPTC share the same tag number (33723)
|
||||
* LibTIFF type is UNDEFINED or BYTE, but often times incorrectly specified as LONG, because TIFF/EP (ISO/DIS 12234-2) specifies type LONG or ASCII. */
|
||||
{TIFFTAG_EP_TIMEZONEOFFSET, -1, -1, TIFF_SSHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP TimeZoneOffset", NULL},
|
||||
{TIFFTAG_EP_SELFTIMERMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP SelfTimerMode", NULL},
|
||||
{TIFFTAG_EP_FLASHENERGY, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP FlashEnergy", NULL},
|
||||
{TIFFTAG_EP_SPATIALFREQUENCYRESPONSE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP SpatialFrequencyResponse", NULL},
|
||||
{TIFFTAG_EP_NOISE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP Noise", NULL},
|
||||
{TIFFTAG_EP_FOCALPLANEXRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP FocalPlaneXResolution", NULL},
|
||||
{TIFFTAG_EP_FOCALPLANEYRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP FocalPlaneYResolution", NULL},
|
||||
{TIFFTAG_EP_FOCALPLANERESOLUTIONUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP FocalPlaneResolutionUnit", NULL},
|
||||
{TIFFTAG_EP_IMAGENUMBER, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ImageNumber", NULL}, /* or SHORT */
|
||||
{TIFFTAG_EP_SECURITYCLASSIFICATION, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP SecurityClassification", NULL},
|
||||
{TIFFTAG_EP_IMAGEHISTORY, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ImageHistory", NULL},
|
||||
{TIFFTAG_EP_EXPOSUREINDEX, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP ExposureIndex", NULL},
|
||||
{TIFFTAG_EP_STANDARDID, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP StandardId", NULL},
|
||||
{TIFFTAG_EP_SENSINGMETHOD, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP SensingMethod", NULL},
|
||||
{TIFFTAG_EP_TIMEZONEOFFSET, -1, -1, TIFF_SSHORT, 0, TIFF_SETGET_C16_UINT16, FIELD_CUSTOM, 1, 1, "EP TimeZoneOffset", NULL},
|
||||
{TIFFTAG_EP_SELFTIMERMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "EP SelfTimerMode", NULL},
|
||||
{TIFFTAG_EP_FLASHENERGY, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "EP FlashEnergy", NULL},
|
||||
{TIFFTAG_EP_SPATIALFREQUENCYRESPONSE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "EP SpatialFrequencyResponse", NULL},
|
||||
{TIFFTAG_EP_NOISE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "EP Noise", NULL},
|
||||
{TIFFTAG_EP_FOCALPLANEXRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "EP FocalPlaneXResolution", NULL},
|
||||
{TIFFTAG_EP_FOCALPLANEYRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "EP FocalPlaneYResolution", NULL},
|
||||
{TIFFTAG_EP_FOCALPLANERESOLUTIONUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "EP FocalPlaneResolutionUnit", NULL},
|
||||
{TIFFTAG_EP_IMAGENUMBER, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "EP ImageNumber", NULL}, /* or SHORT */
|
||||
{TIFFTAG_EP_SECURITYCLASSIFICATION, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "EP SecurityClassification", NULL},
|
||||
{TIFFTAG_EP_IMAGEHISTORY, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "EP ImageHistory", NULL},
|
||||
{TIFFTAG_EP_EXPOSUREINDEX, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "EP ExposureIndex", NULL},
|
||||
{TIFFTAG_EP_STANDARDID, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "EP StandardId", NULL},
|
||||
{TIFFTAG_EP_SENSINGMETHOD, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "EP SensingMethod", NULL},
|
||||
/* TIFF/EP tags equivalent to EXIF tags, sometimes defined differently. */
|
||||
{TIFFTAG_EP_EXPOSURETIME, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP ExposureTime", NULL}, /*N=1 or 2 */
|
||||
{TIFFTAG_EP_FNUMBER, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP FNumber", NULL},
|
||||
{TIFFTAG_EP_EXPOSUREPROGRAM, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ExposureProgram", NULL},
|
||||
{TIFFTAG_EP_SPECTRALSENSITIVITY, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP SpectralSensitivity", NULL},
|
||||
{TIFFTAG_EP_ISOSPEEDRATINGS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ISOSpeedRatings", NULL},
|
||||
{TIFFTAG_EP_OECF, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP OptoelectricConversionFactor", NULL},
|
||||
{TIFFTAG_EP_DATETIMEORIGINAL, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP DateTimeOriginal", NULL},
|
||||
{TIFFTAG_EP_COMPRESSEDBITSPERPIXEL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP CompressedBitsPerPixel", NULL},
|
||||
{TIFFTAG_EP_SHUTTERSPEEDVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ShutterSpeedValue", NULL},
|
||||
{TIFFTAG_EP_APERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP ApertureValue", NULL},
|
||||
{TIFFTAG_EP_BRIGHTNESSVALUE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP BrightnessValue", NULL},
|
||||
{TIFFTAG_EP_EXPOSUREBIASVALUE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP ExposureBiasValue", NULL}, /*N=1 or 2 */
|
||||
{TIFFTAG_EP_MAXAPERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP MaxApertureValue", NULL},
|
||||
{TIFFTAG_EP_SUBJECTDISTANCE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP SubjectDistance", NULL},
|
||||
{TIFFTAG_EP_METERINGMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP MeteringMode", NULL},
|
||||
{TIFFTAG_EP_LIGHTSOURCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP LightSource", NULL},
|
||||
{TIFFTAG_EP_FLASH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EP Flash", NULL},
|
||||
{TIFFTAG_EP_FOCALLENGTH, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP FocalLength", NULL},
|
||||
{TIFFTAG_EP_SUBJECTLOCATION, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "EP SubjectLocation", NULL},
|
||||
{TIFFTAG_EP_EXPOSURETIME, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "EP ExposureTime", NULL}, /*N=1 or 2 */
|
||||
{TIFFTAG_EP_FNUMBER, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "EP FNumber", NULL},
|
||||
{TIFFTAG_EP_EXPOSUREPROGRAM, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "EP ExposureProgram", NULL},
|
||||
{TIFFTAG_EP_SPECTRALSENSITIVITY, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "EP SpectralSensitivity", NULL},
|
||||
{TIFFTAG_EP_ISOSPEEDRATINGS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "EP ISOSpeedRatings", NULL},
|
||||
{TIFFTAG_EP_OECF, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, FIELD_CUSTOM, 1, 1, "EP OptoelectricConversionFactor", NULL},
|
||||
{TIFFTAG_EP_DATETIMEORIGINAL, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "EP DateTimeOriginal", NULL},
|
||||
{TIFFTAG_EP_COMPRESSEDBITSPERPIXEL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "EP CompressedBitsPerPixel", NULL},
|
||||
{TIFFTAG_EP_SHUTTERSPEEDVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "EP ShutterSpeedValue", NULL},
|
||||
{TIFFTAG_EP_APERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "EP ApertureValue", NULL},
|
||||
{TIFFTAG_EP_BRIGHTNESSVALUE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "EP BrightnessValue", NULL},
|
||||
{TIFFTAG_EP_EXPOSUREBIASVALUE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "EP ExposureBiasValue", NULL}, /*N=1 or 2 */
|
||||
{TIFFTAG_EP_MAXAPERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "EP MaxApertureValue", NULL},
|
||||
{TIFFTAG_EP_SUBJECTDISTANCE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "EP SubjectDistance", NULL},
|
||||
{TIFFTAG_EP_METERINGMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "EP MeteringMode", NULL},
|
||||
{TIFFTAG_EP_LIGHTSOURCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "EP LightSource", NULL},
|
||||
{TIFFTAG_EP_FLASH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "EP Flash", NULL},
|
||||
{TIFFTAG_EP_FOCALLENGTH, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "EP FocalLength", NULL},
|
||||
{TIFFTAG_EP_SUBJECTLOCATION, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, FIELD_CUSTOM, 1, 1, "EP SubjectLocation", NULL},
|
||||
/* end TIFF/EP tags */
|
||||
#endif
|
||||
/* begin TIFF/FX tags */
|
||||
{TIFFTAG_INDEXED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Indexed", NULL},
|
||||
{TIFFTAG_GLOBALPARAMETERSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "GlobalParametersIFD", NULL},
|
||||
{TIFFTAG_PROFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ProfileType", NULL},
|
||||
{TIFFTAG_FAXPROFILE, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FaxProfile", NULL},
|
||||
{TIFFTAG_CODINGMETHODS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CodingMethods", NULL},
|
||||
{TIFFTAG_VERSIONYEAR, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "VersionYear", NULL},
|
||||
{TIFFTAG_MODENUMBER, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ModeNumber", NULL},
|
||||
{TIFFTAG_DECODE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "Decode", NULL},
|
||||
{TIFFTAG_IMAGEBASECOLOR, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ImageBaseColor", NULL},
|
||||
{TIFFTAG_T82OPTIONS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "T82Options", NULL},
|
||||
{TIFFTAG_STRIPROWCOUNTS, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "StripRowCounts", NULL},
|
||||
{TIFFTAG_IMAGELAYER, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageLayer", NULL},
|
||||
{TIFFTAG_INDEXED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "Indexed", NULL},
|
||||
{TIFFTAG_GLOBALPARAMETERSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, FIELD_CUSTOM, 1, 0, "GlobalParametersIFD", NULL},
|
||||
{TIFFTAG_PROFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "ProfileType", NULL},
|
||||
{TIFFTAG_FAXPROFILE, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, FIELD_CUSTOM, 1, 0, "FaxProfile", NULL},
|
||||
{TIFFTAG_CODINGMETHODS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "CodingMethods", NULL},
|
||||
{TIFFTAG_VERSIONYEAR, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "VersionYear", NULL},
|
||||
{TIFFTAG_MODENUMBER, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, FIELD_CUSTOM, 1, 0, "ModeNumber", NULL},
|
||||
{TIFFTAG_DECODE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, FIELD_CUSTOM, 1, 1, "Decode", NULL},
|
||||
{TIFFTAG_IMAGEBASECOLOR, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, FIELD_CUSTOM, 1, 1, "ImageBaseColor", NULL},
|
||||
{TIFFTAG_T82OPTIONS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "T82Options", NULL},
|
||||
{TIFFTAG_STRIPROWCOUNTS, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, FIELD_CUSTOM, 1, 1, "StripRowCounts", NULL},
|
||||
{TIFFTAG_IMAGELAYER, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, FIELD_CUSTOM, 1, 0, "ImageLayer", NULL},
|
||||
/* end TIFF/FX tags */
|
||||
/* begin pseudo tags */
|
||||
};
|
||||
|
|
@ -348,91 +348,91 @@ static const TIFFField tiffFields[] = {
|
|||
* EXIF tags (Version 2.31, July 2016 plus version 2.32 May 2019)
|
||||
*/
|
||||
static const TIFFField exifFields[] = {
|
||||
{EXIFTAG_EXPOSURETIME, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureTime", NULL},
|
||||
{EXIFTAG_FNUMBER, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FNumber", NULL},
|
||||
{EXIFTAG_EXPOSUREPROGRAM, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureProgram", NULL},
|
||||
{EXIFTAG_SPECTRALSENSITIVITY, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SpectralSensitivity", NULL},
|
||||
{EXIFTAG_EXPOSURETIME, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "ExposureTime", NULL},
|
||||
{EXIFTAG_FNUMBER, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "FNumber", NULL},
|
||||
{EXIFTAG_EXPOSUREPROGRAM, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "ExposureProgram", NULL},
|
||||
{EXIFTAG_SPECTRALSENSITIVITY, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "SpectralSensitivity", NULL},
|
||||
/* After EXIF 2.2.1 ISOSpeedRatings is named PhotographicSensitivity. In addition, while "Count=Any", only 1 count should be used. */
|
||||
{EXIFTAG_ISOSPEEDRATINGS, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ISOSpeedRatings", NULL},
|
||||
{EXIFTAG_OECF, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OptoelectricConversionFactor", NULL},
|
||||
{EXIFTAG_SENSITIVITYTYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SensitivityType", NULL},
|
||||
{EXIFTAG_STANDARDOUTPUTSENSITIVITY, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "StandardOutputSensitivity", NULL},
|
||||
{EXIFTAG_RECOMMENDEDEXPOSUREINDEX, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RecommendedExposureIndex", NULL},
|
||||
{EXIFTAG_ISOSPEED, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ISOSpeed", NULL},
|
||||
{EXIFTAG_ISOSPEEDLATITUDEYYY, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ISOSpeedLatitudeyyy", NULL},
|
||||
{EXIFTAG_ISOSPEEDLATITUDEZZZ, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ISOSpeedLatitudezzz", NULL},
|
||||
{EXIFTAG_EXIFVERSION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExifVersion", NULL},
|
||||
{EXIFTAG_DATETIMEORIGINAL, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateTimeOriginal", NULL},
|
||||
{EXIFTAG_DATETIMEDIGITIZED, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateTimeDigitized", NULL},
|
||||
{EXIFTAG_OFFSETTIME, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OffsetTime", NULL},
|
||||
{EXIFTAG_OFFSETTIMEORIGINAL, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OffsetTimeOriginal", NULL},
|
||||
{EXIFTAG_OFFSETTIMEDIGITIZED, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OffsetTimeDigitized", NULL},
|
||||
{EXIFTAG_COMPONENTSCONFIGURATION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ComponentsConfiguration", NULL},
|
||||
{EXIFTAG_COMPRESSEDBITSPERPIXEL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CompressedBitsPerPixel", NULL},
|
||||
{EXIFTAG_SHUTTERSPEEDVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ShutterSpeedValue", NULL},
|
||||
{EXIFTAG_APERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ApertureValue", NULL},
|
||||
{EXIFTAG_BRIGHTNESSVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BrightnessValue", NULL},
|
||||
{EXIFTAG_EXPOSUREBIASVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureBiasValue", NULL},
|
||||
{EXIFTAG_MAXAPERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MaxApertureValue", NULL},
|
||||
/*--: EXIFTAG_SUBJECTDISTANCE: LibTiff returns value of "-1" if numerator equals 4294967295 (0xFFFFFFFF) to indicate infinite distance!
|
||||
{EXIFTAG_ISOSPEEDRATINGS, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, FIELD_CUSTOM, 1, 1, "ISOSpeedRatings", NULL},
|
||||
{EXIFTAG_OECF, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "OptoelectricConversionFactor", NULL},
|
||||
{EXIFTAG_SENSITIVITYTYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "SensitivityType", NULL},
|
||||
{EXIFTAG_STANDARDOUTPUTSENSITIVITY, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "StandardOutputSensitivity", NULL},
|
||||
{EXIFTAG_RECOMMENDEDEXPOSUREINDEX, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "RecommendedExposureIndex", NULL},
|
||||
{EXIFTAG_ISOSPEED, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "ISOSpeed", NULL},
|
||||
{EXIFTAG_ISOSPEEDLATITUDEYYY, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "ISOSpeedLatitudeyyy", NULL},
|
||||
{EXIFTAG_ISOSPEEDLATITUDEZZZ, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "ISOSpeedLatitudezzz", NULL},
|
||||
{EXIFTAG_EXIFVERSION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "ExifVersion", NULL},
|
||||
{EXIFTAG_DATETIMEORIGINAL, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "DateTimeOriginal", NULL},
|
||||
{EXIFTAG_DATETIMEDIGITIZED, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "DateTimeDigitized", NULL},
|
||||
{EXIFTAG_OFFSETTIME, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "OffsetTime", NULL},
|
||||
{EXIFTAG_OFFSETTIMEORIGINAL, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "OffsetTimeOriginal", NULL},
|
||||
{EXIFTAG_OFFSETTIMEDIGITIZED, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "OffsetTimeDigitized", NULL},
|
||||
{EXIFTAG_COMPONENTSCONFIGURATION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "ComponentsConfiguration", NULL},
|
||||
{EXIFTAG_COMPRESSEDBITSPERPIXEL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "CompressedBitsPerPixel", NULL},
|
||||
{EXIFTAG_SHUTTERSPEEDVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "ShutterSpeedValue", NULL},
|
||||
{EXIFTAG_APERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "ApertureValue", NULL},
|
||||
{EXIFTAG_BRIGHTNESSVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "BrightnessValue", NULL},
|
||||
{EXIFTAG_EXPOSUREBIASVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "ExposureBiasValue", NULL},
|
||||
{EXIFTAG_MAXAPERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "MaxApertureValue", NULL},
|
||||
/*--: EXIFTAG_SUBJECTDISTANCE: LibTiff returns value of "-1" if numerator equals 4294967295 (0xFFFFFFFF) to indicate infinite distance!
|
||||
* However, there are two other EXIF tags where numerator indicates a special value and six other cases where the denominator indicates special values,
|
||||
* which are not treated within LibTiff!! */
|
||||
{EXIFTAG_SUBJECTDISTANCE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubjectDistance", NULL},
|
||||
{EXIFTAG_METERINGMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MeteringMode", NULL},
|
||||
{EXIFTAG_LIGHTSOURCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LightSource", NULL},
|
||||
{EXIFTAG_FLASH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Flash", NULL},
|
||||
{EXIFTAG_FOCALLENGTH, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalLength", NULL},
|
||||
{EXIFTAG_SUBJECTAREA, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "SubjectArea", NULL},
|
||||
{EXIFTAG_MAKERNOTE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "MakerNote", NULL},
|
||||
{EXIFTAG_USERCOMMENT, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "UserComment", NULL},
|
||||
{EXIFTAG_SUBSECTIME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTime", NULL},
|
||||
{EXIFTAG_SUBSECTIMEORIGINAL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTimeOriginal", NULL},
|
||||
{EXIFTAG_SUBSECTIMEDIGITIZED, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTimeDigitized", NULL},
|
||||
{EXIFTAG_TEMPERATURE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Temperature", NULL},
|
||||
{EXIFTAG_HUMIDITY, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Humidity", NULL},
|
||||
{EXIFTAG_PRESSURE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Pressure", NULL},
|
||||
{EXIFTAG_WATERDEPTH, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "WaterDepth", NULL},
|
||||
{EXIFTAG_ACCELERATION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Acceleration", NULL},
|
||||
{EXIFTAG_CAMERAELEVATIONANGLE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CameraElevationAngle", NULL},
|
||||
{EXIFTAG_FLASHPIXVERSION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FlashpixVersion", NULL},
|
||||
{EXIFTAG_COLORSPACE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ColorSpace", NULL},
|
||||
{EXIFTAG_PIXELXDIMENSION, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PixelXDimension", NULL},
|
||||
{EXIFTAG_PIXELYDIMENSION, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PixelYDimension", NULL},
|
||||
{EXIFTAG_RELATEDSOUNDFILE, 13, 13, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RelatedSoundFile", NULL},
|
||||
{EXIFTAG_FLASHENERGY, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FlashEnergy", NULL},
|
||||
{EXIFTAG_SPATIALFREQUENCYRESPONSE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "SpatialFrequencyResponse", NULL},
|
||||
{EXIFTAG_FOCALPLANEXRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalPlaneXResolution", NULL},
|
||||
{EXIFTAG_FOCALPLANEYRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalPlaneYResolution", NULL},
|
||||
{EXIFTAG_FOCALPLANERESOLUTIONUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalPlaneResolutionUnit", NULL},
|
||||
{EXIFTAG_SUBJECTLOCATION, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubjectLocation", NULL},
|
||||
{EXIFTAG_EXPOSUREINDEX, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureIndex", NULL},
|
||||
{EXIFTAG_SENSINGMETHOD, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SensingMethod", NULL},
|
||||
{EXIFTAG_FILESOURCE, 1, 1, TIFF_UNDEFINED, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FileSource", NULL},
|
||||
{EXIFTAG_SCENETYPE, 1, 1, TIFF_UNDEFINED, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SceneType", NULL},
|
||||
{EXIFTAG_CFAPATTERN, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CFAPattern", NULL},
|
||||
{EXIFTAG_CUSTOMRENDERED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CustomRendered", NULL},
|
||||
{EXIFTAG_EXPOSUREMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureMode", NULL},
|
||||
{EXIFTAG_WHITEBALANCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "WhiteBalance", NULL},
|
||||
{EXIFTAG_DIGITALZOOMRATIO, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DigitalZoomRatio", NULL},
|
||||
{EXIFTAG_FOCALLENGTHIN35MMFILM, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalLengthIn35mmFilm", NULL},
|
||||
{EXIFTAG_SCENECAPTURETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SceneCaptureType", NULL},
|
||||
{EXIFTAG_GAINCONTROL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "GainControl", NULL},
|
||||
{EXIFTAG_CONTRAST, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Contrast", NULL},
|
||||
{EXIFTAG_SATURATION, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Saturation", NULL},
|
||||
{EXIFTAG_SHARPNESS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Sharpness", NULL},
|
||||
{EXIFTAG_DEVICESETTINGDESCRIPTION, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "DeviceSettingDescription", NULL},
|
||||
{EXIFTAG_SUBJECTDISTANCERANGE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubjectDistanceRange", NULL},
|
||||
{EXIFTAG_IMAGEUNIQUEID, 33, 33, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageUniqueID", NULL},
|
||||
{EXIFTAG_CAMERAOWNERNAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CameraOwnerName", NULL},
|
||||
{EXIFTAG_BODYSERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BodySerialNumber", NULL},
|
||||
{EXIFTAG_LENSSPECIFICATION, 4, 4, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensSpecification", NULL},
|
||||
{EXIFTAG_LENSMAKE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensMake", NULL},
|
||||
{EXIFTAG_LENSMODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensModel", NULL},
|
||||
{EXIFTAG_LENSSERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensSerialNumber", NULL},
|
||||
{EXIFTAG_GAMMA, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Gamma", NULL},
|
||||
{EXIFTAG_COMPOSITEIMAGE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CompositeImage", NULL},
|
||||
{EXIFTAG_SOURCEIMAGENUMBEROFCOMPOSITEIMAGE, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SourceImageNumberOfCompositeImage", NULL},
|
||||
{EXIFTAG_SOURCEEXPOSURETIMESOFCOMPOSITEIMAGE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1,
|
||||
{EXIFTAG_SUBJECTDISTANCE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "SubjectDistance", NULL},
|
||||
{EXIFTAG_METERINGMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "MeteringMode", NULL},
|
||||
{EXIFTAG_LIGHTSOURCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "LightSource", NULL},
|
||||
{EXIFTAG_FLASH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "Flash", NULL},
|
||||
{EXIFTAG_FOCALLENGTH, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "FocalLength", NULL},
|
||||
{EXIFTAG_SUBJECTAREA, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, FIELD_CUSTOM, 1, 1, "SubjectArea", NULL},
|
||||
{EXIFTAG_MAKERNOTE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "MakerNote", NULL},
|
||||
{EXIFTAG_USERCOMMENT, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "UserComment", NULL},
|
||||
{EXIFTAG_SUBSECTIME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "SubSecTime", NULL},
|
||||
{EXIFTAG_SUBSECTIMEORIGINAL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "SubSecTimeOriginal", NULL},
|
||||
{EXIFTAG_SUBSECTIMEDIGITIZED, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "SubSecTimeDigitized", NULL},
|
||||
{EXIFTAG_TEMPERATURE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "Temperature", NULL},
|
||||
{EXIFTAG_HUMIDITY, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "Humidity", NULL},
|
||||
{EXIFTAG_PRESSURE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "Pressure", NULL},
|
||||
{EXIFTAG_WATERDEPTH, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "WaterDepth", NULL},
|
||||
{EXIFTAG_ACCELERATION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "Acceleration", NULL},
|
||||
{EXIFTAG_CAMERAELEVATIONANGLE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "CameraElevationAngle", NULL},
|
||||
{EXIFTAG_FLASHPIXVERSION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "FlashpixVersion", NULL},
|
||||
{EXIFTAG_COLORSPACE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "ColorSpace", NULL},
|
||||
{EXIFTAG_PIXELXDIMENSION, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "PixelXDimension", NULL},
|
||||
{EXIFTAG_PIXELYDIMENSION, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, FIELD_CUSTOM, 1, 0, "PixelYDimension", NULL},
|
||||
{EXIFTAG_RELATEDSOUNDFILE, 13, 13, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "RelatedSoundFile", NULL},
|
||||
{EXIFTAG_FLASHENERGY, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "FlashEnergy", NULL},
|
||||
{EXIFTAG_SPATIALFREQUENCYRESPONSE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "SpatialFrequencyResponse", NULL},
|
||||
{EXIFTAG_FOCALPLANEXRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "FocalPlaneXResolution", NULL},
|
||||
{EXIFTAG_FOCALPLANEYRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "FocalPlaneYResolution", NULL},
|
||||
{EXIFTAG_FOCALPLANERESOLUTIONUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "FocalPlaneResolutionUnit", NULL},
|
||||
{EXIFTAG_SUBJECTLOCATION, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, FIELD_CUSTOM, 1, 0, "SubjectLocation", NULL},
|
||||
{EXIFTAG_EXPOSUREINDEX, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "ExposureIndex", NULL},
|
||||
{EXIFTAG_SENSINGMETHOD, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "SensingMethod", NULL},
|
||||
{EXIFTAG_FILESOURCE, 1, 1, TIFF_UNDEFINED, 0, TIFF_SETGET_UINT8, FIELD_CUSTOM, 1, 0, "FileSource", NULL},
|
||||
{EXIFTAG_SCENETYPE, 1, 1, TIFF_UNDEFINED, 0, TIFF_SETGET_UINT8, FIELD_CUSTOM, 1, 0, "SceneType", NULL},
|
||||
{EXIFTAG_CFAPATTERN, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "CFAPattern", NULL},
|
||||
{EXIFTAG_CUSTOMRENDERED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "CustomRendered", NULL},
|
||||
{EXIFTAG_EXPOSUREMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "ExposureMode", NULL},
|
||||
{EXIFTAG_WHITEBALANCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "WhiteBalance", NULL},
|
||||
{EXIFTAG_DIGITALZOOMRATIO, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "DigitalZoomRatio", NULL},
|
||||
{EXIFTAG_FOCALLENGTHIN35MMFILM, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "FocalLengthIn35mmFilm", NULL},
|
||||
{EXIFTAG_SCENECAPTURETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "SceneCaptureType", NULL},
|
||||
{EXIFTAG_GAINCONTROL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "GainControl", NULL},
|
||||
{EXIFTAG_CONTRAST, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "Contrast", NULL},
|
||||
{EXIFTAG_SATURATION, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "Saturation", NULL},
|
||||
{EXIFTAG_SHARPNESS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "Sharpness", NULL},
|
||||
{EXIFTAG_DEVICESETTINGDESCRIPTION, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "DeviceSettingDescription", NULL},
|
||||
{EXIFTAG_SUBJECTDISTANCERANGE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "SubjectDistanceRange", NULL},
|
||||
{EXIFTAG_IMAGEUNIQUEID, 33, 33, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "ImageUniqueID", NULL},
|
||||
{EXIFTAG_CAMERAOWNERNAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "CameraOwnerName", NULL},
|
||||
{EXIFTAG_BODYSERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "BodySerialNumber", NULL},
|
||||
{EXIFTAG_LENSSPECIFICATION, 4, 4, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, FIELD_CUSTOM, 1, 0, "LensSpecification", NULL},
|
||||
{EXIFTAG_LENSMAKE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "LensMake", NULL},
|
||||
{EXIFTAG_LENSMODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "LensModel", NULL},
|
||||
{EXIFTAG_LENSSERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "LensSerialNumber", NULL},
|
||||
{EXIFTAG_GAMMA, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, FIELD_CUSTOM, 1, 0, "Gamma", NULL},
|
||||
{EXIFTAG_COMPOSITEIMAGE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "CompositeImage", NULL},
|
||||
{EXIFTAG_SOURCEIMAGENUMBEROFCOMPOSITEIMAGE, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, FIELD_CUSTOM, 1, 0, "SourceImageNumberOfCompositeImage", NULL},
|
||||
{EXIFTAG_SOURCEEXPOSURETIMESOFCOMPOSITEIMAGE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1,
|
||||
"SourceExposureTimesOfCompositeImage", NULL}};
|
||||
/*
|
||||
* EXIF-GPS tags (Version 2.31, July 2016; nothing changed for version 2.32 May
|
||||
|
|
@ -445,38 +445,38 @@ static const TIFFField gpsFields[] = {
|
|||
* In order to achieve double precision for GPS tags: Standard definitions for GPSTAG is kept to TIFF_SETGET_DOUBLE
|
||||
* and TIFF_SETGET_C0_FLOAT is changed to TIFF_SETGET_C0_DOUBLE.
|
||||
*/
|
||||
{GPSTAG_VERSIONID, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UINT8, FIELD_CUSTOM, 1, 0, "VersionID", NULL},
|
||||
{GPSTAG_LATITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LatitudeRef", NULL},
|
||||
{GPSTAG_LATITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Latitude", NULL},
|
||||
{GPSTAG_LONGITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LongitudeRef", NULL},
|
||||
{GPSTAG_LONGITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Longitude", NULL},
|
||||
{GPSTAG_ALTITUDEREF, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "AltitudeRef", NULL},
|
||||
{GPSTAG_ALTITUDE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Altitude", NULL},
|
||||
{GPSTAG_TIMESTAMP, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TimeStamp", NULL},
|
||||
{GPSTAG_SATELLITES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Satellites", NULL},
|
||||
{GPSTAG_STATUS, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Status", NULL},
|
||||
{GPSTAG_MEASUREMODE, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MeasureMode", NULL},
|
||||
{GPSTAG_DOP, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DOP", NULL},
|
||||
{GPSTAG_SPEEDREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SpeedRef", NULL},
|
||||
{GPSTAG_SPEED, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Speed", NULL},
|
||||
{GPSTAG_TRACKREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TrackRef", NULL},
|
||||
{GPSTAG_TRACK, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Track", NULL},
|
||||
{GPSTAG_IMGDIRECTIONREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImgDirectionRef", NULL},
|
||||
{GPSTAG_IMGDIRECTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImgDirection", NULL},
|
||||
{GPSTAG_MAPDATUM, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MapDatum", NULL},
|
||||
{GPSTAG_DESTLATITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestLatitudeRef", NULL},
|
||||
{GPSTAG_DESTLATITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestLatitude", NULL},
|
||||
{GPSTAG_DESTLONGITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestLongitudeRef", NULL},
|
||||
{GPSTAG_DESTLONGITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestLongitude", NULL},
|
||||
{GPSTAG_DESTBEARINGREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestBearingRef", NULL},
|
||||
{GPSTAG_DESTBEARING, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestBearing", NULL},
|
||||
{GPSTAG_DESTDISTANCEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestDistanceRef", NULL},
|
||||
{GPSTAG_DESTDISTANCE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DestDistance", NULL},
|
||||
{GPSTAG_PROCESSINGMETHOD, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ProcessingMethod", NULL},
|
||||
{GPSTAG_AREAINFORMATION, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "AreaInformation", NULL},
|
||||
{GPSTAG_DATESTAMP, 11, 11, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateStamp", NULL},
|
||||
{GPSTAG_DIFFERENTIAL, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Differential", NULL},
|
||||
{GPSTAG_GPSHPOSITIONINGERROR, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "HorizontalPositioningError", NULL}};
|
||||
{GPSTAG_VERSIONID, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, FIELD_CUSTOM, 1, 0, "VersionID", NULL},
|
||||
{GPSTAG_LATITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "LatitudeRef", NULL},
|
||||
{GPSTAG_LATITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, FIELD_CUSTOM, 1, 0, "Latitude", NULL},
|
||||
{GPSTAG_LONGITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "LongitudeRef", NULL},
|
||||
{GPSTAG_LONGITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, FIELD_CUSTOM, 1, 0, "Longitude", NULL},
|
||||
{GPSTAG_ALTITUDEREF, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, FIELD_CUSTOM, 1, 0, "AltitudeRef", NULL},
|
||||
{GPSTAG_ALTITUDE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, FIELD_CUSTOM, 1, 0, "Altitude", NULL},
|
||||
{GPSTAG_TIMESTAMP, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, FIELD_CUSTOM, 1, 0, "TimeStamp", NULL},
|
||||
{GPSTAG_SATELLITES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "Satellites", NULL},
|
||||
{GPSTAG_STATUS, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "Status", NULL},
|
||||
{GPSTAG_MEASUREMODE, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "MeasureMode", NULL},
|
||||
{GPSTAG_DOP, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, FIELD_CUSTOM, 1, 0, "DOP", NULL},
|
||||
{GPSTAG_SPEEDREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "SpeedRef", NULL},
|
||||
{GPSTAG_SPEED, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, FIELD_CUSTOM, 1, 0, "Speed", NULL},
|
||||
{GPSTAG_TRACKREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "TrackRef", NULL},
|
||||
{GPSTAG_TRACK, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, FIELD_CUSTOM, 1, 0, "Track", NULL},
|
||||
{GPSTAG_IMGDIRECTIONREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "ImgDirectionRef", NULL},
|
||||
{GPSTAG_IMGDIRECTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, FIELD_CUSTOM, 1, 0, "ImgDirection", NULL},
|
||||
{GPSTAG_MAPDATUM, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "MapDatum", NULL},
|
||||
{GPSTAG_DESTLATITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "DestLatitudeRef", NULL},
|
||||
{GPSTAG_DESTLATITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, FIELD_CUSTOM, 1, 0, "DestLatitude", NULL},
|
||||
{GPSTAG_DESTLONGITUDEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "DestLongitudeRef", NULL},
|
||||
{GPSTAG_DESTLONGITUDE, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_DOUBLE, FIELD_CUSTOM, 1, 0, "DestLongitude", NULL},
|
||||
{GPSTAG_DESTBEARINGREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "DestBearingRef", NULL},
|
||||
{GPSTAG_DESTBEARING, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, FIELD_CUSTOM, 1, 0, "DestBearing", NULL},
|
||||
{GPSTAG_DESTDISTANCEREF, 2, 2, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "DestDistanceRef", NULL},
|
||||
{GPSTAG_DESTDISTANCE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, FIELD_CUSTOM, 1, 0, "DestDistance", NULL},
|
||||
{GPSTAG_PROCESSINGMETHOD, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "ProcessingMethod", NULL},
|
||||
{GPSTAG_AREAINFORMATION, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, FIELD_CUSTOM, 1, 1, "AreaInformation", NULL},
|
||||
{GPSTAG_DATESTAMP, 11, 11, TIFF_ASCII, 0, TIFF_SETGET_ASCII, FIELD_CUSTOM, 1, 0, "DateStamp", NULL},
|
||||
{GPSTAG_DIFFERENTIAL, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, FIELD_CUSTOM, 1, 0, "Differential", NULL},
|
||||
{GPSTAG_GPSHPOSITIONINGERROR, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, FIELD_CUSTOM, 1, 0, "HorizontalPositioningError", NULL}};
|
||||
/* clang-format on */ /* was off for better readability of tag comments */
|
||||
|
||||
static const TIFFFieldArray tiffFieldArray = {
|
||||
|
|
@ -674,18 +674,19 @@ int TIFFFieldSetGetSize(const TIFFField *fip)
|
|||
{
|
||||
/*
|
||||
* TIFFSetField() and TIFFGetField() must provide the parameter accordingly
|
||||
* to the definition of "set_field_type" of the tag definition in
|
||||
* to the definition of "set_get_field_type" of the tag definition in
|
||||
* dir_info.c. This function returns the data size for that purpose.
|
||||
*
|
||||
* Furthermore, this data size is also used for the internal storage,
|
||||
* even for TIFF_RATIONAL values for FIELD_CUSTOM, which are stored
|
||||
* internally as 4-byte float, but some of them should be stored internally
|
||||
* as 8-byte double, depending on the "set_field_type" _FLOAT_ or _DOUBLE_.
|
||||
* as 8-byte double, depending on the "set_get_field_type" _FLOAT_ or
|
||||
* _DOUBLE_.
|
||||
*/
|
||||
if (fip == NULL)
|
||||
return 0;
|
||||
|
||||
switch (fip->set_field_type)
|
||||
switch (fip->set_get_field_type)
|
||||
{
|
||||
case TIFF_SETGET_UNDEFINED:
|
||||
case TIFF_SETGET_ASCII:
|
||||
|
|
@ -758,7 +759,7 @@ int TIFFFieldSetGetCountSize(const TIFFField *fip)
|
|||
if (fip == NULL)
|
||||
return 0;
|
||||
|
||||
switch (fip->set_field_type)
|
||||
switch (fip->set_get_field_type)
|
||||
{
|
||||
case TIFF_SETGET_C16_ASCII:
|
||||
case TIFF_SETGET_C16_UINT8:
|
||||
|
|
@ -793,7 +794,7 @@ int TIFFFieldSetGetCountSize(const TIFFField *fip)
|
|||
|
||||
const TIFFField *TIFFFindField(TIFF *tif, uint32_t tag, TIFFDataType dt)
|
||||
{
|
||||
TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL};
|
||||
TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, NULL, NULL};
|
||||
TIFFField *pkey = &key;
|
||||
const TIFFField **ret;
|
||||
if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag &&
|
||||
|
|
@ -817,7 +818,7 @@ const TIFFField *TIFFFindField(TIFF *tif, uint32_t tag, TIFFDataType dt)
|
|||
static const TIFFField *_TIFFFindFieldByName(TIFF *tif, const char *field_name,
|
||||
TIFFDataType dt)
|
||||
{
|
||||
TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL};
|
||||
TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, NULL, NULL};
|
||||
TIFFField *pkey = &key;
|
||||
const TIFFField **ret;
|
||||
if (tif->tif_foundfield &&
|
||||
|
|
@ -887,7 +888,7 @@ const TIFFField *_TIFFFindOrRegisterField(TIFF *tif, uint32_t tag,
|
|||
if (fld == NULL)
|
||||
{
|
||||
fld = _TIFFCreateAnonField(tif, tag, dt);
|
||||
if (!_TIFFMergeFields(tif, fld, 1))
|
||||
if (fld == NULL || !_TIFFMergeFields(tif, fld, 1))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -915,59 +916,46 @@ TIFFField *_TIFFCreateAnonField(TIFF *tif, uint32_t tag,
|
|||
{
|
||||
case TIFF_BYTE:
|
||||
case TIFF_UNDEFINED:
|
||||
fld->set_field_type = TIFF_SETGET_C32_UINT8;
|
||||
fld->get_field_type = TIFF_SETGET_C32_UINT8;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_UINT8;
|
||||
break;
|
||||
case TIFF_ASCII:
|
||||
fld->set_field_type = TIFF_SETGET_C32_ASCII;
|
||||
fld->get_field_type = TIFF_SETGET_C32_ASCII;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_ASCII;
|
||||
break;
|
||||
case TIFF_SHORT:
|
||||
fld->set_field_type = TIFF_SETGET_C32_UINT16;
|
||||
fld->get_field_type = TIFF_SETGET_C32_UINT16;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_UINT16;
|
||||
break;
|
||||
case TIFF_LONG:
|
||||
fld->set_field_type = TIFF_SETGET_C32_UINT32;
|
||||
fld->get_field_type = TIFF_SETGET_C32_UINT32;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_UINT32;
|
||||
break;
|
||||
case TIFF_RATIONAL:
|
||||
case TIFF_SRATIONAL:
|
||||
case TIFF_FLOAT:
|
||||
fld->set_field_type = TIFF_SETGET_C32_FLOAT;
|
||||
fld->get_field_type = TIFF_SETGET_C32_FLOAT;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_FLOAT;
|
||||
break;
|
||||
case TIFF_SBYTE:
|
||||
fld->set_field_type = TIFF_SETGET_C32_SINT8;
|
||||
fld->get_field_type = TIFF_SETGET_C32_SINT8;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_SINT8;
|
||||
break;
|
||||
case TIFF_SSHORT:
|
||||
fld->set_field_type = TIFF_SETGET_C32_SINT16;
|
||||
fld->get_field_type = TIFF_SETGET_C32_SINT16;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_SINT16;
|
||||
break;
|
||||
case TIFF_SLONG:
|
||||
fld->set_field_type = TIFF_SETGET_C32_SINT32;
|
||||
fld->get_field_type = TIFF_SETGET_C32_SINT32;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_SINT32;
|
||||
break;
|
||||
case TIFF_DOUBLE:
|
||||
fld->set_field_type = TIFF_SETGET_C32_DOUBLE;
|
||||
fld->get_field_type = TIFF_SETGET_C32_DOUBLE;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_DOUBLE;
|
||||
break;
|
||||
case TIFF_IFD:
|
||||
case TIFF_IFD8:
|
||||
fld->set_field_type = TIFF_SETGET_C32_IFD8;
|
||||
fld->get_field_type = TIFF_SETGET_C32_IFD8;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_IFD8;
|
||||
break;
|
||||
case TIFF_LONG8:
|
||||
fld->set_field_type = TIFF_SETGET_C32_UINT64;
|
||||
fld->get_field_type = TIFF_SETGET_C32_UINT64;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_UINT64;
|
||||
break;
|
||||
case TIFF_SLONG8:
|
||||
fld->set_field_type = TIFF_SETGET_C32_SINT64;
|
||||
fld->get_field_type = TIFF_SETGET_C32_SINT64;
|
||||
fld->set_get_field_type = TIFF_SETGET_C32_SINT64;
|
||||
break;
|
||||
default:
|
||||
fld->set_field_type = TIFF_SETGET_UNDEFINED;
|
||||
fld->get_field_type = TIFF_SETGET_UNDEFINED;
|
||||
fld->set_get_field_type = TIFF_SETGET_UNDEFINED;
|
||||
break;
|
||||
}
|
||||
fld->field_bit = FIELD_CUSTOM;
|
||||
|
|
@ -1197,27 +1185,52 @@ int TIFFMergeFieldInfo(TIFF *tif, const TIFFFieldInfo info[], uint32_t n)
|
|||
for (i = 0; i < n; i++)
|
||||
{
|
||||
tp->field_tag = info[i].field_tag;
|
||||
if (info[i].field_readcount < TIFF_VARIABLE2 ||
|
||||
info[i].field_writecount < TIFF_VARIABLE2)
|
||||
{
|
||||
/* The fields (field_readcount) and (field_writecount) may use the
|
||||
* values TIFF_VARIABLE (-1), TIFF_SPP (-2), TIFF_VARIABLE2 (-3). */
|
||||
TIFFErrorExtR(
|
||||
tif, module,
|
||||
"The value of field_readcount %d and field_writecount %d "
|
||||
"must be greater than or equal to -3.",
|
||||
info[i].field_readcount, info[i].field_writecount);
|
||||
return -1;
|
||||
}
|
||||
if ((info[i].field_readcount == 0 || info[i].field_writecount == 0) &&
|
||||
info[i].field_bit != FIELD_IGNORE)
|
||||
{
|
||||
/* The fields (field_readcount) and (field_writecount) may only
|
||||
be zero for pseudo_tags or ignored tags. */
|
||||
TIFFErrorExtR(
|
||||
tif, module,
|
||||
"The value of field_readcount %d and field_writecount %d "
|
||||
"may only be zero for field_bit = 0 (i.e. ignored tags).",
|
||||
info[i].field_readcount, info[i].field_writecount);
|
||||
return -1;
|
||||
}
|
||||
tp->field_readcount = info[i].field_readcount;
|
||||
tp->field_writecount = info[i].field_writecount;
|
||||
tp->field_type = info[i].field_type;
|
||||
tp->field_anonymous = 0;
|
||||
tp->set_field_type =
|
||||
_TIFFSetGetType(info[i].field_type, info[i].field_readcount,
|
||||
info[i].field_passcount);
|
||||
tp->get_field_type =
|
||||
_TIFFSetGetType(info[i].field_type, info[i].field_readcount,
|
||||
tp->set_get_field_type =
|
||||
_TIFFSetGetType(info[i].field_type, info[i].field_writecount,
|
||||
info[i].field_passcount);
|
||||
tp->field_bit = info[i].field_bit;
|
||||
tp->field_oktochange = info[i].field_oktochange;
|
||||
tp->field_passcount = info[i].field_passcount;
|
||||
/* Define an empty static string to be passed as field_name where a NULL
|
||||
* pointer is passed in. Otherwise, this will lead to buffer overflow
|
||||
* furtheron. */
|
||||
if (info[i].field_name == NULL)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Field_name of %d.th allocation tag %d is NULL", i,
|
||||
info[i].field_tag);
|
||||
return -1;
|
||||
static const char *string_static_empty = "";
|
||||
tp->field_name = (char *)string_static_empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
tp->field_name = info[i].field_name;
|
||||
}
|
||||
tp->field_name = info[i].field_name;
|
||||
tp->field_subfields = NULL;
|
||||
tp++;
|
||||
}
|
||||
|
|
|
|||
745
3rdparty/libtiff/tif_dirread.c
vendored
745
3rdparty/libtiff/tif_dirread.c
vendored
File diff suppressed because it is too large
Load Diff
606
3rdparty/libtiff/tif_dirwrite.c
vendored
606
3rdparty/libtiff/tif_dirwrite.c
vendored
File diff suppressed because it is too large
Load Diff
143
3rdparty/libtiff/tif_fax3.c
vendored
143
3rdparty/libtiff/tif_fax3.c
vendored
|
|
@ -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,12 @@ 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 */
|
||||
int eolReachedCount; /* number of times decode has been called with
|
||||
EOL already reached */
|
||||
int unexpectedReachedCount; /* number of times decode has been called with
|
||||
"unexpedted" 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 +134,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 +177,9 @@ 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;
|
||||
sp->eolReachedCount = 0;
|
||||
sp->unexpectedReachedCount = 0;
|
||||
/*
|
||||
* Decoder assumes lsb-to-msb bit order. Note that we select
|
||||
* this here rather than in Fax3SetupState so that viewers can
|
||||
|
|
@ -197,7 +215,12 @@ static void Fax3Unexpected(const char *module, TIFF *tif, uint32_t line,
|
|||
line, isTiled(tif) ? "tile" : "strip",
|
||||
(isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip), a0);
|
||||
}
|
||||
#define unexpected(table, a0) Fax3Unexpected(module, tif, sp->line, a0)
|
||||
#define unexpected(table, a0) \
|
||||
do \
|
||||
{ \
|
||||
Fax3Unexpected(module, tif, sp->line, a0); \
|
||||
++sp->unexpectedReachedCount; \
|
||||
} while (0)
|
||||
|
||||
static void Fax3Extension(const char *module, TIFF *tif, uint32_t line,
|
||||
uint32_t a0)
|
||||
|
|
@ -221,7 +244,12 @@ static void Fax3BadLength(const char *module, TIFF *tif, uint32_t line,
|
|||
(isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip), a0,
|
||||
lastx);
|
||||
}
|
||||
#define badlength(a0, lastx) Fax3BadLength(module, tif, sp->line, a0, lastx)
|
||||
#define badlength(a0, lastx) \
|
||||
do \
|
||||
{ \
|
||||
Fax3BadLength(module, tif, sp->line, a0, lastx); \
|
||||
++sp->eolReachedCount; \
|
||||
} while (0)
|
||||
|
||||
static void Fax3PrematureEOF(const char *module, TIFF *tif, uint32_t line,
|
||||
uint32_t a0)
|
||||
|
|
@ -232,10 +260,62 @@ 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)
|
||||
|
||||
static void Fax3TryG3WithoutEOL(const char *module, TIFF *tif, uint32_t line,
|
||||
uint32_t a0)
|
||||
{
|
||||
TIFFWarningExtR(
|
||||
tif, module,
|
||||
"Try to decode (read) fax Group 3 data without EOL at line %" PRIu32
|
||||
" of %s %" PRIu32 " (x %" PRIu32 "). Please check result",
|
||||
line, isTiled(tif) ? "tile" : "strip",
|
||||
(isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip), a0);
|
||||
}
|
||||
#define tryG3WithoutEOL(a0) \
|
||||
do \
|
||||
{ \
|
||||
Fax3TryG3WithoutEOL(module, tif, sp->line, a0); \
|
||||
} while (0)
|
||||
|
||||
#define Nop
|
||||
|
||||
static int CheckReachedCounters(TIFF *tif, const char *module,
|
||||
Fax3CodecState *sp)
|
||||
{
|
||||
if (sp->eofReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"End of file (EOF) has already been reached %d times "
|
||||
"within that %s.",
|
||||
sp->eofReachedCount, isTiled(tif) ? "tile" : "strip");
|
||||
return (-1);
|
||||
}
|
||||
if (sp->eolReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Bad line length (EOL) has already been reached %d times "
|
||||
"within that %s",
|
||||
sp->eolReachedCount, isTiled(tif) ? "tile" : "strip");
|
||||
return (-1);
|
||||
}
|
||||
if (sp->unexpectedReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Bad code word (unexpected) has already been reached %d "
|
||||
"times within that %s",
|
||||
sp->unexpectedReachedCount,
|
||||
isTiled(tif) ? "tile" : "strip");
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode the requested amount of G3 1D-encoded data.
|
||||
* @param buf destination buffer
|
||||
|
|
@ -252,6 +332,9 @@ 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 (CheckReachedCounters(tif, module, sp))
|
||||
return (-1);
|
||||
RETRY_WITHOUT_EOL_1D:
|
||||
CACHE_STATE(tif, sp);
|
||||
thisrun = sp->curruns;
|
||||
while (occ > 0)
|
||||
|
|
@ -264,7 +347,7 @@ static int Fax3Decode1D(TIFF *tif, uint8_t *buf, tmsize_t occ, uint16_t s)
|
|||
printf("-------------------- %" PRIu32 "\n", tif->tif_row);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
SYNC_EOL(EOF1D);
|
||||
SYNC_EOL(EOF1D, RETRY_WITHOUT_EOL_1D);
|
||||
EXPAND1D(EOF1Da);
|
||||
(*sp->fill)(buf, thisrun, pa, lastx);
|
||||
buf += sp->b.rowbytes;
|
||||
|
|
@ -302,6 +385,9 @@ 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 (CheckReachedCounters(tif, module, sp))
|
||||
return (-1);
|
||||
RETRY_WITHOUT_EOL_2D:
|
||||
CACHE_STATE(tif, sp);
|
||||
while (occ > 0)
|
||||
{
|
||||
|
|
@ -312,7 +398,7 @@ static int Fax3Decode2D(TIFF *tif, uint8_t *buf, tmsize_t occ, uint16_t s)
|
|||
printf("\nBitAcc=%08" PRIX32 ", BitsAvail = %d EOLcnt = %d", BitAcc,
|
||||
BitsAvail, EOLcnt);
|
||||
#endif
|
||||
SYNC_EOL(EOF2D);
|
||||
SYNC_EOL(EOF2D, RETRY_WITHOUT_EOL_2D);
|
||||
NeedBits8(1, EOF2D);
|
||||
is1D = GetBits(1); /* 1D/2D-encoding tag bit */
|
||||
ClrBits(1);
|
||||
|
|
@ -502,6 +588,15 @@ static int Fax3SetupState(TIFF *tif)
|
|||
"Bits/sample must be 1 for Group 3/4 encoding/decoding");
|
||||
return (0);
|
||||
}
|
||||
if (td->td_samplesperpixel != 1 &&
|
||||
td->td_planarconfig != PLANARCONFIG_SEPARATE)
|
||||
{
|
||||
TIFFErrorExtR(
|
||||
tif, module,
|
||||
"Samples/pixel shall be 1 for Group 3/4 encoding/decoding, "
|
||||
"or PlanarConfiguration must be set to Separate.");
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Calculate the scanline/tile widths.
|
||||
*/
|
||||
|
|
@ -536,7 +631,11 @@ static int Fax3SetupState(TIFF *tif)
|
|||
|
||||
TIFFroundup and TIFFSafeMultiply return zero on integer overflow
|
||||
*/
|
||||
dsp->runs = (uint32_t *)NULL;
|
||||
if (dsp->runs != NULL)
|
||||
{
|
||||
_TIFFfreeExt(tif, dsp->runs);
|
||||
dsp->runs = (uint32_t *)NULL;
|
||||
}
|
||||
dsp->nruns = TIFFroundup_32(rowpixels + 1, 32);
|
||||
if (needsRefLine)
|
||||
{
|
||||
|
|
@ -578,6 +677,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)
|
||||
{
|
||||
|
|
@ -1234,24 +1337,23 @@ static void Fax3Cleanup(TIFF *tif)
|
|||
#define FIELD_OPTIONS (FIELD_CODEC + 7)
|
||||
|
||||
static const TIFFField faxFields[] = {
|
||||
{TIFFTAG_FAXMODE, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, TIFF_SETGET_UNDEFINED,
|
||||
FIELD_PSEUDO, FALSE, FALSE, "FaxMode", NULL},
|
||||
{TIFFTAG_FAXFILLFUNC, 0, 0, TIFF_ANY, 0, TIFF_SETGET_OTHER,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, FALSE, FALSE, "FaxFillFunc", NULL},
|
||||
{TIFFTAG_FAXMODE, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO, FALSE,
|
||||
FALSE, "FaxMode", NULL},
|
||||
{TIFFTAG_FAXFILLFUNC, 0, 0, TIFF_ANY, 0, TIFF_SETGET_OTHER, FIELD_PSEUDO,
|
||||
FALSE, FALSE, "FaxFillFunc", NULL},
|
||||
{TIFFTAG_BADFAXLINES, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32,
|
||||
TIFF_SETGET_UINT32, FIELD_BADFAXLINES, TRUE, FALSE, "BadFaxLines", NULL},
|
||||
FIELD_BADFAXLINES, TRUE, FALSE, "BadFaxLines", NULL},
|
||||
{TIFFTAG_CLEANFAXDATA, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16,
|
||||
TIFF_SETGET_UINT16, FIELD_CLEANFAXDATA, TRUE, FALSE, "CleanFaxData", NULL},
|
||||
FIELD_CLEANFAXDATA, TRUE, FALSE, "CleanFaxData", NULL},
|
||||
{TIFFTAG_CONSECUTIVEBADFAXLINES, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32,
|
||||
TIFF_SETGET_UINT32, FIELD_BADFAXRUN, TRUE, FALSE, "ConsecutiveBadFaxLines",
|
||||
NULL}};
|
||||
FIELD_BADFAXRUN, TRUE, FALSE, "ConsecutiveBadFaxLines", NULL}};
|
||||
static const TIFFField fax3Fields[] = {
|
||||
{TIFFTAG_GROUP3OPTIONS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32,
|
||||
TIFF_SETGET_UINT32, FIELD_OPTIONS, FALSE, FALSE, "Group3Options", NULL},
|
||||
FIELD_OPTIONS, FALSE, FALSE, "Group3Options", NULL},
|
||||
};
|
||||
static const TIFFField fax4Fields[] = {
|
||||
{TIFFTAG_GROUP4OPTIONS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32,
|
||||
TIFF_SETGET_UINT32, FIELD_OPTIONS, FALSE, FALSE, "Group4Options", NULL},
|
||||
FIELD_OPTIONS, FALSE, FALSE, "Group4Options", NULL},
|
||||
};
|
||||
|
||||
static int Fax3VSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
|
|
@ -1514,7 +1616,10 @@ 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 (CheckReachedCounters(tif, module, sp))
|
||||
return (-1);
|
||||
CACHE_STATE(tif, sp);
|
||||
int start = sp->line;
|
||||
while (occ > 0)
|
||||
{
|
||||
a0 = 0;
|
||||
|
|
@ -1563,7 +1668,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);
|
||||
|
|
@ -1655,6 +1762,8 @@ static int Fax3DecodeRLE(TIFF *tif, uint8_t *buf, tmsize_t occ, uint16_t s)
|
|||
TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
|
||||
return (-1);
|
||||
}
|
||||
if (CheckReachedCounters(tif, module, sp))
|
||||
return (-1);
|
||||
CACHE_STATE(tif, sp);
|
||||
thisrun = sp->curruns;
|
||||
while (occ > 0)
|
||||
|
|
|
|||
41
3rdparty/libtiff/tif_fax3.h
vendored
41
3rdparty/libtiff/tif_fax3.h
vendored
|
|
@ -289,30 +289,39 @@ static const char *StateNames[] = {
|
|||
* is non-zero then we still need to scan for the final flag
|
||||
* bit that is part of the EOL code.
|
||||
*/
|
||||
#define SYNC_EOL(eoflab) \
|
||||
#define SYNC_EOL(eoflab, retrywithouteol) \
|
||||
do \
|
||||
{ \
|
||||
if (EOLcnt == 0) \
|
||||
if (!(sp->b.mode & FAXMODE_NOEOL)) /* skip EOL, if not present */ \
|
||||
{ \
|
||||
if (EOLcnt == 0) \
|
||||
{ \
|
||||
for (;;) \
|
||||
{ \
|
||||
NeedBits16(11, eoflab); \
|
||||
if (GetBits(11) == 0) \
|
||||
break; /* EOL found */ \
|
||||
ClrBits(1); \
|
||||
} \
|
||||
} \
|
||||
/* Now move after EOL or detect missing EOL. */ \
|
||||
for (;;) \
|
||||
{ \
|
||||
NeedBits16(11, eoflab); \
|
||||
if (GetBits(11) == 0) \
|
||||
NeedBits8(8, noEOLFound); \
|
||||
if (GetBits(8)) \
|
||||
break; \
|
||||
ClrBits(1); \
|
||||
ClrBits(8); \
|
||||
} \
|
||||
while (GetBits(1) == 0) \
|
||||
ClrBits(1); \
|
||||
ClrBits(1); /* EOL bit */ \
|
||||
EOLcnt = 0; /* reset EOL counter/flag */ \
|
||||
break; /* existing EOL skipped, leave macro */ \
|
||||
noEOLFound: \
|
||||
sp->b.mode |= FAXMODE_NOEOL; \
|
||||
tryG3WithoutEOL(a0); \
|
||||
goto retrywithouteol; \
|
||||
} \
|
||||
for (;;) \
|
||||
{ \
|
||||
NeedBits8(8, eoflab); \
|
||||
if (GetBits(8)) \
|
||||
break; \
|
||||
ClrBits(8); \
|
||||
} \
|
||||
while (GetBits(1) == 0) \
|
||||
ClrBits(1); \
|
||||
ClrBits(1); /* EOL bit */ \
|
||||
EOLcnt = 0; /* reset EOL counter/flag */ \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
|
|
|
|||
249
3rdparty/libtiff/tif_getimage.c
vendored
249
3rdparty/libtiff/tif_getimage.c
vendored
|
|
@ -600,6 +600,27 @@ int TIFFRGBAImageGet(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
"No \"put\" routine setupl; probably can not handle image format");
|
||||
return (0);
|
||||
}
|
||||
/* Verify raster height against image height.
|
||||
* Width is checked in img->get() function individually. */
|
||||
if (0 <= img->row_offset && (uint32_t)img->row_offset < img->height)
|
||||
{
|
||||
uint32_t hx = img->height - img->row_offset;
|
||||
if (h > hx)
|
||||
{
|
||||
/* Adapt parameters to read only available lines and put image
|
||||
* at the bottom of the raster. */
|
||||
raster += (size_t)(h - hx) * w;
|
||||
h = hx;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
|
||||
"Error in TIFFRGBAImageGet: row offset %d exceeds "
|
||||
"image height %d",
|
||||
img->row_offset, img->height);
|
||||
return 0;
|
||||
}
|
||||
return (*img->get)(img, raster, w, h);
|
||||
}
|
||||
|
||||
|
|
@ -614,12 +635,10 @@ int TIFFReadRGBAImageOriented(TIFF *tif, uint32_t rwidth, uint32_t rheight,
|
|||
TIFFRGBAImage img;
|
||||
int ok;
|
||||
|
||||
if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, stop, emsg))
|
||||
if (TIFFRGBAImageBegin(&img, tif, stop, emsg))
|
||||
{
|
||||
img.req_orientation = (uint16_t)orientation;
|
||||
/* XXX verify rwidth and rheight against width and height */
|
||||
ok = TIFFRGBAImageGet(&img, raster + (rheight - img.height) * rwidth,
|
||||
rwidth, img.height);
|
||||
ok = TIFFRGBAImageGet(&img, raster, rwidth, rheight);
|
||||
TIFFRGBAImageEnd(&img);
|
||||
}
|
||||
else
|
||||
|
|
@ -726,6 +745,22 @@ static int gtTileContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
uint32_t leftmost_tw;
|
||||
tmsize_t bufsize;
|
||||
|
||||
/* If the raster is smaller than the image,
|
||||
* or if there is a col_offset, adapt the samples to be copied per row. */
|
||||
uint32_t wmin;
|
||||
|
||||
if (0 <= img->col_offset && (uint32_t)img->col_offset < img->width)
|
||||
{
|
||||
wmin = TIFFmin(w, img->width - img->col_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
"Error in gtTileContig: column offset %d exceeds "
|
||||
"image width %d",
|
||||
img->col_offset, img->width);
|
||||
return 0;
|
||||
}
|
||||
bufsize = TIFFTileSize(tif);
|
||||
if (bufsize == 0)
|
||||
{
|
||||
|
|
@ -739,7 +774,7 @@ static int gtTileContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
flip = setorientation(img);
|
||||
if (flip & FLIP_VERTICALLY)
|
||||
{
|
||||
if ((tw + w) > INT_MAX)
|
||||
if (((int64_t)tw + w) > INT_MAX)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
|
||||
"unsupported tile size (too wide)");
|
||||
|
|
@ -750,7 +785,7 @@ static int gtTileContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (tw > (INT_MAX + w))
|
||||
if (tw > ((int64_t)INT_MAX + w))
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
|
||||
"unsupported tile size (too wide)");
|
||||
|
|
@ -760,12 +795,25 @@ 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.
|
||||
*/
|
||||
leftmost_fromskew = img->col_offset % tw;
|
||||
leftmost_tw = tw - leftmost_fromskew;
|
||||
leftmost_toskew = toskew + leftmost_fromskew;
|
||||
int64_t skew_i64 = (int64_t)toskew + leftmost_fromskew;
|
||||
if (skew_i64 > INT_MAX || skew_i64 < INT_MIN)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "%s %" PRId64, "Invalid skew",
|
||||
skew_i64);
|
||||
return (0);
|
||||
}
|
||||
leftmost_toskew = (int32_t)skew_i64;
|
||||
for (row = 0; ret != 0 && row < h; row += nrow)
|
||||
{
|
||||
rowstoread = th - (row + img->row_offset) % th;
|
||||
|
|
@ -775,7 +823,8 @@ static int gtTileContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
this_toskew = leftmost_toskew;
|
||||
tocol = 0;
|
||||
col = img->col_offset;
|
||||
while (tocol < w)
|
||||
/* wmin: only write imagewidth if raster is bigger. */
|
||||
while (tocol < wmin)
|
||||
{
|
||||
if (_TIFFReadTileAndAllocBuffer(tif, (void **)&buf, bufsize, col,
|
||||
row + img->row_offset, 0,
|
||||
|
|
@ -787,12 +836,12 @@ static int gtTileContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
}
|
||||
pos = ((row + img->row_offset) % th) * TIFFTileRowSize(tif) +
|
||||
((tmsize_t)fromskew * img->samplesperpixel);
|
||||
if (tocol + this_tw > w)
|
||||
if (tocol + this_tw > wmin)
|
||||
{
|
||||
/*
|
||||
* Rightmost tile is clipped on right side.
|
||||
*/
|
||||
fromskew = tw - (w - tocol);
|
||||
fromskew = tw - (wmin - tocol);
|
||||
this_tw = tw - fromskew;
|
||||
this_toskew = toskew + fromskew;
|
||||
}
|
||||
|
|
@ -821,7 +870,9 @@ static int gtTileContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
for (line = 0; line < h; line++)
|
||||
{
|
||||
uint32_t *left = raster + (line * w);
|
||||
uint32_t *right = left + w - 1;
|
||||
/* Use wmin to only flip horizontally data in place and not complete
|
||||
* raster-row. */
|
||||
uint32_t *right = left + wmin - 1;
|
||||
|
||||
while (left < right)
|
||||
{
|
||||
|
|
@ -868,6 +919,22 @@ static int gtTileSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
int32_t leftmost_fromskew;
|
||||
uint32_t leftmost_tw;
|
||||
|
||||
/* If the raster is smaller than the image,
|
||||
* or if there is a col_offset, adapt the samples to be copied per row. */
|
||||
uint32_t wmin;
|
||||
if (0 <= img->col_offset && (uint32_t)img->col_offset < img->width)
|
||||
{
|
||||
wmin = TIFFmin(w, img->width - img->col_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
"Error in gtTileSeparate: column offset %d exceeds "
|
||||
"image width %d",
|
||||
img->col_offset, img->width);
|
||||
return 0;
|
||||
}
|
||||
|
||||
tilesize = TIFFTileSize(tif);
|
||||
bufsize =
|
||||
_TIFFMultiplySSize(tif, alpha ? 4 : 3, tilesize, "gtTileSeparate");
|
||||
|
|
@ -882,7 +949,7 @@ static int gtTileSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
flip = setorientation(img);
|
||||
if (flip & FLIP_VERTICALLY)
|
||||
{
|
||||
if ((tw + w) > INT_MAX)
|
||||
if (((int64_t)tw + w) > INT_MAX)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
|
||||
"unsupported tile size (too wide)");
|
||||
|
|
@ -893,7 +960,7 @@ static int gtTileSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (tw > (INT_MAX + w))
|
||||
if (tw > ((int64_t)INT_MAX + w))
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
|
||||
"unsupported tile size (too wide)");
|
||||
|
|
@ -916,12 +983,25 @@ 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.
|
||||
*/
|
||||
leftmost_fromskew = img->col_offset % tw;
|
||||
leftmost_tw = tw - leftmost_fromskew;
|
||||
leftmost_toskew = toskew + leftmost_fromskew;
|
||||
int64_t skew_i64 = (int64_t)toskew + leftmost_fromskew;
|
||||
if (skew_i64 > INT_MAX || skew_i64 < INT_MIN)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "%s %" PRId64, "Invalid skew",
|
||||
skew_i64);
|
||||
return (0);
|
||||
}
|
||||
leftmost_toskew = (int32_t)skew_i64;
|
||||
for (row = 0; ret != 0 && row < h; row += nrow)
|
||||
{
|
||||
rowstoread = th - (row + img->row_offset) % th;
|
||||
|
|
@ -931,7 +1011,8 @@ static int gtTileSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
this_toskew = leftmost_toskew;
|
||||
tocol = 0;
|
||||
col = img->col_offset;
|
||||
while (tocol < w)
|
||||
/* wmin: only write imagewidth if raster is bigger. */
|
||||
while (tocol < wmin)
|
||||
{
|
||||
if (buf == NULL)
|
||||
{
|
||||
|
|
@ -988,14 +1069,16 @@ static int gtTileSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
break;
|
||||
}
|
||||
|
||||
/* For SEPARATE the pos-offset is per sample and should not be
|
||||
* multiplied by img->samplesperpixel. */
|
||||
pos = ((row + img->row_offset) % th) * TIFFTileRowSize(tif) +
|
||||
((tmsize_t)fromskew * img->samplesperpixel);
|
||||
if (tocol + this_tw > w)
|
||||
(tmsize_t)fromskew;
|
||||
if (tocol + this_tw > wmin)
|
||||
{
|
||||
/*
|
||||
* Rightmost tile is clipped on right side.
|
||||
*/
|
||||
fromskew = tw - (w - tocol);
|
||||
fromskew = tw - (wmin - tocol);
|
||||
this_tw = tw - fromskew;
|
||||
this_toskew = toskew + fromskew;
|
||||
}
|
||||
|
|
@ -1024,7 +1107,9 @@ static int gtTileSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
for (line = 0; line < h; line++)
|
||||
{
|
||||
uint32_t *left = raster + (line * w);
|
||||
uint32_t *right = left + w - 1;
|
||||
/* Use wmin to only flip horizontally data in place and not complete
|
||||
* raster-row. */
|
||||
uint32_t *right = left + wmin - 1;
|
||||
|
||||
while (left < right)
|
||||
{
|
||||
|
|
@ -1059,10 +1144,28 @@ static int gtStripContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
uint16_t subsamplinghor, subsamplingver;
|
||||
uint32_t imagewidth = img->width;
|
||||
tmsize_t scanline;
|
||||
/* fromskew, toskew are the increments within the input image or the raster
|
||||
* from the end of a line to the start of the next line to read or write. */
|
||||
int32_t fromskew, toskew;
|
||||
int ret = 1, flip;
|
||||
tmsize_t maxstripsize;
|
||||
|
||||
/* If the raster is smaller than the image,
|
||||
* or if there is a col_offset, adapt the samples to be copied per row. */
|
||||
uint32_t wmin;
|
||||
if (0 <= img->col_offset && (uint32_t)img->col_offset < imagewidth)
|
||||
{
|
||||
wmin = TIFFmin(w, imagewidth - img->col_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
"Error in gtStripContig: column offset %d exceeds "
|
||||
"image width %d",
|
||||
img->col_offset, imagewidth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor,
|
||||
&subsamplingver);
|
||||
if (subsamplingver == 0)
|
||||
|
|
@ -1077,21 +1180,30 @@ static int gtStripContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
flip = setorientation(img);
|
||||
if (flip & FLIP_VERTICALLY)
|
||||
{
|
||||
if (w > INT_MAX)
|
||||
if (w > INT_MAX / 2)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "Width overflow");
|
||||
return (0);
|
||||
}
|
||||
y = h - 1;
|
||||
toskew = -(int32_t)(w + w);
|
||||
/* Skew back to the raster row before the currently written row
|
||||
* -> one raster width plus copied image pixels. */
|
||||
toskew = -(int32_t)(w + wmin);
|
||||
}
|
||||
else
|
||||
{
|
||||
y = 0;
|
||||
toskew = -(int32_t)(w - w);
|
||||
/* Skew forward to the end of the raster width of the row currently
|
||||
* copied. */
|
||||
toskew = w - wmin;
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
@ -1123,19 +1235,25 @@ static int gtStripContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
pos = ((row + img->row_offset) % rowsperstrip) * scanline +
|
||||
((tmsize_t)img->col_offset * img->samplesperpixel);
|
||||
tmsize_t roffset = (tmsize_t)y * w;
|
||||
(*put)(img, raster + roffset, 0, y, w, nrow, fromskew, toskew,
|
||||
(*put)(img, raster + roffset, 0, y, wmin, nrow, fromskew, toskew,
|
||||
buf + pos);
|
||||
y += ((flip & FLIP_VERTICALLY) ? -(int32_t)nrow : (int32_t)nrow);
|
||||
}
|
||||
|
||||
if (flip & FLIP_HORIZONTALLY)
|
||||
{
|
||||
/* Flips the complete raster matrix horizontally. If raster width is
|
||||
* larger than image width, data are moved horizontally to the right
|
||||
* side.
|
||||
* Use wmin to only flip data in place. */
|
||||
uint32_t line;
|
||||
|
||||
for (line = 0; line < h; line++)
|
||||
{
|
||||
uint32_t *left = raster + (line * w);
|
||||
uint32_t *right = left + w - 1;
|
||||
/* Use wmin to only flip horizontally data in place and not complete
|
||||
* raster-row. */
|
||||
uint32_t *right = left + wmin - 1;
|
||||
|
||||
while (left < right)
|
||||
{
|
||||
|
|
@ -1177,6 +1295,22 @@ static int gtStripSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
int ret = 1, flip;
|
||||
uint16_t colorchannels;
|
||||
|
||||
/* If the raster is smaller than the image,
|
||||
* or if there is a col_offset, adapt the samples to be copied per row. */
|
||||
uint32_t wmin;
|
||||
if (0 <= img->col_offset && (uint32_t)img->col_offset < imagewidth)
|
||||
{
|
||||
wmin = TIFFmin(w, imagewidth - img->col_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif),
|
||||
"Error in gtStripSeparate: column offset %d exceeds "
|
||||
"image width %d",
|
||||
img->col_offset, imagewidth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
stripsize = TIFFStripSize(tif);
|
||||
bufsize =
|
||||
_TIFFMultiplySSize(tif, alpha ? 4 : 3, stripsize, "gtStripSeparate");
|
||||
|
|
@ -1188,18 +1322,22 @@ static int gtStripSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
flip = setorientation(img);
|
||||
if (flip & FLIP_VERTICALLY)
|
||||
{
|
||||
if (w > INT_MAX)
|
||||
if (w > INT_MAX / 2)
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "Width overflow");
|
||||
return (0);
|
||||
}
|
||||
y = h - 1;
|
||||
toskew = -(int32_t)(w + w);
|
||||
/* Skew back to the raster row before the currently written row
|
||||
* -> one raster width plus one image width. */
|
||||
toskew = -(int32_t)(w + wmin);
|
||||
}
|
||||
else
|
||||
{
|
||||
y = 0;
|
||||
toskew = -(int32_t)(w - w);
|
||||
/* Skew forward to the end of the raster width of the row currently
|
||||
* written. */
|
||||
toskew = w - wmin;
|
||||
}
|
||||
|
||||
switch (img->photometric)
|
||||
|
|
@ -1216,6 +1354,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)
|
||||
|
|
@ -1289,11 +1433,13 @@ static int gtStripSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
}
|
||||
}
|
||||
|
||||
/* For SEPARATE the pos-offset is per sample and should not be
|
||||
* multiplied by img->samplesperpixel. */
|
||||
pos = ((row + img->row_offset) % rowsperstrip) * scanline +
|
||||
((tmsize_t)img->col_offset * img->samplesperpixel);
|
||||
(tmsize_t)img->col_offset;
|
||||
tmsize_t roffset = (tmsize_t)y * w;
|
||||
(*put)(img, raster + roffset, 0, y, w, nrow, fromskew, toskew, p0 + pos,
|
||||
p1 + pos, p2 + pos, (alpha ? (pa + pos) : NULL));
|
||||
(*put)(img, raster + roffset, 0, y, wmin, nrow, fromskew, toskew,
|
||||
p0 + pos, p1 + pos, p2 + pos, (alpha ? (pa + pos) : NULL));
|
||||
y += ((flip & FLIP_VERTICALLY) ? -(int32_t)nrow : (int32_t)nrow);
|
||||
}
|
||||
|
||||
|
|
@ -1304,7 +1450,9 @@ static int gtStripSeparate(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
|
|||
for (line = 0; line < h; line++)
|
||||
{
|
||||
uint32_t *left = raster + (line * w);
|
||||
uint32_t *right = left + w - 1;
|
||||
/* Use wmin to only flip horizontally data in place and not complete
|
||||
* raster-row. */
|
||||
uint32_t *right = left + wmin - 1;
|
||||
|
||||
while (left < right)
|
||||
{
|
||||
|
|
@ -3117,8 +3265,8 @@ static int PickSeparateCase(TIFFRGBAImage *img)
|
|||
case PHOTOMETRIC_SEPARATED:
|
||||
if (img->bitspersample == 8 && img->samplesperpixel == 4)
|
||||
{
|
||||
img->alpha =
|
||||
1; // Not alpha, but seems like the only way to get 4th band
|
||||
/* Not alpha, but seems like the only way to get 4th band */
|
||||
img->alpha = 1;
|
||||
img->put.separate = putCMYKseparate8bittile;
|
||||
}
|
||||
break;
|
||||
|
|
@ -3213,6 +3361,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(
|
||||
|
|
@ -3221,9 +3376,15 @@ int TIFFReadRGBAStripExt(TIFF *tif, uint32_t row, uint32_t *raster,
|
|||
return (0);
|
||||
}
|
||||
|
||||
if (TIFFRGBAImageOK(tif, emsg) &&
|
||||
TIFFRGBAImageBegin(&img, tif, stop_on_error, emsg))
|
||||
if (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 +3443,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),
|
||||
|
|
@ -3294,13 +3462,20 @@ int TIFFReadRGBATileExt(TIFF *tif, uint32_t col, uint32_t row, uint32_t *raster,
|
|||
* Setup the RGBA reader.
|
||||
*/
|
||||
|
||||
if (!TIFFRGBAImageOK(tif, emsg) ||
|
||||
!TIFFRGBAImageBegin(&img, tif, stop_on_error, emsg))
|
||||
if (!TIFFRGBAImageBegin(&img, tif, stop_on_error, emsg))
|
||||
{
|
||||
TIFFErrorExtR(tif, TIFFFileName(tif), "%s", emsg);
|
||||
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
|
||||
|
|
|
|||
2
3rdparty/libtiff/tif_jbig.c
vendored
2
3rdparty/libtiff/tif_jbig.c
vendored
|
|
@ -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",
|
||||
|
|
|
|||
116
3rdparty/libtiff/tif_jpeg.c
vendored
116
3rdparty/libtiff/tif_jpeg.c
vendored
|
|
@ -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,19 @@ 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.
|
||||
* (note: libjpeg-turbo 2.2 was actually released as 3.0)
|
||||
*/
|
||||
|
||||
#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 +146,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
|
||||
|
|
@ -231,6 +206,8 @@ typedef struct
|
|||
int samplesperclump;
|
||||
|
||||
JPEGOtherSettings otherSettings;
|
||||
|
||||
int encode_raw_error;
|
||||
} JPEGState;
|
||||
|
||||
#define JState(tif) ((JPEGState *)(tif)->tif_data)
|
||||
|
|
@ -246,13 +223,13 @@ static int DecodeRowError(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s);
|
|||
|
||||
static const TIFFField jpegFields[] = {
|
||||
{TIFFTAG_JPEGTABLES, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8,
|
||||
TIFF_SETGET_C32_UINT8, FIELD_JPEGTABLES, FALSE, TRUE, "JPEGTables", NULL},
|
||||
{TIFFTAG_JPEGQUALITY, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "", NULL},
|
||||
{TIFFTAG_JPEGCOLORMODE, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, FALSE, FALSE, "", NULL},
|
||||
{TIFFTAG_JPEGTABLESMODE, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, FALSE, FALSE, "", NULL}};
|
||||
FIELD_JPEGTABLES, FALSE, TRUE, "JPEGTables", NULL},
|
||||
{TIFFTAG_JPEGQUALITY, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO,
|
||||
TRUE, FALSE, "", NULL},
|
||||
{TIFFTAG_JPEGCOLORMODE, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO,
|
||||
FALSE, FALSE, "", NULL},
|
||||
{TIFFTAG_JPEGTABLESMODE, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO,
|
||||
FALSE, FALSE, "", NULL}};
|
||||
|
||||
/*
|
||||
* libjpeg interface layer.
|
||||
|
|
@ -1241,6 +1218,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 +1454,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 +1478,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 +1515,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 +1554,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)
|
||||
{
|
||||
|
|
@ -1777,7 +1772,8 @@ static int JPEGDecode(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s)
|
|||
{
|
||||
unsigned char *out_ptr =
|
||||
((unsigned char *)buf) + iPair * 3;
|
||||
JSAMPLE *in_ptr = (JSAMPLE *)(tmpbuf + iPair * 2);
|
||||
TIFF_JSAMPLE *in_ptr =
|
||||
(TIFF_JSAMPLE *)(tmpbuf + iPair * 2);
|
||||
out_ptr[0] = (unsigned char)((in_ptr[0] & 0xff0) >> 4);
|
||||
out_ptr[1] =
|
||||
(unsigned char)(((in_ptr[0] & 0xf) << 4) |
|
||||
|
|
@ -2190,12 +2186,21 @@ 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);
|
||||
}
|
||||
if (segment_width > 65535 || segment_height > 65535)
|
||||
if (segment_width > (uint32_t)JPEG_MAX_DIMENSION ||
|
||||
segment_height > (uint32_t)JPEG_MAX_DIMENSION)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Strip/tile too large for JPEG");
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Strip/tile too large for JPEG. Maximum dimension is %d",
|
||||
(int)JPEG_MAX_DIMENSION);
|
||||
return (0);
|
||||
}
|
||||
sp->cinfo.c.image_width = segment_width;
|
||||
|
|
@ -2302,6 +2307,7 @@ static int JPEGPreEncode(TIFF *tif, uint16_t s)
|
|||
return (0);
|
||||
}
|
||||
sp->scancount = 0;
|
||||
sp->encode_raw_error = FALSE;
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
|
@ -2398,6 +2404,13 @@ static int JPEGEncodeRaw(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s)
|
|||
|
||||
(void)s;
|
||||
assert(sp != NULL);
|
||||
|
||||
if (sp->encode_raw_error)
|
||||
{
|
||||
TIFFErrorExtR(tif, tif->tif_name, "JPEGEncodeRaw() already failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* data is expected to be supplied in multiples of a clumpline */
|
||||
/* a clumpline is equivalent to v_sampling desubsampled scanlines */
|
||||
/* TODO: the following calculation of bytesperclumpline, should substitute
|
||||
|
|
@ -2469,7 +2482,10 @@ static int JPEGEncodeRaw(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s)
|
|||
{
|
||||
int n = sp->cinfo.c.max_v_samp_factor * DCTSIZE;
|
||||
if (TIFFjpeg_write_raw_data(sp, sp->ds_buffer, n) != n)
|
||||
{
|
||||
sp->encode_raw_error = TRUE;
|
||||
return (0);
|
||||
}
|
||||
sp->scancount = 0;
|
||||
}
|
||||
tif->tif_row += sp->v_sampling;
|
||||
|
|
|
|||
603
3rdparty/libtiff/tif_lerc.c
vendored
603
3rdparty/libtiff/tif_lerc.c
vendored
|
|
@ -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,11 +89,10 @@ 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);
|
||||
|
||||
static int LERCFixupTags(TIFF *tif)
|
||||
|
|
@ -101,7 +103,7 @@ static int LERCFixupTags(TIFF *tif)
|
|||
|
||||
static int LERCSetupDecode(TIFF *tif)
|
||||
{
|
||||
LERCState *sp = DecoderState(tif);
|
||||
LERCState *sp = LERCDecoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
|
||||
|
|
@ -168,7 +170,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 +204,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);
|
||||
|
|
@ -218,7 +221,7 @@ static int SetupUncompressedBuffer(TIFF *tif, LERCState *sp, const char *module)
|
|||
{
|
||||
TIFFErrorExtR(tif, module, "Too large uncompressed strip/tile");
|
||||
_TIFFfreeExt(tif, sp->uncompressed_buffer);
|
||||
sp->uncompressed_buffer = 0;
|
||||
sp->uncompressed_buffer = NULL;
|
||||
sp->uncompressed_alloc = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -226,12 +229,12 @@ static int SetupUncompressedBuffer(TIFF *tif, LERCState *sp, const char *module)
|
|||
if (sp->uncompressed_alloc < new_alloc)
|
||||
{
|
||||
_TIFFfreeExt(tif, sp->uncompressed_buffer);
|
||||
sp->uncompressed_buffer = _TIFFmallocExt(tif, new_alloc);
|
||||
sp->uncompressed_buffer = (uint8_t *)_TIFFmallocExt(tif, new_alloc);
|
||||
if (!sp->uncompressed_buffer)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Cannot allocate buffer");
|
||||
_TIFFfreeExt(tif, sp->uncompressed_buffer);
|
||||
sp->uncompressed_buffer = 0;
|
||||
sp->uncompressed_buffer = NULL;
|
||||
sp->uncompressed_alloc = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -243,11 +246,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 =
|
||||
|
|
@ -257,7 +266,7 @@ static int SetupUncompressedBuffer(TIFF *tif, LERCState *sp, const char *module)
|
|||
TIFFErrorExtR(tif, module, "Cannot allocate buffer");
|
||||
sp->mask_size = 0;
|
||||
_TIFFfreeExt(tif, sp->uncompressed_buffer);
|
||||
sp->uncompressed_buffer = 0;
|
||||
sp->uncompressed_buffer = NULL;
|
||||
sp->uncompressed_alloc = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -277,9 +286,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 +304,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)
|
||||
|
|
@ -338,7 +347,7 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
|||
return 0;
|
||||
}
|
||||
assert(lerc_data_sizet == (unsigned int)lerc_data_sizet);
|
||||
lerc_data = sp->compressed_buffer;
|
||||
lerc_data = (uint8_t *)sp->compressed_buffer;
|
||||
lerc_data_size = (unsigned int)lerc_data_sizet;
|
||||
#else
|
||||
z_stream strm;
|
||||
|
|
@ -359,7 +368,7 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
|||
strm.avail_in = (uInt)tif->tif_rawcc;
|
||||
strm.next_in = tif->tif_rawcp;
|
||||
strm.avail_out = sp->compressed_size;
|
||||
strm.next_out = sp->compressed_buffer;
|
||||
strm.next_out = (Bytef *)sp->compressed_buffer;
|
||||
zlib_ret = inflate(&strm, Z_FINISH);
|
||||
if (zlib_ret != Z_STREAM_END && zlib_ret != Z_OK)
|
||||
{
|
||||
|
|
@ -367,7 +376,7 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
|||
inflateEnd(&strm);
|
||||
return 0;
|
||||
}
|
||||
lerc_data = sp->compressed_buffer;
|
||||
lerc_data = (uint8_t *)sp->compressed_buffer;
|
||||
lerc_data_size = sp->compressed_size - strm.avail_out;
|
||||
inflateEnd(&strm);
|
||||
#endif
|
||||
|
|
@ -386,7 +395,7 @@ static int LERCPreDecode(TIFF *tif, uint16_t s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
lerc_data = sp->compressed_buffer;
|
||||
lerc_data = (uint8_t *)sp->compressed_buffer;
|
||||
lerc_data_size = (unsigned int)zstd_ret;
|
||||
#else
|
||||
TIFFErrorExtR(tif, module, "ZSTD support missing");
|
||||
|
|
@ -400,7 +409,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 +427,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 +449,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 +484,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 +523,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 =
|
||||
(uint8_t *)_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,7 +627,6 @@ 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 WORDS_BIGENDIAN
|
||||
const unsigned char nan_bytes[] = {0x7f, 0xc0, 0, 0};
|
||||
|
|
@ -525,23 +636,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,14 +745,15 @@ 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);
|
||||
assert(sp->state == LSTATE_INIT_DECODE);
|
||||
|
||||
if (sp->uncompressed_buffer == 0)
|
||||
if (sp->uncompressed_buffer == NULL)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module, "Uncompressed buffer not allocated");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -568,6 +761,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;
|
||||
}
|
||||
|
|
@ -578,9 +772,11 @@ static int LERCDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifndef LERC_READ_ONLY
|
||||
|
||||
static int LERCSetupEncode(TIFF *tif)
|
||||
{
|
||||
LERCState *sp = EncoderState(tif);
|
||||
LERCState *sp = LERCEncoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
if (sp->state & LSTATE_INIT_DECODE)
|
||||
|
|
@ -599,7 +795,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 +807,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 +819,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 +845,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 +857,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 +871,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 +907,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 +986,170 @@ 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 =
|
||||
(uint8_t *)_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,
|
||||
(unsigned char *)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,
|
||||
(unsigned char *)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)
|
||||
{
|
||||
|
|
@ -937,7 +1274,7 @@ static int LERCPostEncode(TIFF *tif)
|
|||
{
|
||||
int ret;
|
||||
uint8_t *tif_rawdata_backup = tif->tif_rawdata;
|
||||
tif->tif_rawdata = sp->compressed_buffer;
|
||||
tif->tif_rawdata = (uint8_t *)sp->compressed_buffer;
|
||||
tif->tif_rawcc = numBytesWritten;
|
||||
ret = TIFFFlushData1(tif);
|
||||
tif->tif_rawdata = tif_rawdata_backup;
|
||||
|
|
@ -948,16 +1285,19 @@ static int LERCPostEncode(TIFF *tif)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#endif /* LERC_READ_ONLY */
|
||||
|
||||
static void LERCCleanup(TIFF *tif)
|
||||
{
|
||||
LERCState *sp = LState(tif);
|
||||
LERCState *sp = GetLERCState(tif);
|
||||
|
||||
assert(sp != 0);
|
||||
assert(sp != NULL);
|
||||
|
||||
tif->tif_tagmethods.vgetfield = sp->vgetparent;
|
||||
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);
|
||||
|
||||
|
|
@ -976,26 +1316,23 @@ static void LERCCleanup(TIFF *tif)
|
|||
|
||||
static const TIFFField LERCFields[] = {
|
||||
{TIFFTAG_LERC_PARAMETERS, TIFF_VARIABLE2, TIFF_VARIABLE2, TIFF_LONG, 0,
|
||||
TIFF_SETGET_C32_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, FALSE, TRUE,
|
||||
"LercParameters", NULL},
|
||||
TIFF_SETGET_C32_UINT32, FIELD_CUSTOM, FALSE, TRUE,
|
||||
(char *)"LercParameters", NULL},
|
||||
{TIFFTAG_LERC_MAXZERROR, 0, 0, TIFF_ANY, 0, TIFF_SETGET_DOUBLE,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "LercMaximumError",
|
||||
NULL},
|
||||
{TIFFTAG_LERC_VERSION, 0, 0, TIFF_ANY, 0, TIFF_SETGET_UINT32,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, FALSE, FALSE, "LercVersion", NULL},
|
||||
FIELD_PSEUDO, TRUE, FALSE, (char *)"LercMaximumError", NULL},
|
||||
{TIFFTAG_LERC_VERSION, 0, 0, TIFF_ANY, 0, TIFF_SETGET_UINT32, FIELD_PSEUDO,
|
||||
FALSE, FALSE, (char *)"LercVersion", NULL},
|
||||
{TIFFTAG_LERC_ADD_COMPRESSION, 0, 0, TIFF_ANY, 0, TIFF_SETGET_UINT32,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, FALSE, FALSE,
|
||||
"LercAdditionalCompression", NULL},
|
||||
{TIFFTAG_ZSTD_LEVEL, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE,
|
||||
"ZSTD zstd_compress_level", NULL},
|
||||
{TIFFTAG_ZIPQUALITY, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "", NULL},
|
||||
FIELD_PSEUDO, FALSE, FALSE, (char *)"LercAdditionalCompression", NULL},
|
||||
{TIFFTAG_ZSTD_LEVEL, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO, TRUE,
|
||||
FALSE, (char *)"ZSTD zstd_compress_level", NULL},
|
||||
{TIFFTAG_ZIPQUALITY, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO, TRUE,
|
||||
FALSE, (char *)"", NULL},
|
||||
};
|
||||
|
||||
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 +1344,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 +1452,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 +1500,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.
|
||||
|
|
@ -1182,12 +1519,14 @@ int TIFFInitLERC(TIFF *tif, int scheme)
|
|||
tif->tif_decoderow = LERCDecode;
|
||||
tif->tif_decodestrip = LERCDecode;
|
||||
tif->tif_decodetile = LERCDecode;
|
||||
#ifndef LERC_READ_ONLY
|
||||
tif->tif_setupencode = LERCSetupEncode;
|
||||
tif->tif_preencode = LERCPreEncode;
|
||||
tif->tif_postencode = LERCPostEncode;
|
||||
tif->tif_encoderow = LERCEncode;
|
||||
tif->tif_encodestrip = LERCEncode;
|
||||
tif->tif_encodetile = LERCEncode;
|
||||
#endif
|
||||
tif->tif_cleanup = LERCCleanup;
|
||||
|
||||
/* Default values for codec-specific fields */
|
||||
|
|
|
|||
37
3rdparty/libtiff/tif_luv.c
vendored
37
3rdparty/libtiff/tif_luv.c
vendored
|
|
@ -145,9 +145,11 @@
|
|||
* quantization errors into noise.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
/*
|
||||
* State block for each open TIFF
|
||||
|
|
@ -770,13 +772,26 @@ static int LogLuvEncodeTile(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
|||
#undef exp2 /* Conflict with C'99 function */
|
||||
#define exp2(x) exp(M_LN2 *(x))
|
||||
|
||||
#define TIFF_RAND_MAX 32767
|
||||
|
||||
// From POSIX.1-2001 as an example of an implementation of rand()
|
||||
static uint32_t _TIFFRand()
|
||||
{
|
||||
static uint32_t nCounter = 0;
|
||||
if (!nCounter)
|
||||
nCounter = (uint32_t)(time(NULL) & UINT32_MAX);
|
||||
++nCounter;
|
||||
uint32_t nCounterLocal =
|
||||
(uint32_t)(((uint64_t)(nCounter)*1103515245U + 12345U) & UINT32_MAX);
|
||||
nCounter = nCounterLocal;
|
||||
return (nCounterLocal / 65536U) % (TIFF_RAND_MAX + 1);
|
||||
};
|
||||
|
||||
static int tiff_itrunc(double x, int m)
|
||||
{
|
||||
if (m == SGILOGENCODE_NODITHER)
|
||||
return (int)x;
|
||||
/* Silence CoverityScan warning about bad crypto function */
|
||||
/* coverity[dont_call] */
|
||||
return (int)(x + rand() * (1. / RAND_MAX) - .5);
|
||||
return (int)(x + _TIFFRand() * (1. / TIFF_RAND_MAX) - .5);
|
||||
}
|
||||
|
||||
#if !LOGLUV_PUBLIC
|
||||
|
|
@ -951,7 +966,8 @@ 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)
|
||||
|
|
@ -980,8 +996,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);
|
||||
|
|
@ -1772,10 +1789,10 @@ static int LogLuvVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
}
|
||||
|
||||
static const TIFFField LogLuvFields[] = {
|
||||
{TIFFTAG_SGILOGDATAFMT, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "SGILogDataFmt", NULL},
|
||||
{TIFFTAG_SGILOGENCODE, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "SGILogEncode", NULL}};
|
||||
{TIFFTAG_SGILOGDATAFMT, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_INT, FIELD_PSEUDO,
|
||||
TRUE, FALSE, "SGILogDataFmt", NULL},
|
||||
{TIFFTAG_SGILOGENCODE, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_INT, FIELD_PSEUDO,
|
||||
TRUE, FALSE, "SGILogEncode", NULL}};
|
||||
|
||||
int TIFFInitSGILog(TIFF *tif, int scheme)
|
||||
{
|
||||
|
|
|
|||
55
3rdparty/libtiff/tif_lzma.c
vendored
55
3rdparty/libtiff/tif_lzma.c
vendored
|
|
@ -44,6 +44,8 @@
|
|||
typedef struct
|
||||
{
|
||||
TIFFPredictorState predict;
|
||||
int read_error; /* whether a read error has occurred, and which should cause
|
||||
further reads in the same strip/tile to be aborted */
|
||||
lzma_stream stream;
|
||||
lzma_filter filters[LZMA_FILTERS_MAX + 1];
|
||||
lzma_options_delta opt_delta; /* delta filter options */
|
||||
|
|
@ -58,9 +60,9 @@ typedef struct
|
|||
TIFFVSetMethod vsetparent; /* super-class method */
|
||||
} LZMAState;
|
||||
|
||||
#define LState(tif) ((LZMAState *)(tif)->tif_data)
|
||||
#define DecoderState(tif) LState(tif)
|
||||
#define EncoderState(tif) LState(tif)
|
||||
#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
|
||||
#define LZMADecoderState(tif) GetLZMAState(tif)
|
||||
#define LZMAEncoderState(tif) GetLZMAState(tif)
|
||||
|
||||
static int LZMAEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s);
|
||||
static int LZMADecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s);
|
||||
|
|
@ -106,7 +108,7 @@ static int LZMAFixupTags(TIFF *tif)
|
|||
|
||||
static int LZMASetupDecode(TIFF *tif)
|
||||
{
|
||||
LZMAState *sp = DecoderState(tif);
|
||||
LZMAState *sp = LZMADecoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
|
||||
|
|
@ -127,7 +129,7 @@ static int LZMASetupDecode(TIFF *tif)
|
|||
static int LZMAPreDecode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
static const char module[] = "LZMAPreDecode";
|
||||
LZMAState *sp = DecoderState(tif);
|
||||
LZMAState *sp = LZMADecoderState(tif);
|
||||
lzma_ret ret;
|
||||
|
||||
(void)s;
|
||||
|
|
@ -156,18 +158,31 @@ static int LZMAPreDecode(TIFF *tif, uint16_t s)
|
|||
LZMAStrerror(ret));
|
||||
return 0;
|
||||
}
|
||||
|
||||
sp->read_error = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int LZMADecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
||||
{
|
||||
static const char module[] = "LZMADecode";
|
||||
LZMAState *sp = DecoderState(tif);
|
||||
LZMAState *sp = LZMADecoderState(tif);
|
||||
|
||||
(void)s;
|
||||
assert(sp != NULL);
|
||||
assert(sp->state == LSTATE_INIT_DECODE);
|
||||
|
||||
if (sp->read_error)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"LZMADecode: Scanline %" PRIu32 " cannot be read due to "
|
||||
"previous error",
|
||||
tif->tif_row);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sp->stream.next_in = tif->tif_rawcp;
|
||||
sp->stream.avail_in = (size_t)tif->tif_rawcc;
|
||||
|
||||
|
|
@ -175,6 +190,9 @@ static int LZMADecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
sp->stream.avail_out = (size_t)occ;
|
||||
if ((tmsize_t)sp->stream.avail_out != occ)
|
||||
{
|
||||
// read_error not set here as this is a usage issue that can be
|
||||
// recovered in a following call.
|
||||
memset(op, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Liblzma cannot deal with buffers this size");
|
||||
return 0;
|
||||
|
|
@ -198,6 +216,8 @@ static int LZMADecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
lzma_stream_decoder(&sp->stream, lzma_memusage(&sp->stream), 0);
|
||||
if (r != LZMA_OK)
|
||||
{
|
||||
sp->read_error = 1;
|
||||
memset(op, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Error initializing the stream decoder, %s",
|
||||
LZMAStrerror(r));
|
||||
|
|
@ -217,6 +237,8 @@ static int LZMADecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
} while (sp->stream.avail_out > 0);
|
||||
if (sp->stream.avail_out != 0)
|
||||
{
|
||||
sp->read_error = 1;
|
||||
memset(sp->stream.next_out, 0, sp->stream.avail_out);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Not enough data at scanline %" PRIu32
|
||||
" (short %" TIFF_SIZE_FORMAT " bytes)",
|
||||
|
|
@ -232,7 +254,7 @@ static int LZMADecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
|
||||
static int LZMASetupEncode(TIFF *tif)
|
||||
{
|
||||
LZMAState *sp = EncoderState(tif);
|
||||
LZMAState *sp = LZMAEncoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
if (sp->state & LSTATE_INIT_DECODE)
|
||||
|
|
@ -251,7 +273,7 @@ static int LZMASetupEncode(TIFF *tif)
|
|||
static int LZMAPreEncode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
static const char module[] = "LZMAPreEncode";
|
||||
LZMAState *sp = EncoderState(tif);
|
||||
LZMAState *sp = LZMAEncoderState(tif);
|
||||
lzma_ret ret;
|
||||
|
||||
(void)s;
|
||||
|
|
@ -283,7 +305,7 @@ static int LZMAPreEncode(TIFF *tif, uint16_t s)
|
|||
static int LZMAEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
||||
{
|
||||
static const char module[] = "LZMAEncode";
|
||||
LZMAState *sp = EncoderState(tif);
|
||||
LZMAState *sp = LZMAEncoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
assert(sp->state == LSTATE_INIT_ENCODE);
|
||||
|
|
@ -329,7 +351,7 @@ static int LZMAEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
|||
static int LZMAPostEncode(TIFF *tif)
|
||||
{
|
||||
static const char module[] = "LZMAPostEncode";
|
||||
LZMAState *sp = EncoderState(tif);
|
||||
LZMAState *sp = LZMAEncoderState(tif);
|
||||
lzma_ret ret;
|
||||
|
||||
sp->stream.avail_in = 0;
|
||||
|
|
@ -365,7 +387,7 @@ static int LZMAPostEncode(TIFF *tif)
|
|||
|
||||
static void LZMACleanup(TIFF *tif)
|
||||
{
|
||||
LZMAState *sp = LState(tif);
|
||||
LZMAState *sp = GetLZMAState(tif);
|
||||
|
||||
assert(sp != 0);
|
||||
|
||||
|
|
@ -388,7 +410,7 @@ static void LZMACleanup(TIFF *tif)
|
|||
static int LZMAVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
{
|
||||
static const char module[] = "LZMAVSetField";
|
||||
LZMAState *sp = LState(tif);
|
||||
LZMAState *sp = GetLZMAState(tif);
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
|
|
@ -414,7 +436,7 @@ static int LZMAVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
|
||||
static int LZMAVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
{
|
||||
LZMAState *sp = LState(tif);
|
||||
LZMAState *sp = GetLZMAState(tif);
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
|
|
@ -428,9 +450,8 @@ static int LZMAVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
}
|
||||
|
||||
static const TIFFField lzmaFields[] = {
|
||||
{TIFFTAG_LZMAPRESET, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE,
|
||||
"LZMA2 Compression Preset", NULL},
|
||||
{TIFFTAG_LZMAPRESET, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO, TRUE,
|
||||
FALSE, "LZMA2 Compression Preset", NULL},
|
||||
};
|
||||
|
||||
int TIFFInitLZMA(TIFF *tif, int scheme)
|
||||
|
|
@ -457,7 +478,7 @@ int TIFFInitLZMA(TIFF *tif, int scheme)
|
|||
tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LZMAState));
|
||||
if (tif->tif_data == NULL)
|
||||
goto bad;
|
||||
sp = LState(tif);
|
||||
sp = GetLZMAState(tif);
|
||||
memcpy(&sp->stream, &tmp_stream, sizeof(lzma_stream));
|
||||
|
||||
/*
|
||||
|
|
|
|||
62
3rdparty/libtiff/tif_lzw.c
vendored
62
3rdparty/libtiff/tif_lzw.c
vendored
|
|
@ -161,14 +161,13 @@ typedef struct
|
|||
} LZWCodecState;
|
||||
|
||||
#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
|
||||
#define DecoderState(tif) ((LZWCodecState *)LZWState(tif))
|
||||
#define EncoderState(tif) ((LZWCodecState *)LZWState(tif))
|
||||
#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
|
||||
#define LZWEncoderState(tif) ((LZWCodecState *)LZWState(tif))
|
||||
|
||||
static int LZWDecode(TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s);
|
||||
#ifdef LZW_COMPAT
|
||||
static int LZWDecodeCompat(TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s);
|
||||
#endif
|
||||
static void cl_hash(LZWCodecState *);
|
||||
|
||||
/*
|
||||
* LZW Decoder.
|
||||
|
|
@ -183,7 +182,7 @@ static int LZWFixupTags(TIFF *tif)
|
|||
static int LZWSetupDecode(TIFF *tif)
|
||||
{
|
||||
static const char module[] = "LZWSetupDecode";
|
||||
LZWCodecState *sp = DecoderState(tif);
|
||||
LZWCodecState *sp = LZWDecoderState(tif);
|
||||
int code;
|
||||
|
||||
if (sp == NULL)
|
||||
|
|
@ -199,7 +198,7 @@ static int LZWSetupDecode(TIFF *tif)
|
|||
return (0);
|
||||
}
|
||||
|
||||
sp = DecoderState(tif);
|
||||
sp = LZWDecoderState(tif);
|
||||
sp->dec_codetab = NULL;
|
||||
sp->dec_decode = NULL;
|
||||
|
||||
|
|
@ -245,7 +244,7 @@ static int LZWSetupDecode(TIFF *tif)
|
|||
static int LZWPreDecode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
static const char module[] = "LZWPreDecode";
|
||||
LZWCodecState *sp = DecoderState(tif);
|
||||
LZWCodecState *sp = LZWDecoderState(tif);
|
||||
|
||||
(void)s;
|
||||
assert(sp != NULL);
|
||||
|
|
@ -329,10 +328,7 @@ static int LZWPreDecode(TIFF *tif, uint16_t s)
|
|||
#ifdef WORDS_BIGENDIAN
|
||||
#define GetNextData(nextdata, bp) memcpy(&nextdata, bp, sizeof(nextdata))
|
||||
#elif SIZEOF_WORDTYPE == 8
|
||||
#if defined(__GNUC__) && defined(__x86_64__)
|
||||
#define GetNextData(nextdata, bp) \
|
||||
nextdata = __builtin_bswap64(*(uint64_t *)(bp))
|
||||
#elif defined(_M_X64)
|
||||
#if defined(_M_X64)
|
||||
#define GetNextData(nextdata, bp) nextdata = _byteswap_uint64(*(uint64_t *)(bp))
|
||||
#elif defined(__GNUC__)
|
||||
#define GetNextData(nextdata, bp) \
|
||||
|
|
@ -346,10 +342,7 @@ static int LZWPreDecode(TIFF *tif, uint16_t s)
|
|||
(((uint64_t)bp[6]) << 8) | (((uint64_t)bp[7]))
|
||||
#endif
|
||||
#elif SIZEOF_WORDTYPE == 4
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
#define GetNextData(nextdata, bp) \
|
||||
nextdata = __builtin_bswap32(*(uint32_t *)(bp))
|
||||
#elif defined(_M_X86)
|
||||
#if defined(_M_X86)
|
||||
#define GetNextData(nextdata, bp) \
|
||||
nextdata = _byteswap_ulong(*(unsigned long *)(bp))
|
||||
#elif defined(__GNUC__)
|
||||
|
|
@ -409,7 +402,7 @@ static int LZWPreDecode(TIFF *tif, uint16_t s)
|
|||
static int LZWDecode(TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s)
|
||||
{
|
||||
static const char module[] = "LZWDecode";
|
||||
LZWCodecState *sp = DecoderState(tif);
|
||||
LZWCodecState *sp = LZWDecoderState(tif);
|
||||
uint8_t *op = (uint8_t *)op0;
|
||||
tmsize_t occ = occ0;
|
||||
uint8_t *bp;
|
||||
|
|
@ -423,6 +416,7 @@ static int LZWDecode(TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s)
|
|||
|
||||
if (sp->read_error)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"LZWDecode: Scanline %" PRIu32 " cannot be read due to "
|
||||
"previous error",
|
||||
|
|
@ -737,6 +731,8 @@ after_loop:
|
|||
|
||||
if (occ > 0)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Not enough data at scanline %" PRIu32 " (short %" PRIu64
|
||||
" bytes)",
|
||||
|
|
@ -746,12 +742,14 @@ after_loop:
|
|||
return (1);
|
||||
|
||||
no_eoi:
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
TIFFErrorExtR(tif, module,
|
||||
"LZWDecode: Strip %" PRIu32 " not terminated with EOI code",
|
||||
tif->tif_curstrip);
|
||||
return 0;
|
||||
error_code:
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
TIFFErrorExtR(tif, tif->tif_name, "Using code not yet in table");
|
||||
return 0;
|
||||
|
|
@ -800,7 +798,7 @@ error_code:
|
|||
static int LZWDecodeCompat(TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s)
|
||||
{
|
||||
static const char module[] = "LZWDecodeCompat";
|
||||
LZWCodecState *sp = DecoderState(tif);
|
||||
LZWCodecState *sp = LZWDecoderState(tif);
|
||||
uint8_t *op = (uint8_t *)op0;
|
||||
tmsize_t occ = occ0;
|
||||
uint8_t *tp;
|
||||
|
|
@ -1019,6 +1017,10 @@ static int LZWDecodeCompat(TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s)
|
|||
}
|
||||
#endif /* LZW_COMPAT */
|
||||
|
||||
#ifndef LZW_READ_ONLY
|
||||
|
||||
static void cl_hash(LZWCodecState *);
|
||||
|
||||
/*
|
||||
* LZW Encoding.
|
||||
*/
|
||||
|
|
@ -1026,7 +1028,7 @@ static int LZWDecodeCompat(TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s)
|
|||
static int LZWSetupEncode(TIFF *tif)
|
||||
{
|
||||
static const char module[] = "LZWSetupEncode";
|
||||
LZWCodecState *sp = EncoderState(tif);
|
||||
LZWCodecState *sp = LZWEncoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
sp->enc_hashtab = (hash_t *)_TIFFmallocExt(tif, HSIZE * sizeof(hash_t));
|
||||
|
|
@ -1043,7 +1045,7 @@ static int LZWSetupEncode(TIFF *tif)
|
|||
*/
|
||||
static int LZWPreEncode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
LZWCodecState *sp = EncoderState(tif);
|
||||
LZWCodecState *sp = LZWEncoderState(tif);
|
||||
|
||||
(void)s;
|
||||
assert(sp != NULL);
|
||||
|
|
@ -1114,7 +1116,7 @@ static int LZWPreEncode(TIFF *tif, uint16_t s)
|
|||
*/
|
||||
static int LZWEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
||||
{
|
||||
register LZWCodecState *sp = EncoderState(tif);
|
||||
register LZWCodecState *sp = LZWEncoderState(tif);
|
||||
register long fcode;
|
||||
register hash_t *hp;
|
||||
register int h, c;
|
||||
|
|
@ -1299,7 +1301,7 @@ static int LZWEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
|||
*/
|
||||
static int LZWPostEncode(TIFF *tif)
|
||||
{
|
||||
register LZWCodecState *sp = EncoderState(tif);
|
||||
register LZWCodecState *sp = LZWEncoderState(tif);
|
||||
uint8_t *op = tif->tif_rawcp;
|
||||
long nextbits = sp->lzw_nextbits;
|
||||
WordType nextdata = sp->lzw_nextdata;
|
||||
|
|
@ -1375,17 +1377,19 @@ static void cl_hash(LZWCodecState *sp)
|
|||
hp->hash = -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void LZWCleanup(TIFF *tif)
|
||||
{
|
||||
(void)TIFFPredictorCleanup(tif);
|
||||
|
||||
assert(tif->tif_data != 0);
|
||||
assert(tif->tif_data != NULL);
|
||||
|
||||
if (DecoderState(tif)->dec_codetab)
|
||||
_TIFFfreeExt(tif, DecoderState(tif)->dec_codetab);
|
||||
if (LZWDecoderState(tif)->dec_codetab)
|
||||
_TIFFfreeExt(tif, LZWDecoderState(tif)->dec_codetab);
|
||||
|
||||
if (EncoderState(tif)->enc_hashtab)
|
||||
_TIFFfreeExt(tif, EncoderState(tif)->enc_hashtab);
|
||||
if (LZWEncoderState(tif)->enc_hashtab)
|
||||
_TIFFfreeExt(tif, LZWEncoderState(tif)->enc_hashtab);
|
||||
|
||||
_TIFFfreeExt(tif, tif->tif_data);
|
||||
tif->tif_data = NULL;
|
||||
|
|
@ -1404,9 +1408,9 @@ int TIFFInitLZW(TIFF *tif, int scheme)
|
|||
tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LZWCodecState));
|
||||
if (tif->tif_data == NULL)
|
||||
goto bad;
|
||||
DecoderState(tif)->dec_codetab = NULL;
|
||||
DecoderState(tif)->dec_decode = NULL;
|
||||
EncoderState(tif)->enc_hashtab = NULL;
|
||||
LZWDecoderState(tif)->dec_codetab = NULL;
|
||||
LZWDecoderState(tif)->dec_decode = NULL;
|
||||
LZWEncoderState(tif)->enc_hashtab = NULL;
|
||||
LZWState(tif)->rw_mode = tif->tif_mode;
|
||||
|
||||
/*
|
||||
|
|
@ -1418,12 +1422,14 @@ int TIFFInitLZW(TIFF *tif, int scheme)
|
|||
tif->tif_decoderow = LZWDecode;
|
||||
tif->tif_decodestrip = LZWDecode;
|
||||
tif->tif_decodetile = LZWDecode;
|
||||
#ifndef LZW_READ_ONLY
|
||||
tif->tif_setupencode = LZWSetupEncode;
|
||||
tif->tif_preencode = LZWPreEncode;
|
||||
tif->tif_postencode = LZWPostEncode;
|
||||
tif->tif_encoderow = LZWEncode;
|
||||
tif->tif_encodestrip = LZWEncode;
|
||||
tif->tif_encodetile = LZWEncode;
|
||||
#endif
|
||||
tif->tif_cleanup = LZWCleanup;
|
||||
/*
|
||||
* Setup predictor setup.
|
||||
|
|
|
|||
81
3rdparty/libtiff/tif_ojpeg.c
vendored
81
3rdparty/libtiff/tif_ojpeg.c
vendored
|
|
@ -181,63 +181,46 @@
|
|||
|
||||
static const TIFFField ojpegFields[] = {
|
||||
{TIFFTAG_JPEGIFOFFSET, 1, 1, TIFF_LONG8, 0, TIFF_SETGET_UINT64,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_OJPEG_JPEGINTERCHANGEFORMAT, TRUE, FALSE,
|
||||
"JpegInterchangeFormat", NULL},
|
||||
{TIFFTAG_JPEGIFBYTECOUNT, 1, 1, TIFF_LONG8, 0, TIFF_SETGET_UINT64,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_OJPEG_JPEGINTERCHANGEFORMATLENGTH, TRUE,
|
||||
FALSE, "JpegInterchangeFormatLength", NULL},
|
||||
{TIFFTAG_JPEGQTABLES, TIFF_VARIABLE2, TIFF_VARIABLE2, TIFF_LONG8, 0,
|
||||
TIFF_SETGET_C32_UINT64, TIFF_SETGET_UNDEFINED, FIELD_OJPEG_JPEGQTABLES,
|
||||
FALSE, TRUE, "JpegQTables", NULL},
|
||||
{TIFFTAG_JPEGDCTABLES, TIFF_VARIABLE2, TIFF_VARIABLE2, TIFF_LONG8, 0,
|
||||
TIFF_SETGET_C32_UINT64, TIFF_SETGET_UNDEFINED, FIELD_OJPEG_JPEGDCTABLES,
|
||||
FALSE, TRUE, "JpegDcTables", NULL},
|
||||
{TIFFTAG_JPEGACTABLES, TIFF_VARIABLE2, TIFF_VARIABLE2, TIFF_LONG8, 0,
|
||||
TIFF_SETGET_C32_UINT64, TIFF_SETGET_UNDEFINED, FIELD_OJPEG_JPEGACTABLES,
|
||||
FALSE, TRUE, "JpegAcTables", NULL},
|
||||
{TIFFTAG_JPEGPROC, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_OJPEG_JPEGPROC, FALSE, FALSE, "JpegProc",
|
||||
FIELD_OJPEG_JPEGINTERCHANGEFORMAT, TRUE, FALSE, "JpegInterchangeFormat",
|
||||
NULL},
|
||||
{TIFFTAG_JPEGIFBYTECOUNT, 1, 1, TIFF_LONG8, 0, TIFF_SETGET_UINT64,
|
||||
FIELD_OJPEG_JPEGINTERCHANGEFORMATLENGTH, TRUE, FALSE,
|
||||
"JpegInterchangeFormatLength", NULL},
|
||||
{TIFFTAG_JPEGQTABLES, TIFF_VARIABLE2, TIFF_VARIABLE2, TIFF_LONG8, 0,
|
||||
TIFF_SETGET_C32_UINT64, FIELD_OJPEG_JPEGQTABLES, FALSE, TRUE,
|
||||
"JpegQTables", NULL},
|
||||
{TIFFTAG_JPEGDCTABLES, TIFF_VARIABLE2, TIFF_VARIABLE2, TIFF_LONG8, 0,
|
||||
TIFF_SETGET_C32_UINT64, FIELD_OJPEG_JPEGDCTABLES, FALSE, TRUE,
|
||||
"JpegDcTables", NULL},
|
||||
{TIFFTAG_JPEGACTABLES, TIFF_VARIABLE2, TIFF_VARIABLE2, TIFF_LONG8, 0,
|
||||
TIFF_SETGET_C32_UINT64, FIELD_OJPEG_JPEGACTABLES, FALSE, TRUE,
|
||||
"JpegAcTables", NULL},
|
||||
{TIFFTAG_JPEGPROC, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16,
|
||||
FIELD_OJPEG_JPEGPROC, FALSE, FALSE, "JpegProc", NULL},
|
||||
{TIFFTAG_JPEGRESTARTINTERVAL, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_OJPEG_JPEGRESTARTINTERVAL, FALSE, FALSE,
|
||||
"JpegRestartInterval", NULL},
|
||||
FIELD_OJPEG_JPEGRESTARTINTERVAL, FALSE, FALSE, "JpegRestartInterval",
|
||||
NULL},
|
||||
};
|
||||
|
||||
#ifndef LIBJPEG_ENCAP_EXTERNAL
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
|
||||
/* 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"
|
||||
|
||||
#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
|
||||
|
||||
typedef struct jpeg_common_struct jpeg_common_struct;
|
||||
typedef struct jpeg_decompress_struct jpeg_decompress_struct;
|
||||
typedef struct jpeg_source_mgr jpeg_source_mgr;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
@ -771,6 +754,9 @@ static int OJPEGPreDecode(TIFF *tif, uint16_t s)
|
|||
if (OJPEGWriteHeaderInfo(tif) == 0)
|
||||
return (0);
|
||||
}
|
||||
|
||||
sp->subsampling_convert_state = 0;
|
||||
|
||||
while (sp->write_curstrile < m)
|
||||
{
|
||||
if (sp->libjpeg_jpeg_query_style == 0)
|
||||
|
|
@ -856,12 +842,14 @@ static int OJPEGDecode(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s)
|
|||
(void)s;
|
||||
if (!sp->decoder_ok)
|
||||
{
|
||||
memset(buf, 0, (size_t)cc);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Cannot decode: decoder not correctly initialized");
|
||||
return 0;
|
||||
}
|
||||
if (sp->libjpeg_session_active == 0)
|
||||
{
|
||||
memset(buf, 0, (size_t)cc);
|
||||
/* This should normally not happen, except that it does when */
|
||||
/* using TIFFReadScanline() which calls OJPEGPostDecode() for */
|
||||
/* each scanline, which assumes that a whole strile was read */
|
||||
|
|
@ -875,17 +863,24 @@ static int OJPEGDecode(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s)
|
|||
}
|
||||
if (sp->error_in_raw_data_decoding)
|
||||
{
|
||||
memset(buf, 0, (size_t)cc);
|
||||
return 0;
|
||||
}
|
||||
if (sp->libjpeg_jpeg_query_style == 0)
|
||||
{
|
||||
if (OJPEGDecodeRaw(tif, buf, cc) == 0)
|
||||
{
|
||||
memset(buf, 0, (size_t)cc);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (OJPEGDecodeScanlines(tif, buf, cc) == 0)
|
||||
{
|
||||
memset(buf, 0, (size_t)cc);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
|
|
|||
209
3rdparty/libtiff/tif_open.c
vendored
209
3rdparty/libtiff/tif_open.c
vendored
|
|
@ -25,13 +25,19 @@
|
|||
/*
|
||||
* TIFF Library.
|
||||
*/
|
||||
|
||||
#ifdef TIFF_DO_NOT_USE_NON_EXT_ALLOC_FUNCTIONS
|
||||
#undef TIFF_DO_NOT_USE_NON_EXT_ALLOC_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#include "tiffiop.h"
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
/*
|
||||
* Dummy functions to fill the omitted client procedures.
|
||||
*/
|
||||
static int _tiffDummyMapProc(thandle_t fd, void **pbase, toff_t *psize)
|
||||
int _tiffDummyMapProc(thandle_t fd, void **pbase, toff_t *psize)
|
||||
{
|
||||
(void)fd;
|
||||
(void)pbase;
|
||||
|
|
@ -39,7 +45,7 @@ static int _tiffDummyMapProc(thandle_t fd, void **pbase, toff_t *psize)
|
|||
return (0);
|
||||
}
|
||||
|
||||
static void _tiffDummyUnmapProc(thandle_t fd, void *base, toff_t size)
|
||||
void _tiffDummyUnmapProc(thandle_t fd, void *base, toff_t size)
|
||||
{
|
||||
(void)fd;
|
||||
(void)base;
|
||||
|
|
@ -81,8 +87,9 @@ TIFFOpenOptions *TIFFOpenOptionsAlloc()
|
|||
void TIFFOpenOptionsFree(TIFFOpenOptions *opts) { _TIFFfree(opts); }
|
||||
|
||||
/** Define a limit in bytes for a single memory allocation done by libtiff.
|
||||
* If max_single_mem_alloc is set to 0, no other limit that the underlying
|
||||
* _TIFFmalloc() will be applied, which is the default.
|
||||
* If max_single_mem_alloc is set to 0, which is the default, no other limit
|
||||
* that the underlying _TIFFmalloc() or
|
||||
* TIFFOpenOptionsSetMaxCumulatedMemAlloc() will be applied.
|
||||
*/
|
||||
void TIFFOpenOptionsSetMaxSingleMemAlloc(TIFFOpenOptions *opts,
|
||||
tmsize_t max_single_mem_alloc)
|
||||
|
|
@ -90,6 +97,27 @@ void TIFFOpenOptionsSetMaxSingleMemAlloc(TIFFOpenOptions *opts,
|
|||
opts->max_single_mem_alloc = max_single_mem_alloc;
|
||||
}
|
||||
|
||||
/** Define a limit in bytes for the cumulated memory allocations done by libtiff
|
||||
* on a given TIFF handle.
|
||||
* If max_cumulated_mem_alloc is set to 0, which is the default, no other limit
|
||||
* that the underlying _TIFFmalloc() or
|
||||
* TIFFOpenOptionsSetMaxSingleMemAlloc() will be applied.
|
||||
*/
|
||||
void TIFFOpenOptionsSetMaxCumulatedMemAlloc(TIFFOpenOptions *opts,
|
||||
tmsize_t max_cumulated_mem_alloc)
|
||||
{
|
||||
opts->max_cumulated_mem_alloc = max_cumulated_mem_alloc;
|
||||
}
|
||||
|
||||
/** Whether a warning should be emitted when encountering a unknown tag.
|
||||
* Default is FALSE since libtiff 4.7.1
|
||||
*/
|
||||
void TIFFOpenOptionsSetWarnAboutUnknownTags(TIFFOpenOptions *opts,
|
||||
int warn_about_unknown_tags)
|
||||
{
|
||||
opts->warn_about_unknown_tags = warn_about_unknown_tags;
|
||||
}
|
||||
|
||||
void TIFFOpenOptionsSetErrorHandlerExtR(TIFFOpenOptions *opts,
|
||||
TIFFErrorHandlerExtR handler,
|
||||
void *errorhandler_user_data)
|
||||
|
|
@ -117,6 +145,30 @@ static void _TIFFEmitErrorAboveMaxSingleMemAlloc(TIFF *tif,
|
|||
(uint64_t)s, (uint64_t)tif->tif_max_single_mem_alloc);
|
||||
}
|
||||
|
||||
static void _TIFFEmitErrorAboveMaxCumulatedMemAlloc(TIFF *tif,
|
||||
const char *pszFunction,
|
||||
tmsize_t s)
|
||||
{
|
||||
TIFFErrorExtR(tif, pszFunction,
|
||||
"Cumulated memory allocation of %" PRIu64 " + %" PRIu64
|
||||
" bytes is beyond the %" PRIu64
|
||||
" cumulated byte limit defined in open options",
|
||||
(uint64_t)tif->tif_cur_cumulated_mem_alloc, (uint64_t)s,
|
||||
(uint64_t)tif->tif_max_cumulated_mem_alloc);
|
||||
}
|
||||
|
||||
/* When allocating memory, we write at the beginning of the buffer it size.
|
||||
* This allows us to keep track of the total memory allocated when we
|
||||
* malloc/calloc/realloc and free. In theory we need just SIZEOF_SIZE_T bytes
|
||||
* for that, but on x86_64, allocations of more than 16 bytes are aligned on
|
||||
* 16 bytes. Hence using 2 * SIZEOF_SIZE_T.
|
||||
* It is critical that _TIFFmallocExt/_TIFFcallocExt/_TIFFreallocExt are
|
||||
* paired with _TIFFfreeExt.
|
||||
* CMakeLists.txt defines TIFF_DO_NOT_USE_NON_EXT_ALLOC_FUNCTIONS, which in
|
||||
* turn disables the definition of the non Ext version in tiffio.h
|
||||
*/
|
||||
#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
|
||||
|
||||
/** malloc() version that takes into account memory-specific open options */
|
||||
void *_TIFFmallocExt(TIFF *tif, tmsize_t s)
|
||||
{
|
||||
|
|
@ -126,16 +178,32 @@ void *_TIFFmallocExt(TIFF *tif, tmsize_t s)
|
|||
_TIFFEmitErrorAboveMaxSingleMemAlloc(tif, "_TIFFmallocExt", s);
|
||||
return NULL;
|
||||
}
|
||||
if (tif != NULL && tif->tif_max_cumulated_mem_alloc > 0)
|
||||
{
|
||||
if (s > tif->tif_max_cumulated_mem_alloc -
|
||||
tif->tif_cur_cumulated_mem_alloc ||
|
||||
s > TIFF_TMSIZE_T_MAX - LEADING_AREA_TO_STORE_ALLOC_SIZE)
|
||||
{
|
||||
_TIFFEmitErrorAboveMaxCumulatedMemAlloc(tif, "_TIFFmallocExt", s);
|
||||
return NULL;
|
||||
}
|
||||
void *ptr = _TIFFmalloc(LEADING_AREA_TO_STORE_ALLOC_SIZE + s);
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
tif->tif_cur_cumulated_mem_alloc += s;
|
||||
memcpy(ptr, &s, sizeof(s));
|
||||
return (char *)ptr + LEADING_AREA_TO_STORE_ALLOC_SIZE;
|
||||
}
|
||||
return _TIFFmalloc(s);
|
||||
}
|
||||
|
||||
/** calloc() version that takes into account memory-specific open options */
|
||||
void *_TIFFcallocExt(TIFF *tif, tmsize_t nmemb, tmsize_t siz)
|
||||
{
|
||||
if (nmemb <= 0 || siz <= 0 || nmemb > TIFF_TMSIZE_T_MAX / siz)
|
||||
return NULL;
|
||||
if (tif != NULL && tif->tif_max_single_mem_alloc > 0)
|
||||
{
|
||||
if (nmemb <= 0 || siz <= 0 || nmemb > TIFF_TMSIZE_T_MAX / siz)
|
||||
return NULL;
|
||||
if (nmemb * siz > tif->tif_max_single_mem_alloc)
|
||||
{
|
||||
_TIFFEmitErrorAboveMaxSingleMemAlloc(tif, "_TIFFcallocExt",
|
||||
|
|
@ -143,6 +211,23 @@ void *_TIFFcallocExt(TIFF *tif, tmsize_t nmemb, tmsize_t siz)
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
if (tif != NULL && tif->tif_max_cumulated_mem_alloc > 0)
|
||||
{
|
||||
const tmsize_t s = nmemb * siz;
|
||||
if (s > tif->tif_max_cumulated_mem_alloc -
|
||||
tif->tif_cur_cumulated_mem_alloc ||
|
||||
s > TIFF_TMSIZE_T_MAX - LEADING_AREA_TO_STORE_ALLOC_SIZE)
|
||||
{
|
||||
_TIFFEmitErrorAboveMaxCumulatedMemAlloc(tif, "_TIFFcallocExt", s);
|
||||
return NULL;
|
||||
}
|
||||
void *ptr = _TIFFcalloc(LEADING_AREA_TO_STORE_ALLOC_SIZE + s, 1);
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
tif->tif_cur_cumulated_mem_alloc += s;
|
||||
memcpy(ptr, &s, sizeof(s));
|
||||
return (char *)ptr + LEADING_AREA_TO_STORE_ALLOC_SIZE;
|
||||
}
|
||||
return _TIFFcalloc(nmemb, siz);
|
||||
}
|
||||
|
||||
|
|
@ -155,13 +240,49 @@ void *_TIFFreallocExt(TIFF *tif, void *p, tmsize_t s)
|
|||
_TIFFEmitErrorAboveMaxSingleMemAlloc(tif, "_TIFFreallocExt", s);
|
||||
return NULL;
|
||||
}
|
||||
if (tif != NULL && tif->tif_max_cumulated_mem_alloc > 0)
|
||||
{
|
||||
void *oldPtr = p;
|
||||
tmsize_t oldSize = 0;
|
||||
if (p)
|
||||
{
|
||||
oldPtr = (char *)p - LEADING_AREA_TO_STORE_ALLOC_SIZE;
|
||||
memcpy(&oldSize, oldPtr, sizeof(oldSize));
|
||||
assert(oldSize <= tif->tif_cur_cumulated_mem_alloc);
|
||||
}
|
||||
if (s > oldSize &&
|
||||
(s > tif->tif_max_cumulated_mem_alloc -
|
||||
(tif->tif_cur_cumulated_mem_alloc - oldSize) ||
|
||||
s > TIFF_TMSIZE_T_MAX - LEADING_AREA_TO_STORE_ALLOC_SIZE))
|
||||
{
|
||||
_TIFFEmitErrorAboveMaxCumulatedMemAlloc(tif, "_TIFFreallocExt",
|
||||
s - oldSize);
|
||||
return NULL;
|
||||
}
|
||||
void *newPtr =
|
||||
_TIFFrealloc(oldPtr, LEADING_AREA_TO_STORE_ALLOC_SIZE + s);
|
||||
if (newPtr == NULL)
|
||||
return NULL;
|
||||
tif->tif_cur_cumulated_mem_alloc -= oldSize;
|
||||
tif->tif_cur_cumulated_mem_alloc += s;
|
||||
memcpy(newPtr, &s, sizeof(s));
|
||||
return (char *)newPtr + LEADING_AREA_TO_STORE_ALLOC_SIZE;
|
||||
}
|
||||
return _TIFFrealloc(p, s);
|
||||
}
|
||||
|
||||
/** free() version that takes into account memory-specific open options */
|
||||
void _TIFFfreeExt(TIFF *tif, void *p)
|
||||
{
|
||||
(void)tif;
|
||||
if (p != NULL && tif != NULL && tif->tif_max_cumulated_mem_alloc > 0)
|
||||
{
|
||||
void *oldPtr = (char *)p - LEADING_AREA_TO_STORE_ALLOC_SIZE;
|
||||
tmsize_t oldSize;
|
||||
memcpy(&oldSize, oldPtr, sizeof(oldSize));
|
||||
assert(oldSize <= tif->tif_cur_cumulated_mem_alloc);
|
||||
tif->tif_cur_cumulated_mem_alloc -= oldSize;
|
||||
p = oldPtr;
|
||||
}
|
||||
_TIFFfree(p);
|
||||
}
|
||||
|
||||
|
|
@ -231,6 +352,17 @@ TIFF *TIFFClientOpenExt(const char *name, const char *mode,
|
|||
(uint64_t)opts->max_single_mem_alloc);
|
||||
goto bad2;
|
||||
}
|
||||
if (opts && opts->max_cumulated_mem_alloc > 0 &&
|
||||
size_to_alloc > opts->max_cumulated_mem_alloc)
|
||||
{
|
||||
_TIFFErrorEarly(opts, clientdata, module,
|
||||
"%s: Memory allocation of %" PRIu64
|
||||
" bytes is beyond the %" PRIu64
|
||||
" cumulated byte limit defined in open options",
|
||||
name, (uint64_t)size_to_alloc,
|
||||
(uint64_t)opts->max_cumulated_mem_alloc);
|
||||
goto bad2;
|
||||
}
|
||||
tif = (TIFF *)_TIFFmallocExt(NULL, size_to_alloc);
|
||||
if (tif == NULL)
|
||||
{
|
||||
|
|
@ -243,6 +375,7 @@ TIFF *TIFFClientOpenExt(const char *name, const char *mode,
|
|||
strcpy(tif->tif_name, name);
|
||||
tif->tif_mode = m & ~(O_CREAT | O_TRUNC);
|
||||
tif->tif_curdir = TIFF_NON_EXISTENT_DIR_NUMBER; /* non-existent directory */
|
||||
tif->tif_curdircount = TIFF_NON_EXISTENT_DIR_NUMBER;
|
||||
tif->tif_curoff = 0;
|
||||
tif->tif_curstrip = (uint32_t)-1; /* invalid strip */
|
||||
tif->tif_row = (uint32_t)-1; /* read/write pre-increment */
|
||||
|
|
@ -261,6 +394,8 @@ TIFF *TIFFClientOpenExt(const char *name, const char *mode,
|
|||
tif->tif_warnhandler = opts->warnhandler;
|
||||
tif->tif_warnhandler_user_data = opts->warnhandler_user_data;
|
||||
tif->tif_max_single_mem_alloc = opts->max_single_mem_alloc;
|
||||
tif->tif_max_cumulated_mem_alloc = opts->max_cumulated_mem_alloc;
|
||||
tif->tif_warn_about_unknown_tags = opts->warn_about_unknown_tags;
|
||||
}
|
||||
|
||||
if (!readproc || !writeproc || !seekproc || !closeproc || !sizeproc)
|
||||
|
|
@ -423,9 +558,9 @@ TIFF *TIFFClientOpenExt(const char *name, const char *mode,
|
|||
TIFFErrorExtR(tif, name, "Cannot read TIFF header");
|
||||
goto bad;
|
||||
}
|
||||
/*
|
||||
* Setup header and write.
|
||||
*/
|
||||
/*
|
||||
* Setup header and write.
|
||||
*/
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
tif->tif_header.common.tiff_magic =
|
||||
(tif->tif_flags & TIFF_SWAB) ? TIFF_LITTLEENDIAN : TIFF_BIGENDIAN;
|
||||
|
|
@ -433,13 +568,17 @@ TIFF *TIFFClientOpenExt(const char *name, const char *mode,
|
|||
tif->tif_header.common.tiff_magic =
|
||||
(tif->tif_flags & TIFF_SWAB) ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN;
|
||||
#endif
|
||||
TIFFHeaderUnion tif_header_swapped;
|
||||
if (!(tif->tif_flags & TIFF_BIGTIFF))
|
||||
{
|
||||
tif->tif_header.common.tiff_version = TIFF_VERSION_CLASSIC;
|
||||
tif->tif_header.classic.tiff_diroff = 0;
|
||||
if (tif->tif_flags & TIFF_SWAB)
|
||||
TIFFSwabShort(&tif->tif_header.common.tiff_version);
|
||||
tif->tif_header_size = sizeof(TIFFHeaderClassic);
|
||||
/* Swapped copy for writing */
|
||||
_TIFFmemcpy(&tif_header_swapped, &tif->tif_header,
|
||||
sizeof(TIFFHeaderUnion));
|
||||
if (tif->tif_flags & TIFF_SWAB)
|
||||
TIFFSwabShort(&tif_header_swapped.common.tiff_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -447,12 +586,15 @@ TIFF *TIFFClientOpenExt(const char *name, const char *mode,
|
|||
tif->tif_header.big.tiff_offsetsize = 8;
|
||||
tif->tif_header.big.tiff_unused = 0;
|
||||
tif->tif_header.big.tiff_diroff = 0;
|
||||
tif->tif_header_size = sizeof(TIFFHeaderBig);
|
||||
/* Swapped copy for writing */
|
||||
_TIFFmemcpy(&tif_header_swapped, &tif->tif_header,
|
||||
sizeof(TIFFHeaderUnion));
|
||||
if (tif->tif_flags & TIFF_SWAB)
|
||||
{
|
||||
TIFFSwabShort(&tif->tif_header.common.tiff_version);
|
||||
TIFFSwabShort(&tif->tif_header.big.tiff_offsetsize);
|
||||
TIFFSwabShort(&tif_header_swapped.common.tiff_version);
|
||||
TIFFSwabShort(&tif_header_swapped.big.tiff_offsetsize);
|
||||
}
|
||||
tif->tif_header_size = sizeof(TIFFHeaderBig);
|
||||
}
|
||||
/*
|
||||
* The doc for "fopen" for some STD_C_LIBs says that if you
|
||||
|
|
@ -462,26 +604,12 @@ TIFF *TIFFClientOpenExt(const char *name, const char *mode,
|
|||
* on Solaris.
|
||||
*/
|
||||
TIFFSeekFile(tif, 0, SEEK_SET);
|
||||
if (!WriteOK(tif, &tif->tif_header, (tmsize_t)(tif->tif_header_size)))
|
||||
if (!WriteOK(tif, &tif_header_swapped,
|
||||
(tmsize_t)(tif->tif_header_size)))
|
||||
{
|
||||
TIFFErrorExtR(tif, name, "Error writing TIFF header");
|
||||
goto bad;
|
||||
}
|
||||
/*
|
||||
* Setup the byte order handling.
|
||||
*/
|
||||
if (tif->tif_header.common.tiff_magic == TIFF_BIGENDIAN)
|
||||
{
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
tif->tif_flags |= TIFF_SWAB;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
tif->tif_flags |= TIFF_SWAB;
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Setup default directory.
|
||||
*/
|
||||
|
|
@ -490,10 +618,14 @@ TIFF *TIFFClientOpenExt(const char *name, const char *mode,
|
|||
tif->tif_diroff = 0;
|
||||
tif->tif_lastdiroff = 0;
|
||||
tif->tif_setdirectory_force_absolute = FALSE;
|
||||
/* tif_curdircount = 0 means 'empty file opened for writing, but no IFD
|
||||
* written yet' */
|
||||
tif->tif_curdircount = 0;
|
||||
return (tif);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the byte order handling.
|
||||
* Setup the byte order handling according to the opened file for reading.
|
||||
*/
|
||||
if (tif->tif_header.common.tiff_magic != TIFF_BIGENDIAN &&
|
||||
tif->tif_header.common.tiff_magic != TIFF_LITTLEENDIAN
|
||||
|
|
@ -619,9 +751,17 @@ TIFF *TIFFClientOpenExt(const char *name, const char *mode,
|
|||
* example, it may be broken) and want to proceed to other
|
||||
* directories. I this case we use the TIFF_HEADERONLY flag to open
|
||||
* file and return immediately after reading TIFF header.
|
||||
* However, the pointer to TIFFSetField() and TIFFGetField()
|
||||
* (i.e. tif->tif_tagmethods.vsetfield and
|
||||
* tif->tif_tagmethods.vgetfield) need to be initialized, which is
|
||||
* done in TIFFDefaultDirectory().
|
||||
*/
|
||||
if (tif->tif_flags & TIFF_HEADERONLY)
|
||||
{
|
||||
if (!TIFFDefaultDirectory(tif))
|
||||
goto bad;
|
||||
return (tif);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup initial directory.
|
||||
|
|
@ -764,10 +904,7 @@ int TIFFIsBigEndian(TIFF *tif)
|
|||
/*
|
||||
* Return nonzero if given file is BigTIFF style.
|
||||
*/
|
||||
int TIFFIsBigTIFF(TIFF *tif)
|
||||
{
|
||||
return (tif->tif_header.common.tiff_version == TIFF_VERSION_BIG);
|
||||
}
|
||||
int TIFFIsBigTIFF(TIFF *tif) { return ((tif->tif_flags & TIFF_BIGTIFF) != 0); }
|
||||
|
||||
/*
|
||||
* Return pointer to file read method.
|
||||
|
|
|
|||
9
3rdparty/libtiff/tif_packbits.c
vendored
9
3rdparty/libtiff/tif_packbits.c
vendored
|
|
@ -31,6 +31,8 @@
|
|||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef PACKBITS_READ_ONLY
|
||||
|
||||
static int PackBitsPreEncode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
(void)s;
|
||||
|
|
@ -78,7 +80,7 @@ static int PackBitsEncode(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s)
|
|||
op = tif->tif_rawcp;
|
||||
ep = tif->tif_rawdata + tif->tif_rawdatasize;
|
||||
state = BASE;
|
||||
lastliteral = 0;
|
||||
lastliteral = NULL;
|
||||
while (cc > 0)
|
||||
{
|
||||
/*
|
||||
|
|
@ -231,6 +233,8 @@ static int PackBitsEncodeChunk(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
|||
return (1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int PackBitsDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
||||
{
|
||||
static const char module[] = "PackBitsDecode";
|
||||
|
|
@ -300,6 +304,7 @@ static int PackBitsDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
tif->tif_rawcc = cc;
|
||||
if (occ > 0)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module, "Not enough data for scanline %" PRIu32,
|
||||
tif->tif_row);
|
||||
return (0);
|
||||
|
|
@ -313,11 +318,13 @@ int TIFFInitPackBits(TIFF *tif, int scheme)
|
|||
tif->tif_decoderow = PackBitsDecode;
|
||||
tif->tif_decodestrip = PackBitsDecode;
|
||||
tif->tif_decodetile = PackBitsDecode;
|
||||
#ifndef PACKBITS_READ_ONLY
|
||||
tif->tif_preencode = PackBitsPreEncode;
|
||||
tif->tif_postencode = PackBitsPostEncode;
|
||||
tif->tif_encoderow = PackBitsEncode;
|
||||
tif->tif_encodestrip = PackBitsEncodeChunk;
|
||||
tif->tif_encodetile = PackBitsEncodeChunk;
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
#endif /* PACKBITS_SUPPORT */
|
||||
|
|
|
|||
33
3rdparty/libtiff/tif_pixarlog.c
vendored
33
3rdparty/libtiff/tif_pixarlog.c
vendored
|
|
@ -670,8 +670,8 @@ static int PixarLogMakeTables(TIFF *tif, PixarLogState *sp)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#define DecoderState(tif) ((PixarLogState *)(tif)->tif_data)
|
||||
#define EncoderState(tif) ((PixarLogState *)(tif)->tif_data)
|
||||
#define PixarLogDecoderState(tif) ((PixarLogState *)(tif)->tif_data)
|
||||
#define PixarLogEncoderState(tif) ((PixarLogState *)(tif)->tif_data)
|
||||
|
||||
static int PixarLogEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s);
|
||||
static int PixarLogDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s);
|
||||
|
|
@ -740,7 +740,7 @@ static int PixarLogSetupDecode(TIFF *tif)
|
|||
{
|
||||
static const char module[] = "PixarLogSetupDecode";
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
PixarLogState *sp = DecoderState(tif);
|
||||
PixarLogState *sp = PixarLogDecoderState(tif);
|
||||
tmsize_t tbuf_size;
|
||||
uint32_t strip_height;
|
||||
|
||||
|
|
@ -813,7 +813,7 @@ static int PixarLogSetupDecode(TIFF *tif)
|
|||
static int PixarLogPreDecode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
static const char module[] = "PixarLogPreDecode";
|
||||
PixarLogState *sp = DecoderState(tif);
|
||||
PixarLogState *sp = PixarLogDecoderState(tif);
|
||||
|
||||
(void)s;
|
||||
assert(sp != NULL);
|
||||
|
|
@ -835,7 +835,7 @@ static int PixarLogDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
{
|
||||
static const char module[] = "PixarLogDecode";
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
PixarLogState *sp = DecoderState(tif);
|
||||
PixarLogState *sp = PixarLogDecoderState(tif);
|
||||
tmsize_t i;
|
||||
tmsize_t nsamples;
|
||||
int llen;
|
||||
|
|
@ -859,6 +859,7 @@ static int PixarLogDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
TIFFErrorExtR(tif, module,
|
||||
"%" PRIu16 " bit input not supported in PixarLog",
|
||||
td->td_bitspersample);
|
||||
memset(op, 0, (size_t)occ);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -879,12 +880,14 @@ static int PixarLogDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
if (sp->stream.avail_out != nsamples * sizeof(uint16_t))
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "ZLib cannot deal with buffers this size");
|
||||
memset(op, 0, (size_t)occ);
|
||||
return (0);
|
||||
}
|
||||
/* Check that we will not fill more than what was allocated */
|
||||
if ((tmsize_t)sp->stream.avail_out > sp->tbuf_size)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "sp->stream.avail_out > sp->tbuf_size");
|
||||
memset(op, 0, (size_t)occ);
|
||||
return (0);
|
||||
}
|
||||
do
|
||||
|
|
@ -899,12 +902,14 @@ static int PixarLogDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
TIFFErrorExtR(
|
||||
tif, module, "Decoding error at scanline %" PRIu32 ", %s",
|
||||
tif->tif_row, sp->stream.msg ? sp->stream.msg : "(null)");
|
||||
memset(op, 0, (size_t)occ);
|
||||
return (0);
|
||||
}
|
||||
if (state != Z_OK)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "ZLib error: %s",
|
||||
sp->stream.msg ? sp->stream.msg : "(null)");
|
||||
memset(op, 0, (size_t)occ);
|
||||
return (0);
|
||||
}
|
||||
} while (sp->stream.avail_out > 0);
|
||||
|
|
@ -916,6 +921,7 @@ static int PixarLogDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
"Not enough data at scanline %" PRIu32
|
||||
" (short %u bytes)",
|
||||
tif->tif_row, sp->stream.avail_out);
|
||||
memset(op, 0, (size_t)occ);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
@ -977,6 +983,7 @@ static int PixarLogDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
default:
|
||||
TIFFErrorExtR(tif, module, "Unsupported bits/sample: %" PRIu16,
|
||||
td->td_bitspersample);
|
||||
memset(op, 0, (size_t)occ);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
|
@ -988,7 +995,7 @@ static int PixarLogSetupEncode(TIFF *tif)
|
|||
{
|
||||
static const char module[] = "PixarLogSetupEncode";
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
PixarLogState *sp = EncoderState(tif);
|
||||
PixarLogState *sp = PixarLogEncoderState(tif);
|
||||
tmsize_t tbuf_size;
|
||||
|
||||
assert(sp != NULL);
|
||||
|
|
@ -1038,7 +1045,7 @@ static int PixarLogSetupEncode(TIFF *tif)
|
|||
static int PixarLogPreEncode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
static const char module[] = "PixarLogPreEncode";
|
||||
PixarLogState *sp = EncoderState(tif);
|
||||
PixarLogState *sp = PixarLogEncoderState(tif);
|
||||
|
||||
(void)s;
|
||||
assert(sp != NULL);
|
||||
|
|
@ -1294,7 +1301,7 @@ static int PixarLogEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
|||
{
|
||||
static const char module[] = "PixarLogEncode";
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
PixarLogState *sp = EncoderState(tif);
|
||||
PixarLogState *sp = PixarLogEncoderState(tif);
|
||||
tmsize_t i;
|
||||
tmsize_t n;
|
||||
int llen;
|
||||
|
|
@ -1401,7 +1408,7 @@ static int PixarLogEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
|||
static int PixarLogPostEncode(TIFF *tif)
|
||||
{
|
||||
static const char module[] = "PixarLogPostEncode";
|
||||
PixarLogState *sp = EncoderState(tif);
|
||||
PixarLogState *sp = PixarLogEncoderState(tif);
|
||||
int state;
|
||||
|
||||
sp->stream.avail_in = 0;
|
||||
|
|
@ -1589,10 +1596,10 @@ static int PixarLogVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
}
|
||||
|
||||
static const TIFFField pixarlogFields[] = {
|
||||
{TIFFTAG_PIXARLOGDATAFMT, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, FALSE, FALSE, "", NULL},
|
||||
{TIFFTAG_PIXARLOGQUALITY, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, FALSE, FALSE, "", NULL}};
|
||||
{TIFFTAG_PIXARLOGDATAFMT, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO,
|
||||
FALSE, FALSE, "", NULL},
|
||||
{TIFFTAG_PIXARLOGQUALITY, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO,
|
||||
FALSE, FALSE, "", NULL}};
|
||||
|
||||
int TIFFInitPixarLog(TIFF *tif, int scheme)
|
||||
{
|
||||
|
|
|
|||
181
3rdparty/libtiff/tif_predict.c
vendored
181
3rdparty/libtiff/tif_predict.c
vendored
|
|
@ -30,6 +30,10 @@
|
|||
#include "tif_predict.h"
|
||||
#include "tiffiop.h"
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
|
||||
|
||||
static int horAcc8(TIFF *tif, uint8_t *cp0, tmsize_t cc);
|
||||
|
|
@ -208,16 +212,12 @@ static int PredictorSetupDecode(TIFF *tif)
|
|||
/*
|
||||
* The data should not be swapped outside of the floating
|
||||
* point predictor, the accumulation routine should return
|
||||
* byres in the native order.
|
||||
* bytes in the native order.
|
||||
*/
|
||||
if (tif->tif_flags & TIFF_SWAB)
|
||||
{
|
||||
tif->tif_postdecode = _TIFFNoPostDecode;
|
||||
}
|
||||
/*
|
||||
* Allocate buffer to keep the decoded bytes before
|
||||
* rearranging in the right order
|
||||
*/
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
@ -305,6 +305,15 @@ static int PredictorSetupEncode(TIFF *tif)
|
|||
sp->encodetile = tif->tif_encodetile;
|
||||
tif->tif_encodetile = PredictorEncodeTile;
|
||||
}
|
||||
/*
|
||||
* The data should not be swapped outside of the floating
|
||||
* point predictor, the differentiation routine should return
|
||||
* bytes in the native order.
|
||||
*/
|
||||
if (tif->tif_flags & TIFF_SWAB)
|
||||
{
|
||||
tif->tif_postdecode = _TIFFNoPostDecode;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
@ -343,7 +352,7 @@ static int horAcc8(TIFF *tif, uint8_t *cp0, tmsize_t cc)
|
|||
{
|
||||
tmsize_t stride = PredictorState(tif)->stride;
|
||||
|
||||
unsigned char *cp = (unsigned char *)cp0;
|
||||
uint8_t *cp = cp0;
|
||||
if ((cc % stride) != 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, "horAcc8", "%s", "(cc%stride)!=0");
|
||||
|
|
@ -355,32 +364,48 @@ static int horAcc8(TIFF *tif, uint8_t *cp0, tmsize_t cc)
|
|||
/*
|
||||
* Pipeline the most common cases.
|
||||
*/
|
||||
if (stride == 3)
|
||||
if (stride == 1)
|
||||
{
|
||||
unsigned int cr = cp[0];
|
||||
unsigned int cg = cp[1];
|
||||
unsigned int cb = cp[2];
|
||||
uint32_t acc = cp[0];
|
||||
tmsize_t i = stride;
|
||||
for (; i < cc - 3; i += 4)
|
||||
{
|
||||
cp[i + 0] = (uint8_t)((acc += cp[i + 0]) & 0xff);
|
||||
cp[i + 1] = (uint8_t)((acc += cp[i + 1]) & 0xff);
|
||||
cp[i + 2] = (uint8_t)((acc += cp[i + 2]) & 0xff);
|
||||
cp[i + 3] = (uint8_t)((acc += cp[i + 3]) & 0xff);
|
||||
}
|
||||
for (; i < cc; i++)
|
||||
{
|
||||
cp[i + 0] = (uint8_t)((acc += cp[i + 0]) & 0xff);
|
||||
}
|
||||
}
|
||||
else if (stride == 3)
|
||||
{
|
||||
uint32_t cr = cp[0];
|
||||
uint32_t cg = cp[1];
|
||||
uint32_t cb = cp[2];
|
||||
tmsize_t i = stride;
|
||||
for (; i < cc; i += stride)
|
||||
{
|
||||
cp[i + 0] = (unsigned char)((cr += cp[i + 0]) & 0xff);
|
||||
cp[i + 1] = (unsigned char)((cg += cp[i + 1]) & 0xff);
|
||||
cp[i + 2] = (unsigned char)((cb += cp[i + 2]) & 0xff);
|
||||
cp[i + 0] = (uint8_t)((cr += cp[i + 0]) & 0xff);
|
||||
cp[i + 1] = (uint8_t)((cg += cp[i + 1]) & 0xff);
|
||||
cp[i + 2] = (uint8_t)((cb += cp[i + 2]) & 0xff);
|
||||
}
|
||||
}
|
||||
else if (stride == 4)
|
||||
{
|
||||
unsigned int cr = cp[0];
|
||||
unsigned int cg = cp[1];
|
||||
unsigned int cb = cp[2];
|
||||
unsigned int ca = cp[3];
|
||||
uint32_t cr = cp[0];
|
||||
uint32_t cg = cp[1];
|
||||
uint32_t cb = cp[2];
|
||||
uint32_t ca = cp[3];
|
||||
tmsize_t i = stride;
|
||||
for (; i < cc; i += stride)
|
||||
{
|
||||
cp[i + 0] = (unsigned char)((cr += cp[i + 0]) & 0xff);
|
||||
cp[i + 1] = (unsigned char)((cg += cp[i + 1]) & 0xff);
|
||||
cp[i + 2] = (unsigned char)((cb += cp[i + 2]) & 0xff);
|
||||
cp[i + 3] = (unsigned char)((ca += cp[i + 3]) & 0xff);
|
||||
cp[i + 0] = (uint8_t)((cr += cp[i + 0]) & 0xff);
|
||||
cp[i + 1] = (uint8_t)((cg += cp[i + 1]) & 0xff);
|
||||
cp[i + 2] = (uint8_t)((cb += cp[i + 2]) & 0xff);
|
||||
cp[i + 3] = (uint8_t)((ca += cp[i + 3]) & 0xff);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -389,7 +414,7 @@ static int horAcc8(TIFF *tif, uint8_t *cp0, tmsize_t cc)
|
|||
do
|
||||
{
|
||||
REPEAT4(stride,
|
||||
cp[stride] = (unsigned char)((cp[stride] + *cp) & 0xff);
|
||||
cp[stride] = (uint8_t)((cp[stride] + *cp) & 0xff);
|
||||
cp++)
|
||||
cc -= stride;
|
||||
} while (cc > 0);
|
||||
|
|
@ -512,7 +537,7 @@ static int fpAcc(TIFF *tif, uint8_t *cp0, tmsize_t cc)
|
|||
uint32_t bps = tif->tif_dir.td_bitspersample / 8;
|
||||
tmsize_t wc = cc / bps;
|
||||
tmsize_t count = cc;
|
||||
uint8_t *cp = (uint8_t *)cp0;
|
||||
uint8_t *cp = cp0;
|
||||
uint8_t *tmp;
|
||||
|
||||
if (cc % (bps * stride) != 0)
|
||||
|
|
@ -525,17 +550,85 @@ static int fpAcc(TIFF *tif, uint8_t *cp0, tmsize_t cc)
|
|||
if (!tmp)
|
||||
return 0;
|
||||
|
||||
while (count > stride)
|
||||
if (stride == 1)
|
||||
{
|
||||
REPEAT4(stride,
|
||||
cp[stride] = (unsigned char)((cp[stride] + cp[0]) & 0xff);
|
||||
cp++)
|
||||
count -= stride;
|
||||
/* Optimization of general case */
|
||||
#define OP \
|
||||
do \
|
||||
{ \
|
||||
cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff); \
|
||||
++cp; \
|
||||
} while (0)
|
||||
for (; count > 8; count -= 8)
|
||||
{
|
||||
OP;
|
||||
OP;
|
||||
OP;
|
||||
OP;
|
||||
OP;
|
||||
OP;
|
||||
OP;
|
||||
OP;
|
||||
}
|
||||
for (; count > 1; count -= 1)
|
||||
{
|
||||
OP;
|
||||
}
|
||||
#undef OP
|
||||
}
|
||||
else
|
||||
{
|
||||
while (count > stride)
|
||||
{
|
||||
REPEAT4(stride, cp[stride] = (uint8_t)((cp[stride] + cp[0]) & 0xff);
|
||||
cp++)
|
||||
count -= stride;
|
||||
}
|
||||
}
|
||||
|
||||
_TIFFmemcpy(tmp, cp0, cc);
|
||||
cp = (uint8_t *)cp0;
|
||||
for (count = 0; count < wc; count++)
|
||||
count = 0;
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
if (bps == 4)
|
||||
{
|
||||
/* Optimization of general case */
|
||||
for (; count + 15 < wc; count += 16)
|
||||
{
|
||||
/* Interlace 4*16 byte values */
|
||||
|
||||
__m128i xmm0 =
|
||||
_mm_loadu_si128((const __m128i *)(tmp + count + 3 * wc));
|
||||
__m128i xmm1 =
|
||||
_mm_loadu_si128((const __m128i *)(tmp + count + 2 * wc));
|
||||
__m128i xmm2 =
|
||||
_mm_loadu_si128((const __m128i *)(tmp + count + 1 * wc));
|
||||
__m128i xmm3 =
|
||||
_mm_loadu_si128((const __m128i *)(tmp + count + 0 * wc));
|
||||
/* (xmm0_0, xmm1_0, xmm0_1, xmm1_1, xmm0_2, xmm1_2, ...) */
|
||||
__m128i tmp0 = _mm_unpacklo_epi8(xmm0, xmm1);
|
||||
/* (xmm0_8, xmm1_8, xmm0_9, xmm1_9, xmm0_10, xmm1_10, ...) */
|
||||
__m128i tmp1 = _mm_unpackhi_epi8(xmm0, xmm1);
|
||||
/* (xmm2_0, xmm3_0, xmm2_1, xmm3_1, xmm2_2, xmm3_2, ...) */
|
||||
__m128i tmp2 = _mm_unpacklo_epi8(xmm2, xmm3);
|
||||
/* (xmm2_8, xmm3_8, xmm2_9, xmm3_9, xmm2_10, xmm3_10, ...) */
|
||||
__m128i tmp3 = _mm_unpackhi_epi8(xmm2, xmm3);
|
||||
/* (xmm0_0, xmm1_0, xmm2_0, xmm3_0, xmm0_1, xmm1_1, xmm2_1, xmm3_1,
|
||||
* ...) */
|
||||
__m128i tmp2_0 = _mm_unpacklo_epi16(tmp0, tmp2);
|
||||
__m128i tmp2_1 = _mm_unpackhi_epi16(tmp0, tmp2);
|
||||
__m128i tmp2_2 = _mm_unpacklo_epi16(tmp1, tmp3);
|
||||
__m128i tmp2_3 = _mm_unpackhi_epi16(tmp1, tmp3);
|
||||
_mm_storeu_si128((__m128i *)(cp + 4 * count + 0 * 16), tmp2_0);
|
||||
_mm_storeu_si128((__m128i *)(cp + 4 * count + 1 * 16), tmp2_1);
|
||||
_mm_storeu_si128((__m128i *)(cp + 4 * count + 2 * 16), tmp2_2);
|
||||
_mm_storeu_si128((__m128i *)(cp + 4 * count + 3 * 16), tmp2_3);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (; count < wc; count++)
|
||||
{
|
||||
uint32_t byte;
|
||||
for (byte = 0; byte < bps; byte++)
|
||||
|
|
@ -857,16 +950,38 @@ static int fpDiff(TIFF *tif, uint8_t *cp0, tmsize_t cc)
|
|||
|
||||
static int PredictorEncodeRow(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
||||
{
|
||||
static const char module[] = "PredictorEncodeRow";
|
||||
TIFFPredictorState *sp = PredictorState(tif);
|
||||
uint8_t *working_copy;
|
||||
int result_code;
|
||||
|
||||
assert(sp != NULL);
|
||||
assert(sp->encodepfunc != NULL);
|
||||
assert(sp->encoderow != NULL);
|
||||
|
||||
/* XXX horizontal differencing alters user's data XXX */
|
||||
if (!(*sp->encodepfunc)(tif, bp, cc))
|
||||
/*
|
||||
* Do predictor manipulation in a working buffer to avoid altering
|
||||
* the callers buffer, like for PredictorEncodeTile().
|
||||
* https://gitlab.com/libtiff/libtiff/-/issues/5
|
||||
*/
|
||||
working_copy = (uint8_t *)_TIFFmallocExt(tif, cc);
|
||||
if (working_copy == NULL)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Out of memory allocating %" PRId64 " byte temp buffer.",
|
||||
(int64_t)cc);
|
||||
return 0;
|
||||
return (*sp->encoderow)(tif, bp, cc, s);
|
||||
}
|
||||
memcpy(working_copy, bp, cc);
|
||||
|
||||
if (!(*sp->encodepfunc)(tif, working_copy, cc))
|
||||
{
|
||||
_TIFFfreeExt(tif, working_copy);
|
||||
return 0;
|
||||
}
|
||||
result_code = (*sp->encoderow)(tif, working_copy, cc, s);
|
||||
_TIFFfreeExt(tif, working_copy);
|
||||
return result_code;
|
||||
}
|
||||
|
||||
static int PredictorEncodeTile(TIFF *tif, uint8_t *bp0, tmsize_t cc0,
|
||||
|
|
@ -923,7 +1038,7 @@ static int PredictorEncodeTile(TIFF *tif, uint8_t *bp0, tmsize_t cc0,
|
|||
|
||||
static const TIFFField predictFields[] = {
|
||||
{TIFFTAG_PREDICTOR, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16,
|
||||
TIFF_SETGET_UINT16, FIELD_PREDICTOR, FALSE, FALSE, "Predictor", NULL},
|
||||
FIELD_PREDICTOR, FALSE, FALSE, "Predictor", NULL},
|
||||
};
|
||||
|
||||
static int PredictorVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
|
|
|
|||
3
3rdparty/libtiff/tif_print.c
vendored
3
3rdparty/libtiff/tif_print.c
vendored
|
|
@ -677,7 +677,8 @@ void TIFFPrintDirectory(TIFF *tif, FILE *fd, long flags)
|
|||
else
|
||||
{
|
||||
/*--: Rational2Double: For Rationals evaluate
|
||||
* "set_field_type" to determine internal storage size. */
|
||||
* "set_get_field_type" to determine internal storage size.
|
||||
*/
|
||||
int tv_size = TIFFFieldSetGetSize(fip);
|
||||
raw_data = _TIFFmallocExt(tif, tv_size * value_count);
|
||||
mem_alloc = 1;
|
||||
|
|
|
|||
89
3rdparty/libtiff/tif_read.c
vendored
89
3rdparty/libtiff/tif_read.c
vendored
|
|
@ -105,8 +105,8 @@ static int TIFFReadAndRealloc(TIFF *tif, tmsize_t size, tmsize_t rawdata_offset,
|
|||
TIFFErrorExtR(tif, module, "Invalid buffer size");
|
||||
return 0;
|
||||
}
|
||||
new_rawdata =
|
||||
(uint8_t *)_TIFFrealloc(tif->tif_rawdata, tif->tif_rawdatasize);
|
||||
new_rawdata = (uint8_t *)_TIFFreallocExt(tif, tif->tif_rawdata,
|
||||
tif->tif_rawdatasize);
|
||||
if (new_rawdata == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
|
|
@ -351,15 +351,14 @@ static int TIFFSeek(TIFF *tif, uint32_t row, uint16_t sample)
|
|||
* chunk strip */
|
||||
whole_strip = 1;
|
||||
}
|
||||
#else
|
||||
whole_strip = 1;
|
||||
#endif
|
||||
|
||||
if (!whole_strip)
|
||||
{
|
||||
/* 16 is for YCbCr mode where we may need to read 16 */
|
||||
/* lines at a time to get a decompressed line, and 5000 */
|
||||
/* is some constant value, for example for JPEG tables */
|
||||
|
||||
/* coverity[dead_error_line:SUPPRESS] */
|
||||
if (tif->tif_scanlinesize < TIFF_TMSIZE_T_MAX / 16 &&
|
||||
tif->tif_scanlinesize * 16 < TIFF_TMSIZE_T_MAX - 5000)
|
||||
{
|
||||
|
|
@ -370,6 +369,9 @@ static int TIFFSeek(TIFF *tif, uint32_t row, uint16_t sample)
|
|||
read_ahead = tif->tif_scanlinesize;
|
||||
}
|
||||
}
|
||||
#else
|
||||
whole_strip = 1;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If we haven't loaded this strip, do so now, possibly
|
||||
|
|
@ -383,18 +385,22 @@ static int TIFFSeek(TIFF *tif, uint32_t row, uint16_t sample)
|
|||
if (!TIFFFillStrip(tif, strip))
|
||||
return (0);
|
||||
}
|
||||
#if defined(CHUNKY_STRIP_READ_SUPPORT)
|
||||
else
|
||||
{
|
||||
if (!TIFFFillStripPartial(tif, strip, read_ahead, 1))
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(CHUNKY_STRIP_READ_SUPPORT)
|
||||
/*
|
||||
** If we already have some data loaded, do we need to read some more?
|
||||
*/
|
||||
else if (!whole_strip)
|
||||
{
|
||||
/* coverity[dead_error_line:SUPPRESS] */
|
||||
if (((tif->tif_rawdata + tif->tif_rawdataloaded) - tif->tif_rawcp) <
|
||||
read_ahead &&
|
||||
(uint64_t)tif->tif_rawdataoff + tif->tif_rawdataloaded <
|
||||
|
|
@ -404,6 +410,7 @@ static int TIFFSeek(TIFF *tif, uint32_t row, uint16_t sample)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (row < tif->tif_row)
|
||||
{
|
||||
|
|
@ -464,6 +471,12 @@ int TIFFReadScanline(TIFF *tif, void *buf, uint32_t row, uint16_t sample)
|
|||
if (e)
|
||||
(*tif->tif_postdecode)(tif, (uint8_t *)buf, tif->tif_scanlinesize);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* See TIFFReadEncodedStrip comment regarding TIFFTAG_FAXFILLFUNC. */
|
||||
if (buf)
|
||||
memset(buf, 0, (size_t)tif->tif_scanlinesize);
|
||||
}
|
||||
return (e > 0 ? 1 : -1);
|
||||
}
|
||||
|
||||
|
|
@ -495,6 +508,11 @@ static tmsize_t TIFFReadEncodedStripGetStripSize(TIFF *tif, uint32_t strip,
|
|||
rowsperstrip = td->td_rowsperstrip;
|
||||
if (rowsperstrip > td->td_imagelength)
|
||||
rowsperstrip = td->td_imagelength;
|
||||
if (rowsperstrip == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "rowsperstrip is zero");
|
||||
return ((tmsize_t)(-1));
|
||||
}
|
||||
stripsperplane =
|
||||
TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
|
||||
stripinplane = (strip % stripsperplane);
|
||||
|
|
@ -544,7 +562,13 @@ tmsize_t TIFFReadEncodedStrip(TIFF *tif, uint32_t strip, void *buf,
|
|||
if ((size != (tmsize_t)(-1)) && (size < stripsize))
|
||||
stripsize = size;
|
||||
if (!TIFFFillStrip(tif, strip))
|
||||
{
|
||||
/* The output buf may be NULL, in particular if TIFFTAG_FAXFILLFUNC
|
||||
is being used. Thus, memset must be conditional on buf not NULL. */
|
||||
if (buf)
|
||||
memset(buf, 0, (size_t)stripsize);
|
||||
return ((tmsize_t)(-1));
|
||||
}
|
||||
if ((*tif->tif_decodestrip)(tif, buf, stripsize, plane) <= 0)
|
||||
return ((tmsize_t)(-1));
|
||||
(*tif->tif_postdecode)(tif, buf, stripsize);
|
||||
|
|
@ -962,9 +986,15 @@ tmsize_t TIFFReadEncodedTile(TIFF *tif, uint32_t tile, void *buf, tmsize_t size)
|
|||
size = tilesize;
|
||||
else if (size > tilesize)
|
||||
size = tilesize;
|
||||
if (TIFFFillTile(tif, tile) &&
|
||||
(*tif->tif_decodetile)(tif, (uint8_t *)buf, size,
|
||||
(uint16_t)(tile / td->td_stripsperimage)))
|
||||
if (!TIFFFillTile(tif, tile))
|
||||
{
|
||||
/* See TIFFReadEncodedStrip comment regarding TIFFTAG_FAXFILLFUNC. */
|
||||
if (buf)
|
||||
memset(buf, 0, (size_t)size);
|
||||
return ((tmsize_t)(-1));
|
||||
}
|
||||
else if ((*tif->tif_decodetile)(tif, (uint8_t *)buf, size,
|
||||
(uint16_t)(tile / td->td_stripsperimage)))
|
||||
{
|
||||
(*tif->tif_postdecode)(tif, (uint8_t *)buf, size);
|
||||
return (size);
|
||||
|
|
@ -1449,6 +1479,11 @@ static int TIFFStartTile(TIFF *tif, uint32_t tile)
|
|||
tif->tif_flags |= TIFF_CODERSETUP;
|
||||
}
|
||||
tif->tif_curtile = tile;
|
||||
if (td->td_tilewidth == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Zero tilewidth");
|
||||
return 0;
|
||||
}
|
||||
howmany32 = TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth);
|
||||
if (howmany32 == 0)
|
||||
{
|
||||
|
|
@ -1545,9 +1580,16 @@ int TIFFReadFromUserBuffer(TIFF *tif, uint32_t strile, void *inbuf,
|
|||
|
||||
if (TIFFIsTiled(tif))
|
||||
{
|
||||
if (!TIFFStartTile(tif, strile) ||
|
||||
!(*tif->tif_decodetile)(tif, (uint8_t *)outbuf, outsize,
|
||||
(uint16_t)(strile / td->td_stripsperimage)))
|
||||
if (!TIFFStartTile(tif, strile))
|
||||
{
|
||||
ret = 0;
|
||||
/* See related TIFFReadEncodedStrip comment. */
|
||||
if (outbuf)
|
||||
memset(outbuf, 0, (size_t)outsize);
|
||||
}
|
||||
else if (!(*tif->tif_decodetile)(
|
||||
tif, (uint8_t *)outbuf, outsize,
|
||||
(uint16_t)(strile / td->td_stripsperimage)))
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
|
|
@ -1558,14 +1600,29 @@ int TIFFReadFromUserBuffer(TIFF *tif, uint32_t strile, void *inbuf,
|
|||
uint32_t stripsperplane;
|
||||
if (rowsperstrip > td->td_imagelength)
|
||||
rowsperstrip = td->td_imagelength;
|
||||
stripsperplane =
|
||||
TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
|
||||
if (!TIFFStartStrip(tif, strile) ||
|
||||
!(*tif->tif_decodestrip)(tif, (uint8_t *)outbuf, outsize,
|
||||
(uint16_t)(strile / stripsperplane)))
|
||||
if (rowsperstrip == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "rowsperstrip is zero");
|
||||
ret = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
stripsperplane =
|
||||
TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
|
||||
if (!TIFFStartStrip(tif, strile))
|
||||
{
|
||||
ret = 0;
|
||||
/* See related TIFFReadEncodedStrip comment. */
|
||||
if (outbuf)
|
||||
memset(outbuf, 0, (size_t)outsize);
|
||||
}
|
||||
else if (!(*tif->tif_decodestrip)(
|
||||
tif, (uint8_t *)outbuf, outsize,
|
||||
(uint16_t)(strile / stripsperplane)))
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
|
|
|
|||
12
3rdparty/libtiff/tif_stream.cxx
vendored
12
3rdparty/libtiff/tif_stream.cxx
vendored
|
|
@ -87,8 +87,8 @@ extern "C"
|
|||
static uint64_t _tiffisSizeProc(thandle_t fd);
|
||||
static int _tiffosCloseProc(thandle_t fd);
|
||||
static int _tiffisCloseProc(thandle_t fd);
|
||||
static int _tiffDummyMapProc(thandle_t, void **base, toff_t *size);
|
||||
static void _tiffDummyUnmapProc(thandle_t, void *base, toff_t size);
|
||||
static int _tiffDummyMapProcCxx(thandle_t, void **base, toff_t *size);
|
||||
static void _tiffDummyUnmapProcCxx(thandle_t, void *base, toff_t size);
|
||||
static TIFF *_tiffStreamOpen(const char *name, const char *mode, void *fd);
|
||||
|
||||
struct tiffis_data
|
||||
|
|
@ -324,14 +324,14 @@ extern "C"
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int _tiffDummyMapProc(thandle_t, void **base, toff_t *size)
|
||||
static int _tiffDummyMapProcCxx(thandle_t, void **base, toff_t *size)
|
||||
{
|
||||
(void)base;
|
||||
(void)size;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void _tiffDummyUnmapProc(thandle_t, void *base, toff_t size)
|
||||
static void _tiffDummyUnmapProcCxx(thandle_t, void *base, toff_t size)
|
||||
{
|
||||
(void)base;
|
||||
(void)size;
|
||||
|
|
@ -354,7 +354,7 @@ extern "C"
|
|||
tif = TIFFClientOpen(
|
||||
name, mode, reinterpret_cast<thandle_t>(data), _tiffosReadProc,
|
||||
_tiffosWriteProc, _tiffosSeekProc, _tiffosCloseProc,
|
||||
_tiffosSizeProc, _tiffDummyMapProc, _tiffDummyUnmapProc);
|
||||
_tiffosSizeProc, _tiffDummyMapProcCxx, _tiffDummyUnmapProcCxx);
|
||||
if (!tif)
|
||||
{
|
||||
delete data;
|
||||
|
|
@ -369,7 +369,7 @@ extern "C"
|
|||
tif = TIFFClientOpen(
|
||||
name, mode, reinterpret_cast<thandle_t>(data), _tiffisReadProc,
|
||||
_tiffisWriteProc, _tiffisSeekProc, _tiffisCloseProc,
|
||||
_tiffisSizeProc, _tiffDummyMapProc, _tiffDummyUnmapProc);
|
||||
_tiffisSizeProc, _tiffDummyMapProcCxx, _tiffDummyUnmapProcCxx);
|
||||
if (!tif)
|
||||
{
|
||||
delete data;
|
||||
|
|
|
|||
37
3rdparty/libtiff/tif_strip.c
vendored
37
3rdparty/libtiff/tif_strip.c
vendored
|
|
@ -38,6 +38,12 @@ uint32_t TIFFComputeStrip(TIFF *tif, uint32_t row, uint16_t sample)
|
|||
TIFFDirectory *td = &tif->tif_dir;
|
||||
uint32_t strip;
|
||||
|
||||
if (td->td_rowsperstrip == 0)
|
||||
{
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Cannot compute strip: RowsPerStrip is zero");
|
||||
return 0;
|
||||
}
|
||||
strip = row / td->td_rowsperstrip;
|
||||
if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
|
||||
{
|
||||
|
|
@ -61,6 +67,11 @@ uint32_t TIFFNumberOfStrips(TIFF *tif)
|
|||
TIFFDirectory *td = &tif->tif_dir;
|
||||
uint32_t nstrips;
|
||||
|
||||
if (td->td_rowsperstrip == 0)
|
||||
{
|
||||
TIFFWarningExtR(tif, "TIFFNumberOfStrips", "RowsPerStrip is zero");
|
||||
return 0;
|
||||
}
|
||||
nstrips = (td->td_rowsperstrip == (uint32_t)-1
|
||||
? 1
|
||||
: TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
|
||||
|
|
@ -107,7 +118,8 @@ uint64_t TIFFVStripSize64(TIFF *tif, uint32_t nrows)
|
|||
if ((ycbcrsubsampling[0] != 1 && ycbcrsubsampling[0] != 2 &&
|
||||
ycbcrsubsampling[0] != 4) ||
|
||||
(ycbcrsubsampling[1] != 1 && ycbcrsubsampling[1] != 2 &&
|
||||
ycbcrsubsampling[1] != 4))
|
||||
ycbcrsubsampling[1] != 4) ||
|
||||
(ycbcrsubsampling[0] == 0 || ycbcrsubsampling[1] == 0))
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Invalid YCbCr subsampling (%dx%d)",
|
||||
ycbcrsubsampling[0], ycbcrsubsampling[1]);
|
||||
|
|
@ -267,7 +279,8 @@ uint64_t TIFFScanlineSize64(TIFF *tif)
|
|||
if (((ycbcrsubsampling[0] != 1) && (ycbcrsubsampling[0] != 2) &&
|
||||
(ycbcrsubsampling[0] != 4)) ||
|
||||
((ycbcrsubsampling[1] != 1) && (ycbcrsubsampling[1] != 2) &&
|
||||
(ycbcrsubsampling[1] != 4)))
|
||||
(ycbcrsubsampling[1] != 4)) ||
|
||||
((ycbcrsubsampling[0] == 0) || (ycbcrsubsampling[1] == 0)))
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Invalid YCbCr subsampling");
|
||||
return 0;
|
||||
|
|
@ -287,7 +300,25 @@ uint64_t TIFFScanlineSize64(TIFF *tif)
|
|||
else
|
||||
{
|
||||
uint64_t scanline_samples;
|
||||
scanline_samples = _TIFFMultiply64(tif, td->td_imagewidth,
|
||||
uint32_t scanline_width = td->td_imagewidth;
|
||||
|
||||
#if 0
|
||||
// Tries to fix https://gitlab.com/libtiff/libtiff/-/merge_requests/564
|
||||
// but causes regression when decoding legit files with tiffcp -c none
|
||||
// Cf https://gitlab.com/libtiff/libtiff/-/merge_requests/644
|
||||
if (td->td_photometric == PHOTOMETRIC_YCBCR)
|
||||
{
|
||||
uint16_t subsampling_hor;
|
||||
uint16_t ignored;
|
||||
TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
|
||||
&subsampling_hor, &ignored);
|
||||
if (subsampling_hor > 1) // roundup width for YCbCr
|
||||
scanline_width =
|
||||
TIFFroundup_32(scanline_width, subsampling_hor);
|
||||
}
|
||||
#endif
|
||||
|
||||
scanline_samples = _TIFFMultiply64(tif, scanline_width,
|
||||
td->td_samplesperpixel, module);
|
||||
scanline_size =
|
||||
TIFFhowmany_64(_TIFFMultiply64(tif, scanline_samples,
|
||||
|
|
|
|||
16
3rdparty/libtiff/tif_thunder.c
vendored
16
3rdparty/libtiff/tif_thunder.c
vendored
|
|
@ -82,13 +82,14 @@ static int ThunderSetupDecode(TIFF *tif)
|
|||
return (1);
|
||||
}
|
||||
|
||||
static int ThunderDecode(TIFF *tif, uint8_t *op, tmsize_t maxpixels)
|
||||
static int ThunderDecode(TIFF *tif, uint8_t *op0, tmsize_t maxpixels)
|
||||
{
|
||||
static const char module[] = "ThunderDecode";
|
||||
register unsigned char *bp;
|
||||
register tmsize_t cc;
|
||||
unsigned int lastpixel;
|
||||
tmsize_t npixels;
|
||||
uint8_t *op = op0;
|
||||
|
||||
bp = (unsigned char *)tif->tif_rawcp;
|
||||
cc = tif->tif_rawcc;
|
||||
|
|
@ -107,6 +108,8 @@ static int ThunderDecode(TIFF *tif, uint8_t *op, tmsize_t maxpixels)
|
|||
* Replicate the last pixel n times,
|
||||
* where n is the lower-order 6 bits.
|
||||
*/
|
||||
if (n == 0)
|
||||
break;
|
||||
if (npixels & 1)
|
||||
{
|
||||
op[0] |= lastpixel;
|
||||
|
|
@ -117,11 +120,10 @@ static int ThunderDecode(TIFF *tif, uint8_t *op, tmsize_t maxpixels)
|
|||
else
|
||||
lastpixel |= lastpixel << 4;
|
||||
npixels += n;
|
||||
if (npixels < maxpixels)
|
||||
{
|
||||
for (; n > 0; n -= 2)
|
||||
*op++ = (uint8_t)lastpixel;
|
||||
}
|
||||
if (npixels > maxpixels)
|
||||
break;
|
||||
for (; n > 0; n -= 2)
|
||||
*op++ = (uint8_t)lastpixel;
|
||||
if (n == -1)
|
||||
*--op &= 0xf0;
|
||||
lastpixel &= 0xf;
|
||||
|
|
@ -154,6 +156,8 @@ static int ThunderDecode(TIFF *tif, uint8_t *op, tmsize_t maxpixels)
|
|||
tif->tif_rawcc = cc;
|
||||
if (npixels != maxpixels)
|
||||
{
|
||||
uint8_t *op_end = op0 + (maxpixels + 1) / 2;
|
||||
memset(op, 0, (size_t)(op_end - op));
|
||||
TIFFErrorExtR(tif, module,
|
||||
"%s data at scanline %lu (%" PRIu64 " != %" PRIu64 ")",
|
||||
npixels < maxpixels ? "Not enough" : "Too much",
|
||||
|
|
|
|||
14
3rdparty/libtiff/tif_unix.c
vendored
14
3rdparty/libtiff/tif_unix.c
vendored
|
|
@ -27,6 +27,10 @@
|
|||
* Windows Common RunTime Library.
|
||||
*/
|
||||
|
||||
#ifdef TIFF_DO_NOT_USE_NON_EXT_ALLOC_FUNCTIONS
|
||||
#undef TIFF_DO_NOT_USE_NON_EXT_ALLOC_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#include "tif_config.h"
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
|
|
@ -79,12 +83,16 @@ static tmsize_t _tiffReadProc(thandle_t fd, void *buf, tmsize_t size)
|
|||
size_t io_size = bytes_total - bytes_read;
|
||||
if (io_size > TIFF_IO_MAX)
|
||||
io_size = TIFF_IO_MAX;
|
||||
/* Below is an obvious false positive of Coverity Scan */
|
||||
/* coverity[overflow_sink] */
|
||||
count = read(fdh.fd, buf_offset, (TIFFIOSize_t)io_size);
|
||||
if (count <= 0)
|
||||
break;
|
||||
}
|
||||
if (count < 0)
|
||||
return (tmsize_t)-1;
|
||||
/* Silence Coverity Scan warning about unsigned to signed underflow. */
|
||||
/* coverity[return_overflow:SUPPRESS] */
|
||||
return (tmsize_t)bytes_read;
|
||||
}
|
||||
|
||||
|
|
@ -106,12 +114,16 @@ static tmsize_t _tiffWriteProc(thandle_t fd, void *buf, tmsize_t size)
|
|||
size_t io_size = bytes_total - bytes_written;
|
||||
if (io_size > TIFF_IO_MAX)
|
||||
io_size = TIFF_IO_MAX;
|
||||
/* Below is an obvious false positive of Coverity Scan */
|
||||
/* coverity[overflow_sink] */
|
||||
count = write(fdh.fd, buf_offset, (TIFFIOSize_t)io_size);
|
||||
if (count <= 0)
|
||||
break;
|
||||
}
|
||||
if (count < 0)
|
||||
return (tmsize_t)-1;
|
||||
/* Silence Coverity Scan warning about unsigned to signed underflow. */
|
||||
/* coverity[return_overflow:SUPPRESS] */
|
||||
return (tmsize_t)bytes_written;
|
||||
/* return ((tmsize_t) write(fdh.fd, buf, bytes_total)); */
|
||||
}
|
||||
|
|
@ -258,7 +270,7 @@ TIFF *TIFFOpenExt(const char *name, const char *mode, TIFFOpenOptions *opts)
|
|||
return tif;
|
||||
}
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
/*
|
||||
* Open a TIFF file with a Unicode filename, for read/writing.
|
||||
|
|
|
|||
52
3rdparty/libtiff/tif_webp.c
vendored
52
3rdparty/libtiff/tif_webp.c
vendored
|
|
@ -47,7 +47,9 @@ typedef struct
|
|||
{
|
||||
uint16_t nSamples; /* number of samples per pixel */
|
||||
|
||||
int lossless; /* lossy/lossless compression */
|
||||
int read_error; /* whether a read error has occurred, and which should cause
|
||||
further reads in the same strip/tile to be aborted */
|
||||
int lossless; /* lossy/lossless compression */
|
||||
int lossless_exact; /* lossless exact mode. If TRUE, R,G,B values in areas
|
||||
with alpha = 0 will be preserved */
|
||||
int quality_level; /* compression level */
|
||||
|
|
@ -133,6 +135,16 @@ static int TWebPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
assert(sp != NULL);
|
||||
assert(sp->state == LSTATE_INIT_DECODE);
|
||||
|
||||
if (sp->read_error)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"ZIPDecode: Scanline %" PRIu32 " cannot be read due to "
|
||||
"previous error",
|
||||
tif->tif_row);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sp->psDecoder == NULL)
|
||||
{
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
|
|
@ -158,12 +170,16 @@ static int TWebPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
: (uint32_t)tif->tif_rawcc,
|
||||
&webp_width, &webp_height))
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
TIFFErrorExtR(tif, module, "WebPGetInfo() failed");
|
||||
return 0;
|
||||
}
|
||||
if ((uint32_t)webp_width != segment_width ||
|
||||
(uint32_t)webp_height != segment_height)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
TIFFErrorExtR(
|
||||
tif, module, "WebP blob dimension is %dx%d. Expected %ux%u",
|
||||
webp_width, webp_height, segment_width, segment_height);
|
||||
|
|
@ -174,6 +190,8 @@ static int TWebPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
WebPDecoderConfig config;
|
||||
if (!WebPInitDecoderConfig(&config))
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
TIFFErrorExtR(tif, module, "WebPInitDecoderConfig() failed");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -189,6 +207,8 @@ static int TWebPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
|
||||
if (!bWebPGetFeaturesOK)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
TIFFErrorExtR(tif, module, "WebPInitDecoderConfig() failed");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -202,6 +222,8 @@ static int TWebPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
*/
|
||||
!(webp_bands == 3 && sp->nSamples == 4))
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
TIFFErrorExtR(tif, module,
|
||||
"WebP blob band count is %d. Expected %d", webp_bands,
|
||||
sp->nSamples);
|
||||
|
|
@ -228,6 +250,8 @@ static int TWebPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
if (!sp->pBuffer)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Cannot allocate buffer");
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
return 0;
|
||||
}
|
||||
sp->buffer_size = buffer_size;
|
||||
|
|
@ -257,6 +281,8 @@ static int TWebPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
|
||||
if (sp->psDecoder == NULL)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
TIFFErrorExtR(tif, module, "Unable to allocate WebP decoder.");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -264,6 +290,10 @@ static int TWebPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
|
||||
if (occ % sp->sDecBuffer.u.RGBA.stride)
|
||||
{
|
||||
// read_error not set here as this is a usage issue that can be
|
||||
// recovered in a following call.
|
||||
memset(op, 0, (size_t)occ);
|
||||
/* Do not set read_error as could potentially be recovered */
|
||||
TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -284,6 +314,8 @@ static int TWebPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
{
|
||||
TIFFErrorExtR(tif, module, "Unrecognized error.");
|
||||
}
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
|
@ -303,6 +335,8 @@ static int TWebPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
{
|
||||
if (current_y != numberOfExpectedLines)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Unable to decode WebP data: less lines than "
|
||||
"expected.");
|
||||
|
|
@ -332,6 +366,8 @@ static int TWebPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
}
|
||||
else
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
TIFFErrorExtR(tif, module, "Unable to decode WebP data.");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -451,6 +487,8 @@ static int TWebPPreDecode(TIFF *tif, uint16_t s)
|
|||
sp->psDecoder = NULL;
|
||||
}
|
||||
|
||||
sp->read_error = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -798,14 +836,12 @@ static int TWebPVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
}
|
||||
|
||||
static const TIFFField TWebPFields[] = {
|
||||
{TIFFTAG_WEBP_LEVEL, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "WEBP quality", NULL},
|
||||
{TIFFTAG_WEBP_LOSSLESS, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "WEBP lossless/lossy",
|
||||
NULL},
|
||||
{TIFFTAG_WEBP_LEVEL, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO, TRUE,
|
||||
FALSE, "WEBP quality", NULL},
|
||||
{TIFFTAG_WEBP_LOSSLESS, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO,
|
||||
TRUE, FALSE, "WEBP lossless/lossy", NULL},
|
||||
{TIFFTAG_WEBP_LOSSLESS_EXACT, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "WEBP exact lossless",
|
||||
NULL},
|
||||
FIELD_PSEUDO, TRUE, FALSE, "WEBP exact lossless", NULL},
|
||||
};
|
||||
|
||||
int TIFFInitWebP(TIFF *tif, int scheme)
|
||||
|
|
|
|||
19
3rdparty/libtiff/tif_win32.c
vendored
19
3rdparty/libtiff/tif_win32.c
vendored
|
|
@ -27,6 +27,10 @@
|
|||
* Scott Wagner (wagner@itek.com), Itek Graphix, Rochester, NY USA
|
||||
*/
|
||||
|
||||
#ifdef TIFF_DO_NOT_USE_NON_EXT_ALLOC_FUNCTIONS
|
||||
#undef TIFF_DO_NOT_USE_NON_EXT_ALLOC_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#include "tiffiop.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
@ -154,14 +158,6 @@ static uint64_t _tiffSizeProc(thandle_t fd)
|
|||
return (0);
|
||||
}
|
||||
|
||||
static int _tiffDummyMapProc(thandle_t fd, void **pbase, toff_t *psize)
|
||||
{
|
||||
(void)fd;
|
||||
(void)pbase;
|
||||
(void)psize;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* From "Hermann Josef Hill" <lhill@rhein-zeitung.de>:
|
||||
*
|
||||
|
|
@ -197,13 +193,6 @@ static int _tiffMapProc(thandle_t fd, void **pbase, toff_t *psize)
|
|||
return (1);
|
||||
}
|
||||
|
||||
static void _tiffDummyUnmapProc(thandle_t fd, void *base, toff_t size)
|
||||
{
|
||||
(void)fd;
|
||||
(void)base;
|
||||
(void)size;
|
||||
}
|
||||
|
||||
static void _tiffUnmapProc(thandle_t fd, void *base, toff_t size)
|
||||
{
|
||||
(void)fd;
|
||||
|
|
|
|||
5
3rdparty/libtiff/tif_write.c
vendored
5
3rdparty/libtiff/tif_write.c
vendored
|
|
@ -573,8 +573,13 @@ int TIFFSetupStrips(TIFF *tif)
|
|||
}
|
||||
if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
|
||||
td->td_stripsperimage /= td->td_samplesperpixel;
|
||||
|
||||
if (td->td_stripoffset_p != NULL)
|
||||
_TIFFfreeExt(tif, td->td_stripoffset_p);
|
||||
td->td_stripoffset_p = (uint64_t *)_TIFFCheckMalloc(
|
||||
tif, td->td_nstrips, sizeof(uint64_t), "for \"StripOffsets\" array");
|
||||
if (td->td_stripbytecount_p != NULL)
|
||||
_TIFFfreeExt(tif, td->td_stripbytecount_p);
|
||||
td->td_stripbytecount_p = (uint64_t *)_TIFFCheckMalloc(
|
||||
tif, td->td_nstrips, sizeof(uint64_t), "for \"StripByteCounts\" array");
|
||||
if (td->td_stripoffset_p == NULL || td->td_stripbytecount_p == NULL)
|
||||
|
|
|
|||
119
3rdparty/libtiff/tif_zip.c
vendored
119
3rdparty/libtiff/tif_zip.c
vendored
|
|
@ -67,6 +67,8 @@ typedef struct
|
|||
{
|
||||
TIFFPredictorState predict;
|
||||
z_stream stream;
|
||||
int read_error; /* whether a read error has occurred, and which should cause
|
||||
further reads in the same strip/tile to be aborted */
|
||||
int zipquality; /* compression level */
|
||||
int state; /* state flags */
|
||||
int subcodec; /* DEFLATE_SUBCODEC_ZLIB or DEFLATE_SUBCODEC_LIBDEFLATE */
|
||||
|
|
@ -83,9 +85,9 @@ typedef struct
|
|||
TIFFVSetMethod vsetparent; /* super-class method */
|
||||
} ZIPState;
|
||||
|
||||
#define ZState(tif) ((ZIPState *)(tif)->tif_data)
|
||||
#define DecoderState(tif) ZState(tif)
|
||||
#define EncoderState(tif) ZState(tif)
|
||||
#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
|
||||
#define ZIPDecoderState(tif) GetZIPState(tif)
|
||||
#define ZIPEncoderState(tif) GetZIPState(tif)
|
||||
|
||||
static int ZIPEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s);
|
||||
static int ZIPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s);
|
||||
|
|
@ -99,7 +101,7 @@ static int ZIPFixupTags(TIFF *tif)
|
|||
static int ZIPSetupDecode(TIFF *tif)
|
||||
{
|
||||
static const char module[] = "ZIPSetupDecode";
|
||||
ZIPState *sp = DecoderState(tif);
|
||||
ZIPState *sp = ZIPDecoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
|
||||
|
|
@ -126,12 +128,22 @@ static int ZIPSetupDecode(TIFF *tif)
|
|||
}
|
||||
}
|
||||
|
||||
static inline uint64_t TIFF_MIN_UINT64(uint64_t a, uint64_t b)
|
||||
{
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
static inline uInt TIFF_CLAMP_UINT64_TO_INT32_MAX(uint64_t v)
|
||||
{
|
||||
return (uInt)TIFF_MIN_UINT64(v, INT32_MAX);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup state for decoding a strip.
|
||||
*/
|
||||
static int ZIPPreDecode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
ZIPState *sp = DecoderState(tif);
|
||||
ZIPState *sp = ZIPDecoderState(tif);
|
||||
|
||||
(void)s;
|
||||
assert(sp != NULL);
|
||||
|
|
@ -147,21 +159,34 @@ static int ZIPPreDecode(TIFF *tif, uint16_t s)
|
|||
we need to simplify this code to reflect a ZLib that is likely updated
|
||||
to deal with 8byte memory sizes, though this code will respond
|
||||
appropriately even before we simplify it */
|
||||
sp->stream.avail_in = (uint64_t)tif->tif_rawcc < 0xFFFFFFFFU
|
||||
? (uInt)tif->tif_rawcc
|
||||
: 0xFFFFFFFFU;
|
||||
return (inflateReset(&sp->stream) == Z_OK);
|
||||
sp->stream.avail_in = TIFF_CLAMP_UINT64_TO_INT32_MAX(tif->tif_rawcc);
|
||||
if (inflateReset(&sp->stream) == Z_OK)
|
||||
{
|
||||
sp->read_error = 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ZIPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
||||
{
|
||||
static const char module[] = "ZIPDecode";
|
||||
ZIPState *sp = DecoderState(tif);
|
||||
ZIPState *sp = ZIPDecoderState(tif);
|
||||
|
||||
(void)s;
|
||||
assert(sp != NULL);
|
||||
assert(sp->state == ZSTATE_INIT_DECODE);
|
||||
|
||||
if (sp->read_error)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"ZIPDecode: Scanline %" PRIu32 " cannot be read due to "
|
||||
"previous error",
|
||||
tif->tif_row);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if LIBDEFLATE_SUPPORT
|
||||
if (sp->libdeflate_state == 1)
|
||||
return 0;
|
||||
|
|
@ -227,8 +252,10 @@ static int ZIPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
if (res != LIBDEFLATE_SUCCESS &&
|
||||
res != LIBDEFLATE_INSUFFICIENT_SPACE)
|
||||
{
|
||||
memset(op, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module, "Decoding error at scanline %lu",
|
||||
(unsigned long)tif->tif_row);
|
||||
sp->read_error = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -248,14 +275,10 @@ static int ZIPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
do
|
||||
{
|
||||
int state;
|
||||
uInt avail_in_before = (uint64_t)tif->tif_rawcc <= 0xFFFFFFFFU
|
||||
? (uInt)tif->tif_rawcc
|
||||
: 0xFFFFFFFFU;
|
||||
uInt avail_out_before =
|
||||
(uint64_t)occ < 0xFFFFFFFFU ? (uInt)occ : 0xFFFFFFFFU;
|
||||
uInt avail_in_before = TIFF_CLAMP_UINT64_TO_INT32_MAX(tif->tif_rawcc);
|
||||
uInt avail_out_before = TIFF_CLAMP_UINT64_TO_INT32_MAX(occ);
|
||||
sp->stream.avail_in = avail_in_before;
|
||||
sp->stream.avail_out = avail_out_before;
|
||||
/* coverity[overrun-buffer-arg] */
|
||||
state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
|
||||
tif->tif_rawcc -= (avail_in_before - sp->stream.avail_in);
|
||||
occ -= (avail_out_before - sp->stream.avail_out);
|
||||
|
|
@ -263,13 +286,17 @@ static int ZIPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
break;
|
||||
if (state == Z_DATA_ERROR)
|
||||
{
|
||||
memset(sp->stream.next_out, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module, "Decoding error at scanline %lu, %s",
|
||||
(unsigned long)tif->tif_row, SAFE_MSG(sp));
|
||||
sp->read_error = 1;
|
||||
return (0);
|
||||
}
|
||||
if (state != Z_OK)
|
||||
{
|
||||
memset(sp->stream.next_out, 0, (size_t)occ);
|
||||
TIFFErrorExtR(tif, module, "ZLib error: %s", SAFE_MSG(sp));
|
||||
sp->read_error = 1;
|
||||
return (0);
|
||||
}
|
||||
} while (occ > 0);
|
||||
|
|
@ -279,6 +306,8 @@ static int ZIPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
"Not enough data at scanline %lu (short %" PRIu64
|
||||
" bytes)",
|
||||
(unsigned long)tif->tif_row, (uint64_t)occ);
|
||||
memset(sp->stream.next_out, 0, (size_t)occ);
|
||||
sp->read_error = 1;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
@ -290,7 +319,7 @@ static int ZIPDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
static int ZIPSetupEncode(TIFF *tif)
|
||||
{
|
||||
static const char module[] = "ZIPSetupEncode";
|
||||
ZIPState *sp = EncoderState(tif);
|
||||
ZIPState *sp = ZIPEncoderState(tif);
|
||||
int cappedQuality;
|
||||
|
||||
assert(sp != NULL);
|
||||
|
|
@ -321,7 +350,7 @@ static int ZIPSetupEncode(TIFF *tif)
|
|||
*/
|
||||
static int ZIPPreEncode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
ZIPState *sp = EncoderState(tif);
|
||||
ZIPState *sp = ZIPEncoderState(tif);
|
||||
|
||||
(void)s;
|
||||
assert(sp != NULL);
|
||||
|
|
@ -348,7 +377,7 @@ static int ZIPPreEncode(TIFF *tif, uint16_t s)
|
|||
static int ZIPEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
||||
{
|
||||
static const char module[] = "ZIPEncode";
|
||||
ZIPState *sp = EncoderState(tif);
|
||||
ZIPState *sp = ZIPEncoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
assert(sp->state == ZSTATE_INIT_ENCODE);
|
||||
|
|
@ -456,10 +485,8 @@ static int ZIPEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
|||
appropriately even before we simplify it */
|
||||
do
|
||||
{
|
||||
uInt avail_in_before =
|
||||
(uint64_t)cc <= 0xFFFFFFFFU ? (uInt)cc : 0xFFFFFFFFU;
|
||||
uInt avail_in_before = TIFF_CLAMP_UINT64_TO_INT32_MAX(cc);
|
||||
sp->stream.avail_in = avail_in_before;
|
||||
/* coverity[overrun-buffer-arg] */
|
||||
if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Encoder error: %s", SAFE_MSG(sp));
|
||||
|
|
@ -471,9 +498,8 @@ static int ZIPEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
|||
if (!TIFFFlushData1(tif))
|
||||
return 0;
|
||||
sp->stream.next_out = tif->tif_rawdata;
|
||||
sp->stream.avail_out = (uint64_t)tif->tif_rawdatasize <= 0xFFFFFFFFU
|
||||
? (uInt)tif->tif_rawdatasize
|
||||
: 0xFFFFFFFFU;
|
||||
sp->stream.avail_out =
|
||||
TIFF_CLAMP_UINT64_TO_INT32_MAX(tif->tif_rawdatasize);
|
||||
}
|
||||
cc -= (avail_in_before - sp->stream.avail_in);
|
||||
} while (cc > 0);
|
||||
|
|
@ -487,7 +513,7 @@ static int ZIPEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
|||
static int ZIPPostEncode(TIFF *tif)
|
||||
{
|
||||
static const char module[] = "ZIPPostEncode";
|
||||
ZIPState *sp = EncoderState(tif);
|
||||
ZIPState *sp = ZIPEncoderState(tif);
|
||||
int state;
|
||||
|
||||
#if LIBDEFLATE_SUPPORT
|
||||
|
|
@ -526,7 +552,7 @@ static int ZIPPostEncode(TIFF *tif)
|
|||
|
||||
static void ZIPCleanup(TIFF *tif)
|
||||
{
|
||||
ZIPState *sp = ZState(tif);
|
||||
ZIPState *sp = GetZIPState(tif);
|
||||
|
||||
assert(sp != 0);
|
||||
|
||||
|
|
@ -562,7 +588,7 @@ static void ZIPCleanup(TIFF *tif)
|
|||
static int ZIPVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
{
|
||||
static const char module[] = "ZIPVSetField";
|
||||
ZIPState *sp = ZState(tif);
|
||||
ZIPState *sp = GetZIPState(tif);
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
|
|
@ -628,7 +654,7 @@ static int ZIPVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
|
||||
static int ZIPVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
{
|
||||
ZIPState *sp = ZState(tif);
|
||||
ZIPState *sp = GetZIPState(tif);
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
|
|
@ -647,12 +673,31 @@ static int ZIPVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
}
|
||||
|
||||
static const TIFFField zipFields[] = {
|
||||
{TIFFTAG_ZIPQUALITY, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "", NULL},
|
||||
{TIFFTAG_DEFLATE_SUBCODEC, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "", NULL},
|
||||
{TIFFTAG_ZIPQUALITY, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO, TRUE,
|
||||
FALSE, "", NULL},
|
||||
{TIFFTAG_DEFLATE_SUBCODEC, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO,
|
||||
TRUE, FALSE, "", NULL},
|
||||
};
|
||||
|
||||
static void *TIFF_zalloc(void *opaque, unsigned int items, unsigned int size)
|
||||
{
|
||||
static const char module[] = "TIFF_zalloc";
|
||||
TIFF *tif = opaque;
|
||||
|
||||
if (items > ~(size_t)0 / size)
|
||||
{
|
||||
TIFFErrorExtR(tif, module, "Overflow");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _TIFFmallocExt(tif, items * size);
|
||||
}
|
||||
|
||||
static void TIFF_zfree(void *opaque, void *ptr)
|
||||
{
|
||||
_TIFFfreeExt((TIFF *)opaque, ptr);
|
||||
}
|
||||
|
||||
int TIFFInitZIP(TIFF *tif, int scheme)
|
||||
{
|
||||
static const char module[] = "TIFFInitZIP";
|
||||
|
|
@ -680,10 +725,10 @@ int TIFFInitZIP(TIFF *tif, int scheme)
|
|||
tif->tif_data = (uint8_t *)_TIFFcallocExt(tif, sizeof(ZIPState), 1);
|
||||
if (tif->tif_data == NULL)
|
||||
goto bad;
|
||||
sp = ZState(tif);
|
||||
sp->stream.zalloc = NULL;
|
||||
sp->stream.zfree = NULL;
|
||||
sp->stream.opaque = NULL;
|
||||
sp = GetZIPState(tif);
|
||||
sp->stream.zalloc = TIFF_zalloc;
|
||||
sp->stream.zfree = TIFF_zfree;
|
||||
sp->stream.opaque = tif;
|
||||
sp->stream.data_type = Z_BINARY;
|
||||
|
||||
/*
|
||||
|
|
|
|||
35
3rdparty/libtiff/tif_zstd.c
vendored
35
3rdparty/libtiff/tif_zstd.c
vendored
|
|
@ -54,9 +54,9 @@ typedef struct
|
|||
TIFFVSetMethod vsetparent; /* super-class method */
|
||||
} ZSTDState;
|
||||
|
||||
#define LState(tif) ((ZSTDState *)(tif)->tif_data)
|
||||
#define DecoderState(tif) LState(tif)
|
||||
#define EncoderState(tif) LState(tif)
|
||||
#define GetZSTDState(tif) ((ZSTDState *)(tif)->tif_data)
|
||||
#define ZSTDDecoderState(tif) GetZSTDState(tif)
|
||||
#define ZSTDEncoderState(tif) GetZSTDState(tif)
|
||||
|
||||
static int ZSTDEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s);
|
||||
static int ZSTDDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s);
|
||||
|
|
@ -69,7 +69,7 @@ static int ZSTDFixupTags(TIFF *tif)
|
|||
|
||||
static int ZSTDSetupDecode(TIFF *tif)
|
||||
{
|
||||
ZSTDState *sp = DecoderState(tif);
|
||||
ZSTDState *sp = ZSTDDecoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ static int ZSTDSetupDecode(TIFF *tif)
|
|||
static int ZSTDPreDecode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
static const char module[] = "ZSTDPreDecode";
|
||||
ZSTDState *sp = DecoderState(tif);
|
||||
ZSTDState *sp = ZSTDDecoderState(tif);
|
||||
size_t zstd_ret;
|
||||
|
||||
(void)s;
|
||||
|
|
@ -124,7 +124,7 @@ static int ZSTDPreDecode(TIFF *tif, uint16_t s)
|
|||
static int ZSTDDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
||||
{
|
||||
static const char module[] = "ZSTDDecode";
|
||||
ZSTDState *sp = DecoderState(tif);
|
||||
ZSTDState *sp = ZSTDDecoderState(tif);
|
||||
ZSTD_inBuffer in_buffer;
|
||||
ZSTD_outBuffer out_buffer;
|
||||
size_t zstd_ret;
|
||||
|
|
@ -146,6 +146,7 @@ static int ZSTDDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
zstd_ret = ZSTD_decompressStream(sp->dstream, &out_buffer, &in_buffer);
|
||||
if (ZSTD_isError(zstd_ret))
|
||||
{
|
||||
memset(op + out_buffer.pos, 0, out_buffer.size - out_buffer.pos);
|
||||
TIFFErrorExtR(tif, module, "Error in ZSTD_decompressStream(): %s",
|
||||
ZSTD_getErrorName(zstd_ret));
|
||||
return 0;
|
||||
|
|
@ -155,6 +156,7 @@ static int ZSTDDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
|
||||
if (out_buffer.pos < (size_t)occ)
|
||||
{
|
||||
memset(op + out_buffer.pos, 0, out_buffer.size - out_buffer.pos);
|
||||
TIFFErrorExtR(tif, module,
|
||||
"Not enough data at scanline %lu (short %lu bytes)",
|
||||
(unsigned long)tif->tif_row,
|
||||
|
|
@ -170,7 +172,7 @@ static int ZSTDDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
|
|||
|
||||
static int ZSTDSetupEncode(TIFF *tif)
|
||||
{
|
||||
ZSTDState *sp = EncoderState(tif);
|
||||
ZSTDState *sp = ZSTDEncoderState(tif);
|
||||
|
||||
assert(sp != NULL);
|
||||
if (sp->state & LSTATE_INIT_DECODE)
|
||||
|
|
@ -190,7 +192,7 @@ static int ZSTDSetupEncode(TIFF *tif)
|
|||
static int ZSTDPreEncode(TIFF *tif, uint16_t s)
|
||||
{
|
||||
static const char module[] = "ZSTDPreEncode";
|
||||
ZSTDState *sp = EncoderState(tif);
|
||||
ZSTDState *sp = ZSTDEncoderState(tif);
|
||||
size_t zstd_ret;
|
||||
|
||||
(void)s;
|
||||
|
|
@ -229,7 +231,7 @@ static int ZSTDPreEncode(TIFF *tif, uint16_t s)
|
|||
static int ZSTDEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
||||
{
|
||||
static const char module[] = "ZSTDEncode";
|
||||
ZSTDState *sp = EncoderState(tif);
|
||||
ZSTDState *sp = ZSTDEncoderState(tif);
|
||||
ZSTD_inBuffer in_buffer;
|
||||
size_t zstd_ret;
|
||||
|
||||
|
|
@ -271,7 +273,7 @@ static int ZSTDEncode(TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s)
|
|||
static int ZSTDPostEncode(TIFF *tif)
|
||||
{
|
||||
static const char module[] = "ZSTDPostEncode";
|
||||
ZSTDState *sp = EncoderState(tif);
|
||||
ZSTDState *sp = ZSTDEncoderState(tif);
|
||||
size_t zstd_ret;
|
||||
|
||||
do
|
||||
|
|
@ -297,7 +299,7 @@ static int ZSTDPostEncode(TIFF *tif)
|
|||
|
||||
static void ZSTDCleanup(TIFF *tif)
|
||||
{
|
||||
ZSTDState *sp = LState(tif);
|
||||
ZSTDState *sp = GetZSTDState(tif);
|
||||
|
||||
assert(sp != 0);
|
||||
|
||||
|
|
@ -325,7 +327,7 @@ static void ZSTDCleanup(TIFF *tif)
|
|||
static int ZSTDVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
{
|
||||
static const char module[] = "ZSTDVSetField";
|
||||
ZSTDState *sp = LState(tif);
|
||||
ZSTDState *sp = GetZSTDState(tif);
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
|
|
@ -347,7 +349,7 @@ static int ZSTDVSetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
|
||||
static int ZSTDVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
||||
{
|
||||
ZSTDState *sp = LState(tif);
|
||||
ZSTDState *sp = GetZSTDState(tif);
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
|
|
@ -361,9 +363,8 @@ static int ZSTDVGetField(TIFF *tif, uint32_t tag, va_list ap)
|
|||
}
|
||||
|
||||
static const TIFFField ZSTDFields[] = {
|
||||
{TIFFTAG_ZSTD_LEVEL, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT,
|
||||
TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "ZSTD compression_level",
|
||||
NULL},
|
||||
{TIFFTAG_ZSTD_LEVEL, 0, 0, TIFF_ANY, 0, TIFF_SETGET_INT, FIELD_PSEUDO, TRUE,
|
||||
FALSE, "ZSTD compression_level", NULL},
|
||||
};
|
||||
|
||||
int TIFFInitZSTD(TIFF *tif, int scheme)
|
||||
|
|
@ -389,7 +390,7 @@ int TIFFInitZSTD(TIFF *tif, int scheme)
|
|||
tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(ZSTDState));
|
||||
if (tif->tif_data == NULL)
|
||||
goto bad;
|
||||
sp = LState(tif);
|
||||
sp = GetZSTDState(tif);
|
||||
|
||||
/*
|
||||
* Override parent get/set field methods.
|
||||
|
|
|
|||
1
3rdparty/libtiff/tiff.h
vendored
1
3rdparty/libtiff/tiff.h
vendored
|
|
@ -216,6 +216,7 @@ typedef enum
|
|||
#define COMPRESSION_ZSTD 50000 /* ZSTD: WARNING not registered in Adobe-maintained registry */
|
||||
#define COMPRESSION_WEBP 50001 /* WEBP: WARNING not registered in Adobe-maintained registry */
|
||||
#define COMPRESSION_JXL 50002 /* JPEGXL: WARNING not registered in Adobe-maintained registry */
|
||||
#define COMPRESSION_JXL_DNG_1_7 52546 /* JPEGXL from DNG 1.7 specification */
|
||||
#define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */
|
||||
#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */
|
||||
#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */
|
||||
|
|
|
|||
2
3rdparty/libtiff/tiffconf.h.cmake.in
vendored
2
3rdparty/libtiff/tiffconf.h.cmake.in
vendored
|
|
@ -89,7 +89,7 @@
|
|||
/* Support NeXT 2-bit RLE algorithm */
|
||||
#cmakedefine NEXT_SUPPORT 1
|
||||
|
||||
/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
|
||||
/* Support Old JPEG compression (read contrib/ojpeg/README first! Compilation
|
||||
fails with unpatched IJG JPEG library) */
|
||||
#cmakedefine OJPEG_SUPPORT 1
|
||||
|
||||
|
|
|
|||
50
3rdparty/libtiff/tiffio.h
vendored
50
3rdparty/libtiff/tiffio.h
vendored
|
|
@ -45,12 +45,14 @@ typedef struct tiff TIFF;
|
|||
* to pass tag types and values uses the types defined in
|
||||
* tiff.h directly.
|
||||
*
|
||||
* NB: ttag_t is unsigned int and not unsigned short because
|
||||
* NB: ttag_t -> deprecated and replaced by uint32_t
|
||||
* is unsigned int and not unsigned short because
|
||||
* ANSI C requires that the type before the ellipsis be a
|
||||
* promoted type (i.e. one of int, unsigned int, pointer,
|
||||
* or double) and because we defined pseudo-tags that are
|
||||
* outside the range of legal Aldus-assigned tags.
|
||||
* NB: tsize_t is signed and not unsigned because some functions
|
||||
* NB: tsize_t -> deprecated and replaced by tmsize_t
|
||||
* is signed and not unsigned because some functions
|
||||
* return -1.
|
||||
* NB: toff_t is not off_t for many reasons; TIFFs max out at
|
||||
* 32-bit file offsets, and BigTIFF maxes out at 64-bit
|
||||
|
|
@ -66,10 +68,11 @@ typedef TIFF_SSIZE_T tmsize_t;
|
|||
#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
|
||||
|
||||
typedef uint64_t toff_t; /* file offset */
|
||||
typedef uint32_t tdir_t; /* directory index */
|
||||
|
||||
/* the following are deprecated and should be replaced by their defining
|
||||
counterparts */
|
||||
typedef uint32_t ttag_t; /* directory tag */
|
||||
typedef uint32_t tdir_t; /* directory index */
|
||||
typedef uint16_t tsample_t; /* sample number */
|
||||
typedef uint32_t tstrile_t; /* strip or tile number */
|
||||
typedef tstrile_t tstrip_t; /* strip number */
|
||||
|
|
@ -77,10 +80,6 @@ typedef tstrile_t ttile_t; /* tile number */
|
|||
typedef tmsize_t tsize_t; /* i/o size in bytes */
|
||||
typedef void *tdata_t; /* image data ref */
|
||||
|
||||
#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
|
||||
#define __WIN32__
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
|
||||
* or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
|
||||
|
|
@ -88,7 +87,7 @@ typedef void *tdata_t; /* image data ref */
|
|||
* By default tif_unix.c is assumed.
|
||||
*/
|
||||
|
||||
#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
|
||||
#if defined(_WIN32)
|
||||
#if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && \
|
||||
!defined(USE_WIN32_FILEIO)
|
||||
#define AVOID_WIN32_FILEIO
|
||||
|
|
@ -98,11 +97,11 @@ typedef void *tdata_t; /* image data ref */
|
|||
#if defined(USE_WIN32_FILEIO)
|
||||
#define VC_EXTRALEAN
|
||||
#include <windows.h>
|
||||
#ifdef __WIN32__
|
||||
#ifdef _WIN32
|
||||
DECLARE_HANDLE(thandle_t); /* Win32 file handle */
|
||||
#else
|
||||
typedef HFILE thandle_t; /* client data handle */
|
||||
#endif /* __WIN32__ */
|
||||
#endif /* _WIN32 */
|
||||
#else
|
||||
typedef void *thandle_t; /* client data handle */
|
||||
#endif /* USE_WIN32_FILEIO */
|
||||
|
|
@ -155,6 +154,18 @@ typedef struct
|
|||
float d_gammaB;
|
||||
} TIFFDisplay;
|
||||
|
||||
/* YCbCr->RGB support for TIFFYCbCrToRGBInit() and TIFFYCbCrToRGB()
|
||||
* Attention:
|
||||
* Functions TIFFYCbCrToRGBInit() and TIFFYCbCrToRGB() require a user provided
|
||||
* large memory buffer, where several tables can be setup.
|
||||
* The pointers to these tables are stored in the structure TIFFYCbCrToRGB,
|
||||
* which is located at the beginning of the buffer. Thus, this memory has to be
|
||||
* allocated as follows:
|
||||
* TIFFYCbCrToRGB *ycbcr = (TIFFYCbCrToRGB *)_TIFFmalloc(
|
||||
* TIFFroundup_32(sizeof(TIFFYCbCrToRGB), sizeof(long)) +
|
||||
* 4 * 256 * sizeof(TIFFRGBValue) + 2 * 256 * sizeof(int) +
|
||||
* 3 * 256 * sizeof(int32_t));
|
||||
*/
|
||||
typedef struct
|
||||
{ /* YCbCr->RGB support */
|
||||
TIFFRGBValue *clamptab; /* range clamping table */
|
||||
|
|
@ -311,14 +322,15 @@ extern "C"
|
|||
/*
|
||||
* Auxiliary functions.
|
||||
*/
|
||||
|
||||
#ifndef TIFF_DO_NOT_USE_NON_EXT_ALLOC_FUNCTIONS
|
||||
extern void *_TIFFmalloc(tmsize_t s);
|
||||
extern void *_TIFFcalloc(tmsize_t nmemb, tmsize_t siz);
|
||||
extern void *_TIFFrealloc(void *p, tmsize_t s);
|
||||
extern void _TIFFfree(void *p);
|
||||
#endif
|
||||
extern void _TIFFmemset(void *p, int v, tmsize_t c);
|
||||
extern void _TIFFmemcpy(void *d, const void *s, tmsize_t c);
|
||||
extern int _TIFFmemcmp(const void *p1, const void *p2, tmsize_t c);
|
||||
extern void _TIFFfree(void *p);
|
||||
|
||||
/*
|
||||
** Stuff, related to tag handling and creating custom tags.
|
||||
|
|
@ -508,6 +520,12 @@ extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
|
|||
TIFFOpenOptionsSetMaxSingleMemAlloc(TIFFOpenOptions *opts,
|
||||
tmsize_t max_single_mem_alloc);
|
||||
extern void
|
||||
TIFFOpenOptionsSetMaxCumulatedMemAlloc(TIFFOpenOptions *opts,
|
||||
tmsize_t max_cumulated_mem_alloc);
|
||||
extern void
|
||||
TIFFOpenOptionsSetWarnAboutUnknownTags(TIFFOpenOptions *opts,
|
||||
int warn_about_unknown_tags);
|
||||
extern void
|
||||
TIFFOpenOptionsSetErrorHandlerExtR(TIFFOpenOptions *opts,
|
||||
TIFFErrorHandlerExtR handler,
|
||||
void *errorhandler_user_data);
|
||||
|
|
@ -518,11 +536,11 @@ extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
|
|||
|
||||
extern TIFF *TIFFOpen(const char *, const char *);
|
||||
extern TIFF *TIFFOpenExt(const char *, const char *, TIFFOpenOptions *opts);
|
||||
#ifdef __WIN32__
|
||||
#ifdef _WIN32
|
||||
extern TIFF *TIFFOpenW(const wchar_t *, const char *);
|
||||
extern TIFF *TIFFOpenWExt(const wchar_t *, const char *,
|
||||
TIFFOpenOptions *opts);
|
||||
#endif /* __WIN32__ */
|
||||
#endif /* _WIN32 */
|
||||
extern TIFF *TIFFFdOpen(int, const char *, const char *);
|
||||
extern TIFF *TIFFFdOpenExt(int, const char *, const char *,
|
||||
TIFFOpenOptions *opts);
|
||||
|
|
@ -590,7 +608,7 @@ extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
|
|||
extern uint64_t TIFFGetStrileByteCountWithErr(TIFF *tif, uint32_t strile,
|
||||
int *pbErr);
|
||||
|
||||
#ifdef LOGLUV_PUBLIC
|
||||
#if LOGLUV_PUBLIC
|
||||
#define U_NEU 0.210526316
|
||||
#define V_NEU 0.473684211
|
||||
#define UVSCALE 410.
|
||||
|
|
@ -634,7 +652,7 @@ extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
|
|||
****************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
ttag_t field_tag; /* field's tag */
|
||||
uint32_t field_tag; /* field's tag */
|
||||
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
|
||||
short field_writecount; /* write count/TIFF_VARIABLE */
|
||||
TIFFDataType field_type; /* type of associated data */
|
||||
|
|
|
|||
56
3rdparty/libtiff/tiffiop.h
vendored
56
3rdparty/libtiff/tiffiop.h
vendored
|
|
@ -102,6 +102,13 @@ struct TIFFOffsetAndDirNumber
|
|||
};
|
||||
typedef struct TIFFOffsetAndDirNumber TIFFOffsetAndDirNumber;
|
||||
|
||||
typedef union
|
||||
{
|
||||
TIFFHeaderCommon common;
|
||||
TIFFHeaderClassic classic;
|
||||
TIFFHeaderBig big;
|
||||
} TIFFHeaderUnion;
|
||||
|
||||
struct tiff
|
||||
{
|
||||
char *tif_name; /* name of open file */
|
||||
|
|
@ -153,20 +160,35 @@ struct tiff
|
|||
TIFFDirectory tif_dir; /* internal rep of current directory */
|
||||
TIFFDirectory
|
||||
tif_customdir; /* custom IFDs are separated from the main ones */
|
||||
union
|
||||
{
|
||||
TIFFHeaderCommon common;
|
||||
TIFFHeaderClassic classic;
|
||||
TIFFHeaderBig big;
|
||||
} tif_header;
|
||||
uint16_t tif_header_size; /* file's header block and its length */
|
||||
uint32_t tif_row; /* current scanline */
|
||||
tdir_t tif_curdir; /* current directory (index) */
|
||||
TIFFHeaderUnion tif_header; /* file's header block Classic/BigTIFF union */
|
||||
uint16_t tif_header_size; /* file's header block and its length */
|
||||
uint32_t tif_row; /* current scanline */
|
||||
|
||||
/* There are IFDs in the file and an "active" IFD in memory,
|
||||
* from which fields are "set" and "get".
|
||||
* tif_curdir is set to:
|
||||
* a) TIFF_NON_EXISTENT_DIR_NUMBER if there is no IFD in the file
|
||||
* 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 tif_diroff is zero.
|
||||
* If writing fails, tif_curdir 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 tif_diroff contains the offset of the IFD in the file.
|
||||
* d) IFD index 0, whenever a custom directory or an unchained SubIFD
|
||||
* was read. */
|
||||
tdir_t tif_curdir; /* current directory (index) */
|
||||
/* tif_curdircount: number of directories (main-IFDs) in file:
|
||||
* - TIFF_NON_EXISTENT_DIR_NUMBER means 'dont know number of IFDs'.
|
||||
* - 0 means 'empty file opened for writing, but no IFD written yet' */
|
||||
tdir_t tif_curdircount;
|
||||
uint32_t tif_curstrip; /* current strip for read/write */
|
||||
uint64_t tif_curoff; /* current offset for read/write */
|
||||
uint64_t tif_lastvalidoff; /* last valid offset allowed for rewrite in
|
||||
place. Used only by TIFFAppendToStrip() */
|
||||
uint64_t tif_dataoff; /* current offset for writing dir */
|
||||
uint64_t tif_dataoff; /* current offset for writing dir (IFD) */
|
||||
/* SubIFD support */
|
||||
uint16_t tif_nsubifd; /* remaining subifds to write */
|
||||
uint64_t tif_subifdoff; /* offset for patching SubIFD link */
|
||||
|
|
@ -233,7 +255,10 @@ struct tiff
|
|||
void *tif_errorhandler_user_data;
|
||||
TIFFErrorHandlerExtR tif_warnhandler;
|
||||
void *tif_warnhandler_user_data;
|
||||
tmsize_t tif_max_single_mem_alloc; /* in bytes. 0 for unlimited */
|
||||
tmsize_t tif_max_single_mem_alloc; /* in bytes. 0 for unlimited */
|
||||
tmsize_t tif_max_cumulated_mem_alloc; /* in bytes. 0 for unlimited */
|
||||
tmsize_t tif_cur_cumulated_mem_alloc; /* in bytes */
|
||||
int tif_warn_about_unknown_tags;
|
||||
};
|
||||
|
||||
struct TIFFOpenOptions
|
||||
|
|
@ -243,6 +268,8 @@ struct TIFFOpenOptions
|
|||
TIFFErrorHandlerExtR warnhandler; /* may be NULL */
|
||||
void *warnhandler_user_data; /* may be NULL */
|
||||
tmsize_t max_single_mem_alloc; /* in bytes. 0 for unlimited */
|
||||
tmsize_t max_cumulated_mem_alloc; /* in bytes. 0 for unlimited */
|
||||
int warn_about_unknown_tags;
|
||||
};
|
||||
|
||||
#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
|
||||
|
|
@ -331,7 +358,7 @@ struct TIFFOpenOptions
|
|||
#define ftell(stream, offset, whence) ftello(stream, offset, whence)
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__WIN32__) && !(defined(_MSC_VER) && _MSC_VER < 1400) && \
|
||||
#if defined(_WIN32) && \
|
||||
!(defined(__MSVCRT_VERSION__) && __MSVCRT_VERSION__ < 0x800)
|
||||
typedef unsigned int TIFFIOSize_t;
|
||||
#define _TIFF_lseek_f(fildes, offset, whence) \
|
||||
|
|
@ -373,6 +400,8 @@ typedef size_t TIFFIOSize_t;
|
|||
extern "C"
|
||||
{
|
||||
#endif
|
||||
extern int _tiffDummyMapProc(thandle_t fd, void **pbase, toff_t *psize);
|
||||
extern void _tiffDummyUnmapProc(thandle_t fd, void *base, toff_t size);
|
||||
extern int _TIFFgetMode(TIFFOpenOptions *opts, thandle_t clientdata,
|
||||
const char *mode, const char *module);
|
||||
extern int _TIFFNoRowEncode(TIFF *tif, uint8_t *pp, tmsize_t cc,
|
||||
|
|
@ -437,9 +466,6 @@ extern "C"
|
|||
extern void *_TIFFCheckRealloc(TIFF *, void *, tmsize_t, tmsize_t,
|
||||
const char *);
|
||||
|
||||
extern double _TIFFUInt64ToDouble(uint64_t);
|
||||
extern float _TIFFUInt64ToFloat(uint64_t);
|
||||
|
||||
extern float _TIFFClampDoubleToFloat(double);
|
||||
extern uint32_t _TIFFClampDoubleToUInt32(double);
|
||||
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ OCV_OPTION(WITH_CAP_IOS "Enable iOS video capture" ON
|
|||
OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" (NOT CV_DISABLE_OPTIMIZATION)
|
||||
VISIBLE_IF (ARM OR AARCH64) AND NOT IOS AND NOT XROS)
|
||||
OCV_OPTION(WITH_KLEIDICV "Use KleidiCV library for ARM platforms" (ANDROID AND AARCH64 AND NOT CV_DISABLE_OPTIMIZATION)
|
||||
VISIBLE_IF (AARCH64 AND (ANDROID OR UNIX AND NOT IOS AND NOT XROS)))
|
||||
VISIBLE_IF (AARCH64 AND (ANDROID OR UNIX)))
|
||||
OCV_OPTION(WITH_NDSRVP "Use Andes RVP extension" (NOT CV_DISABLE_OPTIMIZATION)
|
||||
VISIBLE_IF RISCV)
|
||||
OCV_OPTION(WITH_HAL_RVV "Use HAL RVV optimizations" (NOT CV_DISABLE_OPTIMIZATION)
|
||||
|
|
@ -640,6 +640,7 @@ ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS)
|
|||
# --- Python Support ---
|
||||
if(NOT IOS AND NOT XROS)
|
||||
include(cmake/OpenCVDetectPython.cmake)
|
||||
include(cmake/OpenCVDetectDLPack.cmake)
|
||||
endif()
|
||||
|
||||
include(cmake/OpenCVCompilerOptions.cmake)
|
||||
|
|
@ -1588,7 +1589,7 @@ if(WITH_OPENEXR OR HAVE_OPENEXR)
|
|||
endif()
|
||||
|
||||
if(WITH_GDAL OR HAVE_GDAL)
|
||||
status(" GDAL:" HAVE_GDAL THEN "YES (${GDAL_LIBRARY})" ELSE "NO")
|
||||
status(" GDAL:" HAVE_GDAL THEN "${GDAL_LIBRARY} (ver ${GDAL_VERSION})" ELSE "NO")
|
||||
endif()
|
||||
|
||||
if(WITH_GDCM OR HAVE_GDCM)
|
||||
|
|
@ -1635,7 +1636,6 @@ if(WITH_FFMPEG OR HAVE_FFMPEG)
|
|||
status(" avformat:" FFMPEG_libavformat_VERSION THEN "YES (${FFMPEG_libavformat_VERSION})" ELSE NO)
|
||||
status(" avutil:" FFMPEG_libavutil_VERSION THEN "YES (${FFMPEG_libavutil_VERSION})" ELSE NO)
|
||||
status(" swscale:" FFMPEG_libswscale_VERSION THEN "YES (${FFMPEG_libswscale_VERSION})" ELSE NO)
|
||||
status(" avresample:" FFMPEG_libavresample_VERSION THEN "YES (${FFMPEG_libavresample_VERSION})" ELSE NO)
|
||||
if(OPENCV_FFMPEG_ENABLE_LIBAVDEVICE)
|
||||
status(" avdevice:" FFMPEG_libavdevice_VERSION THEN "YES (${FFMPEG_libavdevice_VERSION})" ELSE NO)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -7,5 +7,6 @@ Copyright (C) 2008-2016, Itseez Inc., all rights reserved.
|
|||
Copyright (C) 2019-2023, Xperience AI, all rights reserved.
|
||||
Copyright (C) 2019-2022, Shenzhen Institute of Artificial Intelligence and Robotics for Society, all rights reserved.
|
||||
Copyright (C) 2022-2023, Southern University of Science And Technology, all rights reserved.
|
||||
Copyright (C) 2023-2025, OpenCV AI, all rights reserved.
|
||||
|
||||
Third party copyrights are property of their respective owners.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
add_definitions(-D__OPENCV_BUILD=1)
|
||||
add_definitions(-D__OPENCV_APPS=1)
|
||||
|
||||
if (NOT CMAKE_CROSSCOMPILING)
|
||||
file(RELATIVE_PATH __loc_relative "${OpenCV_BINARY_DIR}" "${CMAKE_CURRENT_LIST_DIR}/pattern-tools\n")
|
||||
file(APPEND "${OpenCV_BINARY_DIR}/opencv_apps_python_tests.cfg" "${__loc_relative}")
|
||||
endif()
|
||||
|
||||
string(REPLACE "," ";" OPENCV_INSTALL_APPS_LIST "${OPENCV_INSTALL_APPS_LIST}") # support comma-separated list (,) too
|
||||
|
||||
# Unified function for creating OpenCV applications:
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ namespace calib
|
|||
std::string videoFileName;
|
||||
bool flipVertical;
|
||||
int camID;
|
||||
int camBackend;
|
||||
int fps;
|
||||
cv::Size cameraResolution;
|
||||
int maxFramesNum;
|
||||
|
|
@ -117,6 +118,9 @@ namespace calib
|
|||
double solverEps;
|
||||
int solverMaxIters;
|
||||
bool fastSolving;
|
||||
bool rationalModel;
|
||||
bool thinPrismModel;
|
||||
bool tiltedModel;
|
||||
double filterAlpha;
|
||||
|
||||
internalParameters()
|
||||
|
|
@ -124,6 +128,9 @@ namespace calib
|
|||
solverEps = 1e-7;
|
||||
solverMaxIters = 30;
|
||||
fastSolving = false;
|
||||
rationalModel = false;
|
||||
thinPrismModel = false;
|
||||
tiltedModel = false;
|
||||
filterAlpha = 0.1;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -306,10 +306,10 @@ bool calib::calibDataController::saveCurrentCameraParameters() const
|
|||
parametersWriter << "calibrationDate" << buf;
|
||||
parametersWriter << "framesCount" << std::max((int)mCalibData->objectPoints.size(), (int)mCalibData->allCharucoCorners.size());
|
||||
parametersWriter << "cameraResolution" << mCalibData->imageSize;
|
||||
parametersWriter << "cameraMatrix" << mCalibData->cameraMatrix;
|
||||
parametersWriter << "cameraMatrix_std_dev" << mCalibData->stdDeviations.rowRange(cv::Range(0, 4));
|
||||
parametersWriter << "dist_coeffs" << mCalibData->distCoeffs;
|
||||
parametersWriter << "dist_coeffs_std_dev" << mCalibData->stdDeviations.rowRange(cv::Range(4, 9));
|
||||
parametersWriter << "camera_matrix" << mCalibData->cameraMatrix;
|
||||
parametersWriter << "camera_matrix_std_dev" << mCalibData->stdDeviations.rowRange(cv::Range(0, 4));
|
||||
parametersWriter << "distortion_coefficients" << mCalibData->distCoeffs;
|
||||
parametersWriter << "distortion_coefficients_std_dev" << mCalibData->stdDeviations.rowRange(cv::Range(4, 9));
|
||||
parametersWriter << "avg_reprojection_error" << mCalibData->totalAvgErr;
|
||||
|
||||
parametersWriter.release();
|
||||
|
|
|
|||
|
|
@ -31,10 +31,13 @@ CalibPipeline::CalibPipeline(captureParameters params) :
|
|||
|
||||
PipelineExitStatus CalibPipeline::start(std::vector<cv::Ptr<FrameProcessor> > processors)
|
||||
{
|
||||
const int allowedEmptyFrames = 5;
|
||||
int emptyFrames = 0;
|
||||
|
||||
auto open_camera = [this] () {
|
||||
if(mCaptureParams.source == Camera)
|
||||
{
|
||||
mCapture.open(mCaptureParams.camID);
|
||||
mCapture.open(mCaptureParams.camID, mCaptureParams.camBackend);
|
||||
cv::Size maxRes = getCameraResolution();
|
||||
cv::Size neededRes = mCaptureParams.cameraResolution;
|
||||
|
||||
|
|
@ -55,7 +58,7 @@ PipelineExitStatus CalibPipeline::start(std::vector<cv::Ptr<FrameProcessor> > pr
|
|||
mCapture.set(cv::CAP_PROP_AUTOFOCUS, 0);
|
||||
}
|
||||
else if (mCaptureParams.source == File)
|
||||
mCapture.open(mCaptureParams.videoFileName);
|
||||
mCapture.open(mCaptureParams.videoFileName, mCaptureParams.camBackend);
|
||||
};
|
||||
|
||||
if(!mCapture.isOpened()) {
|
||||
|
|
@ -87,6 +90,22 @@ PipelineExitStatus CalibPipeline::start(std::vector<cv::Ptr<FrameProcessor> > pr
|
|||
CV_CheckEQ(mImageSize, newSize, "Camera image size changed after reopening.");
|
||||
}
|
||||
mCapture.retrieve(frame);
|
||||
|
||||
if (frame.empty()) {
|
||||
emptyFrames++;
|
||||
if (emptyFrames >= allowedEmptyFrames) {
|
||||
CV_LOG_ERROR(NULL, "VideoCapture error: grabbed sequence of empty frames. VideoCapture is not ready or broken.");
|
||||
return Finished;
|
||||
}
|
||||
|
||||
continue;
|
||||
} else {
|
||||
emptyFrames = 0;
|
||||
if (mImageSize.width == 0 || mImageSize.height == 0) { // looks like VideoCapture does not support required properties
|
||||
mImageSize = frame.size();
|
||||
}
|
||||
}
|
||||
|
||||
if(mCaptureParams.flipVertical)
|
||||
cv::flip(frame, frame, -1);
|
||||
|
||||
|
|
|
|||
|
|
@ -308,7 +308,10 @@ cv::Mat CalibProcessor::processFrame(const cv::Mat &frame)
|
|||
{
|
||||
cv::Mat frameCopy;
|
||||
cv::Mat frameCopyToSave;
|
||||
frame.copyTo(frameCopy);
|
||||
if (frame.channels() == 1)
|
||||
cv::cvtColor(frame, frameCopy, cv::COLOR_GRAY2BGR);
|
||||
else
|
||||
frame.copyTo(frameCopy);
|
||||
bool isTemplateFound = false;
|
||||
mCurrentImagePoints.clear();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <opencv2/calib3d.hpp>
|
||||
#include <opencv2/cvconfig.h>
|
||||
#include <opencv2/highgui.hpp>
|
||||
|
||||
#include <opencv2/videoio/registry.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
@ -23,9 +23,25 @@
|
|||
|
||||
using namespace calib;
|
||||
|
||||
const std::string keys =
|
||||
static std::string getVideoIoBackendsString()
|
||||
{
|
||||
std::string result;
|
||||
auto backs = cv::videoio_registry::getBackends();
|
||||
for (const auto& b: backs)
|
||||
{
|
||||
if (!result.empty())
|
||||
result += ", ";
|
||||
|
||||
result += cv::videoio_registry::getBackendName(b);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* keys =
|
||||
"{v | | Input from video file }"
|
||||
"{ci | 0 | Default camera id }"
|
||||
"{ci | 0 | Camera id }"
|
||||
"{vb | | Video I/O back-end. One of: %s }"
|
||||
"{flip | false | Vertical flip of input frames }"
|
||||
"{t | circles | Template for calibration (circles, chessboard, dualCircles, charuco, symcircles) }"
|
||||
"{sz | 16.3 | Distance between two nearest centers of circles or squares on calibration board}"
|
||||
|
|
@ -95,11 +111,13 @@ static void undistortButton(int state, void* data)
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
cv::CommandLineParser parser(argc, argv, keys);
|
||||
cv::CommandLineParser parser(argc, argv, cv::format(keys, getVideoIoBackendsString().c_str()));
|
||||
|
||||
if(parser.has("help")) {
|
||||
parser.printMessage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::cout << consoleHelp << std::endl;
|
||||
parametersController paramsController;
|
||||
|
||||
|
|
@ -116,6 +134,10 @@ int main(int argc, char** argv)
|
|||
|
||||
int calibrationFlags = 0;
|
||||
if(intParams.fastSolving) calibrationFlags |= cv::CALIB_USE_QR;
|
||||
if(intParams.rationalModel) calibrationFlags |= cv::CALIB_RATIONAL_MODEL;
|
||||
if(intParams.thinPrismModel) calibrationFlags |= cv::CALIB_THIN_PRISM_MODEL;
|
||||
if(intParams.tiltedModel) calibrationFlags |= cv::CALIB_TILTED_MODEL;
|
||||
|
||||
cv::Ptr<calibController> controller(new calibController(globalData, calibrationFlags,
|
||||
parser.get<bool>("ft"), capParams.minFramesNum));
|
||||
cv::Ptr<calibDataController> dataController(new calibDataController(globalData, capParams.maxFramesNum,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "parametersController.hpp"
|
||||
#include <opencv2/objdetect/aruco_dictionary.hpp>
|
||||
|
||||
#include <opencv2/videoio/registry.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <typename T>
|
||||
|
|
@ -49,6 +49,9 @@ bool calib::parametersController::loadFromFile(const std::string &inputFileName)
|
|||
readFromNode(reader["solver_eps"], mInternalParameters.solverEps);
|
||||
readFromNode(reader["solver_max_iters"], mInternalParameters.solverMaxIters);
|
||||
readFromNode(reader["fast_solver"], mInternalParameters.fastSolving);
|
||||
readFromNode(reader["rational_model"], mInternalParameters.rationalModel);
|
||||
readFromNode(reader["thin_prism_model"], mInternalParameters.thinPrismModel);
|
||||
readFromNode(reader["tiltedModel"], mInternalParameters.tiltedModel);
|
||||
readFromNode(reader["frame_filter_conv_param"], mInternalParameters.filterAlpha);
|
||||
|
||||
bool retValue =
|
||||
|
|
@ -106,6 +109,27 @@ bool calib::parametersController::loadFromParser(cv::CommandLineParser &parser)
|
|||
mCapParams.camID = parser.get<int>("ci");
|
||||
}
|
||||
|
||||
mCapParams.camBackend = cv::CAP_ANY;
|
||||
if (parser.has("vb"))
|
||||
{
|
||||
std::string backendName = parser.get<std::string>("vb");
|
||||
auto backs = cv::videoio_registry::getBackends();
|
||||
bool backendSet = false;
|
||||
for (const auto& b: backs)
|
||||
{
|
||||
if (backendName == cv::videoio_registry::getBackendName(b))
|
||||
{
|
||||
mCapParams.camBackend = b;
|
||||
backendSet = true;
|
||||
}
|
||||
}
|
||||
if (!backendSet)
|
||||
{
|
||||
std::cout << "Unknown or unsupported backend " << backendName << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::string templateType = parser.get<std::string>("t");
|
||||
|
||||
if(templateType.find("symcircles", 0) == 0) {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user