Fixing missing files from repo.

This commit is contained in:
Scott Duensing 2023-11-08 17:57:52 -06:00
parent 6802761e49
commit 42f2b7003c
781 changed files with 123374 additions and 118335 deletions

1
.gitattributes vendored
View file

@ -23,6 +23,7 @@
# Other Binary
#
*.exe filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text
*.dat filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text

2
.gitignore vendored
View file

@ -1,5 +1,5 @@
*~
**/build/
**/.builddir/
**/.git-hidden/
**/.github/
cmake-build-debug/

View file

@ -34,38 +34,6 @@ subdirectory that was generated during installation. (You really shouldn't
be changing things in there!) Delete the Singe subdirectory and run the new
Singe binary with no command line arguments to generate the new files.
Games are available on the Internet Archive:
Gun Games:
- https://archive.org/details/singe-actionmax
- https://archive.org/details/singe-crime-patrol
- https://archive.org/details/singe-crime-patrol-2
- https://archive.org/details/singe-last-bounty-hunter
- https://archive.org/details/singe-mad-dog-mccree
- https://archive.org/details/singe-mad-dog-mccree-2
- https://archive.org/details/singe-platoon
- https://archive.org/details/singe-space-pirates
- https://archive.org/details/singe-who-shot-johnny-rock
QTE Games:
- https://archive.org/details/singe-cliff-hanger
- https://archive.org/details/singe-conan
- https://archive.org/details/singe-daitarn-3
- https://archive.org/details/singe-dl-2e
- https://archive.org/details/singe-dl-tv
- https://archive.org/details/singe-dragon-english
- https://archive.org/details/singe-dragon-italian
- https://archive.org/details/singe-fire-and-ice
- https://archive.org/details/singe-jack-english
- https://archive.org/details/singe-jack-italian
- https://archive.org/details/singe-puss-in-boots-english
- https://archive.org/details/singe-puss-in-boots-italian
- https://archive.org/details/singe-time-traveler
- https://archive.org/details/singe-timegal
- https://archive.org/details/singe-titan-ae
Know of a game we don't have listed? Let us know!
COMMAND LINE
============

View file

@ -21,6 +21,7 @@
G_BUILDROOT=${PWD}
G_BUILDDIR=.builddir
G_TARGET=
G_GENERATED=
@ -86,7 +87,7 @@ function buildAll() {
esac
G_TARGET=${G_BUILDROOT}/build/${OS}/${ARCH}
G_TARGET=${G_BUILDROOT}/${G_BUILDDIR}/${OS}/${ARCH}
G_GENERATED=${G_TARGET}/generated
TOOLCHAIN=${G_BUILDROOT}/../toolchains/cmake/${TRIPLE}.cmake
COMMON="-DCMAKE_INSTALL_PREFIX=${G_TARGET} -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}"
@ -285,9 +286,9 @@ UNUSED
function clearAndEnterBuild() {
[[ -d build ]] && rm -rf build
mkdir -p build
cd build
[[ -d ${G_BUILDDIR} ]] && rm -rf ${G_BUILDDIR}
mkdir -p ${G_BUILDDIR}
cd ${G_BUILDDIR}
}
@ -409,8 +410,8 @@ function outputLicense() {
#buildAll linux x86
#buildAll linux x86_64
buildAll macos aarch64
buildAll linux x86_64
#buildAll macos aarch64
#buildAll macos x86 #***TODO*** Needs older SDL2
#buildAll macos x86_64 #***TODO*** Needs older SDL2
#buildAll windows x86

View file

@ -1,32 +0,0 @@
[submodule "external/jpeg"]
path = external/jpeg
url = https://github.com/libsdl-org/jpeg.git
branch = v9e-SDL
[submodule "external/libpng"]
path = external/libpng
url = https://github.com/libsdl-org/libpng.git
branch = v1.6.40-SDL
[submodule "external/libwebp"]
path = external/libwebp
url = https://github.com/libsdl-org/libwebp.git
branch = 1.0.3-SDL
[submodule "external/libtiff"]
path = external/libtiff
url = https://github.com/libsdl-org/libtiff.git
branch = v4.5.1-SDL
[submodule "external/zlib"]
path = external/zlib
url = https://github.com/libsdl-org/zlib.git
branch = v1.3-SDL
[submodule "external/libjxl"]
path = external/libjxl
url = https://github.com/libsdl-org/libjxl.git
branch = v0.6.1-SDL
[submodule "external/libavif"]
path = external/libavif
url = https://github.com/libsdl-org/libavif.git
branch = v1.0.1-SDL
[submodule "external/dav1d"]
path = external/dav1d
url = https://github.com/libsdl-org/dav1d.git
branch = 1.2.1-SDL

View file

@ -619,8 +619,6 @@ if(SDL2IMAGE_TIF)
target_compile_definitions(SDL2_image PRIVATE LOAD_TIF)
if(SDL2IMAGE_TIF_VENDORED)
message(STATUS "${PROJECT_NAME}: Using vendored libtiff")
# tiff-tests variable is used by vendored libtiff
set(tiff-tests OFF CACHE BOOL "libtiff: tests" FORCE)
# jpeg variable is used by vendored libtiff
set(jpeg OFF CACHE BOOL "libtiff: jpeg option" FORCE)
# libdeflate variable is used by vendored libtiff

View file

@ -108,7 +108,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir)\..\include;external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DLL_EXPORT;_DEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_AVIF;LOAD_AVIF_DYNAMIC="libavif-16.dll";LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC="libtiff-6.dll";LOAD_WEBP;LOAD_WEBP_DYNAMIC="libwebp-7.dll";LOAD_WEBPDEMUX_DYNAMIC="libwebpdemux-2.dll";LOAD_XCF;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DLL_EXPORT;_DEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_AVIF;LOAD_AVIF_DYNAMIC="libavif-16.dll";LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC="libtiff-5.dll";LOAD_WEBP;LOAD_WEBP_DYNAMIC="libwebp-7.dll";LOAD_WEBPDEMUX_DYNAMIC="libwebpdemux-2.dll";LOAD_XCF;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
@ -136,7 +136,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\include;external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DLL_EXPORT;_DEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_AVIF;LOAD_AVIF_DYNAMIC="libavif-16.dll";LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC="libtiff-6.dll";LOAD_WEBP;LOAD_WEBP_DYNAMIC="libwebp-7.dll";LOAD_WEBPDEMUX_DYNAMIC="libwebpdemux-2.dll";LOAD_XCF;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DLL_EXPORT;_DEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_AVIF;LOAD_AVIF_DYNAMIC="libavif-16.dll";LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC="libtiff-5.dll";LOAD_WEBP;LOAD_WEBP_DYNAMIC="libwebp-7.dll";LOAD_WEBPDEMUX_DYNAMIC="libwebpdemux-2.dll";LOAD_XCF;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
@ -165,7 +165,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\include;external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DLL_EXPORT;NDEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_AVIF;LOAD_AVIF_DYNAMIC="libavif-16.dll";LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC="libtiff-6.dll";LOAD_WEBP;LOAD_WEBP_DYNAMIC="libwebp-7.dll";LOAD_WEBPDEMUX_DYNAMIC="libwebpdemux-2.dll";LOAD_XCF;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DLL_EXPORT;NDEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_AVIF;LOAD_AVIF_DYNAMIC="libavif-16.dll";LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC="libtiff-5.dll";LOAD_WEBP;LOAD_WEBP_DYNAMIC="libwebp-7.dll";LOAD_WEBPDEMUX_DYNAMIC="libwebpdemux-2.dll";LOAD_XCF;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
@ -191,7 +191,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\include;external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DLL_EXPORT;NDEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_AVIF;LOAD_AVIF_DYNAMIC="libavif-16.dll";LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC="libtiff-6.dll";LOAD_WEBP;LOAD_WEBP_DYNAMIC="libwebp-7.dll";LOAD_WEBPDEMUX_DYNAMIC="libwebpdemux-2.dll";LOAD_XCF;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DLL_EXPORT;NDEBUG;WIN32;_WINDOWS;USE_STBIMAGE;LOAD_AVIF;LOAD_AVIF_DYNAMIC="libavif-16.dll";LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNM;LOAD_QOI;LOAD_SVG;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC="libtiff-5.dll";LOAD_WEBP;LOAD_WEBP_DYNAMIC="libwebp-7.dll";LOAD_WEBPDEMUX_DYNAMIC="libwebpdemux-2.dll";LOAD_XCF;LOAD_XPM;LOAD_XV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>

View file

@ -56,38 +56,24 @@
/*
* Intrinsic data types required by the file format:
*
* 8-bit quantities int8_t/uint_8_t
* 16-bit quantities int16_t/uint_16_t
* 32-bit quantities int32_t/uint_32_t
* 64-bit quantities int64_t/uint_64_t
* 8-bit quantities int8/uint8
* 16-bit quantities int16/uint16
* 32-bit quantities int32/uint32
* 64-bit quantities int64/uint64
* strings unsigned char*
*/
#ifdef __GNUC__
#define TIFF_GCC_DEPRECATED __attribute__((deprecated))
#else
#define TIFF_GCC_DEPRECATED
#endif
#ifdef _MSC_VER
#define TIFF_MSC_DEPRECATED \
__declspec(deprecated("libtiff type deprecated; please use corresponding " \
"C99 stdint.h type"))
#else
#define TIFF_MSC_DEPRECATED
#endif
#ifndef TIFF_DISABLE_DEPRECATED
typedef TIFF_MSC_DEPRECATED int8_t int8 TIFF_GCC_DEPRECATED;
typedef TIFF_MSC_DEPRECATED uint8_t uint8 TIFF_GCC_DEPRECATED;
typedef TIFF_INT8_T int8;
typedef TIFF_UINT8_T uint8;
typedef TIFF_MSC_DEPRECATED int16_t int16 TIFF_GCC_DEPRECATED;
typedef TIFF_MSC_DEPRECATED uint16_t uint16 TIFF_GCC_DEPRECATED;
typedef TIFF_INT16_T int16;
typedef TIFF_UINT16_T uint16;
typedef TIFF_MSC_DEPRECATED int32_t int32 TIFF_GCC_DEPRECATED;
typedef TIFF_MSC_DEPRECATED uint32_t uint32 TIFF_GCC_DEPRECATED;
typedef TIFF_INT32_T int32;
typedef TIFF_UINT32_T uint32;
typedef TIFF_MSC_DEPRECATED int64_t int64 TIFF_GCC_DEPRECATED;
typedef TIFF_MSC_DEPRECATED uint64_t uint64 TIFF_GCC_DEPRECATED;
#endif /* TIFF_DISABLE_DEPRECATED */
typedef TIFF_INT64_T int64;
typedef TIFF_UINT64_T uint64;
/*
* Some types as promoted in a variable argument list
@ -102,26 +88,24 @@ typedef int uint16_vap;
/*
* TIFF header.
*/
typedef struct
{
uint16_t tiff_magic; /* magic number (defines byte order) */
uint16_t tiff_version; /* TIFF version number */
typedef struct {
uint16 tiff_magic; /* magic number (defines byte order) */
uint16 tiff_version; /* TIFF version number */
} TIFFHeaderCommon;
typedef struct
{
uint16_t tiff_magic; /* magic number (defines byte order) */
uint16_t tiff_version; /* TIFF version number */
uint32_t tiff_diroff; /* byte offset to first directory */
typedef struct {
uint16 tiff_magic; /* magic number (defines byte order) */
uint16 tiff_version; /* TIFF version number */
uint32 tiff_diroff; /* byte offset to first directory */
} TIFFHeaderClassic;
typedef struct
{
uint16_t tiff_magic; /* magic number (defines byte order) */
uint16_t tiff_version; /* TIFF version number */
uint16_t tiff_offsetsize; /* size of offsets, should be 8 */
uint16_t tiff_unused; /* unused word, should be 0 */
uint64_t tiff_diroff; /* byte offset to first directory */
typedef struct {
uint16 tiff_magic; /* magic number (defines byte order) */
uint16 tiff_version; /* TIFF version number */
uint16 tiff_offsetsize; /* size of offsets, should be 8 */
uint16 tiff_unused; /* unused word, should be 0 */
uint64 tiff_diroff; /* byte offset to first directory */
} TIFFHeaderBig;
/*
* NB: In the comments below,
* - items marked with a + are obsoleted by revision 5.0,
@ -136,14 +120,12 @@ typedef struct
*
* Note: RATIONALs are the ratio of two 32-bit integer values.
*--:
* Note2: TIFF_IFD8 data type is used in tiffFields[]-tag definition in order to
distinguish the write-handling of those tags between ClassicTIFF and BigTiff:
For ClassicTIFF libtiff writes a 32-bit value and the TIFF_IFD
type-id into the file For BigTIFF libtiff writes a 64-bit value and the
TIFF_IFD8 type-id into the file
* Note2: TIFF_IFD8 data type is used in tiffFields[]-tag definition in order to distinguish the write-handling
of those tags between ClassicTIFF and BigTiff:
For ClassicTIFF libtiff writes a 32-bit value and the TIFF_IFD type-id into the file
For BigTIFF libtiff writes a 64-bit value and the TIFF_IFD8 type-id into the file
*/
typedef enum
{
typedef enum {
TIFF_NOTYPE = 0, /* placeholder */
TIFF_BYTE = 1, /* 8-bit unsigned integer */
TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */
@ -166,7 +148,6 @@ typedef enum
/*
* TIFF Tag Definitions.
*/
/* clang-format off */ /* for better readability of tag comments */
#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */
#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */
#define FILETYPE_PAGE 0x2 /* one page of many */
@ -202,8 +183,9 @@ typedef enum
/* compression codes 32908-32911 are reserved for Pixar */
#define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */
#define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */
#define COMPRESSION_DEFLATE 32946 /* Deflate compression, legacy tag */
#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression, as recognized by Adobe */
#define COMPRESSION_DEFLATE 32946 /* Deflate compression */
#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression,
as recognized by Adobe */
/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
#define COMPRESSION_DCS 32947 /* Kodak DCS encoding */
#define COMPRESSION_JBIG 34661 /* ISO JBIG */
@ -215,7 +197,6 @@ typedef enum
#define COMPRESSION_LZMA 34925 /* LZMA2 */
#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 TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */
#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */
#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */
@ -338,10 +319,14 @@ typedef enum
#define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */
#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */
#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */
#define TIFFTAG_CLIPPATH 343 /* %ClipPath [Adobe TIFF technote 2] */
#define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits [Adobe TIFF technote 2] */
#define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits [Adobe TIFF technote 2] */
#define TIFFTAG_INDEXED 346 /* %Indexed [Adobe TIFF Technote 3] */
#define TIFFTAG_CLIPPATH 343 /* %ClipPath
[Adobe TIFF technote 2] */
#define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits
[Adobe TIFF technote 2] */
#define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits
[Adobe TIFF technote 2] */
#define TIFFTAG_INDEXED 346 /* %Indexed
[Adobe TIFF Technote 3] */
#define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */
#define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */
/* Tags 400-435 are from the TIFF/FX spec */
@ -390,11 +375,12 @@ typedef enum
#define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */
#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */
#define TIFFTAG_STRIPROWCOUNTS 559 /* !TIFF/FX strip row counts */
#define TIFFTAG_XMLPACKET 700 /* %XML packet [Adobe XMP Specification, January 2004 */
#define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID [Adobe TIFF technote] */
/* For eiStream Annotation Specification, Version 1.00.06 see
* http://web.archive.org/web/20050309141348/http://www.kofile.com/support%20pro/faqs/annospec.htm */
#define TIFFTAG_TIFFANNOTATIONDATA 32932
#define TIFFTAG_XMLPACKET 700 /* %XML packet
[Adobe XMP Specification,
January 2004 */
#define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID
[Adobe TIFF technote] */
#define TIFFTAG_TIFFANNOTATIONDATA 32932 /* http://web.archive.org/web/20050309141348/http://www.kofile.com/support%20pro/faqs/annospec.htm */
/* tags 32952-32956 are private tags registered to Island Graphics */
#define TIFFTAG_REFPTS 32953 /* image reference points */
#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */
@ -415,7 +401,7 @@ typedef enum
*/
#define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */
#define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */
/* Tags 33302-33306 are used to identify special image modes and data
/* Tags 33302-33306 are used to identify special image modes and data
* used by Pixar's texture formats.
*/
#define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */
@ -425,24 +411,21 @@ typedef enum
#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
/* tag 33405 is a private tag registered to Eastman Kodak */
#define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */
#define TIFFTAG_CFAREPEATPATTERNDIM 33421 /* (alias for TIFFTAG_EP_CFAREPEATPATTERNDIM)*/
#define TIFFTAG_CFAPATTERN 33422 /* (alias for TIFFTAG_EP_CFAPATTERN) */
#define TIFFTAG_BATTERYLEVEL 33423 /* (alias for TIFFTAG_EP_BATTERYLEVEL) */
#define TIFFTAG_CFAREPEATPATTERNDIM 33421 /* dimensions of CFA pattern */
#define TIFFTAG_CFAPATTERN 33422 /* color filter array pattern */
/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
#define TIFFTAG_COPYRIGHT 33432 /* copyright string */
/* Tags 33445-33452 are used for Molecular Dynamics GEL fileformat,
* see http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf
* (2023: the above web site is unavailable but tags are explained briefly at
* https://www.awaresystems.be/imaging/tiff/tifftags/docs/gel.html
/* Tags 33445-33452 are used for GEL fileformat, see
* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf
*/
#define TIFFTAG_MD_FILETAG 33445 /* Specifies the pixel data format encoding in the GEL file format. */
#define TIFFTAG_MD_SCALEPIXEL 33446 /* scale factor */
#define TIFFTAG_MD_COLORTABLE 33447 /* conversion from 16bit to 8bit */
#define TIFFTAG_MD_LABNAME 33448 /* name of the lab that scanned this file. */
#define TIFFTAG_MD_SAMPLEINFO 33449 /* information about the scanned GEL sample */
#define TIFFTAG_MD_PREPDATE 33450 /* information about the date the sample was prepared YY/MM/DD */
#define TIFFTAG_MD_PREPTIME 33451 /* information about the time the sample was prepared HH:MM*/
#define TIFFTAG_MD_FILEUNITS 33452 /* Units for data in this file, as used in the GEL file format. */
#define TIFFTAG_MD_FILETAG 33445 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
#define TIFFTAG_MD_SCALEPIXEL 33446 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
#define TIFFTAG_MD_COLORTABLE 33447 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
#define TIFFTAG_MD_LABNAME 33448 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
#define TIFFTAG_MD_SAMPLEINFO 33449 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
#define TIFFTAG_MD_PREPDATE 33450 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
#define TIFFTAG_MD_PREPTIME 33451 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
#define TIFFTAG_MD_FILEUNITS 33452 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
/* IPTC TAG from RichTIFF specifications */
#define TIFFTAG_RICHTIFFIPTC 33723
#define TIFFTAG_INGR_PACKET_DATA_TAG 33918 /* Intergraph Application specific storage. */
@ -455,7 +438,7 @@ typedef enum
#define TIFFTAG_IT8HEADER 34018 /* DDES Header */
#define TIFFTAG_IT8RASTERPADDING 34019 /* raster scanline padding */
#define TIFFTAG_IT8BITSPERRUNLENGTH 34020 /* # of bits in short run */
#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021 /* # of bits in long run */
#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */
#define TIFFTAG_IT8COLORTABLE 34022 /* LW colortable */
#define TIFFTAG_IT8IMAGECOLORINDICATOR 34023 /* BP/BL image color switch */
#define TIFFTAG_IT8BKGCOLORINDICATOR 34024 /* BP/BL bg color switch */
@ -465,7 +448,8 @@ typedef enum
#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */
#define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */
#define TIFFTAG_IT8HCUSAGE 34030 /* HC usage indicator */
#define TIFFTAG_IT8TRAPINDICATOR 34031 /* Trapping indicator (untrapped=0, trapped=1) */
#define TIFFTAG_IT8TRAPINDICATOR 34031 /* Trapping indicator
(untrapped=0, trapped=1) */
#define TIFFTAG_IT8CMYKEQUIVALENT 34032 /* CMYK color equivalents */
/* tags 34232-34236 are private tags registered to Texas Instruments */
#define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */
@ -479,9 +463,9 @@ typedef enum
#define TIFFTAG_IMAGELAYER 34732 /* !TIFF/FX image layer information */
/* tag 34750 is a private tag registered to Pixel Magic */
#define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */
#define TIFFTAG_GPSIFD 34853 /* Pointer to EXIF GPS private directory */
#define TIFFTAG_GPSIFD 34853 /* Pointer to GPS private directory */
/* tags 34908-34914 are private tags registered to SGI */
#define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. params */
#define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. parms */
#define TIFFTAG_FAXSUBADDRESS 34909 /* received SubAddr string */
#define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */
#define TIFFTAG_FAXDCS 34911 /* encoded fax ses. params, Table 2/T.30 */
@ -490,193 +474,106 @@ typedef enum
/* tag 34929 is a private tag registered to FedEx */
#define TIFFTAG_FEDEX_EDR 34929 /* unknown use */
#define TIFFTAG_IMAGESOURCEDATA 37724 /* http://justsolve.archiveteam.org/wiki/PSD, http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/ */
#define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to EXIF Interoperability private directory */
#define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */
#define TIFFTAG_GDAL_METADATA 42112 /* Used by the GDAL library */
#define TIFFTAG_GDAL_NODATA 42113 /* Used by the GDAL library */
#define TIFFTAG_OCE_SCANJOB_DESCRIPTION 50215 /* Used in the Oce scanning process */
#define TIFFTAG_OCE_APPLICATION_SELECTOR 50216 /* Used in the Oce scanning process. */
#define TIFFTAG_OCE_IDENTIFICATION_NUMBER 50217
#define TIFFTAG_OCE_IMAGELOGIC_CHARACTERISTICS 50218
/* tags 50674 to 50677 are reserved for ESRI */
#define TIFFTAG_LERC_PARAMETERS 50674 /* Stores LERC version and additional compression method */
/* Adobe Digital Negative (DNG) format tags */
#define TIFFTAG_DNGVERSION 50706 /* &DNG version number */
#define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */
#define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */
#define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model name (UTF-8) */
#define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space mapping */
#define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model
name */
#define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space
mapping */
#define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */
#define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */
#define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for the BlackLevel tag */
#define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for
the BlackLevel tag */
#define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */
#define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level differences (columns) */
#define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level differences (rows) */
#define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding level */
#define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level
differences (columns) */
#define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level
differences (rows) */
#define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding
level */
#define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */
#define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image area */
#define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image area */
#define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space transformation matrix 1 */
#define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space transformation matrix 2 */
#define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image
area */
#define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image
area */
#define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space
transformation matrix 1 */
#define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space
transformation matrix 2 */
#define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */
#define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */
#define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction matrix 1 */
#define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction matrix 2 */
#define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw values*/
#define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in linear reference space */
#define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in x-y chromaticity coordinates */
#define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero point */
#define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction
matrix 1 */
#define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction
matrix 2 */
#define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw
values*/
#define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in
linear reference space */
#define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in
x-y chromaticity
coordinates */
#define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero
point */
#define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */
#define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of sharpening */
/* TIFFTAG_BAYERGREENSPLIT: &how closely the values of the green pixels in the blue/green rows
* track the values of the green pixels in the red/green rows */
#define TIFFTAG_BAYERGREENSPLIT 50733
#define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of
sharpening */
#define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of
the green pixels in the
blue/green rows track the
values of the green pixels
in the red/green rows */
#define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */
#define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */
#define TIFFTAG_LENSINFO 50736 /* info about the lens */
#define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */
#define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the camera's anti-alias filter */
#define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the
camera's anti-alias filter */
#define TIFFTAG_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */
#define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */
#define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote tag is safe to preserve along with the rest of the EXIF data */
#define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote
tag is safe to preserve
along with the rest of the
EXIF data */
#define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */
#define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */
#define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */
#define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for the raw image data */
#define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original raw file (UTF-8) */
#define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original raw file */
#define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels of the sensor */
#define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates of fully masked pixels */
#define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for
the raw image data */
#define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original
raw file */
#define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original
raw file */
#define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels
of the sensor */
#define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates
of fully masked pixels */
#define TIFFTAG_ASSHOTICCPROFILE 50831 /* &these two tags used to */
#define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space into ICC profile space */
#define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space
into ICC profile space */
#define TIFFTAG_CURRENTICCPROFILE 50833 /* & */
#define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */
/* DNG 1.2.0.0 */
#define TIFFTAG_COLORIMETRICREFERENCE 50879 /* &colorimetric reference */
#define TIFFTAG_CAMERACALIBRATIONSIGNATURE 50931 /* &camera calibration signature (UTF-8) */
#define TIFFTAG_PROFILECALIBRATIONSIGNATURE 50932 /* &profile calibration signature (UTF-8) */
/* TIFFTAG_EXTRACAMERAPROFILES 50933 &extra camera profiles : is already defined for GeoTIFF DGIWG */
#define TIFFTAG_ASSHOTPROFILENAME 50934 /* &as shot profile name (UTF-8) */
#define TIFFTAG_NOISEREDUCTIONAPPLIED 50935 /* &amount of applied noise reduction */
#define TIFFTAG_PROFILENAME 50936 /* &camera profile name (UTF-8) */
#define TIFFTAG_PROFILEHUESATMAPDIMS 50937 /* &dimensions of HSV mapping */
#define TIFFTAG_PROFILEHUESATMAPDATA1 50938 /* &first HSV mapping table */
#define TIFFTAG_PROFILEHUESATMAPDATA2 50939 /* &second HSV mapping table */
#define TIFFTAG_PROFILETONECURVE 50940 /* &default tone curve */
#define TIFFTAG_PROFILEEMBEDPOLICY 50941 /* &profile embedding policy */
#define TIFFTAG_PROFILECOPYRIGHT 50942 /* &profile copyright information (UTF-8) */
#define TIFFTAG_FORWARDMATRIX1 50964 /* &matrix for mapping white balanced camera colors to XYZ D50 */
#define TIFFTAG_FORWARDMATRIX2 50965 /* &matrix for mapping white balanced camera colors to XYZ D50 */
#define TIFFTAG_PREVIEWAPPLICATIONNAME 50966 /* &name of application that created preview (UTF-8) */
#define TIFFTAG_PREVIEWAPPLICATIONVERSION 50967 /* &version of application that created preview (UTF-8) */
#define TIFFTAG_PREVIEWSETTINGSNAME 50968 /* &name of conversion settings (UTF-8) */
#define TIFFTAG_PREVIEWSETTINGSDIGEST 50969 /* &unique id of conversion settings */
#define TIFFTAG_PREVIEWCOLORSPACE 50970 /* &preview color space */
#define TIFFTAG_PREVIEWDATETIME 50971 /* &date/time preview was rendered */
#define TIFFTAG_RAWIMAGEDIGEST 50972 /* &md5 of raw image data */
#define TIFFTAG_ORIGINALRAWFILEDIGEST 50973 /* &md5 of the data stored in the OriginalRawFileData tag */
#define TIFFTAG_SUBTILEBLOCKSIZE 50974 /* &subtile block size */
#define TIFFTAG_ROWINTERLEAVEFACTOR 50975 /* &number of interleaved fields */
#define TIFFTAG_PROFILELOOKTABLEDIMS 50981 /* &num of input samples in each dim of default "look" table */
#define TIFFTAG_PROFILELOOKTABLEDATA 50982 /* &default "look" table for use as starting point */
/* DNG 1.3.0.0 */
#define TIFFTAG_OPCODELIST1 51008 /* &opcodes that should be applied to raw image after reading */
#define TIFFTAG_OPCODELIST2 51009 /* &opcodes that should be applied after mapping to linear reference */
#define TIFFTAG_OPCODELIST3 51022 /* &opcodes that should be applied after demosaicing */
#define TIFFTAG_NOISEPROFILE 51041 /* &noise profile */
/* DNG 1.4.0.0 */
#define TIFFTAG_DEFAULTUSERCROP 51125 /* &default user crop rectangle in relative coords */
#define TIFFTAG_DEFAULTBLACKRENDER 51110 /* &black rendering hint */
#define TIFFTAG_BASELINEEXPOSUREOFFSET 51109 /* &baseline exposure offset */
#define TIFFTAG_PROFILELOOKTABLEENCODING 51108 /* &3D LookTable indexing conversion */
#define TIFFTAG_PROFILEHUESATMAPENCODING 51107 /* &3D HueSatMap indexing conversion */
#define TIFFTAG_ORIGINALDEFAULTFINALSIZE 51089 /* &default final size of larger original file for this proxy */
#define TIFFTAG_ORIGINALBESTQUALITYFINALSIZE 51090 /* &best quality final size of larger original file for this proxy */
#define TIFFTAG_ORIGINALDEFAULTCROPSIZE 51091 /* &the default crop size of larger original file for this proxy */
#define TIFFTAG_NEWRAWIMAGEDIGEST 51111 /* &modified MD5 digest of the raw image data */
#define TIFFTAG_RAWTOPREVIEWGAIN 51112 /* &The gain between the main raw FD and the preview IFD containing this tag */
/* DNG 1.5.0.0 */
#define TIFFTAG_DEPTHFORMAT 51177 /* &encoding of the depth data in the file */
#define TIFFTAG_DEPTHNEAR 51178 /* &distance from the camera represented by value 0 in the depth map */
#define TIFFTAG_DEPTHFAR 51179 /* &distance from the camera represented by the maximum value in the depth map */
#define TIFFTAG_DEPTHUNITS 51180 /* &measurement units for DepthNear and DepthFar */
#define TIFFTAG_DEPTHMEASURETYPE 51181 /* &measurement geometry for the depth map */
#define TIFFTAG_ENHANCEPARAMS 51182 /* &a string that documents how the enhanced image data was processed. */
/* DNG 1.6.0.0 */
#define TIFFTAG_PROFILEGAINTABLEMAP 52525 /* &spatially varying gain tables that can be applied as starting point */
#define TIFFTAG_SEMANTICNAME 52526 /* &a string that identifies the semantic mask */
#define TIFFTAG_SEMANTICINSTANCEID 52528 /* &a string that identifies a specific instance in a semantic mask */
#define TIFFTAG_MASKSUBAREA 52536 /* &the crop rectangle of this IFD's mask, relative to the main image */
#define TIFFTAG_RGBTABLES 52543 /* &color transforms to apply to masked image regions */
#define TIFFTAG_CALIBRATIONILLUMINANT3 52529 /* &the illuminant used for the third set of color calibration tags */
#define TIFFTAG_COLORMATRIX3 52531 /* &matrix to convert XYZ values to reference camera native color space under CalibrationIlluminant3 */
#define TIFFTAG_CAMERACALIBRATION3 52530 /* &matrix to transform reference camera native space values to individual camera native space values under CalibrationIlluminant3 */
#define TIFFTAG_REDUCTIONMATRIX3 52538 /* &dimensionality reduction matrix for use in color conversion to XYZ under CalibrationIlluminant3 */
#define TIFFTAG_PROFILEHUESATMAPDATA3 52537 /* &the data for the third HSV table */
#define TIFFTAG_FORWARDMATRIX3 52532 /* &matrix to map white balanced camera colors to XYZ D50 */
#define TIFFTAG_ILLUMINANTDATA1 52533 /* &data for the first calibration illuminant */
#define TIFFTAG_ILLUMINANTDATA2 52534 /* &data for the second calibration illuminant */
#define TIFFTAG_ILLUMINANTDATA3 53535 /* &data for the third calibration illuminant */
/* TIFF/EP */
#define TIFFTAG_EP_CFAREPEATPATTERNDIM 33421 /* dimensions of CFA pattern */
#define TIFFTAG_EP_CFAPATTERN 33422 /* color filter array pattern */
#define TIFFTAG_EP_BATTERYLEVEL 33423 /* battery level (rational or ASCII) */
#define TIFFTAG_EP_INTERLACE 34857 /* Number of multi-field images */
/* 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. */
#define TIFFTAG_EP_IPTC_NAA 33723 /* Alias IPTC/NAA Newspaper Association RichTIFF */
#define TIFFTAG_EP_TIMEZONEOFFSET 34858 /* Time zone offset relative to UTC */
#define TIFFTAG_EP_SELFTIMERMODE 34859 /* Number of seconds capture was delayed from button press */
#define TIFFTAG_EP_FLASHENERGY 37387 /* Flash energy, or range if there is uncertainty */
#define TIFFTAG_EP_SPATIALFREQUENCYRESPONSE 37388 /* Spatial frequency response */
#define TIFFTAG_EP_NOISE 37389 /* Camera noise measurement values */
#define TIFFTAG_EP_FOCALPLANEXRESOLUTION 37390 /* Focal plane X resolution */
#define TIFFTAG_EP_FOCALPLANEYRESOLUTION 37391 /* Focal plane Y resolution */
#define TIFFTAG_EP_FOCALPLANERESOLUTIONUNIT 37392 /* Focal plane resolution unit */
#define TIFFTAG_EP_IMAGENUMBER 37393 /* Number of image when several of burst shot stored in same TIFF/EP */
#define TIFFTAG_EP_SECURITYCLASSIFICATION 37394 /* Security classification */
#define TIFFTAG_EP_IMAGEHISTORY 37395 /* Record of what has been done to the image */
#define TIFFTAG_EP_EXPOSUREINDEX 37397 /* Exposure index */
#define TIFFTAG_EP_STANDARDID 37398 /* TIFF/EP standard version, n.n.n.n */
#define TIFFTAG_EP_SENSINGMETHOD 37399 /* Type of image sensor */
/*
* TIFF/EP tags equivalent to EXIF tags
* Note that TIFF-EP and EXIF use nearly the same metadata tag set, but TIFF-EP stores the tags in IFD 0,
* while EXIF store the tags in a separate IFD. Either location is allowed by DNG, but the EXIF location is preferred.
*/
#define TIFFTAG_EP_EXPOSURETIME 33434 /* Exposure time */
#define TIFFTAG_EP_FNUMBER 33437 /* F number */
#define TIFFTAG_EP_EXPOSUREPROGRAM 34850 /* Exposure program */
#define TIFFTAG_EP_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */
#define TIFFTAG_EP_ISOSPEEDRATINGS 34855 /* ISO speed rating */
#define TIFFTAG_EP_OECF 34856 /* Optoelectric conversion factor */
#define TIFFTAG_EP_DATETIMEORIGINAL 36867 /* Date and time of original data generation */
#define TIFFTAG_EP_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */
#define TIFFTAG_EP_SHUTTERSPEEDVALUE 37377 /* Shutter speed */
#define TIFFTAG_EP_APERTUREVALUE 37378 /* Aperture */
#define TIFFTAG_EP_BRIGHTNESSVALUE 37379 /* Brightness */
#define TIFFTAG_EP_EXPOSUREBIASVALUE 37380 /* Exposure bias */
#define TIFFTAG_EP_MAXAPERTUREVALUE 37381 /* Maximum lens aperture */
#define TIFFTAG_EP_SUBJECTDISTANCE 37382 /* Subject distance */
#define TIFFTAG_EP_METERINGMODE 37383 /* Metering mode */
#define TIFFTAG_EP_LIGHTSOURCE 37384 /* Light source */
#define TIFFTAG_EP_FLASH 37385 /* Flash */
#define TIFFTAG_EP_FOCALLENGTH 37386 /* Lens focal length */
#define TIFFTAG_EP_SUBJECTLOCATION 37396 /* Subject location (area) */
#define TIFFTAG_RPCCOEFFICIENT 50844 /* Define by GDAL for geospatial georeferencing through RPC: http://geotiff.maptools.org/rpc_prop.html */
#define TIFFTAG_ALIAS_LAYER_METADATA 50784 /* Alias Sketchbook Pro layer usage description. */
/* GeoTIFF DGIWG */
#define TIFFTAG_TIFF_RSID 50908 /* https://www.awaresystems.be/imaging/tiff/tifftags/tiff_rsid.html */
#define TIFFTAG_GEO_METADATA 50909 /* https://www.awaresystems.be/imaging/tiff/tifftags/geo_metadata.html */
#define TIFFTAG_EXTRACAMERAPROFILES 50933 /* http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/products/photoshop/pdfs/dng_spec_1.4.0.0.pdf */
/* tag 65535 is an undefined tag used by Eastman Kodak */
@ -772,14 +669,14 @@ typedef enum
#define EXIFTAG_FNUMBER 33437 /* F number */
#define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */
#define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */
/* After EXIF 2.2.1 ISOSpeedRatings is named PhotographicSensitivity.
In addition, while "Count=Any", only 1 count should be used. */
#define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */
#define EXIFTAG_PHOTOGRAPHICSENSITIVITY 34855 /* Photographic Sensitivity (new name for tag 34855) */
#define EXIFTAG_OECF 34856 /* Optoelectric conversion factor */
#define EXIFTAG_EXIFVERSION 36864 /* Exif version */
#define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original data generation */
#define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital data generation */
#define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original
data generation */
#define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital
data generation */
#define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */
#define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */
#define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */
@ -842,15 +739,11 @@ typedef enum
#define EXIFTAG_HUMIDITY 37889 /* Humidity as the ambient situation at the shot in percent */
#define EXIFTAG_PRESSURE 37890 /* Pressure as the ambient situation at the shot hecto-Pascal (hPa) */
#define EXIFTAG_WATERDEPTH 37891 /* WaterDepth as the ambient situation at the shot in meter (m) */
#define EXIFTAG_ACCELERATION 37892 /* Acceleration (a scalar regardless of direction) as the ambientsituation at the shot in units of mGal (10-5 m/s^2) */
/* EXIFTAG_CAMERAELEVATIONANGLE: Elevation/depression. angle of the orientation of the camera(imaging optical axis)
* as the ambient situation at the shot in degree from -180deg to +180deg. */
#define EXIFTAG_CAMERAELEVATIONANGLE 37893
#define EXIFTAG_ACCELERATION 37892 /* Acceleration (a scalar regardless of direction) as the ambient situation at the shot in units of mGal (10-5 m/s^2) */
#define EXIFTAG_CAMERAELEVATIONANGLE 37893 /* Elevation/depression. angle of the orientation of the camera(imaging optical axis) as the ambient situation at the shot in degree from -180deg to +180deg. */
#define EXIFTAG_CAMERAOWNERNAME 42032 /* owner of a camera */
#define EXIFTAG_BODYSERIALNUMBER 42033 /* serial number of the body of the camera */
/* EXIFTAG_LENSSPECIFICATION: minimum focal length (in mm), maximum focal length (in mm),minimum F number in the minimum focal length,
* and minimum F number in the maximum focal length, */
#define EXIFTAG_LENSSPECIFICATION 42034
#define EXIFTAG_LENSSPECIFICATION 42034 /* minimum focal length (in mm), maximum focal length (in mm), minimum F number in the minimum focal length, and minimum F number in the maximum focal length, */
#define EXIFTAG_LENSMAKE 42035 /* the lens manufacturer */
#define EXIFTAG_LENSMODEL 42036 /* the lens model name and model number */
#define EXIFTAG_LENSSERIALNUMBER 42037 /* the serial number of the interchangeable lens */
@ -869,8 +762,8 @@ typedef enum
#define GPSTAG_LONGITUDE 4 /* Indicates the longitude. */
#define GPSTAG_ALTITUDEREF 5 /* Indicates the altitude used as the reference altitude. */
#define GPSTAG_ALTITUDE 6 /* Indicates the altitude based on the reference in GPSAltitudeRef. */
#define GPSTAG_TIMESTAMP 7 /*Indicates the time as UTC (Coordinated Universal Time). */
#define GPSTAG_SATELLITES 8 /*Indicates the GPS satellites used for measurements. */
#define GPSTAG_TIMESTAMP 7 /* Indicates the time as UTC (Coordinated Universal Time). */
#define GPSTAG_SATELLITES 8 /* Indicates the GPS satellites used for measurements. */
#define GPSTAG_STATUS 9 /* Indicates the status of the GPS receiver when the image is recorded. */
#define GPSTAG_MEASUREMODE 10 /* Indicates the GPS measurement mode. */
#define GPSTAG_DOP 11 /* Indicates the GPS DOP (data degree of precision). */
@ -896,3 +789,12 @@ typedef enum
#define GPSTAG_GPSHPOSITIONINGERROR 31 /* Indicates horizontal positioning errors in meters. */
#endif /* _TIFF_ */
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View file

@ -5,68 +5,50 @@
from this file in your programs.
*/
/* clang-format off */
/* clang-format disabled because CMake scripts are very sensitive to the
* formatting of this file. configure_file variables of type "@VAR@" are
* modified by clang-format and won't be substituted.
*/
#ifndef _TIFFCONF_
#define _TIFFCONF_
#include <stddef.h>
#include <stdint.h>
#include <inttypes.h>
/* Signed 16-bit type */
/* #undef TIFF_INT16_T */
#define TIFF_INT16_T signed short
/* Signed 32-bit type */
/* #undef TIFF_INT32_T */
#define TIFF_INT32_T signed int
/* Signed 64-bit type */
/* #undef TIFF_INT64_T */
#define TIFF_INT64_T signed long long
/* Signed 8-bit type */
/* #undef TIFF_INT8_T */
#define TIFF_INT8_T signed char
/* Unsigned 16-bit type */
/* #undef TIFF_UINT16_T */
#define TIFF_UINT16_T unsigned short
/* Unsigned 32-bit type */
/* #undef TIFF_UINT32_T */
#define TIFF_UINT32_T unsigned int
/* Unsigned 64-bit type */
/* #undef TIFF_UINT64_T */
#define TIFF_UINT64_T unsigned long long
/* Unsigned 8-bit type */
/* #undef TIFF_UINT8_T */
#define TIFF_UINT8_T unsigned char
/* Signed size type */
#if defined _WIN64
#define TIFF_SSIZE_T int64_t
#define TIFF_SSIZE_T signed long long
#else
#define TIFF_SSIZE_T int32_t
#define TIFF_SSIZE_T signed int
#endif
/* Pointer difference type */
#define TIFF_PTRDIFF_T ptrdiff_t
/* Compatibility stuff. */
/* Define as 0 or 1 according to the floating point format supported by the
/* Define as 0 or 1 according to the floating point format suported by the
machine */
#define HAVE_IEEEFP 1
/* The concept of HOST_FILLORDER is broken. Since libtiff 4.5.1
* this macro will always be hardcoded to FILLORDER_LSB2MSB on all
* architectures, to reflect past long behavior of doing so on x86 architecture.
* Note however that the default FillOrder used by libtiff is FILLORDER_MSB2LSB,
* as mandated per the TIFF specification.
* The influence of HOST_FILLORDER is only when passing the 'H' mode in
* TIFFOpen().
* You should NOT rely on this macro to decide the CPU endianness!
* This macro will be removed in libtiff 4.6
*/
/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
#define HOST_FILLORDER FILLORDER_LSB2MSB
/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
@ -82,9 +64,6 @@
/* Support JBIG compression (requires JBIG-KIT library) */
/* #undef JBIG_SUPPORT */
/* Support LERC compression */
/* #undef LERC_SUPPORT */
/* Support LogLuv high dynamic range encoding */
#define LOGLUV_SUPPORT 1
@ -114,7 +93,7 @@
/* #undef LIBDEFLATE_SUPPORT */
/* Support strip chopping (whether or not to convert single-strip uncompressed
images to multiple strips of ~8Kb to reduce memory usage) */
images to mutiple strips of ~8Kb to reduce memory usage) */
#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
/* Enable SubIFD tag (330) support */
@ -127,7 +106,7 @@
/* Pick up YCbCr subsampling info from the JPEG data stream to support files
lacking the tag (default enabled). */
#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
/* #undef CHECK_JPEG_YCBCR_SUBSAMPLING */
/* Support MS MDI magic number files as TIFF */
#define MDI_SUPPORT 1
@ -145,5 +124,3 @@
#define IPTC_SUPPORT
#endif /* _TIFFCONF_ */
/* clang-format on */

View file

@ -60,22 +60,20 @@ typedef struct tiff TIFF;
*/
/*
* this is the machine addressing size type, only it's signed, so make it
* int32_t on 32bit machines, int64_t on 64bit machines
* int32 on 32bit machines, int64 on 64bit machines
*/
typedef TIFF_SSIZE_T tmsize_t;
#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
typedef uint64_t toff_t; /* file offset */
typedef uint64 toff_t; /* file offset */
/* 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 uint32 ttag_t; /* directory tag */
typedef uint16 tdir_t; /* directory index */
typedef uint16 tsample_t; /* sample number */
typedef uint32 tstrile_t; /* strip or tile number */
typedef tstrile_t tstrip_t; /* strip number */
typedef tstrile_t ttile_t; /* tile number */
typedef tmsize_t tsize_t; /* i/o size in bytes */
typedef void *tdata_t; /* image data ref */
typedef void* tdata_t; /* image data ref */
#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
#define __WIN32__
@ -89,22 +87,21 @@ typedef void *tdata_t; /* image data ref */
*/
#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
#if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && \
!defined(USE_WIN32_FILEIO)
#define AVOID_WIN32_FILEIO
#endif
# if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
# define AVOID_WIN32_FILEIO
# endif
#endif
#if defined(USE_WIN32_FILEIO)
#define VC_EXTRALEAN
#include <windows.h>
#ifdef __WIN32__
# define VC_EXTRALEAN
# include <windows.h>
# ifdef __WIN32__
DECLARE_HANDLE(thandle_t); /* Win32 file handle */
#else
# else
typedef HFILE thandle_t; /* client data handle */
#endif /* __WIN32__ */
# endif /* __WIN32__ */
#else
typedef void *thandle_t; /* client data handle */
typedef void* thandle_t; /* client data handle */
#endif /* USE_WIN32_FILEIO */
/*
@ -138,15 +135,14 @@ typedef void *thandle_t; /* client data handle */
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
typedef struct
{
typedef struct {
float d_mat[3][3]; /* XYZ -> luminance matrix */
float d_YCR; /* Light o/p for reference white */
float d_YCG;
float d_YCB;
uint32_t d_Vrwr; /* Pixel values for ref. white */
uint32_t d_Vrwg;
uint32_t d_Vrwb;
uint32 d_Vrwr; /* Pixel values for ref. white */
uint32 d_Vrwg;
uint32 d_Vrwb;
float d_Y0R; /* Residual light for black pixel */
float d_Y0G;
float d_Y0B;
@ -155,18 +151,16 @@ typedef struct
float d_gammaB;
} TIFFDisplay;
typedef struct
{ /* YCbCr->RGB support */
TIFFRGBValue *clamptab; /* range clamping table */
int *Cr_r_tab;
int *Cb_b_tab;
int32_t *Cr_g_tab;
int32_t *Cb_g_tab;
int32_t *Y_tab;
typedef struct { /* YCbCr->RGB support */
TIFFRGBValue* clamptab; /* range clamping table */
int* Cr_r_tab;
int* Cb_b_tab;
int32* Cr_g_tab;
int32* Cb_g_tab;
int32* Y_tab;
} TIFFYCbCrToRGB;
typedef struct
{ /* CIE Lab 1976->RGB support */
typedef struct { /* CIE Lab 1976->RGB support */
int range; /* Size of conversion table */
#define CIELABTORGB_TABLE_RANGE 1500
float rstep, gstep, bstep;
@ -191,49 +185,46 @@ typedef struct _TIFFRGBAImage TIFFRGBAImage;
* different format or, for example, unpack the data
* and draw the unpacked raster on the display.
*/
typedef void (*tileContigRoutine)(TIFFRGBAImage *, uint32_t *, uint32_t,
uint32_t, uint32_t, uint32_t, int32_t,
int32_t, unsigned char *);
typedef void (*tileSeparateRoutine)(TIFFRGBAImage *, uint32_t *, uint32_t,
uint32_t, uint32_t, uint32_t, int32_t,
int32_t, unsigned char *, unsigned char *,
unsigned char *, unsigned char *);
typedef void (*tileContigRoutine)
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
unsigned char*);
typedef void (*tileSeparateRoutine)
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
/*
* RGBA-reader state.
*/
struct _TIFFRGBAImage
{
TIFF *tif; /* image handle */
struct _TIFFRGBAImage {
TIFF* tif; /* image handle */
int stoponerr; /* stop on read error */
int isContig; /* data is packed/separate */
int alpha; /* type of alpha data present */
uint32_t width; /* image width */
uint32_t height; /* image height */
uint16_t bitspersample; /* image bits/sample */
uint16_t samplesperpixel; /* image samples/pixel */
uint16_t orientation; /* image orientation */
uint16_t req_orientation; /* requested orientation */
uint16_t photometric; /* image photometric interp */
uint16_t *redcmap; /* colormap palette */
uint16_t *greencmap;
uint16_t *bluecmap;
uint32 width; /* image width */
uint32 height; /* image height */
uint16 bitspersample; /* image bits/sample */
uint16 samplesperpixel; /* image samples/pixel */
uint16 orientation; /* image orientation */
uint16 req_orientation; /* requested orientation */
uint16 photometric; /* image photometric interp */
uint16* redcmap; /* colormap palette */
uint16* greencmap;
uint16* bluecmap;
/* get image data routine */
int (*get)(TIFFRGBAImage *, uint32_t *, uint32_t, uint32_t);
int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
/* put decoded strip/tile */
union
{
void (*any)(TIFFRGBAImage *);
union {
void (*any)(TIFFRGBAImage*);
tileContigRoutine contig;
tileSeparateRoutine separate;
} put;
TIFFRGBValue *Map; /* sample mapping array */
uint32_t **BWmap; /* black&white map */
uint32_t **PALmap; /* palette image map */
TIFFYCbCrToRGB *ycbcr; /* YCbCr conversion state */
TIFFCIELabToRGB *cielab; /* CIE L*a*b conversion state */
TIFFRGBValue* Map; /* sample mapping array */
uint32** BWmap; /* black&white map */
uint32** PALmap; /* palette image map */
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
uint8_t *UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
uint8_t *Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
uint8* UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
uint8* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
int row_offset;
int col_offset;
@ -243,7 +234,7 @@ struct _TIFFRGBAImage
* Macros for extracting components from the
* packed ABGR form returned by TIFFReadRGBAImage.
*/
#define TIFFGetR(abgr) ((abgr)&0xff)
#define TIFFGetR(abgr) ((abgr) & 0xff)
#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)
#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)
#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)
@ -255,385 +246,304 @@ struct _TIFFRGBAImage
* More codecs may be registered through calls to the library
* and/or the builtin implementations may be overridden.
*/
typedef int (*TIFFInitMethod)(TIFF *, int);
typedef struct
{
char *name;
uint16_t scheme;
typedef int (*TIFFInitMethod)(TIFF*, int);
typedef struct {
char* name;
uint16 scheme;
TIFFInitMethod init;
} TIFFCodec;
typedef struct
{
uint32_t uNum;
uint32_t uDenom;
} TIFFRational_t;
#include <stdarg.h>
#include <stdio.h>
#include <stdarg.h>
/* share internal LogLuv conversion routines? */
#ifndef LOGLUV_PUBLIC
#define LOGLUV_PUBLIC 1
#endif
#if defined(__GNUC__) || defined(__attribute__)
#define TIFF_ATTRIBUTE(x) __attribute__(x)
#if defined(__GNUC__) || defined(__clang__) || defined(__attribute__)
# define TIFF_ATTRIBUTE(x) __attribute__(x)
#else
#define TIFF_ATTRIBUTE(x) /*nothing*/
# define TIFF_ATTRIBUTE(x) /*nothing*/
#endif
#if defined(c_plusplus) || defined(__cplusplus)
extern "C"
{
extern "C" {
#endif
typedef void (*TIFFErrorHandler)(const char *, const char *, va_list);
typedef void (*TIFFErrorHandlerExt)(thandle_t, const char *, const char *,
va_list);
typedef int (*TIFFErrorHandlerExtR)(TIFF *, void *user_data, const char *,
const char *, va_list);
typedef tmsize_t (*TIFFReadWriteProc)(thandle_t, void *, tmsize_t);
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
typedef int (*TIFFCloseProc)(thandle_t);
typedef toff_t (*TIFFSizeProc)(thandle_t);
typedef int (*TIFFMapFileProc)(thandle_t, void **base, toff_t *size);
typedef void (*TIFFUnmapFileProc)(thandle_t, void *base, toff_t size);
typedef void (*TIFFExtendProc)(TIFF *);
typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
typedef tmsize_t (*TIFFReadWriteProc)(thandle_t, void*, tmsize_t);
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
typedef int (*TIFFCloseProc)(thandle_t);
typedef toff_t (*TIFFSizeProc)(thandle_t);
typedef int (*TIFFMapFileProc)(thandle_t, void** base, toff_t* size);
typedef void (*TIFFUnmapFileProc)(thandle_t, void* base, toff_t size);
typedef void (*TIFFExtendProc)(TIFF*);
extern const char *TIFFGetVersion(void);
extern const char* TIFFGetVersion(void);
extern const TIFFCodec *TIFFFindCODEC(uint16_t);
extern TIFFCodec *TIFFRegisterCODEC(uint16_t, const char *, TIFFInitMethod);
extern void TIFFUnRegisterCODEC(TIFFCodec *);
extern int TIFFIsCODECConfigured(uint16_t);
extern TIFFCodec *TIFFGetConfiguredCODECs(void);
extern const TIFFCodec* TIFFFindCODEC(uint16);
extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
extern void TIFFUnRegisterCODEC(TIFFCodec*);
extern int TIFFIsCODECConfigured(uint16);
extern TIFFCodec* TIFFGetConfiguredCODECs(void);
/*
/*
* Auxiliary 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 _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);
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 _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.
*/
extern int TIFFGetTagListCount(TIFF *);
extern uint32_t TIFFGetTagListEntry(TIFF *, int tag_index);
/*
** Stuff, related to tag handling and creating custom tags.
*/
extern int TIFFGetTagListCount( TIFF * );
extern uint32 TIFFGetTagListEntry( TIFF *, int tag_index );
#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
#define TIFF_VARIABLE -1 /* marker for variable length tags */
#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */
#define TIFF_VARIABLE2 -3 /* marker for uint32_t var-length tags */
#define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */
#define FIELD_CUSTOM 65
typedef struct _TIFFField TIFFField;
typedef struct _TIFFFieldArray TIFFFieldArray;
typedef struct _TIFFField TIFFField;
typedef struct _TIFFFieldArray TIFFFieldArray;
extern const TIFFField *TIFFFindField(TIFF *, uint32_t, TIFFDataType);
extern const TIFFField *TIFFFieldWithTag(TIFF *, uint32_t);
extern const TIFFField *TIFFFieldWithName(TIFF *, const char *);
extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType);
extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32);
extern const TIFFField* TIFFFieldWithName(TIFF*, const char *);
extern uint32_t TIFFFieldTag(const TIFFField *);
extern const char *TIFFFieldName(const TIFFField *);
extern TIFFDataType TIFFFieldDataType(const TIFFField *);
extern int TIFFFieldPassCount(const TIFFField *);
extern int TIFFFieldReadCount(const TIFFField *);
extern int TIFFFieldWriteCount(const TIFFField *);
extern int
TIFFFieldSetGetSize(const TIFFField *); /* returns internal storage size of
TIFFSetGetFieldType in bytes. */
extern int TIFFFieldSetGetCountSize(
const TIFFField *); /* returns size of count parameter 0=none,
2=uint16_t, 4=uint32_t */
extern int TIFFFieldIsAnonymous(const TIFFField *);
extern uint32 TIFFFieldTag(const TIFFField*);
extern const char* TIFFFieldName(const TIFFField*);
extern TIFFDataType TIFFFieldDataType(const TIFFField*);
extern int TIFFFieldPassCount(const TIFFField*);
extern int TIFFFieldReadCount(const TIFFField*);
extern int TIFFFieldWriteCount(const TIFFField*);
typedef int (*TIFFVSetMethod)(TIFF *, uint32_t, va_list);
typedef int (*TIFFVGetMethod)(TIFF *, uint32_t, va_list);
typedef void (*TIFFPrintMethod)(TIFF *, FILE *, long);
typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list);
typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list);
typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
typedef struct
{
typedef struct {
TIFFVSetMethod vsetfield; /* tag set routine */
TIFFVGetMethod vgetfield; /* tag get routine */
TIFFPrintMethod printdir; /* directory print routine */
} TIFFTagMethods;
} TIFFTagMethods;
extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *);
extern void *TIFFGetClientInfo(TIFF *, const char *);
extern void TIFFSetClientInfo(TIFF *, void *, const char *);
extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *);
extern void *TIFFGetClientInfo(TIFF *, const char *);
extern void TIFFSetClientInfo(TIFF *, void *, const char *);
extern void TIFFCleanup(TIFF *tif);
extern void TIFFClose(TIFF *tif);
extern int TIFFFlush(TIFF *tif);
extern int TIFFFlushData(TIFF *tif);
extern int TIFFGetField(TIFF *tif, uint32_t tag, ...);
extern int TIFFVGetField(TIFF *tif, uint32_t tag, va_list ap);
extern int TIFFGetFieldDefaulted(TIFF *tif, uint32_t tag, ...);
extern int TIFFVGetFieldDefaulted(TIFF *tif, uint32_t tag, va_list ap);
extern int TIFFReadDirectory(TIFF *tif);
extern int TIFFReadCustomDirectory(TIFF *tif, toff_t diroff,
const TIFFFieldArray *infoarray);
extern int TIFFReadEXIFDirectory(TIFF *tif, toff_t diroff);
extern int TIFFReadGPSDirectory(TIFF *tif, toff_t diroff);
extern uint64_t TIFFScanlineSize64(TIFF *tif);
extern tmsize_t TIFFScanlineSize(TIFF *tif);
extern uint64_t TIFFRasterScanlineSize64(TIFF *tif);
extern tmsize_t TIFFRasterScanlineSize(TIFF *tif);
extern uint64_t TIFFStripSize64(TIFF *tif);
extern tmsize_t TIFFStripSize(TIFF *tif);
extern uint64_t TIFFRawStripSize64(TIFF *tif, uint32_t strip);
extern tmsize_t TIFFRawStripSize(TIFF *tif, uint32_t strip);
extern uint64_t TIFFVStripSize64(TIFF *tif, uint32_t nrows);
extern tmsize_t TIFFVStripSize(TIFF *tif, uint32_t nrows);
extern uint64_t TIFFTileRowSize64(TIFF *tif);
extern tmsize_t TIFFTileRowSize(TIFF *tif);
extern uint64_t TIFFTileSize64(TIFF *tif);
extern tmsize_t TIFFTileSize(TIFF *tif);
extern uint64_t TIFFVTileSize64(TIFF *tif, uint32_t nrows);
extern tmsize_t TIFFVTileSize(TIFF *tif, uint32_t nrows);
extern uint32_t TIFFDefaultStripSize(TIFF *tif, uint32_t request);
extern void TIFFDefaultTileSize(TIFF *, uint32_t *, uint32_t *);
extern int TIFFFileno(TIFF *);
extern int TIFFSetFileno(TIFF *, int);
extern thandle_t TIFFClientdata(TIFF *);
extern thandle_t TIFFSetClientdata(TIFF *, thandle_t);
extern int TIFFGetMode(TIFF *);
extern int TIFFSetMode(TIFF *, int);
extern int TIFFIsTiled(TIFF *);
extern int TIFFIsByteSwapped(TIFF *);
extern int TIFFIsUpSampled(TIFF *);
extern int TIFFIsMSB2LSB(TIFF *);
extern int TIFFIsBigEndian(TIFF *);
extern int TIFFIsBigTIFF(TIFF *);
extern TIFFReadWriteProc TIFFGetReadProc(TIFF *);
extern TIFFReadWriteProc TIFFGetWriteProc(TIFF *);
extern TIFFSeekProc TIFFGetSeekProc(TIFF *);
extern TIFFCloseProc TIFFGetCloseProc(TIFF *);
extern TIFFSizeProc TIFFGetSizeProc(TIFF *);
extern TIFFMapFileProc TIFFGetMapFileProc(TIFF *);
extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF *);
extern uint32_t TIFFCurrentRow(TIFF *);
extern tdir_t TIFFCurrentDirectory(TIFF *);
extern tdir_t TIFFNumberOfDirectories(TIFF *);
extern uint64_t TIFFCurrentDirOffset(TIFF *);
extern uint32_t TIFFCurrentStrip(TIFF *);
extern uint32_t TIFFCurrentTile(TIFF *tif);
extern int TIFFReadBufferSetup(TIFF *tif, void *bp, tmsize_t size);
extern int TIFFWriteBufferSetup(TIFF *tif, void *bp, tmsize_t size);
extern int TIFFSetupStrips(TIFF *);
extern int TIFFWriteCheck(TIFF *, int, const char *);
extern void TIFFFreeDirectory(TIFF *);
extern int TIFFCreateDirectory(TIFF *);
extern int TIFFCreateCustomDirectory(TIFF *, const TIFFFieldArray *);
extern int TIFFCreateEXIFDirectory(TIFF *);
extern int TIFFCreateGPSDirectory(TIFF *);
extern int TIFFLastDirectory(TIFF *);
extern int TIFFSetDirectory(TIFF *, tdir_t);
extern int TIFFSetSubDirectory(TIFF *, uint64_t);
extern int TIFFUnlinkDirectory(TIFF *, tdir_t);
extern int TIFFSetField(TIFF *, uint32_t, ...);
extern int TIFFVSetField(TIFF *, uint32_t, va_list);
extern int TIFFUnsetField(TIFF *, uint32_t);
extern int TIFFWriteDirectory(TIFF *);
extern int TIFFWriteCustomDirectory(TIFF *, uint64_t *);
extern int TIFFCheckpointDirectory(TIFF *);
extern int TIFFRewriteDirectory(TIFF *);
extern int TIFFDeferStrileArrayWriting(TIFF *);
extern int TIFFForceStrileArrayWriting(TIFF *);
extern void TIFFCleanup(TIFF* tif);
extern void TIFFClose(TIFF* tif);
extern int TIFFFlush(TIFF* tif);
extern int TIFFFlushData(TIFF* tif);
extern int TIFFGetField(TIFF* tif, uint32 tag, ...);
extern int TIFFVGetField(TIFF* tif, uint32 tag, va_list ap);
extern int TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...);
extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap);
extern int TIFFReadDirectory(TIFF* tif);
extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray);
extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff);
extern int TIFFReadGPSDirectory(TIFF* tif, toff_t diroff);
extern uint64 TIFFScanlineSize64(TIFF* tif);
extern tmsize_t TIFFScanlineSize(TIFF* tif);
extern uint64 TIFFRasterScanlineSize64(TIFF* tif);
extern tmsize_t TIFFRasterScanlineSize(TIFF* tif);
extern uint64 TIFFStripSize64(TIFF* tif);
extern tmsize_t TIFFStripSize(TIFF* tif);
extern uint64 TIFFRawStripSize64(TIFF* tif, uint32 strip);
extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32 strip);
extern uint64 TIFFVStripSize64(TIFF* tif, uint32 nrows);
extern tmsize_t TIFFVStripSize(TIFF* tif, uint32 nrows);
extern uint64 TIFFTileRowSize64(TIFF* tif);
extern tmsize_t TIFFTileRowSize(TIFF* tif);
extern uint64 TIFFTileSize64(TIFF* tif);
extern tmsize_t TIFFTileSize(TIFF* tif);
extern uint64 TIFFVTileSize64(TIFF* tif, uint32 nrows);
extern tmsize_t TIFFVTileSize(TIFF* tif, uint32 nrows);
extern uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request);
extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
extern int TIFFFileno(TIFF*);
extern int TIFFSetFileno(TIFF*, int);
extern thandle_t TIFFClientdata(TIFF*);
extern thandle_t TIFFSetClientdata(TIFF*, thandle_t);
extern int TIFFGetMode(TIFF*);
extern int TIFFSetMode(TIFF*, int);
extern int TIFFIsTiled(TIFF*);
extern int TIFFIsByteSwapped(TIFF*);
extern int TIFFIsUpSampled(TIFF*);
extern int TIFFIsMSB2LSB(TIFF*);
extern int TIFFIsBigEndian(TIFF*);
extern TIFFReadWriteProc TIFFGetReadProc(TIFF*);
extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
extern TIFFSeekProc TIFFGetSeekProc(TIFF*);
extern TIFFCloseProc TIFFGetCloseProc(TIFF*);
extern TIFFSizeProc TIFFGetSizeProc(TIFF*);
extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
extern uint32 TIFFCurrentRow(TIFF*);
extern uint16 TIFFCurrentDirectory(TIFF*);
extern uint16 TIFFNumberOfDirectories(TIFF*);
extern uint64 TIFFCurrentDirOffset(TIFF*);
extern uint32 TIFFCurrentStrip(TIFF*);
extern uint32 TIFFCurrentTile(TIFF* tif);
extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size);
extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size);
extern int TIFFSetupStrips(TIFF *);
extern int TIFFWriteCheck(TIFF*, int, const char *);
extern void TIFFFreeDirectory(TIFF*);
extern int TIFFCreateDirectory(TIFF*);
extern int TIFFCreateCustomDirectory(TIFF*,const TIFFFieldArray*);
extern int TIFFCreateEXIFDirectory(TIFF*);
extern int TIFFCreateGPSDirectory(TIFF*);
extern int TIFFLastDirectory(TIFF*);
extern int TIFFSetDirectory(TIFF*, uint16);
extern int TIFFSetSubDirectory(TIFF*, uint64);
extern int TIFFUnlinkDirectory(TIFF*, uint16);
extern int TIFFSetField(TIFF*, uint32, ...);
extern int TIFFVSetField(TIFF*, uint32, va_list);
extern int TIFFUnsetField(TIFF*, uint32);
extern int TIFFWriteDirectory(TIFF *);
extern int TIFFWriteCustomDirectory(TIFF *, uint64 *);
extern int TIFFCheckpointDirectory(TIFF *);
extern int TIFFRewriteDirectory(TIFF *);
extern int TIFFDeferStrileArrayWriting(TIFF *);
extern int TIFFForceStrileArrayWriting(TIFF* );
#if defined(c_plusplus) || defined(__cplusplus)
extern void TIFFPrintDirectory(TIFF *, FILE *, long = 0);
extern int TIFFReadScanline(TIFF *tif, void *buf, uint32_t row,
uint16_t sample = 0);
extern int TIFFWriteScanline(TIFF *tif, void *buf, uint32_t row,
uint16_t sample = 0);
extern int TIFFReadRGBAImage(TIFF *, uint32_t, uint32_t, uint32_t *,
int = 0);
extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0);
extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0);
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
int = ORIENTATION_BOTLEFT, int = 0);
#else
extern void TIFFPrintDirectory(TIFF *, FILE *, long);
extern int TIFFReadScanline(TIFF *tif, void *buf, uint32_t row,
uint16_t sample);
extern int TIFFWriteScanline(TIFF *tif, void *buf, uint32_t row,
uint16_t sample);
extern int TIFFReadRGBAImage(TIFF *, uint32_t, uint32_t, uint32_t *, int);
extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
int, int);
extern void TIFFPrintDirectory(TIFF*, FILE*, long);
extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample);
extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample);
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
#endif
extern int TIFFReadRGBAStrip(TIFF *, uint32_t, uint32_t *);
extern int TIFFReadRGBATile(TIFF *, uint32_t, uint32_t, uint32_t *);
extern int TIFFReadRGBAStripExt(TIFF *, uint32_t, uint32_t *,
int stop_on_error);
extern int TIFFReadRGBATileExt(TIFF *, uint32_t, uint32_t, uint32_t *,
int stop_on_error);
extern int TIFFRGBAImageOK(TIFF *, char[1024]);
extern int TIFFRGBAImageBegin(TIFFRGBAImage *, TIFF *, int, char[1024]);
extern int TIFFRGBAImageGet(TIFFRGBAImage *, uint32_t *, uint32_t,
uint32_t);
extern void TIFFRGBAImageEnd(TIFFRGBAImage *);
extern const char *TIFFFileName(TIFF *);
extern const char *TIFFSetFileName(TIFF *, const char *);
extern void TIFFError(const char *, const char *, ...)
TIFF_ATTRIBUTE((__format__(__printf__, 2, 3)));
extern void TIFFErrorExt(thandle_t, const char *, const char *, ...)
TIFF_ATTRIBUTE((__format__(__printf__, 3, 4)));
extern void TIFFWarning(const char *, const char *, ...)
TIFF_ATTRIBUTE((__format__(__printf__, 2, 3)));
extern void TIFFWarningExt(thandle_t, const char *, const char *, ...)
TIFF_ATTRIBUTE((__format__(__printf__, 3, 4)));
extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
extern void TIFFWarningExtR(TIFF *, const char *, const char *, ...)
TIFF_ATTRIBUTE((__format__(__printf__, 3, 4)));
extern void TIFFErrorExtR(TIFF *, const char *, const char *, ...)
TIFF_ATTRIBUTE((__format__(__printf__, 3, 4)));
typedef struct TIFFOpenOptions TIFFOpenOptions;
extern TIFFOpenOptions *TIFFOpenOptionsAlloc(void);
extern void TIFFOpenOptionsFree(TIFFOpenOptions *);
extern void
TIFFOpenOptionsSetMaxSingleMemAlloc(TIFFOpenOptions *opts,
tmsize_t max_single_mem_alloc);
extern void
TIFFOpenOptionsSetErrorHandlerExtR(TIFFOpenOptions *opts,
TIFFErrorHandlerExtR handler,
void *errorhandler_user_data);
extern void
TIFFOpenOptionsSetWarningHandlerExtR(TIFFOpenOptions *opts,
TIFFErrorHandlerExtR handler,
void *warnhandler_user_data);
extern TIFF *TIFFOpen(const char *, const char *);
extern TIFF *TIFFOpenExt(const char *, const char *, TIFFOpenOptions *opts);
#ifdef __WIN32__
extern TIFF *TIFFOpenW(const wchar_t *, const char *);
extern TIFF *TIFFOpenWExt(const wchar_t *, const char *,
TIFFOpenOptions *opts);
#endif /* __WIN32__ */
extern TIFF *TIFFFdOpen(int, const char *, const char *);
extern TIFF *TIFFFdOpenExt(int, const char *, const char *,
TIFFOpenOptions *opts);
extern TIFF *TIFFClientOpen(const char *, const char *, thandle_t,
extern int TIFFReadRGBAStrip(TIFF*, uint32, uint32 * );
extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
extern int TIFFReadRGBAStripExt(TIFF*, uint32, uint32 *, int stop_on_error );
extern int TIFFReadRGBATileExt(TIFF*, uint32, uint32, uint32 *, int stop_on_error );
extern int TIFFRGBAImageOK(TIFF*, char [1024]);
extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
extern void TIFFRGBAImageEnd(TIFFRGBAImage*);
extern TIFF* TIFFOpen(const char*, const char*);
# ifdef __WIN32__
extern TIFF* TIFFOpenW(const wchar_t*, const char*);
# endif /* __WIN32__ */
extern TIFF* TIFFFdOpen(int, const char*, const char*);
extern TIFF* TIFFClientOpen(const char*, const char*,
thandle_t,
TIFFReadWriteProc, TIFFReadWriteProc,
TIFFSeekProc, TIFFCloseProc, TIFFSizeProc,
TIFFSeekProc, TIFFCloseProc,
TIFFSizeProc,
TIFFMapFileProc, TIFFUnmapFileProc);
extern TIFF *TIFFClientOpenExt(const char *, const char *, thandle_t,
TIFFReadWriteProc, TIFFReadWriteProc,
TIFFSeekProc, TIFFCloseProc, TIFFSizeProc,
TIFFMapFileProc, TIFFUnmapFileProc,
TIFFOpenOptions *opts);
extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
extern uint32_t TIFFComputeTile(TIFF *tif, uint32_t x, uint32_t y,
uint32_t z, uint16_t s);
extern int TIFFCheckTile(TIFF *tif, uint32_t x, uint32_t y, uint32_t z,
uint16_t s);
extern uint32_t TIFFNumberOfTiles(TIFF *);
extern tmsize_t TIFFReadTile(TIFF *tif, void *buf, uint32_t x, uint32_t y,
uint32_t z, uint16_t s);
extern tmsize_t TIFFWriteTile(TIFF *tif, void *buf, uint32_t x, uint32_t y,
uint32_t z, uint16_t s);
extern uint32_t TIFFComputeStrip(TIFF *, uint32_t, uint16_t);
extern uint32_t TIFFNumberOfStrips(TIFF *);
extern tmsize_t TIFFReadEncodedStrip(TIFF *tif, uint32_t strip, void *buf,
tmsize_t size);
extern tmsize_t TIFFReadRawStrip(TIFF *tif, uint32_t strip, void *buf,
tmsize_t size);
extern tmsize_t TIFFReadEncodedTile(TIFF *tif, uint32_t tile, void *buf,
tmsize_t size);
extern tmsize_t TIFFReadRawTile(TIFF *tif, uint32_t tile, void *buf,
tmsize_t size);
extern int TIFFReadFromUserBuffer(TIFF *tif, uint32_t strile, void *inbuf,
tmsize_t insize, void *outbuf,
tmsize_t outsize);
extern tmsize_t TIFFWriteEncodedStrip(TIFF *tif, uint32_t strip, void *data,
tmsize_t cc);
extern tmsize_t TIFFWriteRawStrip(TIFF *tif, uint32_t strip, void *data,
tmsize_t cc);
extern tmsize_t TIFFWriteEncodedTile(TIFF *tif, uint32_t tile, void *data,
tmsize_t cc);
extern tmsize_t TIFFWriteRawTile(TIFF *tif, uint32_t tile, void *data,
tmsize_t cc);
extern int TIFFDataWidth(
TIFFDataType); /* table of tag datatype widths within TIFF file. */
extern void TIFFSetWriteOffset(TIFF *tif, toff_t off);
extern void TIFFSwabShort(uint16_t *);
extern void TIFFSwabLong(uint32_t *);
extern void TIFFSwabLong8(uint64_t *);
extern void TIFFSwabFloat(float *);
extern void TIFFSwabDouble(double *);
extern void TIFFSwabArrayOfShort(uint16_t *wp, tmsize_t n);
extern void TIFFSwabArrayOfTriples(uint8_t *tp, tmsize_t n);
extern void TIFFSwabArrayOfLong(uint32_t *lp, tmsize_t n);
extern void TIFFSwabArrayOfLong8(uint64_t *lp, tmsize_t n);
extern void TIFFSwabArrayOfFloat(float *fp, tmsize_t n);
extern void TIFFSwabArrayOfDouble(double *dp, tmsize_t n);
extern void TIFFReverseBits(uint8_t *cp, tmsize_t n);
extern const unsigned char *TIFFGetBitRevTable(int);
extern const char* TIFFFileName(TIFF*);
extern const char* TIFFSetFileName(TIFF*, const char *);
extern void TIFFError(const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,2,3)));
extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,3,4)));
extern void TIFFWarning(const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,2,3)));
extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,3,4)));
extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
extern uint32 TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s);
extern int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s);
extern uint32 TIFFNumberOfTiles(TIFF*);
extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s);
extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s);
extern uint32 TIFFComputeStrip(TIFF*, uint32, uint16);
extern uint32 TIFFNumberOfStrips(TIFF*);
extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size);
extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size);
extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size);
extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size);
extern int TIFFReadFromUserBuffer(TIFF* tif, uint32 strile,
void* inbuf, tmsize_t insize,
void* outbuf, tmsize_t outsize);
extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc);
extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc);
extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc);
extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc);
extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
extern void TIFFSetWriteOffset(TIFF* tif, toff_t off);
extern void TIFFSwabShort(uint16*);
extern void TIFFSwabLong(uint32*);
extern void TIFFSwabLong8(uint64*);
extern void TIFFSwabFloat(float*);
extern void TIFFSwabDouble(double*);
extern void TIFFSwabArrayOfShort(uint16* wp, tmsize_t n);
extern void TIFFSwabArrayOfTriples(uint8* tp, tmsize_t n);
extern void TIFFSwabArrayOfLong(uint32* lp, tmsize_t n);
extern void TIFFSwabArrayOfLong8(uint64* lp, tmsize_t n);
extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n);
extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n);
extern void TIFFReverseBits(uint8* cp, tmsize_t n);
extern const unsigned char* TIFFGetBitRevTable(int);
extern uint64_t TIFFGetStrileOffset(TIFF *tif, uint32_t strile);
extern uint64_t TIFFGetStrileByteCount(TIFF *tif, uint32_t strile);
extern uint64_t TIFFGetStrileOffsetWithErr(TIFF *tif, uint32_t strile,
int *pbErr);
extern uint64_t TIFFGetStrileByteCountWithErr(TIFF *tif, uint32_t strile,
int *pbErr);
extern uint64 TIFFGetStrileOffset(TIFF *tif, uint32 strile);
extern uint64 TIFFGetStrileByteCount(TIFF *tif, uint32 strile);
extern uint64 TIFFGetStrileOffsetWithErr(TIFF *tif, uint32 strile, int *pbErr);
extern uint64 TIFFGetStrileByteCountWithErr(TIFF *tif, uint32 strile, int *pbErr);
#ifdef LOGLUV_PUBLIC
#define U_NEU 0.210526316
#define V_NEU 0.473684211
#define UVSCALE 410.
extern double LogL16toY(int);
extern double LogL10toY(int);
extern void XYZtoRGB24(float *, uint8_t *);
extern int uv_decode(double *, double *, int);
extern void LogLuv24toXYZ(uint32_t, float *);
extern void LogLuv32toXYZ(uint32_t, float *);
extern double LogL16toY(int);
extern double LogL10toY(int);
extern void XYZtoRGB24(float*, uint8*);
extern int uv_decode(double*, double*, int);
extern void LogLuv24toXYZ(uint32, float*);
extern void LogLuv32toXYZ(uint32, float*);
#if defined(c_plusplus) || defined(__cplusplus)
extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
extern uint32_t LogLuv24fromXYZ(float *, int = SGILOGENCODE_NODITHER);
extern uint32_t LogLuv32fromXYZ(float *, int = SGILOGENCODE_NODITHER);
extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
#else
extern int LogL16fromY(double, int);
extern int LogL10fromY(double, int);
extern int uv_encode(double, double, int);
extern uint32_t LogLuv24fromXYZ(float *, int);
extern uint32_t LogLuv32fromXYZ(float *, int);
extern int LogL16fromY(double, int);
extern int LogL10fromY(double, int);
extern int uv_encode(double, double, int);
extern uint32 LogLuv24fromXYZ(float*, int);
extern uint32 LogLuv32fromXYZ(float*, int);
#endif
#endif /* LOGLUV_PUBLIC */
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB *, const TIFFDisplay *,
float *);
extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32_t, int32_t, int32_t,
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*);
extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
float *, float *, float *);
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float, uint32_t *,
uint32_t *, uint32_t *);
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
uint32 *, uint32 *, uint32 *);
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB *, float *, float *);
extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32_t, int32_t, int32_t,
uint32_t *, uint32_t *, uint32_t *);
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
uint32 *, uint32 *, uint32 *);
/****************************************************************************
/****************************************************************************
* O B S O L E T E D I N T E R F A C E S
*
* Don't use this stuff in your applications, it may be removed in the
*future libtiff versions.
* Don't use this stuff in your applications, it may be removed in the future
* libtiff versions.
****************************************************************************/
typedef struct
{
typedef struct {
ttag_t field_tag; /* field's tag */
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
short field_writecount; /* write count/TIFF_VARIABLE */
@ -642,12 +552,21 @@ extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
unsigned char field_oktochange; /* if true, can change while writing */
unsigned char field_passcount; /* if true, pass dir count on set */
char *field_name; /* ASCII name */
} TIFFFieldInfo;
} TIFFFieldInfo;
extern int TIFFMergeFieldInfo(TIFF *, const TIFFFieldInfo[], uint32_t);
extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* _TIFFIO_ */
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View file

@ -1,9 +1,4 @@
/* clang-format off */
/* clang-format disabled because FindTIFF.cmake is very sensitive to the
* formatting of below line being a single line.
*/
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.5.1\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.2.0\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
/*
* This define can be used in code that requires
* compilation-related definitions specific to a
@ -11,20 +6,4 @@
* version checking should be done based on the
* string returned by TIFFGetVersion.
*/
#define TIFFLIB_VERSION 20230609
/* The following defines have been added in 4.5.0 */
#define TIFFLIB_MAJOR_VERSION 4
#define TIFFLIB_MINOR_VERSION 5
#define TIFFLIB_MICRO_VERSION 1
/* Macro added in 4.5.0. Returns TRUE if the current libtiff version is
* greater or equal to major.minor.micro
*/
#define TIFFLIB_AT_LEAST(major, minor, micro) \
(TIFFLIB_MAJOR_VERSION > (major) || \
(TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION > (minor)) || \
(TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION == (minor) && \
TIFFLIB_MICRO_VERSION >= (micro)))
/* clang-format on */
#define TIFFLIB_VERSION 20201219

BIN
thirdparty/SDL2_image/VisualC/external/optional/x64/libtiff-5.dll (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
thirdparty/SDL2_image/VisualC/external/optional/x86/libtiff-5.dll (Stored with Git LFS) vendored Normal file

Binary file not shown.

View file

@ -14503,10 +14503,16 @@ fi
case "$host" in
*-*-darwin*)
avif_lib=`find_lib libavif.dylib`
avif_lib=`find_lib "libavif.[0-9]*.dylib"`
if test x$avif_lib = x; then
avif_lib=`find_lib "libavif*.dylib"`
fi
;;
*-*-cygwin* | *-*-mingw*)
avif_lib=`find_lib "libavif-[0-9]*.dll"`
if test x$avif_lib = x; then
avif_lib=`find_lib "libavif*.dll"`
fi
;;
*)
avif_lib=`find_lib "libavif[0-9]*.so.*"`
@ -14726,7 +14732,10 @@ fi
case "$host" in
*-*-darwin*)
jpg_lib=`find_lib "libjpeg.[0-9]*.dylib"`
if test x$jpg_lib = x; then
jpg_lib=`find_lib libjpeg.dylib`
fi
;;
*-*-cygwin* | *-*-mingw*)
jpg_lib=`find_lib "libjpeg*.dll"`
@ -14938,10 +14947,16 @@ fi
case "$host" in
*-*-darwin*)
jxl_lib=`find_lib "libjxl.[0-9]*.dylib"`
if test x$jxl_lib = x; then
jxl_lib=`find_lib libjxl.dylib`
fi
;;
*-*-cygwin* | *-*-mingw*)
jxl_lib=`find_lib "libjxl-[0-9]*.dll"`
if test x$jxl_lib = x; then
jxl_lib=`find_lib "libjxl.dll"`
fi
;;
*)
jxl_lib=`find_lib "libjxl[0-9]*.so.*"`
@ -15158,7 +15173,10 @@ fi
case "$host" in
*-*-darwin*)
png_lib=`find_lib "libpng[0-9]*.dylib"`
if test x$png_lib = x; then
png_lib=`find_lib libpng.dylib`
fi
;;
*-*-cygwin* | *-*-mingw*)
png_lib=`find_lib "libpng*.dll"`
@ -15368,7 +15386,10 @@ fi
case "$host" in
*-*-darwin*)
tif_lib=`find_lib "libtiff.[0-9]*.dylib"`
if test x$tif_lib = x; then
tif_lib=`find_lib libtiff.dylib`
fi
;;
*-*-cygwin* | *-*-mingw*)
tif_lib=`find_lib "libtiff-*.dll"`
@ -15754,8 +15775,12 @@ fi
case "$host" in
*-*-darwin*)
webpdemux_lib=`find_lib "libwebpdemux.[0-9]*.dylib"`
webp_lib=`find_lib "libwebp.[0-9]*.dylib"`
if test x$webp_lib = x; then
webpdemux_lib=`find_lib libwebpdemux.dylib`
webp_lib=`find_lib libwebp.dylib`
fi
;;
*-*-cygwin* | *-*-mingw*)
webpdemux_lib=`find_lib "libwebpdemux-*.dll"`

View file

@ -339,10 +339,16 @@ if test x$enable_avif = xyes; then
case "$host" in
*-*-darwin*)
avif_lib=[`find_lib libavif.dylib`]
avif_lib=[`find_lib "libavif.[0-9]*.dylib"`]
if test x$avif_lib = x; then
avif_lib=[`find_lib "libavif*.dylib"`]
fi
;;
*-*-cygwin* | *-*-mingw*)
avif_lib=[`find_lib "libavif-[0-9]*.dll"`]
if test x$avif_lib = x; then
avif_lib=[`find_lib "libavif*.dll"`]
fi
;;
*)
avif_lib=[`find_lib "libavif[0-9]*.so.*"`]
@ -391,7 +397,10 @@ if test x$enable_jpg = xyes; then
case "$host" in
*-*-darwin*)
jpg_lib=[`find_lib "libjpeg.[0-9]*.dylib"`]
if test x$jpg_lib = x; then
jpg_lib=[`find_lib libjpeg.dylib`]
fi
;;
*-*-cygwin* | *-*-mingw*)
jpg_lib=[`find_lib "libjpeg*.dll"`]
@ -435,10 +444,16 @@ if test x$enable_jxl = xyes; then
case "$host" in
*-*-darwin*)
jxl_lib=[`find_lib "libjxl.[0-9]*.dylib"`]
if test x$jxl_lib = x; then
jxl_lib=[`find_lib libjxl.dylib`]
fi
;;
*-*-cygwin* | *-*-mingw*)
jxl_lib=[`find_lib "libjxl-[0-9]*.dll"`]
if test x$jxl_lib = x; then
jxl_lib=[`find_lib "libjxl.dll"`]
fi
;;
*)
jxl_lib=[`find_lib "libjxl[0-9]*.so.*"`]
@ -484,7 +499,10 @@ if test x$enable_png = xyes; then
case "$host" in
*-*-darwin*)
png_lib=[`find_lib "libpng[0-9]*.dylib"`]
if test x$png_lib = x; then
png_lib=[`find_lib libpng.dylib`]
fi
;;
*-*-cygwin* | *-*-mingw*)
png_lib=[`find_lib "libpng*.dll"`]
@ -526,7 +544,10 @@ if test x$enable_tif = xyes -a x$enable_imageio != xyes; then
case "$host" in
*-*-darwin*)
tif_lib=[`find_lib "libtiff.[0-9]*.dylib"`]
if test x$tif_lib = x; then
tif_lib=[`find_lib libtiff.dylib`]
fi
;;
*-*-cygwin* | *-*-mingw*)
tif_lib=[`find_lib "libtiff-*.dll"`]
@ -580,8 +601,12 @@ if test x$enable_webp = xyes; then
case "$host" in
*-*-darwin*)
webpdemux_lib=[`find_lib "libwebpdemux.[0-9]*.dylib"`]
webp_lib=[`find_lib "libwebp.[0-9]*.dylib"`]
if test x$webp_lib = x; then
webpdemux_lib=[`find_lib libwebpdemux.dylib`]
webp_lib=[`find_lib libwebp.dylib`]
fi
;;
*-*-cygwin* | *-*-mingw*)
webpdemux_lib=[`find_lib "libwebpdemux-*.dll"`]

View file

@ -0,0 +1,36 @@
<#
.SYNOPSIS
Downloads the Git modules specified in ../.gitmodules
.DESCRIPTION
Parses and downloads the Github repositories specified in the .gitmodules file
.EXAMPLE
PS> .\Get-GitModules.ps1
< Downloads and parses the repositories in the .gitmodules file. >
#>
#------- Variables -------------------------------------------------------------
[String] $PathRegex = "path\s*=\s*(?<path>.*)"
[String] $URLRegex = "url\s*=\s*(?<url>.*)"
[String] $BranchRegex = "branch\s*=\s*(?<Branch>.*)"
#------- Script ----------------------------------------------------------------
foreach ($Line in Get-Content $PSScriptRoot\..\.gitmodules) {
if ($Line -match $PathRegex) {
$Match = Select-String -InputObject $Line -Pattern $PathRegex
$Path = $Match.Matches[0].Groups[1].Value
}
elseif ($Line -match $URLRegex) {
$Match = Select-String -InputObject $Line -Pattern $URLRegex
$URL = $Match.Matches[0].Groups[1].Value
}
elseif ($Line -match $BranchRegex) {
$Match = Select-String -InputObject $Line -Pattern $BranchRegex
$Branch = $Match.Matches[0].Groups[1].Value
Write-Host "git clone $URL $Path -b $Branch --recursive" `
-ForegroundColor Blue
git clone $URL $PSScriptRoot/../$Path -b $Branch --recursive
}
}

View file

@ -1,23 +0,0 @@
[submodule "third_party/lodepng"]
path = third_party/lodepng
url = https://github.com/lvandeve/lodepng
[submodule "third_party/lcms"]
path = third_party/lcms
url = https://github.com/mm2/Little-CMS
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest
[submodule "third_party/sjpeg"]
path = third_party/sjpeg
url = https://github.com/webmproject/sjpeg.git
[submodule "third_party/skcms"]
path = third_party/skcms
url = https://skia.googlesource.com/skcms
[submodule "third_party/brotli"]
path = third_party/brotli
url = https://github.com/libsdl-org/brotli.git
branch = v1.0.9-SDL
[submodule "third_party/highway"]
path = third_party/highway
url = https://github.com/libsdl-org/highway.git
branch = 0.15.0-SDL

View file

@ -1,6 +0,0 @@
[submodule "research/esaxx"]
path = research/esaxx
url = https://github.com/hillbig/esaxx
[submodule "research/libdivsufsort"]
path = research/libdivsufsort
url = https://github.com/y-256/libdivsufsort.git

View file

@ -0,0 +1,18 @@
ndk = ../ndk
cc = $ndk/toolchains/llvm/prebuilt/*/bin/aarch64-linux-android24-clang
cxx = $ndk/toolchains/llvm/prebuilt/*/bin/aarch64-linux-android24-clang++
cflags = -fcolor-diagnostics -Weverything
ldflags = -pie -fuse-ld=lld -static-libstdc++
out = out/android$mode
rule run
command = if which adb >/dev/null && adb get-state >/dev/null 2>/dev/null; $
then $
adb push --sync profiles /data/local/tmp >/dev/null; $
adb push $in /data/local/tmp/$in >/dev/null; $
adb shell "cd /data/local/tmp; taskset f ./$in" > $out; $
else touch $out; fi
description = run $in
include build/common

View file

@ -0,0 +1,18 @@
ndk = ../ndk
cc = $ndk/toolchains/llvm/prebuilt/*/bin/armv7a-linux-androideabi24-clang
cxx = $ndk/toolchains/llvm/prebuilt/*/bin/armv7a-linux-androideabi24-clang++
cflags = -fcolor-diagnostics -Weverything -mthumb
ldflags = -pie -fuse-ld=lld -static-libstdc++
out = out/android-arm$mode
rule run
command = if which adb >/dev/null && adb get-state >/dev/null 2>/dev/null; $
then $
adb push --sync profiles /data/local/tmp >/dev/null; $
adb push $in /data/local/tmp/$in >/dev/null; $
adb shell "cd /data/local/tmp; taskset f ./$in" > $out; $
else touch $out; fi
description = run $in
include build/common

View file

@ -0,0 +1,4 @@
mode = .lsan
extra_cflags = -fsanitize=leak
extra_ldflags = -fsanitize=leak
include build/android-arm

View file

@ -0,0 +1,3 @@
mode = .neon-vfpv4
extra_cflags = -mfpu=neon-vfpv4
include build/android-arm

View file

@ -0,0 +1,3 @@
mode = .neon-vfpv4-O3
extra_cflags = -mfpu=neon-vfpv4 -O3
include build/android-arm

View file

@ -0,0 +1,3 @@
mode = .portable
extra_cflags = -DSKCMS_PORTABLE
include build/android-arm

View file

@ -0,0 +1,3 @@
mode = .tiny
extra_cflags = -g0 -DNDEBUG -fno-unwind-tables -fno-asynchronous-unwind-tables
include build/android-arm

View file

@ -0,0 +1,3 @@
mode = .vfpv2
extra_cflags = -mfpu=vfpv2
include build/android-arm

View file

@ -0,0 +1,3 @@
mode = .fp16
extra_cflags = -march=armv8.2a+fp16 -DSKCMS_OPT_INTO_NEON_FP16
include build/android

View file

@ -0,0 +1,4 @@
mode = .lsan
extra_cflags = -fsanitize=leak
extra_ldflags = -fsanitize=leak
include build/android

View file

@ -0,0 +1,3 @@
mode = .nofp16
extra_cflags = -march=armv8.2a+fp16
include build/android

View file

@ -0,0 +1,3 @@
mode = .portable
extra_cflags = -DSKCMS_PORTABLE
include build/android

View file

@ -0,0 +1,3 @@
mode = .tiny
extra_cflags = -g0 -DNDEBUG -fno-unwind-tables -fno-asynchronous-unwind-tables
include build/android

View file

@ -0,0 +1,7 @@
cc = clang
cxx = clang++
cflags = -fcolor-diagnostics -Weverything
out = out/clang$mode
include build/local
include build/common

View file

@ -0,0 +1,3 @@
mode = .O0
extra_cflags = -O0
include build/clang

View file

@ -0,0 +1,5 @@
mode = .avx512
extra_cflags = -march=skylake-avx512
include build/clang
disabled = (uname | grep -q Darwin && sysctl machdep.cpu.leaf7_features | grep -qv AVX512F || grep flags /proc/cpuinfo | grep -vq avx512f)

View file

@ -0,0 +1,4 @@
mode = .lsan
extra_cflags = -fsanitize=leak
extra_ldflags = -fsanitize=leak
include build/clang

View file

@ -0,0 +1,6 @@
mode = .m32
extra_cflags = -m32 -msse2
extra_ldflags = -m32
include build/clang
disabled = (uname | grep -qv Linux)

View file

@ -0,0 +1,7 @@
mode = .m32-O0
extra_cflags = -m32 -msse2 -O0
extra_ldflags = -m32
include build/clang
disabled = (uname | grep -qv Linux)

View file

@ -0,0 +1,6 @@
mode = .msan
extra_cflags = -fsanitize=memory
extra_ldflags = -fsanitize=memory
include build/clang
disabled = (uname | grep -qv Linux)

View file

@ -0,0 +1,3 @@
mode = .native
extra_cflags = -march=native
include build/clang

View file

@ -0,0 +1,3 @@
mode = .portable
extra_cflags = -DSKCMS_PORTABLE
include build/clang

View file

@ -0,0 +1,4 @@
mode = .sse2
extra_cflags = -msse2 -mno-sse3 -mno-ssse3 -mno-sse4.1 -DSKCMS_NO_RUNTIME_CPU_DETECTION
include build/clang

View file

@ -0,0 +1,4 @@
mode = .sse41
extra_cflags = -msse4.1 -DSKCMS_NO_RUNTIME_CPU_DETECTION
include build/clang

View file

@ -0,0 +1,3 @@
mode = .tiny
extra_cflags = -g0 -DNDEBUG -fno-unwind-tables -fno-asynchronous-unwind-tables
include build/clang

View file

@ -0,0 +1,4 @@
mode = .xsan
extra_cflags = -fsanitize=address,integer,undefined -fno-sanitize-recover=all
extra_ldflags = -fsanitize=address,integer,undefined
include build/clang

View file

@ -0,0 +1,4 @@
mode = .xsan-portable
extra_cflags = -fsanitize=address,integer,undefined -fno-sanitize-recover=all -DSKCMS_PORTABLE
extra_ldflags = -fsanitize=address,integer,undefined
include build/clang

View file

@ -0,0 +1,35 @@
builddir = $out
disabled = false
# Each compiler has enabled all the warnings it can.
# Here we make them errors, and disable a few we don't want bothering us.
warnings = -Werror $
-Wno-double-promotion $
-Wno-float-equal $
-Wno-padded $
warnings_cc = $warnings $
-Wno-c++98-compat-pedantic $
-Wno-gnu-anonymous-struct $
-Wno-old-style-cast $
rule compile_c
command = $disabled && touch $out || $cc -std=c11 -g -Os $warnings $cflags $extra_cflags $
-MD -MF $out.d -c $in -o $out
depfile = $out.d
deps = gcc
description = compile $out
rule compile_cc
command = $disabled && touch $out || $cxx -std=c++11 -g -Os $warnings_cc $cflags $extra_cflags $
-MD -MF $out.d -c $in -o $out
depfile = $out.d
deps = gcc
description = compile $out
rule link
command = $disabled && touch $out || $cxx $ldflags $extra_ldflags $in -ldl -o $out
description = link $out
include build/targets

View file

@ -0,0 +1,19 @@
cc = emcc
cxx = em++
cflags = -g3 -s WASM=1 -s ENVIRONMENT=node
ldflags = -g3 -s WASM=1 -s ENVIRONMENT=node --embed-file profiles
exe = .js
out = out/emscripten$mode
node = 'node'
rule run
command = if which $node >/dev/null; $
then $
$node $in > $out; $
else touch $out; fi
description = run $in
include build/common
disabled = (uname | grep -qv Linux)

View file

@ -0,0 +1,5 @@
mode = .simd
extra_cflags = -s SIMD=1
extra_ldflags = -s SIMD=1
include build/emscripten

View file

@ -0,0 +1,9 @@
cc = gcc
cxx = g++
cflags = -fdiagnostics-color -Wall -Wextra -ffp-contract=off -fstack-usage
out = out/gcc$mode
include build/local
include build/common
disabled = (uname | grep -qv Linux)

View file

@ -0,0 +1,3 @@
mode = .O0
extra_cflags = -O0
include build/gcc

View file

@ -0,0 +1,4 @@
mode = .m32
extra_cflags = -m32 -msse2 -mfpmath=sse
extra_ldflags = -m32
include build/gcc

View file

@ -0,0 +1,4 @@
mode = .m32-O0
extra_cflags = -m32 -msse2 -mfpmath=sse -O0
extra_ldflags = -m32
include build/gcc

View file

@ -0,0 +1,16 @@
mode = .mips64el
_toolchain = ../mips64el_toolchain_linux
_env = env LD_LIBRARY_PATH=$_toolchain/lib/x86_64-linux-gnu
out = out/gcc$mode
cflags = -fdiagnostics-color -Wall -Wextra -ffp-contract=off -fstack-usage
cc = $_env $_toolchain/bin/mips64el-linux-gnuabi64-gcc-7
cxx = $_env $_toolchain/bin/mips64el-linux-gnuabi64-g++-7
rule run
command = touch $out
description = skipping $in
include build/common
disabled = (uname | grep -qv Linux)

View file

@ -0,0 +1,16 @@
mode = .mips64el-O3
_toolchain = ../mips64el_toolchain_linux
_env = env LD_LIBRARY_PATH=$_toolchain/lib/x86_64-linux-gnu
out = out/gcc$mode
cflags = -fdiagnostics-color -Wall -Wextra -ffp-contract=off -fstack-usage -O3
cc = $_env $_toolchain/bin/mips64el-linux-gnuabi64-gcc-7
cxx = $_env $_toolchain/bin/mips64el-linux-gnuabi64-g++-7
rule run
command = touch $out
description = skipping $in
include build/common
disabled = (uname | grep -qv Linux)

View file

@ -0,0 +1,6 @@
mode = .musl
extra_ldflags = -static
include build/gcc
cc = env REALGCC=gcc musl-gcc
cxx = env REALGCC=g++ musl-gcc

View file

@ -0,0 +1,3 @@
mode = .native
extra_cflags = -march=native
include build/gcc

View file

@ -0,0 +1,3 @@
mode = .portable
extra_cflags = -DSKCMS_PORTABLE
include build/gcc

View file

@ -0,0 +1,3 @@
mode = .tiny
extra_cflags = -g0 -DNDEBUG -fno-unwind-tables -fno-asynchronous-unwind-tables
include build/gcc

View file

@ -0,0 +1,4 @@
mode = .xsan
extra_cflags = -fsanitize=address,undefined -fno-sanitize-recover=all
extra_ldflags = -fsanitize=address,undefined
include build/gcc

View file

@ -0,0 +1,11 @@
cc = clang -arch arm64 -isysroot `xcrun --sdk iphoneos --show-sdk-path`
cxx = clang++ -arch arm64 -isysroot `xcrun --sdk iphoneos --show-sdk-path`
cflags = -fcolor-diagnostics -Weverything
out = out/ios$mode
rule run
command = touch $out
description = skipping $in
include build/common
disabled = (uname | grep -qv Darwin)

View file

@ -0,0 +1,3 @@
mode = .portable
extra_cflags = -DSKCMS_PORTABLE
include build/ios

View file

@ -0,0 +1,3 @@
mode = .tiny
extra_cflags = -g0 -DNDEBUG -fno-unwind-tables -fno-asynchronous-unwind-tables
include build/ios

View file

@ -0,0 +1,7 @@
mode = .xsan
extra_cflags = -fsanitize=address,integer,undefined -fno-sanitize-recover=all
extra_ldflags = -fsanitize=address,integer,undefined
include build/ios
cc = /usr/bin/clang
cxx = /usr/bin/clang++

View file

@ -0,0 +1,3 @@
rule run
command = $disabled && touch $out || ./$in > $out
description = run $in

View file

@ -0,0 +1,27 @@
cl = cl.exe
cflags = /W4 /wd"4200" /wd"4201" /wd"4204" /wd"4221"
out = out/msvs$mode
exe = .exe
builddir = $out
rule run
command = cmd /c ""$in" > "$out""
description = run $in
rule compile_c
command = $cl /c /showIncludes /nologo /Zi /WX /MT /Fo"$out" /Fd"$out.pdb" $
$cflags $extra_cflags $in
deps = msvc
description = compile $out
rule compile_cc
command = $cl /c /showIncludes /nologo /Zi /WX /MT /Fo"$out" /Fd"$out.pdb" $
$cflags $extra_cflags $in
deps = msvc
description = compile $out
rule link
command = link.exe /nologo /DEBUG $extra_ldflags $in /OUT:"$out" /PDB:"$out.pdb"
description = link $out
include build/targets

View file

@ -0,0 +1,4 @@
mode = .analyze
extra_cflags = /analyze /RTCcsu /guard:cf
extra_ldflags = /guard:cf
include build/msvs

View file

@ -0,0 +1,5 @@
mode = .clang
include build/msvs
cl = "../clang_win/bin/clang-cl.exe"

View file

@ -0,0 +1,6 @@
mode = .clang-fast
extra_cflags = /O2 /Zc:inline
include build/msvs
cl = "../clang_win/bin/clang-cl.exe"

View file

@ -0,0 +1,3 @@
mode = .fast
extra_cflags = /O2 /Zc:inline
include build/msvs

View file

@ -0,0 +1,30 @@
build $out/skcms.o: compile_cc skcms.cc
build $out/test_only.o: compile_c test_only.c
build $out/tests.o: compile_c tests.c
build $out/tests$exe: link $out/skcms.o $out/tests.o $out/test_only.o
build $out/tests.ok: run $out/tests$exe
build $out/bench.o: compile_c bench.c
build $out/bench$exe: link $out/skcms.o $out/bench.o
build $out/iccdump.o: compile_c iccdump.c
build $out/iccdump$exe: link $out/skcms.o $out/iccdump.o $out/test_only.o
build $out/fuzz/fuzz_main.o: compile_c fuzz/fuzz_main.c
build $out/fuzz/fuzz_iccprofile_atf.o: compile_c fuzz/fuzz_iccprofile_atf.c
build $out/fuzz_iccprofile_atf$exe: link $out/fuzz/fuzz_iccprofile_atf.o $
$out/fuzz/fuzz_main.o $
$out/skcms.o
build $out/fuzz/fuzz_iccprofile_info.o: compile_c fuzz/fuzz_iccprofile_info.c
build $out/fuzz_iccprofile_info$exe: link $out/fuzz/fuzz_iccprofile_info.o $
$out/fuzz/fuzz_main.o $
$out/skcms.o
build $out/fuzz/fuzz_iccprofile_transform.o: compile_c fuzz/fuzz_iccprofile_transform.c
build $out/fuzz_iccprofile_transform$exe: link $out/fuzz/fuzz_iccprofile_transform.o $
$out/fuzz/fuzz_main.o $
$out/skcms.o

View file

@ -24,14 +24,14 @@ environment:
shared: OFF
- compiler: vc14-cmake
configuration: Release
arch: x64
generator: Visual Studio 16 2019
shared: ON
- compiler: vc14-cmake
configuration: Debug
arch: Win32
generator: Visual Studio 16 2019
shared: OFF
- compiler: vc14-nmake
configuration: Release
cache:
@ -50,34 +50,51 @@ init:
- git config --global core.autocrlf input
before_build:
- 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\cygwin64\bin\cygpath -u %AV_TIFF_SOURCE%`) DO SET AV_TIFF_CYG_SOURCE=%%F'
- 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\cygwin64\bin\cygpath -u %AV_TIFF_INSTALL%`) DO SET AV_TIFF_CYG_INSTALL=%%F'
- 'if %compiler%==cygwin-cmake C:\cygwin64\setup-x86_64 -q -R C:\cygwin64 -s http://cygwin.mirror.constant.com -l %AV_TIFF_DOWNLOAD%\cygwin -P cmake,libjpeg-devel,zlib-devel'
- 'if %compiler%==cygwin-cmake set "PATH=C:\cygwin64\bin;%PATH%"'
- 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\Cygwin64\bin\cygpath -u %AV_TIFF_SOURCE%`) DO SET AV_TIFF_CYG_SOURCE=%%F'
- 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\Cygwin64\bin\cygpath -u %AV_TIFF_INSTALL%`) DO SET AV_TIFF_CYG_INSTALL=%%F'
- 'if %compiler%==cygwin-cmake C:\Cygwin64\setup-x86_64 -q -R C:\Cygwin64 -s http://cygwin.mirror.constant.com -l %AV_TIFF_DOWNLOAD%\cygwin -P cmake,libjpeg-devel,zlib-devel'
- 'if %compiler%==cygwin-cmake set "PATH=C:\Cygwin64\bin;%PATH%"'
- set
- 'if %compiler%==cygwin-cmake dir C:\Cygwin64\bin'
- 'if %compiler%==cygwin-cmake dir C:\Cygwin64\bin\cmake.exe'
- 'if %compiler%==cygwin-cmake C:\Cygwin64\bin\cmake.exe --version || echo CMake not found'
- 'if %compiler%==cygwin-cmake C:\Cygwin64\bin\cmake --version || echo CMake not found'
- 'if %compiler%==cygwin-cmake cygpath --version || echo cygpath not found'
- 'if %compiler%==cygwin-cmake cmake --version || echo CMake not found'
- set "AV_CMAKE_ARGS=-DBUILD_SHARED_LIBS:BOOL=%shared%"
- 'if %compiler%==cygwin-cmake set "AV_CMAKE_ARGS=%AV_CMAKE_ARGS% -Dfatal-warnings=ON"'
- 'if %compiler%==mingw32-cmake set "AV_CMAKE_ARGS=%AV_CMAKE_ARGS% -Dfatal-warnings=ON"'
- set "AV_CMAKE_ARGS=-DBUILD_SHARED_LIBS:BOOL=%shared%"
- set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_SOURCE%"
- set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_INSTALL%"
- 'if %compiler%==cygwin-cmake set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_CYG_SOURCE%'
- 'if %compiler%==cygwin-cmake set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_CYG_INSTALL%'
- 'if %compiler%==mingw-cmake set "PATH=C:\MinGW\bin;%PATH%"'
- 'if %compiler%==vc14-nmake call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %platform%'
- mkdir %AV_TIFF_BUILD%
- cd %AV_TIFF_BUILD%
- echo Running cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_TIFF_CMAKE_SOURCE%
- if NOT %compiler%==vc14-nmake echo Running cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_TIFF_CMAKE_SOURCE%
- 'if %compiler%==cygwin-cmake bash -c "cmake -G \"%generator%\" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%"'
- 'if %compiler%==mingw-cmake cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%'
- 'if %compiler%==vc14-cmake cmake -G "%generator%" -A %arch% -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%'
- 'if %compiler%==vc14-cmake cmake -G "%generator%" -A x64 -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%'
build_script:
- cd %AV_TIFF_BUILD%
- if NOT %compiler%==vc14-nmake cd %AV_TIFF_BUILD%
- if %compiler%==vc14-nmake cd %AV_TIFF_SOURCE%
- 'if %compiler%==cygwin-cmake bash -c "cmake --build . --config %configuration% --target install"'
- 'if %compiler%==mingw-cmake cmake --build . --config %configuration% --target install'
- 'if %compiler%==vc14-cmake cmake --build . --config %configuration% --target install'
- 'if %compiler%==vc9-cmake cmake --build . --config %configuration% --target install'
- 'if %compiler%==vc14-nmake nmake /f Makefile.vc EXTRAFLAGS=/DHAVE_SNPRINTF=1'
- 'if %compiler%==vc14-nmake mkdir %AV_TIFF_INSTALL%'
- 'if %compiler%==vc14-nmake mkdir %AV_TIFF_INSTALL%\bin'
- 'if %compiler%==vc14-nmake mkdir %AV_TIFF_INSTALL%\lib'
- 'if %compiler%==vc14-nmake mkdir %AV_TIFF_INSTALL%\include'
- 'if %compiler%==vc14-nmake copy tools\*.exe %AV_TIFF_INSTALL%\bin'
- 'if %compiler%==vc14-nmake copy port\*.lib %AV_TIFF_INSTALL%\lib'
- 'if %compiler%==vc14-nmake copy libtiff\tiff.h %AV_TIFF_INSTALL%\include'
- 'if %compiler%==vc14-nmake copy libtiff\tiffio.h %AV_TIFF_INSTALL%\include'
- 'if %compiler%==vc14-nmake copy libtiff\tiffvers.h %AV_TIFF_INSTALL%\include'
- 'if %compiler%==vc14-nmake copy libtiff\tiffconf.h %AV_TIFF_INSTALL%\include'
- 'if %compiler%==vc14-nmake copy libtiff\tiffio.hxx %AV_TIFF_INSTALL%\include'
# scripts to run after build
after_build:
@ -92,6 +109,7 @@ before_test:
- 'if %compiler%==mingw-cmake ctest -V -C %configuration%'
- 'if %compiler%==vc14-cmake ctest -V -C %configuration%'
- 'if %compiler%==vc9-cmake ctest -V -C %configuration%'
# vc14-nmake does not support unit tests
# AppVeyor don't yet have a configurable retention policy, so this will
# eventually use up all the storage allowance.

View file

@ -1,6 +0,0 @@
---
BasedOnStyle: llvm
IndentWidth: 4
ColumnLimit: 80
BreakBeforeBraces: Allman
IndentCaseLabels: true

View file

@ -1,4 +0,0 @@
42173d6ace476b5228d866640b5355f74e5a108d
b0ae5d7071890160da67d2e833d84a400e0406d0
dee020782c17c1388ca5774f9904d318b51b288b
aee0113f5ec1fd39b97458539bd79a1447425ac4

View file

@ -4,8 +4,6 @@ configure
Makefile.in
config/compile
config/config.guess
config/config.h
config/config.h.in
config/config.sub
config/depcomp
config/install-sh
@ -32,6 +30,7 @@ libtiff/mkg3states
libtiff/stamp-h1
libtiff/stamp-h2
libtiff/tif_config.h
libtiff/tif_config.h.in
libtiff/tiffconf.h
libtool
m4/libtool.m4
@ -76,7 +75,3 @@ test/*.log
test/*.trs
test/o-*
*~
.idea
.vs
cmake-build*
build*

View file

@ -1,60 +1,33 @@
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu22.04:latest
image: ubuntu:20.04
before_script:
- apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq autoconf automake build-essential cmake libtool libjpeg8-dev libjbig-dev liblzma-dev ninja-build zlib1g-dev libdeflate-dev zip wget
stages:
- build
- static-analysis
- pages
autoconf-current:
autoconf:
stage: build
script:
- sh build/gitlab-ci autoconf
after_script:
- 'cat autoconf-build/test/test-suite.log'
artifacts:
name: distribution
paths:
- distribution
autoconf-old:
stage: build
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu20.04:latest
script:
- sh build/gitlab-ci autoconf-minimal
after_script:
- 'cat autoconf-build/test/test-suite.log'
cmake-makefiles-current:
cmake-makefiles:
stage: build
script:
- sh build/gitlab-ci cmake "Unix Makefiles" Release
cmake-ninja-current:
cmake-ninja:
stage: build
script:
- sh build/gitlab-ci cmake "Ninja" Debug
cmake-makefiles-old:
stage: build
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu20.04:latest
script:
- sh build/gitlab-ci cmake "Unix Makefiles" Release
coverity:
stage: static-analysis
image: registry.gitlab.com/libtiff/libtiff-ci-ubuntu22.04-coverity:latest
script:
- sh build/gitlab-ci coverity "Ninja" Debug
only:
refs:
- master
pages:
stage: pages
script:
- sh build/gitlab-ci cmake "Ninja" Debug
- cp -r cmake-install/share/doc/tiff/manual/html public
- cp -r html public
artifacts:
name: $CI_PROJECT_NAME-$CI_JOB_NAME
paths:

View file

@ -1,22 +0,0 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v15.0.4'
hooks:
- id: clang-format
# tif_fax3sm.c is a generated file
# tiffvers.h as well, and its formatting is sensitive for
# FindTIFF.cmake to detect the version number
# Furthermore, the .in files are formatting sensitive for
# cmake functions.
exclude: >
(?x)^(
libtiff/tif_fax3sm.c|
libtiff/tiffvers.h|
libtiff/tiffvers.h.in|
libtiff/tif_config.h|
libtiff/tif_config.h.in|
libtiff/tif_config.h.cmake.in|
libtiff/tiffconf.h|
libtiff/tiffconf.h.in|
libtiff/tiffconf.h.cmake.in
)

View file

@ -0,0 +1,29 @@
language: c
sudo: false
dist: trusty
cache:
directories:
- download
addons:
apt_packages:
- libjpeg8-dev
- libjbig-dev
- liblzma-dev
- zlib1g-dev
- zip
os:
- linux
- osx
env:
matrix:
- BUILD=autoconf
- BUILD=cmake TOOL="Unix Makefiles" TYPE=Release
- BUILD=cmake TOOL="Ninja" TYPE=Debug
script:
- sh ./build/travis-ci "$BUILD" "$TOOL" "$TYPE"

View file

@ -2,7 +2,6 @@
# Run "cmake" to generate the build files for your platform
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
@ -24,158 +23,739 @@
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
cmake_minimum_required(VERSION 3.9.0)
cmake_minimum_required(VERSION 2.8.11) # b/c of use of BUILD_INTERFACE generator expression
# Default policy is from 3.9.0
cmake_policy(VERSION 3.9.0)
# Find CMake modules in cmake/
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# Default policy is from 2.8.9
cmake_policy(VERSION 2.8.9)
# Set MacOSX @rpath usage globally.
if (POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif(POLICY CMP0020)
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif(POLICY CMP0042)
# Use new variable expansion policy.
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
endif(POLICY CMP0053)
if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif(POLICY CMP0054)
# Read version information from configure.ac.
include(AutotoolsVersion)
message(STATUS "Building tiff version ${LIBTIFF_VERSION_FULL}")
message(STATUS "libtiff library version ${SO_VERSION}")
string(TIMESTAMP BUILD_DATE "%Y%m%d")
message(STATUS "libtiff build date: ${BUILD_DATE}")
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" configure REGEX "^LIBTIFF_.*=")
foreach(line ${configure})
foreach(var LIBTIFF_MAJOR_VERSION LIBTIFF_MINOR_VERSION LIBTIFF_MICRO_VERSION LIBTIFF_ALPHA_VERSION
LIBTIFF_CURRENT LIBTIFF_REVISION LIBTIFF_AGE)
if(NOT ${var} AND line MATCHES "^${var}=(.*)")
set(${var} "${CMAKE_MATCH_1}")
break()
endif()
endforeach()
endforeach()
# Project definition
set(CMAKE_C_STANDARD 99)
project(tiff
VERSION "${LIBTIFF_VERSION}"
LANGUAGES C CXX)
math(EXPR SO_MAJOR "${LIBTIFF_CURRENT} - ${LIBTIFF_AGE}")
set(SO_MINOR "${LIBTIFF_AGE}")
set(SO_REVISION "${LIBTIFF_REVISION}")
if(NOT CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
# libtiff is being included as a subproject of some other project.
set(TIFF_INSTALL_DEFAULT OFF)
else()
set(TIFF_INSTALL_DEFAULT ON)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()
message(STATUS "Building tiff version ${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}${LIBTIFF_ALPHA_VERSION}")
message(STATUS "libtiff library version ${SO_MAJOR}.${SO_MINOR}.${SO_REVISION}")
option(tiff-tools "build TIFF tools" ON)
option(tiff-tests "build TIFF tests" ON)
option(tiff-contrib "build TIFF contrib" ON)
option(tiff-docs "build TIFF documentation" ON)
option(tiff-deprecated "build TIFF deprecated features" OFF)
option(tiff-install "install TIFF targets" ${TIFF_INSTALL_DEFAULT})
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
# Disable deprecated features to ensure clean build
if (tiff-deprecated)
add_definitions(-DTIFF_DISABLE_DEPRECATED)
endif()
# Project version
project(tiff C)
set(VERSION "${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}")
set(tiff_VERSION "${VERSION}")
set(tiff_VERSION_MAJOR "${LIBTIFF_MAJOR_VERSION}")
set(tiff_VERSION_MINOR "${LIBTIFF_MINOR_VERSION}")
set(tiff_VERSION_PATCH "${LIBTIFF_MICRO_VERSION}")
# Autotools compatibility
include(AutotoolsCompat)
# the other tiff_VERSION_* variables are set automatically
set(tiff_VERSION_ALPHA "${LIBTIFF_ALPHA_VERSION}")
# Library version (unlike libtool's baroque scheme, WYSIWYG here)
set(SO_COMPATVERSION "${SO_MAJOR}")
set(SO_VERSION "${SO_MAJOR}.${SO_MINOR}.${SO_REVISION}")
# Compiler checks (warning flags, etc.)
include(CompilerChecks)
# For autotools header compatibility
set(PACKAGE_NAME "LibTIFF Software")
set(PACKAGE_TARNAME "${PROJECT_NAME}")
set(PACKAGE_VERSION "${PROJECT_VERSION}${tiff_VERSION_ALPHA}")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "tiff@lists.maptools.org")
# Linker checks (version script, etc.)
include(LinkerChecks)
# Processor checks (endianness, fill order, floating point, etc.)
include(ProcessorChecks)
# Checks for headers
include(IncludeChecks)
# Checks for functions and other symbols
include(SymbolChecks)
# Standard installation paths
include(GNUInstallDirs)
# Documentation install directory (default to cmake project docdir)
set(LIBTIFF_DOCDIR "${CMAKE_INSTALL_DOCDIR}")
# CTest testing
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
include(CheckIncludeFile)
include(CheckLibraryExists)
include(CheckTypeSize)
include(CheckSymbolExists)
enable_testing()
# Checks for type presence and size
include(TypeSizeChecks)
macro(current_date var)
if(UNIX)
execute_process(COMMAND "date" +"%Y%m%d" OUTPUT_VARIABLE ${var})
endif()
endmacro()
# Check for POSIX Large File Support (LFS)
include(LargeFileSupport)
current_date(RELEASE_DATE)
# Options for internal codec support
include(InternalCodecs)
macro(extra_dist)
foreach(file ${ARGV})
file(RELATIVE_PATH relfile "${PROJECT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/${file}")
list(APPEND EXTRA_DIST "${relfile}")
endforeach()
set(EXTRA_DIST "${EXTRA_DIST}" PARENT_SCOPE)
endmacro()
# Check for Deflate codec
include(DeflateCodec)
set(EXTRA_DIST
HOWTO-RELEASE
Makefile.vc
SConstruct
autogen.sh
configure.com
nmake.opt
libtiff-4.pc.in)
# Check for PixarLog codec
include(PixarLogCodec)
# These are annoyingly verbose, produce false positives or don't work
# nicely with all supported compiler versions, so are disabled unless
# explicitly enabled.
option(extra-warnings "Enable extra compiler warnings" OFF)
# Check for JPEG codec
include(JPEGCodec)
# This will cause the compiler to fail when an error occurs.
option(fatal-warnings "Compiler warnings are errors" OFF)
# Check for JBIG codec
include(JBIGCodec)
# Check if the compiler supports each of the following additional
# flags, and enable them if supported. This greatly improves the
# quality of the build by checking for a number of common problems,
# some of which are quite serious.
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID MATCHES "Clang")
set(test_flags
-Wall
-Winline
-W
-Wformat-security
-Wpointer-arith
-Wdisabled-optimization
-Wno-unknown-pragmas
-Wdeclaration-after-statement
-fstrict-aliasing)
if(extra-warnings)
list(APPEND test_flags
-Wfloat-equal
-Wmissing-prototypes
-Wunreachable-code)
endif()
if(fatal-warnings)
list(APPEND test_flags
-Werror)
endif()
elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
set(test_flags)
if(extra-warnings)
list(APPEND test_flags
/W4)
else()
list(APPEND test_flags
/W3)
endif()
if (fatal-warnings)
list(APPEND test_flags
/WX)
endif()
endif()
# Check for LERC codec
include(LERCCodec)
foreach(flag ${test_flags})
string(REGEX REPLACE "[^A-Za-z0-9]" "_" flag_var "${flag}")
set(test_c_flag "C_FLAG${flag_var}")
CHECK_C_COMPILER_FLAG(${flag} "${test_c_flag}")
if (${test_c_flag})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
endif (${test_c_flag})
endforeach(flag ${test_flags})
# Check for LZMA codec
include(LZMACodec)
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
# Check for ZSTD codec
include(ZSTDCodec)
option(ld-version-script "Enable linker version script" ON)
# Check if LD supports linker scripts.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
global: sym;
};
# Check for WebP codec
include(WebPCodec)
VERS_2 {
global: sym;
} VERS_1;
")
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
check_c_source_compiles("int main(void){return 0;}" HAVE_LD_VERSION_SCRIPT)
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
if (ld-version-script AND HAVE_LD_VERSION_SCRIPT)
set(HAVE_LD_VERSION_SCRIPT TRUE)
else()
set(HAVE_LD_VERSION_SCRIPT FALSE)
endif()
# Option for C++ libtiffxx library
include(CXXLibrary)
# Find libm, if available
if(NOT WIN32)
find_library(M_LIBRARY m)
endif()
# Checks for OpenGL support
include(OpenGLChecks)
check_include_file(assert.h HAVE_ASSERT_H)
check_include_file(dlfcn.h HAVE_DLFCN_H)
check_include_file(fcntl.h HAVE_FCNTL_H)
check_include_file(inttypes.h HAVE_INTTYPES_H)
check_include_file(io.h HAVE_IO_H)
check_include_file(search.h HAVE_SEARCH_H)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(string.h HAVE_STRING_H)
check_include_file(strings.h HAVE_STRINGS_H)
check_include_file(sys/time.h HAVE_SYS_TIME_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(unistd.h HAVE_UNISTD_H)
# Windows support
include(WindowsSupport)
# Inspired from /usr/share/autoconf/autoconf/c.m4
foreach(inline_keyword "inline" "__inline__" "__inline")
if(NOT DEFINED C_INLINE)
set(CMAKE_REQUIRED_DEFINITIONS_SAVE ${CMAKE_REQUIRED_DEFINITIONS})
set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
"-Dinline=${inline_keyword}")
check_c_source_compiles("
typedef int foo_t;
static inline foo_t static_foo() {return 0;}
foo_t foo(){return 0;}
int main(int argc, char *argv[]) {return 0;}"
C_HAS_${inline_keyword})
set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS_SAVE})
if(C_HAS_${inline_keyword})
set(C_INLINE TRUE)
set(INLINE_KEYWORD "${inline_keyword}")
endif()
endif()
endforeach()
if(NOT DEFINED C_INLINE)
set(INLINE_KEYWORD)
endif()
# off_t and size_t checks omitted; not clear they are used at all
# Are off_t and size_t checks strictly necessary?
# Check if sys/time.h and time.h allow use together
check_c_source_compiles("
#include <sys/time.h>
#include <time.h>
int main(void){return 0;}"
TIME_WITH_SYS_TIME)
# Check if struct tm is in sys/time.h
check_c_source_compiles("
#include <sys/types.h>
#include <time.h>
int main(void){
struct tm tm;
int *p = &tm.tm_sec;
return !p;
}"
TM_IN_SYS_TIME)
# Check type sizes
# NOTE: Could be replaced with C99 <stdint.h>
check_type_size("signed int" SIZEOF_SIGNED_INT)
check_type_size("unsigned int" SIZEOF_UNSIGNED_INT)
check_type_size("signed long" SIZEOF_SIGNED_LONG)
check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)
check_type_size("signed long long" SIZEOF_SIGNED_LONG_LONG)
check_type_size("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG)
check_type_size("unsigned char *" SIZEOF_UNSIGNED_CHAR_P)
set(CMAKE_EXTRA_INCLUDE_FILES_SAVE ${CMAKE_EXTRA_INCLUDE_FILES})
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} "stddef.h")
check_type_size("size_t" SIZEOF_SIZE_T)
check_type_size("ptrdiff_t" SIZEOF_PTRDIFF_T)
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES_SAVE})
macro(report_values)
foreach(val ${ARGV})
message(STATUS "${val} set to ${${val}}")
endforeach()
endmacro()
set(TIFF_INT8_T "signed char")
set(TIFF_UINT8_T "unsigned char")
set(TIFF_INT16_T "signed short")
set(TIFF_UINT16_T "unsigned short")
if(SIZEOF_SIGNED_INT EQUAL 4)
set(TIFF_INT32_T "signed int")
set(TIFF_INT32_FORMAT "%d")
elseif(SIZEOF_SIGNED_LONG EQUAL 4)
set(TIFF_INT32_T "signed long")
set(TIFF_INT32_FORMAT "%ld")
endif()
if(SIZEOF_UNSIGNED_INT EQUAL 4)
set(TIFF_UINT32_T "unsigned int")
set(TIFF_UINT32_FORMAT "%u")
elseif(SIZEOF_UNSIGNED_LONG EQUAL 4)
set(TIFF_UINT32_T "unsigned long")
set(TIFF_UINT32_FORMAT "%lu")
endif()
if(SIZEOF_SIGNED_LONG EQUAL 8)
set(TIFF_INT64_T "signed long")
set(TIFF_INT64_FORMAT "%ld")
elseif(SIZEOF_SIGNED_LONG_LONG EQUAL 8)
set(TIFF_INT64_T "signed long long")
if (WIN32)
set(TIFF_INT64_FORMAT "%I64d")
else()
set(TIFF_INT64_FORMAT "%lld")
endif()
endif()
if(SIZEOF_UNSIGNED_LONG EQUAL 8)
set(TIFF_UINT64_T "unsigned long")
set(TIFF_UINT64_FORMAT "%lu")
elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL 8)
set(TIFF_UINT64_T "unsigned long long")
if (WIN32)
set(TIFF_UINT64_FORMAT "%I64u")
else()
set(TIFF_UINT64_FORMAT "%llu")
endif()
endif()
if(SIZEOF_UNSIGNED_INT EQUAL SIZEOF_SIZE_T)
set(TIFF_SIZE_T "unsigned int")
set(TIFF_SIZE_FORMAT "%u")
set(TIFF_SSIZE_T "signed int")
set(TIFF_SSIZE_FORMAT "%d")
elseif(SIZEOF_UNSIGNED_LONG EQUAL SIZEOF_SIZE_T)
set(TIFF_SIZE_T "unsigned long")
set(TIFF_SIZE_FORMAT "%lu")
set(TIFF_SSIZE_T "signed long")
set(TIFF_SSIZE_FORMAT "%ld")
elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL SIZEOF_SIZE_T)
set(TIFF_SIZE_T "unsigned long long")
set(TIFF_SSIZE_T "signed long long")
if (WIN32)
set(TIFF_SIZE_FORMAT "%I64u")
set(TIFF_SSIZE_FORMAT "%I64d")
else()
set(TIFF_SIZE_FORMAT "%llu")
set(TIFF_SSIZE_FORMAT "%lld")
endif()
endif()
if(NOT SIZEOF_PTRDIFF_T)
set(TIFF_PTRDIFF_T "${TIFF_SSIZE_T}")
set(TIFF_PTRDIFF_FORMAT "${SSIZE_FORMAT}")
else()
set(TIFF_PTRDIFF_T "ptrdiff_t")
set(TIFF_PTRDIFF_FORMAT "%ld")
endif()
#report_values(TIFF_INT8_T TIFF_INT8_FORMAT
# TIFF_UINT8_T TIFF_UINT8_FORMAT
# TIFF_INT16_T TIFF_INT16_FORMAT
# TIFF_UINT16_T TIFF_UINT16_FORMAT
# TIFF_INT32_T TIFF_INT32_FORMAT
# TIFF_UINT32_T TIFF_UINT32_FORMAT
# TIFF_INT64_T TIFF_INT64_FORMAT
# TIFF_UINT64_T TIFF_UINT64_FORMAT
# TIFF_SSIZE_T TIFF_SSIZE_FORMAT
# TIFF_PTRDIFF_T TIFF_PTRDIFF_FORMAT)
check_symbol_exists(mmap "sys/mman.h" HAVE_MMAP)
check_symbol_exists(setmode "unistd.h" HAVE_SETMODE)
check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
check_symbol_exists(strcasecmp "strings.h" HAVE_STRCASECMP)
check_symbol_exists(strtol "stdlib.h" HAVE_STRTOL)
check_symbol_exists(strtoll "stdlib.h" HAVE_STRTOLL)
check_symbol_exists(strtoul "stdlib.h" HAVE_STRTOUL)
check_symbol_exists(strtoull "stdlib.h" HAVE_STRTOULL)
check_symbol_exists(getopt "unistd.h;stdio.h" HAVE_GETOPT)
check_symbol_exists(lfind "search.h" HAVE_LFIND)
if(NOT HAVE_SNPRINTF)
add_definitions(-DNEED_LIBPORT)
endif()
# CPU bit order
set(HOST_FILLORDER FILLORDER_MSB2LSB)
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i.*86.*" OR
CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*" OR
# AMD64 on Windows
CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "AMD64" OR
CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64.*")
set(HOST_FILLORDER FILLORDER_LSB2MSB)
endif()
# CPU endianness
include(TestBigEndian)
test_big_endian(HOST_BIG_ENDIAN)
if(HOST_BIG_ENDIAN)
add_definitions(-DWORDS_BIGENDIAN)
endif()
# IEEE floating point
set(HAVE_IEEEFP 1)
report_values(CMAKE_HOST_SYSTEM_PROCESSOR HOST_FILLORDER
HOST_BIG_ENDIAN HAVE_IEEEFP)
# Large file support
if (UNIX OR MINGW)
# This might not catch every possibility catered for by
# AC_SYS_LARGEFILE.
add_definitions(-D_FILE_OFFSET_BITS=64)
set(FILE_OFFSET_BITS 64)
endif()
# Documentation install directory (default to cmake project docdir)
set(LIBTIFF_DOCDIR "${CMAKE_INSTALL_FULL_DOCDIR}")
# Options to enable and disable internal codecs
option(ccitt "support for CCITT Group 3 & 4 algorithms" ON)
set(CCITT_SUPPORT ${ccitt})
option(packbits "support for Macintosh PackBits algorithm" ON)
set(PACKBITS_SUPPORT ${packbits})
option(lzw "support for LZW algorithm" ON)
set(LZW_SUPPORT ${lzw})
option(thunder "support for ThunderScan 4-bit RLE algorithm" ON)
set(THUNDER_SUPPORT ${thunder})
option(next "support for NeXT 2-bit RLE algorithm" ON)
set(NEXT_SUPPORT ${next})
option(logluv "support for LogLuv high dynamic range algorithm" ON)
set(LOGLUV_SUPPORT ${logluv})
# Option for Microsoft Document Imaging
option(mdi "support for Microsoft Document Imaging" ON)
set(MDI_SUPPORT ${mdi})
# ZLIB
option(zlib "use zlib (required for Deflate compression)" ON)
if (zlib)
find_package(ZLIB)
endif()
set(ZLIB_SUPPORT 0)
if(ZLIB_FOUND)
set(ZLIB_SUPPORT 1)
endif()
set(ZIP_SUPPORT ${ZLIB_SUPPORT})
# libdeflate
option(libdeflate "use libdeflate (optional for faster Deflate support, still requires zlib)" ON)
if (libdeflate)
set(DEFLATE_FOUND 0)
find_path(DEFLATE_INCLUDE_DIR libdeflate.h)
set(DEFLATE_NAMES ${DEFLATE_NAMES} deflate)
find_library(DEFLATE_LIBRARY NAMES ${DEFLATE_NAMES})
if (DEFLATE_INCLUDE_DIR AND DEFLATE_LIBRARY)
set(DEFLATE_FOUND 1)
set(DEFLATE_LIBRARIES ${DEFLATE_LIBRARY})
endif()
endif()
set(LIBDEFLATE_SUPPORT FALSE)
if(DEFLATE_FOUND)
set(LIBDEFLATE_SUPPORT TRUE)
endif()
if(LIBDEFLATE_SUPPORT AND NOT ZIP_SUPPORT)
message(WARNING "libdeflate available but zlib is not. libdeflate cannot be used")
set(LIBDEFLATE_SUPPORT FALSE)
endif()
set(LIBDEFLATE_SUPPORT ${LIBDEFLATE_SUPPORT})
# Option for Pixar log-format algorithm
# Pixar log format
option(pixarlog "support for Pixar log-format algorithm (requires Zlib)" ON)
set(PIXARLOG_SUPPORT FALSE)
if (ZLIB_SUPPORT)
if(pixarlog)
set(PIXARLOG_SUPPORT TRUE)
endif()
endif()
# JPEG
option(jpeg "use libjpeg (required for JPEG compression)" ON)
if (jpeg)
find_package(JPEG)
endif()
set(JPEG_SUPPORT FALSE)
if(JPEG_FOUND)
set(JPEG_SUPPORT TRUE)
endif()
option(old-jpeg "support for Old JPEG compression (read-only)" ON)
set(OJPEG_SUPPORT FALSE)
if (JPEG_SUPPORT)
if (old-jpeg)
set(OJPEG_SUPPORT TRUE)
endif()
endif()
# JBIG-KIT
option(jbig "use ISO JBIG compression (requires JBIT-KIT library)" ON)
if (jbig)
set(JBIG_FOUND 0)
find_path(JBIG_INCLUDE_DIR jbig.h)
set(JBIG_NAMES ${JBIG_NAMES} jbig libjbig)
find_library(JBIG_LIBRARY NAMES ${JBIG_NAMES})
if (JBIG_INCLUDE_DIR AND JBIG_LIBRARY)
set(JBIG_FOUND 1)
set(JBIG_LIBRARIES ${JBIG_LIBRARY})
endif()
endif()
set(JBIG_SUPPORT 0)
if(JBIG_FOUND)
set(JBIG_FOUND TRUE)
set(JBIG_SUPPORT 1)
else()
set(JBIG_FOUND FALSE)
endif()
set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${JBIG_INCLUDE_DIR})
check_symbol_exists(jbg_newlen "jbig.h" HAVE_JBG_NEWLEN)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
# liblzma2
option(lzma "use liblzma (required for LZMA2 compression)" ON)
if (lzma)
find_package(LibLZMA)
endif()
set(LZMA_SUPPORT 0)
if(LIBLZMA_FOUND)
set(LZMA_SUPPORT 1)
endif()
# libzstd
option(zstd "use libzstd (required for ZSTD compression)" ON)
if (zstd)
find_path(ZSTD_INCLUDE_DIR zstd.h)
find_library(ZSTD_LIBRARY NAMES zstd)
if (ZSTD_INCLUDE_DIR AND ZSTD_LIBRARY)
check_library_exists ("${ZSTD_LIBRARY}" ZSTD_decompressStream "" ZSTD_RECENT_ENOUGH)
if (ZSTD_RECENT_ENOUGH)
set(ZSTD_FOUND TRUE)
set(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
message(STATUS "Found ZSTD library: ${ZSTD_LIBRARY}")
else ()
message(WARNING "Found ZSTD library, but not recent enough. Use zstd >= 1.0")
endif ()
endif ()
endif()
set(ZSTD_SUPPORT 0)
if(ZSTD_FOUND)
set(ZSTD_SUPPORT 1)
endif()
# libwebp
option(webp "use libwebp (required for WEBP compression)" ON)
if (webp)
find_path(WEBP_INCLUDE_DIR /webp/decode.h)
find_library(WEBP_LIBRARY NAMES webp)
endif()
set(WEBP_SUPPORT 0)
set(WEBP_FOUND FALSE)
if (WEBP_INCLUDE_DIR AND WEBP_LIBRARY)
set(WEBP_SUPPORT 1)
set(WEBP_FOUND TRUE)
set(WEBP_LIBRARIES ${WEBP_LIBRARY})
message(STATUS "Found WEBP library: ${WEBP_LIBRARY}")
endif()
# 8/12-bit jpeg mode
option(jpeg12 "enable libjpeg 8/12-bit dual mode (requires separate
12-bit libjpeg build)" ON)
set(JPEG12_INCLUDE_DIR JPEG12_INCLUDE_DIR-NOTFOUND CACHE PATH "Include directory for 12-bit libjpeg")
set(JPEG12_LIBRARY JPEG12_LIBRARY-NOTFOUND CACHE FILEPATH "12-bit libjpeg library")
set(JPEG12_FOUND FALSE)
if (JPEG12_INCLUDE_DIR AND JPEG12_LIBRARY)
set(JPEG12_LIBRARIES ${JPEG12_LIBRARY})
set(JPEG12_FOUND TRUE)
endif()
if (JPEG12_FOUND)
set(JPEG_DUAL_MODE_8_12 1)
set(LIBJPEG_12_PATH "${JPEG12_INCLUDE_DIR}/jpeglib.h")
endif()
# C++ support
option(cxx "Enable C++ stream API building (requires C++ compiler)" ON)
set(CXX_SUPPORT FALSE)
if (cxx)
enable_language(CXX)
set(CXX_SUPPORT TRUE)
endif()
# OpenGL and GLUT
find_package(OpenGL)
find_package(GLUT)
set(HAVE_OPENGL FALSE)
if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
set(HAVE_OPENGL TRUE)
endif()
# Purely to satisfy the generated headers:
check_include_file(GL/gl.h HAVE_GL_GL_H)
check_include_file(GL/glu.h HAVE_GL_GLU_H)
check_include_file(GL/glut.h HAVE_GL_GLUT_H)
check_include_file(GLUT/glut.h HAVE_GLUT_GLUT_H)
check_include_file(OpenGL/gl.h HAVE_OPENGL_GL_H)
check_include_file(OpenGL/glu.h HAVE_OPENGL_GLU_H)
# Win32 IO
set(win32_io FALSE)
if(WIN32)
set(win32_io TRUE)
endif()
set(USE_WIN32_FILEIO ${win32_io})
# Orthogonal features
include(LibraryFeatures)
# Strip chopping
option(strip-chopping "strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage)" ON)
set(TIFF_DEFAULT_STRIP_SIZE 8192 CACHE STRING "default size of the strip in bytes (when strip chopping is enabled)")
# math.h/libm portability
find_package(CMath REQUIRED)
set(STRIPCHOP_DEFAULT)
if(strip-chopping)
set(STRIPCHOP_DEFAULT TRUE)
if(TIFF_DEFAULT_STRIP_SIZE)
set(STRIP_SIZE_DEFAULT "${TIFF_DEFAULT_STRIP_SIZE}")
endif()
endif()
# Release support
include(Release)
# Defer loading of strip/tile offsets
option(defer-strile-load "enable deferred strip/tile offset/size loading (also available at runtime with the 'D' flag of TIFFOpen())" OFF)
set(DEFER_STRILE_LOAD ${defer-strile-load})
# CHUNKY_STRIP_READ_SUPPORT
option(chunky-strip-read "enable reading large strips in chunks for TIFFReadScanline() (experimental)" OFF)
set(CHUNKY_STRIP_READ_SUPPORT ${chunky-strip-read})
# SUBIFD support
set(SUBIFD_SUPPORT 1)
# Default handling of ASSOCALPHA support.
option(extrasample-as-alpha "the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly" ON)
if(extrasample-as-alpha)
set(DEFAULT_EXTRASAMPLE_AS_ALPHA 1)
endif()
# Default handling of YCbCr subsampling support.
# See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details.
option(check-ycbcr-subsampling "enable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag" ON)
if (check-ycbcr-subsampling)
set(CHECK_JPEG_YCBCR_SUBSAMPLING 1)
endif()
# Generate pkg-config file
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libtiff-4.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc
DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
# Includes used by libtiff (and tests)
if(ZLIB_INCLUDE_DIRS)
list(APPEND TIFF_INCLUDES $<BUILD_INTERFACE:${ZLIB_INCLUDE_DIRS}>)
endif()
if(DEFLATE_INCLUDE_DIR)
list(APPEND TIFF_INCLUDES ${DEFLATE_INCLUDE_DIR})
endif()
if(JPEG_INCLUDE_DIR)
list(APPEND TIFF_INCLUDES ${JPEG_INCLUDE_DIR})
endif()
if(JPEG12_INCLUDE_DIR)
list(APPEND TIFF_INCLUDES ${JPEG12_INCLUDE_DIR})
endif()
if(JBIG_INCLUDE_DIR)
list(APPEND TIFF_INCLUDES ${JBIG_INCLUDE_DIR})
endif()
if(LIBLZMA_INCLUDE_DIRS)
list(APPEND TIFF_INCLUDES ${LIBLZMA_INCLUDE_DIRS})
endif()
if(ZSTD_INCLUDE_DIR)
list(APPEND TIFF_INCLUDES ${ZSTD_INCLUDE_DIR})
endif()
if(WEBP_INCLUDE_DIR)
list(APPEND TIFF_INCLUDES ${WEBP_INCLUDE_DIR})
endif()
# Libraries required by libtiff
set(TIFF_LIBRARY_DEPS)
if(NOT WIN32 AND M_LIBRARY)
list(APPEND TIFF_LIBRARY_DEPS "m")
endif()
if(ZLIB_LIBRARIES)
list(APPEND TIFF_LIBRARY_DEPS ${ZLIB_LIBRARIES})
endif()
if(DEFLATE_LIBRARIES)
list(APPEND TIFF_LIBRARY_DEPS ${DEFLATE_LIBRARIES})
endif()
if(JPEG_LIBRARIES)
list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES})
endif()
if(JPEG12_LIBRARIES)
list(APPEND TIFF_LIBRARY_DEPS ${JPEG12_LIBRARIES})
endif()
if(JBIG_LIBRARIES)
list(APPEND TIFF_LIBRARY_DEPS ${JBIG_LIBRARIES})
endif()
if(LIBLZMA_LIBRARIES)
list(APPEND TIFF_LIBRARY_DEPS ${LIBLZMA_LIBRARIES})
endif()
if(ZSTD_LIBRARIES)
list(APPEND TIFF_LIBRARY_DEPS ${ZSTD_LIBRARIES})
endif()
if(WEBP_LIBRARIES)
list(APPEND TIFF_LIBRARY_DEPS ${WEBP_LIBRARIES})
endif()
#report_values(TIFF_INCLUDES TIFF_LIBRARY_DEPS)
# Process subdirectories
add_subdirectory(port)
add_subdirectory(libtiff)
if(tiff-tools)
add_subdirectory(tools)
endif()
if(tiff-tests)
add_subdirectory(test)
endif()
if(tiff-contrib)
add_subdirectory(contrib)
endif()
add_subdirectory(build)
if(tiff-docs)
add_subdirectory(doc)
endif()
#add_subdirectory(tools)
#add_subdirectory(test)
#add_subdirectory(contrib)
#add_subdirectory(build)
#add_subdirectory(man)
#add_subdirectory(html)
# pkg-config support
include(PkgConfig)
#message(STATUS "EXTRA_DIST: ${EXTRA_DIST}")
message(STATUS "")
message(STATUS "Libtiff is now configured for ${CMAKE_SYSTEM}")
message(STATUS "Libtiff is now configured for ${host}")
message(STATUS "")
message(STATUS " Installation directory: ${prefix}")
message(STATUS " Documentation directory: ${LIBTIFF_DOCDIR}")
message(STATUS " C compiler: ${CMAKE_C_COMPILER}")
message(STATUS " C++ compiler: ${CMAKE_CXX_COMPILER}")
message(STATUS " Build shared libraries: ${BUILD_SHARED_LIBS}")
message(STATUS " Build tools: ${tiff-tools}")
message(STATUS " Build tests: ${tiff-tests}")
message(STATUS " Build contrib: ${tiff-contrib}")
message(STATUS " Build docs: ${tiff-docs}")
message(STATUS " Build deprecated features: ${tiff-deprecated}")
message(STATUS " Enable linker symbol versioning: ${HAVE_LD_VERSION_SCRIPT}")
message(STATUS " Support Microsoft Document Imaging: ${mdi}")
message(STATUS " Use win32 IO: ${USE_WIN32_FILEIO}")
@ -189,40 +769,19 @@ message(STATUS " NeXT 2-bit RLE algorithm: ${next}")
message(STATUS " LogLuv high dynamic range encoding: ${logluv}")
message(STATUS "")
message(STATUS " Support for external codecs:")
message(STATUS " ZLIB support: Requested:${zlib} Availability:${ZLIB_FOUND} Support:${ZLIB_SUPPORT}")
if(ZLIB_SUPPORT)
message(STATUS " libdeflate support: Requested:${libdeflate} Availability:${DEFLATE_FOUND} Support:${LIBDEFLATE_SUPPORT}")
else()
message(STATUS " libdeflate support: Requested:${libdeflate} Availability:${DEFLATE_FOUND} Support:${LIBDEFLATE_SUPPORT} (Depends on ZLIB Support)")
endif()
if(ZLIB_SUPPORT)
message(STATUS " Pixar log-format algorithm: Requested:${pixarlog} Availability:${ZLIB_FOUND} Support:${PIXARLOG_SUPPORT}")
else()
message(STATUS " Pixar log-format algorithm: Requested:${pixarlog} Availability:${ZLIB_FOUND} Support:${PIXARLOG_SUPPORT} (Depends on ZLIB Support)")
endif()
message(STATUS " JPEG support: Requested:${jpeg} Availability:${JPEG_FOUND} Support:${JPEG_SUPPORT}")
if(JPEG_SUPPORT)
message(STATUS " Old JPEG support: Requested:${old-jpeg} Availability:${JPEG_SUPPORT} Support:${OJPEG_SUPPORT}")
else()
message(STATUS " Old JPEG support: Requested:${old-jpeg} Availability:${JPEG_SUPPORT} Support:${OJPEG_SUPPORT} (Depends on JPEG Support)")
endif()
if(JPEG_SUPPORT AND HAVE_JPEGTURBO_DUAL_MODE_8_12)
message(STATUS " JPEG 8/12 bit dual mode: Support: yes (libjpeg turbo >= 2.2 dual mode)")
else()
message(STATUS " JPEG 8/12 bit dual mode: Requested:${jpeg12} Availability:${JPEG12_FOUND} Support:${JPEG_DUAL_MODE_8_12}")
endif()
message(STATUS " ISO JBIG support: Requested:${jbig} Availability:${JBIG_FOUND} Support:${JBIG_SUPPORT}")
if(ZLIB_SUPPORT)
message(STATUS " LERC support: Requested:${lerc} Availability:${LERC_FOUND} Support:${LERC_SUPPORT}")
else()
message(STATUS " LERC support: Requested:${lerc} Availability:${LERC_FOUND} Support:${LERC_SUPPORT} (Depends on ZLIB Support)")
endif()
message(STATUS " LZMA2 support: Requested:${lzma} Availability:${liblzma_FOUND} Support:${LZMA_SUPPORT}")
message(STATUS " ZSTD support: Requested:${zstd} Availability:${ZSTD_USABLE} Support:${ZSTD_SUPPORT}")
message(STATUS " WEBP support: Requested:${webp} Availability:${WebP_FOUND} Support:${WEBP_SUPPORT}")
message(STATUS " ZLIB support: ${zlib} (requested) ${ZLIB_FOUND} (availability)")
message(STATUS " libdeflate support: ${libdeflate} (requested) ${LIBDEFLATE_SUPPORT} (availability)")
message(STATUS " Pixar log-format algorithm: ${pixarlog} (requested) ${PIXARLOG_SUPPORT} (availability)")
message(STATUS " JPEG support: ${jpeg} (requested) ${JPEG_FOUND} (availability)")
message(STATUS " Old JPEG support: ${old-jpeg} (requested) ${JPEG_FOUND} (availability)")
message(STATUS " JPEG 8/12 bit dual mode: ${jpeg12} (requested) ${JPEG12_FOUND} (availability)")
message(STATUS " ISO JBIG support: ${jbig} (requested) ${JBIG_FOUND} (availability)")
message(STATUS " LZMA2 support: ${lzma} (requested) ${LIBLZMA_FOUND} (availability)")
message(STATUS " ZSTD support: ${zstd} (requested) ${ZSTD_FOUND} (availability)")
message(STATUS " WEBP support: ${webp} (requested) ${WEBP_FOUND} (availability)")
message(STATUS "")
message(STATUS " C++ support: ${cxx} (requested) ${CXX_SUPPORT} (availability)")
message(STATUS "")
# message(STATUS " X Athena Widgets support: ${HAVE_XAW}")
message(STATUS " OpenGL support: Requested:${tiff-opengl} Availability:${HAVE_OPENGL} Support:${OPENGL_SUPPORT}")
message(STATUS " OpenGL support: ${HAVE_OPENGL}")
message(STATUS "")

View file

@ -1,19 +0,0 @@
Contributing
------------
libtiff uses a ``.clang-format`` file to enforce code formatting rules.
Automatic code reformatting can be done with pre-commit.
Install (once) pre-commit with ``python -m pip install pre-commit``.
Install it (once) in the libtiff git repository with ``pre-commit install``.
Then the rules defined in the ``.pre-commit-config.yaml`` file will be
enforced at ``git commit`` time, with automatic reformatting.
Due to whole-tree code reformatting done during libtiff 4.5 development,
``git blame`` information might be misleading. To avoid that, you need
to modify your git configuration as following to ignore the revision of
the whole-tree reformatting:
``git config blame.ignoreRevsFile .git-blame-ignore-revs``.

View file

@ -1,7 +1,5 @@
# LibTIFF license
Copyright © 1988-1997 Sam Leffler\
Copyright © 1991-1997 Silicon Graphics, Inc.
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

File diff suppressed because it is too large Load diff

View file

@ -25,11 +25,7 @@ Notes on releasing.
1. Commit any unsaved changes.
2. Use gnulib's gitlog-to-changelog script to add new (since the last
release) entries to the traditional ChangeLog file.
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/gitlog-to-changelog
Take note of
release) entries to the traditional ChangeLog file. Take note of
the most recent change note time stamp and use that as the starting
point. Concatenate the old logs to the new logs. The added logs
may be used to help produce the release notes (in next step). For
@ -41,14 +37,13 @@ Notes on releasing.
mv ChangeLog.new ChangeLog
rm ChangeLog.added
3. Create doc/releases/vX.X.rst and add it to git with 'git add doc/releases/vX.X.rst'.
Update doc/releases/index.rst to point to the new file
Take ChangeLog entries and rst-ify in there.
Easist thing to do is take doc/releases/vX.(X-1).rst and use it as a template.
3. Create html/vX.X.html and add it to git with 'git add html/vX.X.html'.
Take ChangeLog entries and html-ify in there.
Easist thing to do is take html/vX.(X-1).html and use it as a template.
4. Add vX.X.rst file to the list of 'rst_sources' files in the doc/Makefile.am.
4. Add vX.X.html file to the list of 'docfiles' files in the html/Makefile.am.
5. Update "Latest Stable Release" in doc/index.rst.
5. Update html/index.html to refer to this new page as the current release.
6. Increment the release version in configure.ac. Put 'alpha' or
'beta' after the version, if applicable. For example:
@ -134,18 +129,18 @@ Notes on releasing.
16. Sign the release files in the build tree using your private key
export GPG_TTY=$(tty)
for file in tiff-*.tar.gz tiff-*.tar.xz tiff-*.zip ; do \
for file in tiff-*.tar.gz tiff-*.zip ; do \
gpg2 --output ${file}.sig --detach-sig $file ; \
done
for file in tiff-*.tar.gz tiff-*.tar.xz tiff-*.zip ; do \
for file in tiff-*.tar.gz tiff-*.zip ; do \
gpg2 --verify ${file}.sig $file ; \
done
17. Copy release packages from the build tree to the
ftp.remotesensing.org ftp site.
scp tiff-*.tar.gz tiff-*.tar.gz.sig tiff-*.tar.xz tiff-*.tar.xz.sig tiff-*.zip tiff-*.zip.sig \
scp tiff-*.tar.gz tiff-*.tar.gz.sig tiff-*.zip tiff-*.zip.sig \
bfriesen@upload.osgeo.org:/osgeo/download/libtiff
18. Announce to list: tiff@lists.osgeo.org
18. Announce to list, tiff@lists.maptools.org

View file

@ -29,30 +29,30 @@ AUTOMAKE_OPTIONS = 1.12 dist-zip foreign
ACLOCAL_AMFLAGS = -I m4
docfiles = \
COPYRIGHT \
ChangeLog \
LICENSE.md \
README.md \
RELEASE-DATE \
TODO \
VERSION
EXTRA_DIST = \
placeholder.h \
cmake \
CMakeLists.txt \
HOWTO-RELEASE \
Makefile.vc \
SConstruct \
autogen.sh \
libtiff-4.pc.in
configure.com \
libtiff-4.pc.in \
nmake.opt
if TIFF_DOCS
dist_doc_DATA = $(docfiles)
endif
distcheck-hook:
if [ -x "$(CMAKE)" ]; then \
mkdir $(distdir)/_build/cmake \
&& cd $(distdir)/_build/cmake \
&& cmake -Dsphinx=OFF ../.. \
&& cmake ../.. \
&& $(MAKE) \
&& ctest -V \
&& $(MAKE) DESTDIR=../../_inst/cmake install ; \
@ -60,12 +60,12 @@ distcheck-hook:
rm -rf $(distdir)/_build/cmake
rm -rf $(distdir)/_inst/cmake
SUBDIRS = port libtiff tools build contrib test doc
SUBDIRS = port libtiff tools build contrib test man html
release:
(rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)
(rm -f $(top_srcdir)/VERSION && echo $(LIBTIFF_VERSION) > $(top_srcdir)/VERSION)
(rm -f $(top_srcdir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),;s,LIBTIFF_MAJOR_VERSION,$(LIBTIFF_MAJOR_VERSION),;s,LIBTIFF_MINOR_VERSION,$(LIBTIFF_MINOR_VERSION),;s,LIBTIFF_MICRO_VERSION,$(LIBTIFF_MICRO_VERSION),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_srcdir)/libtiff/tiffvers.h)
(rm -f $(top_srcdir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_srcdir)/libtiff/tiffvers.h)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libtiff-4.pc

View file

@ -1,8 +1,5 @@
# Checks for symbols
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
@ -22,22 +19,42 @@
# 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.
#
# Makefile for MS Visual C and Watcom C compilers.
# Edit nmake.opt file if you want to ajust building options.
#
# To build:
# C:\libtiff> nmake /f makefile.vc
!INCLUDE nmake.opt
include(CheckSymbolExists)
all: port lib tools
port::
cd libtiff
$(MAKE) /f Makefile.vc tif_config.h
cd..
cd port
$(MAKE) /f Makefile.vc
cd..
# Check for getopt
check_symbol_exists(getopt "unistd.h;stdio.h" HAVE_GETOPT)
check_symbol_exists(optarg "getopt.h" HAVE_DECL_OPTARG)
if (HAVE_DECL_OPTARG)
set(HAVE_DECL_OPTARG 1)
else()
set(HAVE_DECL_OPTARG 0)
endif()
lib: port
cd libtiff
$(MAKE) /f Makefile.vc
cd..
# Check for mmap
check_symbol_exists(mmap "sys/mman.h" HAVE_MMAP)
tools: lib
cd tools
$(MAKE) /f Makefile.vc
cd ..
# Check for setmode
check_symbol_exists(setmode "unistd.h" HAVE_SETMODE)
clean:
cd port
$(MAKE) /f Makefile.vc clean
cd..
cd libtiff
$(MAKE) /f Makefile.vc clean
cd..
cd tools
$(MAKE) /f Makefile.vc clean
cd ..

View file

@ -1 +1 @@
20230609
20201219

View file

@ -0,0 +1,169 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2005, Andrey Kiselev <dron@ak4719.spb.edu>
#
# 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.
# This file contains rules to build software with the SCons tool
# (see the http://www.scons.org/ for details on SCons).
import os
env = Environment()
# Read the user supplied options
opts = Options('libtiff.conf')
opts.Add(PathOption('PREFIX', \
'install architecture-independent files in this directory', \
'/usr/local', PathOption.PathIsDirCreate))
opts.Add(BoolOption('ccitt', \
'enable support for CCITT Group 3 & 4 algorithms', \
'yes'))
opts.Add(BoolOption('packbits', \
'enable support for Macintosh PackBits algorithm', \
'yes'))
opts.Add(BoolOption('lzw', \
'enable support for LZW algorithm', \
'yes'))
opts.Add(BoolOption('thunder', \
'enable support for ThunderScan 4-bit RLE algorithm', \
'yes'))
opts.Add(BoolOption('next', \
'enable support for NeXT 2-bit RLE algorithm', \
'yes'))
opts.Add(BoolOption('logluv', \
'enable support for LogLuv high dynamic range encoding', \
'yes'))
opts.Add(BoolOption('strip_chopping', \
'support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage)', \
'yes'))
opts.Add(BoolOption('extrasample_as_alpha', \
'the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don\'t mark the alpha properly', \
'yes'))
opts.Add(BoolOption('check_ycbcr_subsampling', \
'disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag', \
'yes'))
opts.Update(env)
opts.Save('libtiff.conf', env)
Help(opts.GenerateHelpText(env))
# Here are our installation paths:
idir_prefix = '$PREFIX'
idir_lib = '$PREFIX/lib'
idir_bin = '$PREFIX/bin'
idir_inc = '$PREFIX/include'
idir_doc = '$PREFIX/doc'
Export([ 'env', 'idir_prefix', 'idir_lib', 'idir_bin', 'idir_inc', 'idir_doc' ])
# Now proceed to system feature checks
target_cpu, target_vendor, target_kernel, target_os = \
os.popen("./config/config.guess").readlines()[0].split("-")
def Define(context, key, have):
import SCons.Conftest
SCons.Conftest._Have(context, key, have)
def CheckCustomOption(context, name):
context.Message('Checking is the ' + name + ' option set... ')
ret = env[name]
Define(context, name + '_SUPPORT', ret)
context.Result(ret)
return ret
def CheckFillorderOption(context):
context.Message('Checking for the native cpu bit order... ')
if target_cpu[0] == 'i' and target_cpu[2:] == '86':
Define(context, 'HOST_FILLORDER', 'FILLORDER_LSB2MSB')
context.Result('lsb2msb')
else:
Define(context, 'HOST_FILLORDER', 'FILLORDER_MSB2LSB')
context.Result('msb2lsb')
return 1
def CheckIEEEFPOption(context):
context.Message('Checking for the IEEE floating point format... ')
Define(context, 'HAVE_IEEEFP', 1)
context.Result(1)
return 1
def CheckOtherOption(context, name):
context.Message('Checking is the ' + name + ' option set... ')
ret = env[name]
Define(context, 'HAVE_' + name, ret)
context.Result(ret)
return ret
custom_tests = { \
'CheckCustomOption' : CheckCustomOption, \
'CheckFillorderOption' : CheckFillorderOption, \
'CheckIEEEFPOption' : CheckIEEEFPOption, \
'CheckOtherOption' : CheckOtherOption \
}
conf = Configure(env, custom_tests = custom_tests, \
config_h = 'libtiff/tif_config.h')
# Check for standard library
conf.CheckLib('c')
if target_os != 'cygwin' \
and target_os != 'mingw32' \
and target_os != 'beos' \
and target_os != 'darwin':
conf.CheckLib('m')
# Check for system headers
conf.CheckCHeader('assert.h')
conf.CheckCHeader('fcntl.h')
conf.CheckCHeader('io.h')
conf.CheckCHeader('limits.h')
conf.CheckCHeader('malloc.h')
conf.CheckCHeader('search.h')
conf.CheckCHeader('sys/time.h')
conf.CheckCHeader('unistd.h')
# Check for standard library functions
conf.CheckFunc('floor')
conf.CheckFunc('isascii')
conf.CheckFunc('memmove')
conf.CheckFunc('memset')
conf.CheckFunc('mmap')
conf.CheckFunc('pow')
conf.CheckFunc('setmode')
conf.CheckFunc('sqrt')
conf.CheckFunc('strchr')
conf.CheckFunc('strrchr')
conf.CheckFunc('strstr')
conf.CheckFunc('strtol')
conf.CheckFillorderOption()
conf.CheckIEEEFPOption()
conf.CheckCustomOption('ccitt')
conf.CheckCustomOption('packbits')
conf.CheckCustomOption('lzw')
conf.CheckCustomOption('thunder')
conf.CheckCustomOption('next')
conf.CheckCustomOption('logluv')
conf.CheckOtherOption('strip_chopping')
conf.CheckOtherOption('extrasample_as_alpha')
conf.CheckOtherOption('check_ycbcr_subsampling')
env = conf.Finish()
# Ok, now go to build files in the subdirectories
SConscript(dirs = [ 'libtiff' ], name = 'SConstruct')

View file

@ -1 +1 @@
4.5.1
4.2.0

File diff suppressed because it is too large Load diff

View file

@ -33,18 +33,18 @@
*/
#include "tif_config.h"
#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# include <unistd.h>
#endif
#ifdef NEED_LIBPORT
#include "libport.h"
# include "libport.h"
#endif
#include "tiffio.h"
@ -53,36 +53,38 @@
#define IMAX 0xffff /* max intensity value */
#define EXTRAFUDGE 128 /* some people write BAD .gif files */
#define streq(a, b) (strcmp(a, b) == 0)
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
#define streq(a,b) (strcmp(a,b) == 0)
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
unsigned short gamtab[256];
void makegamtab(float gam)
void
makegamtab(float gam)
{
int i;
for (i = 0; i < 256; i++)
gamtab[i] = (unsigned short)(IMAX * pow(i / 255.0, gam) + 0.5);
for(i=0; i<256; i++)
gamtab[i] = (unsigned short) (IMAX*pow(i/255.0,gam)+0.5);
}
char *stuff[] = {
"usage: gif2tiff [options] input.gif output.tif",
"where options are:",
" -r # make each strip have no more than # rows",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c zip[:opts] compress output with deflate encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"LZW and deflate options:",
" # set predictor value",
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
"differencing",
NULL};
char* stuff[] = {
"usage: gif2tiff [options] input.gif output.tif",
"where options are:",
" -r # make each strip have no more than # rows",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c zip[:opts] compress output with deflate encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"LZW and deflate options:",
" # set predictor value",
"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
NULL
};
static void usage(void)
static void
usage(void)
{
char buf[BUFSIZ];
int i;
@ -100,14 +102,14 @@ unsigned char *stackp;
unsigned int prefix[4096];
unsigned char suffix[4096];
unsigned char stack[4096];
int datasize, codesize, codemask; /* Decoder working variables */
int clear, eoi; /* Special code values */
int datasize,codesize,codemask; /* Decoder working variables */
int clear,eoi; /* Special code values */
int avail, oldcode;
FILE *infile;
int global; /* Is there a global color map? */
int globalbits; /* Number of bits of global colors */
unsigned char globalmap[COLSIZE][3]; /* RGB values for global color map */
unsigned char globalmap[COLSIZE][3];/* RGB values for global color map */
unsigned char *raster; /* Decoded image data */
unsigned long width, height;
unsigned short red[COLSIZE];
@ -115,22 +117,23 @@ unsigned short green[COLSIZE];
unsigned short blue[COLSIZE];
char *filename, *imagename;
static uint16_t compression = COMPRESSION_PACKBITS;
static uint16_t predictor = 0;
static uint32_t rowsperstrip = (uint32_t)-1;
static int processCompressOptions(char *);
static uint16 compression = COMPRESSION_PACKBITS;
static uint16 predictor = 0;
static uint32 rowsperstrip = (uint32) -1;
static int processCompressOptions(char*);
int convert(void);
int checksignature(void);
int readscreen(void);
int readgifimage(char *);
int readgifimage(char*);
int readextension(void);
int readraster(void);
int process(int, unsigned char **);
void initcolors(unsigned char[COLSIZE][3], int);
void rasterize(int, char *);
int process(int, unsigned char**);
void initcolors(unsigned char [COLSIZE][3], int);
void rasterize(int, char*);
int main(int argc, char *argv[])
int
main(int argc, char* argv[])
{
#if !HAVE_DECL_OPTARG
extern int optind;
@ -140,8 +143,7 @@ int main(int argc, char *argv[])
int c, status;
while ((c = getopt(argc, argv, "c:r:")) != -1)
switch (c)
{
switch (c) {
case 'c': /* compression scheme */
if (!processCompressOptions(optarg))
usage();
@ -158,19 +160,16 @@ int main(int argc, char *argv[])
makegamtab(GIFGAMMA);
filename = argv[optind];
imagename = argv[optind + 1];
if ((infile = fopen(imagename, "rb")) != NULL)
{
imagename = argv[optind+1];
if ((infile = fopen(imagename, "rb")) != NULL) {
int c;
fclose(infile);
printf("overwrite %s? ", imagename);
fflush(stdout);
printf("overwrite %s? ", imagename); fflush(stdout);
c = getc(stdin);
if (c != 'y' && c != 'Y')
return (1);
}
if ((infile = fopen(filename, "rb")) == NULL)
{
if ((infile = fopen(filename, "rb")) == NULL) {
perror(filename);
return (1);
}
@ -179,80 +178,70 @@ int main(int argc, char *argv[])
return (status);
}
static int processCompressOptions(char *opt)
static int
processCompressOptions(char* opt)
{
if (streq(opt, "none"))
compression = COMPRESSION_NONE;
else if (streq(opt, "packbits"))
compression = COMPRESSION_PACKBITS;
else if (strneq(opt, "lzw", 3))
{
char *cp = strchr(opt, ':');
else if (strneq(opt, "lzw", 3)) {
char* cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
predictor = atoi(cp+1);
compression = COMPRESSION_LZW;
}
else if (strneq(opt, "zip", 3))
{
char *cp = strchr(opt, ':');
} else if (strneq(opt, "zip", 3)) {
char* cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
compression = COMPRESSION_ADOBE_DEFLATE;
}
else
predictor = atoi(cp+1);
compression = COMPRESSION_DEFLATE;
} else
return (0);
return (1);
}
int convert(void)
int
convert(void)
{
int ch;
char *mode = "w";
char* mode = "w";
if (!checksignature())
return (-1);
if (!readscreen())
return (-1);
while ((ch = getc(infile)) != ';' && ch != EOF)
{
switch (ch)
{
case '\0':
break; /* this kludge for non-standard files */
case ',':
if (!readgifimage(mode))
while ((ch = getc(infile)) != ';' && ch != EOF) {
switch (ch) {
case '\0': break; /* this kludge for non-standard files */
case ',': if (!readgifimage(mode))
return (-1);
mode = "a"; /* subsequent images append */
break;
case '!':
if (!readextension())
case '!': if (!readextension())
return (-1);
break;
default:
fprintf(stderr, "illegal GIF block type\n");
default: fprintf(stderr, "illegal GIF block type\n");
return (-1);
}
}
return (0);
}
int checksignature(void)
int
checksignature(void)
{
char buf[6];
if (fread(buf, 1, 6, infile) != 6)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
if (fread(buf,1,6,infile) != 6) {
fprintf(stderr, "short read from file %s (%s)\n",
filename, strerror(errno));
return 0;
}
if (strncmp(buf, "GIF", 3))
{
if (strncmp(buf,"GIF",3)) {
fprintf(stderr, "file is not a GIF file\n");
return 0;
}
if (strncmp(&buf[3], "87a", 3))
{
if (strncmp(&buf[3],"87a",3)) {
fprintf(stderr, "unknown GIF version number\n");
return 0;
}
@ -264,32 +253,31 @@ int checksignature(void)
* Get information which is global to all the images stored
* in the file
*/
int readscreen(void)
int
readscreen(void)
{
unsigned char buf[7];
if (fread(buf, 1, 7, infile) != 7)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
if (fread(buf,1,7,infile) != 7) {
fprintf(stderr, "short read from file %s (%s)\n",
filename, strerror(errno));
return 0;
}
global = buf[4] & 0x80;
if (global)
{
if (global) {
globalbits = (buf[4] & 0x07) + 1;
if (fread(globalmap, 3, ((size_t)1) << globalbits, infile) !=
((size_t)1) << globalbits)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
if (fread(globalmap,3,((size_t)1)<<globalbits,infile) !=
((size_t)1)<<globalbits) {
fprintf(stderr, "short read from file %s (%s)\n",
filename, strerror(errno));
return 0;
}
}
return 1;
}
int readgifimage(char *mode)
int
readgifimage(char* mode)
{
unsigned char buf[9];
int local, interleaved;
@ -298,58 +286,47 @@ int readgifimage(char *mode)
int status;
size_t raster_size;
if (fread(buf, 1, 9, infile) != 9)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
if (fread(buf, 1, 9, infile) != 9) {
fprintf(stderr, "short read from file %s (%s)\n",
filename, strerror(errno));
return (0);
}
width = (buf[4] + (buf[5] << 8)) & 0xffff; /* 16 bit */
height = (buf[6] + (buf[7] << 8)) & 0xffff; /* 16 bit */
local = buf[8] & 0x80;
interleaved = buf[8] & 0x40;
if (width == 0UL || height == 0UL || (width > 2000000000UL / height))
{
if (width == 0UL || height == 0UL || (width > 2000000000UL / height)) {
fprintf(stderr, "Invalid value of width or height\n");
return (0);
return(0);
}
if (local == 0 && global == 0)
{
if (local == 0 && global == 0) {
fprintf(stderr, "no colormap present for image\n");
return (0);
}
raster_size = width * height;
if ((raster_size / width) == height)
{
raster_size=width*height;
if ((raster_size/width) == height) {
raster_size += EXTRAFUDGE; /* Add elbow room */
} else {
raster_size=0;
}
else
{
raster_size = 0;
}
if ((raster = (unsigned char *)_TIFFmalloc(raster_size)) == NULL)
{
if ((raster = (unsigned char*) _TIFFmalloc(raster_size)) == NULL) {
fprintf(stderr, "not enough memory for image\n");
return (0);
}
if (local)
{
if (local) {
localbits = (buf[8] & 0x7) + 1;
fprintf(stderr, " local colors: %d\n", 1 << localbits);
fprintf(stderr, " local colors: %d\n", 1<<localbits);
if (fread(localmap, 3, ((size_t)1) << localbits, infile) !=
((size_t)1) << localbits)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
if (fread(localmap, 3, ((size_t)1)<<localbits, infile) !=
((size_t)1)<<localbits) {
fprintf(stderr, "short read from file %s (%s)\n",
filename, strerror(errno));
return (0);
}
initcolors(localmap, 1 << localbits);
}
else if (global)
{
initcolors(globalmap, 1 << globalbits);
initcolors(localmap, 1<<localbits);
} else if (global) {
initcolors(globalmap, 1<<globalbits);
}
if ((status = readraster()))
rasterize(interleaved, mode);
@ -362,18 +339,18 @@ int readgifimage(char *mode)
* Read a GIF extension block (and do nothing with it).
*
*/
int readextension(void)
int
readextension(void)
{
int count;
char buf[255];
int status = 1;
(void)getc(infile);
(void) getc(infile);
while ((count = getc(infile)) && count <= 255)
if (fread(buf, 1, count, infile) != (size_t)count)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
if (fread(buf, 1, count, infile) != (size_t) count) {
fprintf(stderr, "short read from file %s (%s)\n",
filename, strerror(errno));
status = 0;
break;
}
@ -385,12 +362,13 @@ int readextension(void)
* Decode a raster image
*
*/
int readraster(void)
int
readraster(void)
{
unsigned char *fill = raster;
unsigned char buf[255];
register int bits = 0;
register unsigned long datum = 0;
register int bits=0;
register unsigned long datum=0;
register unsigned char *ch;
register int count, code;
int status = 1;
@ -404,53 +382,44 @@ int readraster(void)
oldcode = -1;
codesize = datasize + 1;
codemask = (1 << codesize) - 1;
for (code = 0; code < clear; code++)
{
for (code = 0; code < clear; code++) {
prefix[code] = 0;
suffix[code] = code;
}
stackp = stack;
for (count = getc(infile); count > 0 && count <= 255; count = getc(infile))
{
if (fread(buf, 1, count, infile) != (size_t)count)
{
fprintf(stderr, "short read from file %s (%s)\n", filename,
strerror(errno));
for (count = getc(infile); count > 0 && count <= 255; count = getc(infile)) {
if (fread(buf,1,count,infile) != (size_t)count) {
fprintf(stderr, "short read from file %s (%s)\n",
filename, strerror(errno));
return 0;
}
for (ch = buf; count-- > 0; ch++)
{
datum += (unsigned long)*ch << bits;
for (ch=buf; count-- > 0; ch++) {
datum += (unsigned long) *ch << bits;
bits += 8;
while (bits >= codesize)
{
while (bits >= codesize) {
code = datum & codemask;
datum >>= codesize;
bits -= codesize;
if (code == eoi)
{ /* This kludge put in */
if (code == eoi) { /* This kludge put in */
goto exitloop; /* because some GIF files*/
} /* aren't standard */
if (!process(code, &fill))
{
if (!process(code, &fill)) {
status = 0;
goto exitloop;
}
}
}
if (fill >= raster + width * height)
{
if (fill >= raster + width*height) {
fprintf(stderr, "raster full before eoi code\n");
break;
}
}
exitloop:
if (fill != raster + width * height)
{
if (fill != raster + width*height) {
fprintf(stderr, "warning: wrong rastersize: %ld bytes\n",
(long)(fill - raster));
(long) (fill-raster));
fprintf(stderr, " instead of %ld bytes\n",
(long)width * height);
(long) width*height);
}
return status;
}
@ -461,13 +430,13 @@ exitloop:
* Otherwise make a new code table entry, and output the bytes
* associated with the code.
*/
int process(register int code, unsigned char **fill)
int
process(register int code, unsigned char** fill)
{
int incode;
static unsigned char firstchar;
if (code == clear)
{
if (code == clear) {
codesize = datasize + 1;
codemask = (1 << codesize) - 1;
avail = clear + 2;
@ -475,16 +444,12 @@ int process(register int code, unsigned char **fill)
return 1;
}
if (oldcode == -1)
{
if (code >= clear)
{
fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",
code, clear);
if (oldcode == -1) {
if (code >= clear) {
fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",code, clear);
return 0;
}
if (*fill >= raster + width * height)
{
if (*fill >= raster + width*height) {
fprintf(stderr, "raster full before eoi code\n");
return 0;
}
@ -492,20 +457,17 @@ int process(register int code, unsigned char **fill)
firstchar = oldcode = code;
return 1;
}
if (code > avail)
{
if (code > avail) {
fprintf(stderr, "code %d too large for %d\n", code, avail);
return 0;
}
incode = code;
if (code == avail)
{ /* the first code is always < avail */
if (code == avail) { /* the first code is always < avail */
*stackp++ = firstchar;
code = oldcode;
}
while (code > clear)
{
while (code > clear) {
*stackp++ = suffix[code];
code = prefix[code];
}
@ -515,16 +477,13 @@ int process(register int code, unsigned char **fill)
suffix[avail] = firstchar;
avail++;
if (((avail & codemask) == 0) && (avail < 4096))
{
if (((avail & codemask) == 0) && (avail < 4096)) {
codesize++;
codemask += avail;
}
oldcode = incode;
do
{
if (*fill >= raster + width * height)
{
do {
if (*fill >= raster + width*height) {
fprintf(stderr, "raster full before eoi code\n");
return 0;
}
@ -539,19 +498,20 @@ int process(register int code, unsigned char **fill)
* values.
*
*/
void initcolors(unsigned char colormap[COLSIZE][3], int ncolors)
void
initcolors(unsigned char colormap[COLSIZE][3], int ncolors)
{
register int i;
for (i = 0; i < ncolors; i++)
{
for (i = 0; i < ncolors; i++) {
red[i] = gamtab[colormap[i][0]];
green[i] = gamtab[colormap[i][1]];
blue[i] = gamtab[colormap[i][2]];
}
}
void rasterize(int interleaved, char *mode)
void
rasterize(int interleaved, char* mode)
{
register unsigned long row;
unsigned char *newras;
@ -560,40 +520,33 @@ void rasterize(int interleaved, char *mode)
tstrip_t strip;
tsize_t stripsize;
if ((newras = (unsigned char *)_TIFFmalloc(width * height + EXTRAFUDGE)) ==
NULL)
{
if ((newras = (unsigned char*) _TIFFmalloc(width*height+EXTRAFUDGE)) == NULL) {
fprintf(stderr, "not enough memory for image\n");
return;
}
#define DRAWSEGMENT(offset, step) \
{ \
for (row = offset; row < height; row += step) \
{ \
_TIFFmemcpy(newras + row * width, ras, width); \
#define DRAWSEGMENT(offset, step) { \
for (row = offset; row < height; row += step) { \
_TIFFmemcpy(newras + row*width, ras, width);\
ras += width; \
} \
}
ras = raster;
if (interleaved)
{
if (interleaved) {
DRAWSEGMENT(0, 8);
DRAWSEGMENT(4, 8);
DRAWSEGMENT(2, 4);
DRAWSEGMENT(1, 2);
}
else
} else
DRAWSEGMENT(0, 1);
#undef DRAWSEGMENT
tif = TIFFOpen(imagename, mode);
if (!tif)
{
TIFFError(imagename, "Can not open output image");
if (!tif) {
TIFFError(imagename,"Can not open output image");
exit(-1);
}
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32_t)width);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32_t)height);
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) width);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32) height);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
@ -601,10 +554,8 @@ void rasterize(int interleaved, char *mode)
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP,
rowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip));
TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);
switch (compression)
{
switch (compression) {
case COMPRESSION_LZW:
case COMPRESSION_ADOBE_DEFLATE:
case COMPRESSION_DEFLATE:
if (predictor != 0)
TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor);
@ -614,15 +565,12 @@ void rasterize(int interleaved, char *mode)
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
strip = 0;
stripsize = TIFFStripSize(tif);
for (row = 0; row < height; row += rowsperstrip)
{
if (rowsperstrip > height - row)
{
rowsperstrip = height - row;
for (row=0; row<height; row += rowsperstrip) {
if (rowsperstrip > height-row) {
rowsperstrip = height-row;
stripsize = TIFFVStripSize(tif, rowsperstrip);
}
if (TIFFWriteEncodedStrip(tif, strip, newras + row * width, stripsize) <
0)
if (TIFFWriteEncodedStrip(tif, strip, newras+row*width, stripsize) < 0)
break;
strip++;
}
@ -630,3 +578,12 @@ void rasterize(int interleaved, char *mode)
_TIFFfree(newras);
}
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/

View file

@ -24,57 +24,57 @@
#include "tif_config.h"
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# include <unistd.h>
#endif
#ifdef NEED_LIBPORT
#include "libport.h"
# include "libport.h"
#endif
#include "rasterfile.h"
#include "tiffio.h"
#ifndef howmany
#define howmany(x, y) (((x) + ((y)-1)) / (y))
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
#define streq(a, b) (strcmp(a, b) == 0)
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
#define streq(a,b) (strcmp(a,b) == 0)
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
static uint16_t compression = (uint16_t)-1;
static uint16 compression = (uint16) -1;
static int jpegcolormode = JPEGCOLORMODE_RGB;
static int quality = 75; /* JPEG quality */
static uint16_t predictor = 0;
static uint16 predictor = 0;
static void usage(void);
static int processCompressOptions(char *);
static int processCompressOptions(char*);
int main(int argc, char *argv[])
int
main(int argc, char* argv[])
{
unsigned char *buf;
unsigned char* buf;
long row;
tsize_t linebytes, scanline;
TIFF *out;
FILE *in;
struct rasterfile h;
uint16_t photometric;
uint16_t config = PLANARCONFIG_CONTIG;
uint32_t rowsperstrip = (uint32_t)-1;
uint16 photometric;
uint16 config = PLANARCONFIG_CONTIG;
uint32 rowsperstrip = (uint32) -1;
int c;
#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
extern char* optarg;
#endif
while ((c = getopt(argc, argv, "c:r:h")) != -1)
switch (c)
{
switch (c) {
case 'c': /* compression scheme */
if (!processCompressOptions(optarg))
usage();
@ -89,193 +89,158 @@ int main(int argc, char *argv[])
if (argc - optind != 2)
usage();
in = fopen(argv[optind], "rb");
if (in == NULL)
{
if (in == NULL) {
fprintf(stderr, "%s: Can not open.\n", argv[optind]);
return (-1);
}
if (fread(&h, sizeof(h), 1, in) != 1)
{
if (fread(&h, sizeof (h), 1, in) != 1) {
fprintf(stderr, "%s: Can not read header.\n", argv[optind]);
fclose(in);
return (-2);
}
if (strcmp(h.ras_magic, RAS_MAGIC) == 0)
{
if (strcmp(h.ras_magic, RAS_MAGIC) == 0) {
#ifndef WORDS_BIGENDIAN
TIFFSwabLong((uint32_t *)&h.ras_width);
TIFFSwabLong((uint32_t *)&h.ras_height);
TIFFSwabLong((uint32_t *)&h.ras_depth);
TIFFSwabLong((uint32_t *)&h.ras_length);
TIFFSwabLong((uint32_t *)&h.ras_type);
TIFFSwabLong((uint32_t *)&h.ras_maptype);
TIFFSwabLong((uint32_t *)&h.ras_maplength);
TIFFSwabLong((uint32 *)&h.ras_width);
TIFFSwabLong((uint32 *)&h.ras_height);
TIFFSwabLong((uint32 *)&h.ras_depth);
TIFFSwabLong((uint32 *)&h.ras_length);
TIFFSwabLong((uint32 *)&h.ras_type);
TIFFSwabLong((uint32 *)&h.ras_maptype);
TIFFSwabLong((uint32 *)&h.ras_maplength);
#endif
}
else if (strcmp(h.ras_magic, RAS_MAGIC_INV) == 0)
{
} else if (strcmp(h.ras_magic, RAS_MAGIC_INV) == 0) {
#ifdef WORDS_BIGENDIAN
TIFFSwabLong((uint32_t *)&h.ras_width);
TIFFSwabLong((uint32_t *)&h.ras_height);
TIFFSwabLong((uint32_t *)&h.ras_depth);
TIFFSwabLong((uint32_t *)&h.ras_length);
TIFFSwabLong((uint32_t *)&h.ras_type);
TIFFSwabLong((uint32_t *)&h.ras_maptype);
TIFFSwabLong((uint32_t *)&h.ras_maplength);
TIFFSwabLong((uint32 *)&h.ras_width);
TIFFSwabLong((uint32 *)&h.ras_height);
TIFFSwabLong((uint32 *)&h.ras_depth);
TIFFSwabLong((uint32 *)&h.ras_length);
TIFFSwabLong((uint32 *)&h.ras_type);
TIFFSwabLong((uint32 *)&h.ras_maptype);
TIFFSwabLong((uint32 *)&h.ras_maplength);
#endif
}
else
{
} else {
fprintf(stderr, "%s: Not a rasterfile.\n", argv[optind]);
fclose(in);
return (-3);
}
if ((h.ras_width <= 0) || (h.ras_width >= INT_MAX) || (h.ras_height <= 0) ||
(h.ras_height >= INT_MAX) || (h.ras_depth <= 0) ||
(h.ras_depth >= INT_MAX) || (h.ras_length <= 0) ||
(h.ras_length >= INT_MAX) || (h.ras_type <= 0) ||
(h.ras_maptype <= 0) || (h.ras_maplength <= 0) ||
(h.ras_maplength >= INT_MAX))
{
if ((h.ras_width <= 0) || (h.ras_width >= INT_MAX) ||
(h.ras_height <= 0) || (h.ras_height >= INT_MAX) ||
(h.ras_depth <= 0) || (h.ras_depth >= INT_MAX) ||
(h.ras_length <= 0) || (h.ras_length >= INT_MAX) ||
(h.ras_type <= 0) ||
(h.ras_maptype <= 0) ||
(h.ras_maplength <= 0) || (h.ras_maplength >= INT_MAX)) {
fprintf(stderr, "%s: Improper image header.\n", argv[optind]);
fclose(in);
return (-2);
}
if ((h.ras_depth != 1) && (h.ras_depth != 8) && (h.ras_depth != 24))
{
fprintf(stderr, "%s: Improper image depth (%d).\n", argv[optind],
h.ras_depth);
if ((h.ras_depth != 1) &&
(h.ras_depth != 8) &&
(h.ras_depth != 24)) {
fprintf(stderr, "%s: Improper image depth (%d).\n",
argv[optind], h.ras_depth);
fclose(in);
return (-2);
}
out = TIFFOpen(argv[optind + 1], "w");
out = TIFFOpen(argv[optind+1], "w");
if (out == NULL)
{
fclose(in);
return (-4);
}
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32_t)h.ras_width);
TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32_t)h.ras_height);
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) h.ras_width);
TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) h.ras_height);
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, h.ras_depth > 8 ? 3 : 1);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, h.ras_depth > 1 ? 8 : 1);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
if (h.ras_maptype != RMT_NONE)
{
uint16_t *red;
register uint16_t *map;
if (h.ras_maptype != RMT_NONE) {
uint16* red;
register uint16* map;
register int i, j;
int mapsize;
buf = (unsigned char *)_TIFFmalloc(h.ras_maplength);
if (buf == NULL)
{
if (buf == NULL) {
fprintf(stderr, "No space to read in colormap.\n");
fclose(in);
(void)TIFFClose(out);
return (-5);
}
if (fread(buf, h.ras_maplength, 1, in) != 1)
{
fprintf(stderr, "%s: Read error on colormap.\n", argv[optind]);
fclose(in);
(void)TIFFClose(out);
if (fread(buf, h.ras_maplength, 1, in) != 1) {
fprintf(stderr, "%s: Read error on colormap.\n",
argv[optind]);
return (-6);
}
mapsize = 1 << h.ras_depth;
if (h.ras_maplength > mapsize * 3)
{
fprintf(stderr, "%s: Huh, %d colormap entries, should be %d?\n",
argv[optind], h.ras_maplength, mapsize * 3);
fclose(in);
(void)TIFFClose(out);
mapsize = 1<<h.ras_depth;
if (h.ras_maplength > mapsize*3) {
fprintf(stderr,
"%s: Huh, %d colormap entries, should be %d?\n",
argv[optind], h.ras_maplength, mapsize*3);
return (-7);
}
red = (uint16_t *)_TIFFmalloc(mapsize * 3 * sizeof(uint16_t));
if (red == NULL)
{
red = (uint16*)_TIFFmalloc(mapsize * 3 * sizeof (uint16));
if (red == NULL) {
fprintf(stderr, "No space for colormap.\n");
fclose(in);
(void)TIFFClose(out);
return (-8);
}
map = red;
for (j = 0; j < 3; j++)
{
#define SCALE(x) (((x) * ((1L << 16) - 1)) / 255)
for (i = h.ras_maplength / 3; i-- > 0;)
for (j = 0; j < 3; j++) {
#define SCALE(x) (((x)*((1L<<16)-1))/255)
for (i = h.ras_maplength/3; i-- > 0;)
*map++ = SCALE(*buf++);
if ((i = h.ras_maplength / 3) < mapsize)
{
if ((i = h.ras_maplength/3) < mapsize) {
i = mapsize - i;
_TIFFmemset(map, 0, i * sizeof(uint16_t));
_TIFFmemset(map, 0, i*sizeof (uint16));
map += i;
}
}
TIFFSetField(out, TIFFTAG_COLORMAP, red, red + mapsize,
red + 2 * mapsize);
TIFFSetField(out, TIFFTAG_COLORMAP,
red, red + mapsize, red + 2*mapsize);
photometric = PHOTOMETRIC_PALETTE;
if (compression == (uint16_t)-1)
if (compression == (uint16) -1)
compression = COMPRESSION_PACKBITS;
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
}
else
{
} else {
/* XXX this is bogus... */
photometric =
h.ras_depth == 24 ? PHOTOMETRIC_RGB : PHOTOMETRIC_MINISBLACK;
if (compression == (uint16_t)-1)
photometric = h.ras_depth == 24 ?
PHOTOMETRIC_RGB : PHOTOMETRIC_MINISBLACK;
if (compression == (uint16) -1)
compression = COMPRESSION_LZW;
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
}
switch (compression)
{
switch (compression) {
case COMPRESSION_JPEG:
if (photometric == PHOTOMETRIC_RGB &&
jpegcolormode == JPEGCOLORMODE_RGB)
if (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)
photometric = PHOTOMETRIC_YCBCR;
TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
break;
case COMPRESSION_LZW:
case COMPRESSION_ADOBE_DEFLATE:
case COMPRESSION_DEFLATE:
if (predictor != 0)
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
break;
}
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);
linebytes = ((h.ras_depth * h.ras_width + 15) >> 3) & ~1;
linebytes = ((h.ras_depth*h.ras_width+15) >> 3) &~ 1;
scanline = TIFFScanlineSize(out);
if (scanline > linebytes)
{
if (scanline > linebytes) {
buf = (unsigned char *)_TIFFmalloc(scanline);
_TIFFmemset(buf + linebytes, 0, scanline - linebytes);
}
else
_TIFFmemset(buf+linebytes, 0, scanline-linebytes);
} else
buf = (unsigned char *)_TIFFmalloc(linebytes);
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
TIFFDefaultStripSize(out, rowsperstrip));
for (row = 0; row < h.ras_height; row++)
{
if (fread(buf, linebytes, 1, in) != 1)
{
fprintf(stderr, "%s: scanline %ld: Read error.\n", argv[optind],
row);
for (row = 0; row < h.ras_height; row++) {
if (fread(buf, linebytes, 1, in) != 1) {
fprintf(stderr, "%s: scanline %ld: Read error.\n",
argv[optind], row);
break;
}
if (h.ras_type == RT_STANDARD && h.ras_depth == 24)
{
if (h.ras_type == RT_STANDARD && h.ras_depth == 24) {
tsize_t cc = h.ras_width;
unsigned char *cp = buf;
#define SWAP(a, b) \
{ \
unsigned char t = (a); \
(a) = (b); \
(b) = t; \
}
do
{
unsigned char* cp = buf;
#define SWAP(a,b) { unsigned char t = (a); (a) = (b); (b) = t; }
do {
SWAP(cp[0], cp[2]);
cp += 3;
} while (--cc);
@ -283,78 +248,73 @@ int main(int argc, char *argv[])
if (TIFFWriteScanline(out, buf, row, 0) < 0)
break;
}
(void)TIFFClose(out);
(void) TIFFClose(out);
fclose(in);
return (0);
}
static int processCompressOptions(char *opt)
static int
processCompressOptions(char* opt)
{
if (streq(opt, "none"))
compression = COMPRESSION_NONE;
else if (streq(opt, "packbits"))
compression = COMPRESSION_PACKBITS;
else if (strneq(opt, "jpeg", 4))
{
char *cp = strchr(opt, ':');
else if (strneq(opt, "jpeg", 4)) {
char* cp = strchr(opt, ':');
compression = COMPRESSION_JPEG;
while (cp)
while( cp )
{
if (isdigit((int)cp[1]))
quality = atoi(cp + 1);
else if (cp[1] == 'r')
quality = atoi(cp+1);
else if (cp[1] == 'r' )
jpegcolormode = JPEGCOLORMODE_RAW;
else
usage();
cp = strchr(cp + 1, ':');
cp = strchr(cp+1,':');
}
}
else if (strneq(opt, "lzw", 3))
{
char *cp = strchr(opt, ':');
} else if (strneq(opt, "lzw", 3)) {
char* cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
predictor = atoi(cp+1);
compression = COMPRESSION_LZW;
}
else if (strneq(opt, "zip", 3))
{
char *cp = strchr(opt, ':');
} else if (strneq(opt, "zip", 3)) {
char* cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
compression = COMPRESSION_ADOBE_DEFLATE;
}
else
predictor = atoi(cp+1);
compression = COMPRESSION_DEFLATE;
} else
return (0);
return (1);
}
char *stuff[] = {
"usage: ras2tiff [options] input.ras output.tif",
"where options are:",
" -r # make each strip have no more than # rows",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c zip[:opts] compress output with deflate encoding",
" -c jpeg[:opts] compress output with JPEG encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"JPEG options:",
" # set compression quality level (0-100, default 75)",
" r output color image as RGB rather than YCbCr",
"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. "
"quality",
"",
"LZW and deflate options:",
" # set predictor value",
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
"differencing",
" -h this help message",
NULL};
char* stuff[] = {
"usage: ras2tiff [options] input.ras output.tif",
"where options are:",
" -r # make each strip have no more than # rows",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c zip[:opts] compress output with deflate encoding",
" -c jpeg[:opts] compress output with JPEG encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"JPEG options:",
" # set compression quality level (0-100, default 75)",
" r output color image as RGB rather than YCbCr",
"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
"",
"LZW and deflate options:",
" # set predictor value",
"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
" -h this help message",
NULL
};
static void usage(void)
static void
usage(void)
{
char buf[BUFSIZ];
int i;
@ -365,3 +325,12 @@ static void usage(void)
fprintf(stderr, "%s\n", stuff[i]);
exit(-1);
}
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View file

@ -3,30 +3,29 @@
/*
* Description of header for files containing raster images
*/
struct rasterfile
{
struct rasterfile {
char ras_magic[4]; /* magic number */
int32_t ras_width; /* width (pixels) of image */
int32_t ras_height; /* height (pixels) of image */
int32_t ras_depth; /* depth (1, 8, or 24 bits) of pixel */
int32_t ras_length; /* length (bytes) of image */
int32_t ras_type; /* type of file; see RT_* below */
int32_t ras_maptype; /* type of colormap; see RMT_* below */
int32_t ras_maplength; /* length (bytes) of following map */
int32 ras_width; /* width (pixels) of image */
int32 ras_height; /* height (pixels) of image */
int32 ras_depth; /* depth (1, 8, or 24 bits) of pixel */
int32 ras_length; /* length (bytes) of image */
int32 ras_type; /* type of file; see RT_* below */
int32 ras_maptype; /* type of colormap; see RMT_* below */
int32 ras_maplength; /* length (bytes) of following map */
/* color map follows for ras_maplength bytes, followed by image */
};
#define RAS_MAGIC "\x59\xa6\x6a\x95"
#define RAS_MAGIC_INV "\x95\x6a\xa6\x59"
/* Sun supported ras_type's */
/* Sun supported ras_type's */
#define RT_OLD 0 /* Raw pixrect image in 68000 byte order */
#define RT_STANDARD 1 /* Raw pixrect image in 68000 byte order */
#define RT_BYTE_ENCODED 2 /* Run-length compression of bytes */
#define RT_EXPERIMENTAL 0xffff /* Reserved for testing */
/* Sun registered ras_maptype's */
/* Sun registered ras_maptype's */
#define RMT_RAW 2
/* Sun supported ras_maptype's */
/* Sun supported ras_maptype's */
#define RMT_NONE 0 /* ras_maplength is expected to be 0 */
#define RMT_EQUAL_RGB 1 /* red[ras_maplength/3],green[],blue[] */

View file

@ -22,49 +22,49 @@
* OF THIS SOFTWARE.
*/
#include <ctype.h>
#include <gl/image.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gl/image.h>
#include <ctype.h>
#include "tiffio.h"
#define streq(a, b) (strcmp(a, b) == 0)
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
#define streq(a,b) (strcmp(a,b) == 0)
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
static short config = PLANARCONFIG_CONTIG;
static uint16_t compression = COMPRESSION_PACKBITS;
static uint16_t predictor = 0;
static uint16_t fillorder = 0;
static uint32_t rowsperstrip = (uint32_t)-1;
static uint16 compression = COMPRESSION_PACKBITS;
static uint16 predictor = 0;
static uint16 fillorder = 0;
static uint32 rowsperstrip = (uint32) -1;
static int jpegcolormode = JPEGCOLORMODE_RGB;
static int quality = 75; /* JPEG quality */
static uint16_t photometric;
static uint16 photometric;
static void usage(void);
static int cpContig(IMAGE *, TIFF *);
static int cpSeparate(IMAGE *, TIFF *);
static int processCompressOptions(char *);
static int cpContig(IMAGE*, TIFF*);
static int cpSeparate(IMAGE*, TIFF*);
static int processCompressOptions(char*);
/* XXX image library has no prototypes */
extern IMAGE *iopen(const char *, const char *);
extern void iclose(IMAGE *);
extern void getrow(IMAGE *, short *, int, int);
extern IMAGE* iopen(const char*, const char*);
extern void iclose(IMAGE*);
extern void getrow(IMAGE*, short*, int, int);
int main(int argc, char *argv[])
int
main(int argc, char* argv[])
{
IMAGE *in;
TIFF *out;
int c;
#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
extern char* optarg;
#endif
while ((c = getopt(argc, argv, "c:p:r:")) != -1)
switch (c)
{
switch (c) {
case 'c': /* compression scheme */
if (!processCompressOptions(optarg))
usage();
@ -97,28 +97,25 @@ int main(int argc, char *argv[])
in = iopen(argv[optind], "r");
if (in == NULL)
return (-1);
out = TIFFOpen(argv[optind + 1], "w");
out = TIFFOpen(argv[optind+1], "w");
if (out == NULL)
return (-2);
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32_t)in->xsize);
TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32_t)in->ysize);
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) in->xsize);
TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) in->ysize);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
if (in->zsize == 1)
photometric = PHOTOMETRIC_MINISBLACK;
else
photometric = PHOTOMETRIC_RGB;
switch (compression)
{
switch (compression) {
case COMPRESSION_JPEG:
if (photometric == PHOTOMETRIC_RGB &&
jpegcolormode == JPEGCOLORMODE_RGB)
if (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)
photometric = PHOTOMETRIC_YCBCR;
TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
break;
case COMPRESSION_LZW:
case COMPRESSION_ADOBE_DEFLATE:
case COMPRESSION_DEFLATE:
if (predictor != 0)
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
@ -129,14 +126,13 @@ int main(int argc, char *argv[])
TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, in->zsize);
if (in->zsize > 3)
{
uint16_t v[1];
if (in->zsize > 3) {
uint16 v[1];
v[0] = EXTRASAMPLE_UNASSALPHA;
TIFFSetField(out, TIFFTAG_EXTRASAMPLES, 1, v);
}
TIFFSetField(out, TIFFTAG_MINSAMPLEVALUE, (uint16_t)in->min);
TIFFSetField(out, TIFFTAG_MAXSAMPLEVALUE, (uint16_t)in->max);
TIFFSetField(out, TIFFTAG_MINSAMPLEVALUE, (uint16) in->min);
TIFFSetField(out, TIFFTAG_MAXSAMPLEVALUE, (uint16) in->max);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
if (config != PLANARCONFIG_SEPARATE)
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
@ -149,123 +145,109 @@ int main(int argc, char *argv[])
cpContig(in, out);
else
cpSeparate(in, out);
(void)iclose(in);
(void)TIFFClose(out);
(void) iclose(in);
(void) TIFFClose(out);
return (0);
}
static int processCompressOptions(char *opt)
static int
processCompressOptions(char* opt)
{
if (streq(opt, "none"))
compression = COMPRESSION_NONE;
else if (streq(opt, "packbits"))
compression = COMPRESSION_PACKBITS;
else if (strneq(opt, "jpeg", 4))
{
char *cp = strchr(opt, ':');
else if (strneq(opt, "jpeg", 4)) {
char* cp = strchr(opt, ':');
defcompression = COMPRESSION_JPEG;
while (cp)
while( cp )
{
if (isdigit((int)cp[1]))
quality = atoi(cp + 1);
else if (cp[1] == 'r')
quality = atoi(cp+1);
else if (cp[1] == 'r' )
jpegcolormode = JPEGCOLORMODE_RAW;
else
usage();
cp = strchr(cp + 1, ':');
cp = strchr(cp+1,':');
}
}
else if (strneq(opt, "lzw", 3))
{
char *cp = strchr(opt, ':');
} else if (strneq(opt, "lzw", 3)) {
char* cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
predictor = atoi(cp+1);
compression = COMPRESSION_LZW;
}
else if (strneq(opt, "zip", 3))
{
char *cp = strchr(opt, ':');
} else if (strneq(opt, "zip", 3)) {
char* cp = strchr(opt, ':');
if (cp)
predictor = atoi(cp + 1);
compression = COMPRESSION_ADOBE_DEFLATE;
}
else
predictor = atoi(cp+1);
compression = COMPRESSION_DEFLATE;
} else
return (0);
return (1);
}
static int cpContig(IMAGE *in, TIFF *out)
static int
cpContig(IMAGE* in, TIFF* out)
{
tdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));
short *r = NULL;
int x, y;
if (in->zsize == 3)
{
if (in->zsize == 3) {
short *g, *b;
r = (short *)_TIFFmalloc(3 * in->xsize * sizeof(short));
r = (short *)_TIFFmalloc(3 * in->xsize * sizeof (short));
g = r + in->xsize;
b = g + in->xsize;
for (y = in->ysize - 1; y >= 0; y--)
{
uint8_t *pp = (uint8_t *)buf;
for (y = in->ysize-1; y >= 0; y--) {
uint8* pp = (uint8*) buf;
getrow(in, r, y, 0);
getrow(in, g, y, 1);
getrow(in, b, y, 2);
for (x = 0; x < in->xsize; x++)
{
for (x = 0; x < in->xsize; x++) {
pp[0] = r[x];
pp[1] = g[x];
pp[2] = b[x];
pp += 3;
}
if (TIFFWriteScanline(out, buf, in->ysize - y - 1, 0) < 0)
if (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)
goto bad;
}
}
else if (in->zsize == 4)
{
} else if (in->zsize == 4) {
short *g, *b, *a;
r = (short *)_TIFFmalloc(4 * in->xsize * sizeof(short));
r = (short *)_TIFFmalloc(4 * in->xsize * sizeof (short));
g = r + in->xsize;
b = g + in->xsize;
a = b + in->xsize;
for (y = in->ysize - 1; y >= 0; y--)
{
uint8_t *pp = (uint8_t *)buf;
for (y = in->ysize-1; y >= 0; y--) {
uint8* pp = (uint8*) buf;
getrow(in, r, y, 0);
getrow(in, g, y, 1);
getrow(in, b, y, 2);
getrow(in, a, y, 3);
for (x = 0; x < in->xsize; x++)
{
for (x = 0; x < in->xsize; x++) {
pp[0] = r[x];
pp[1] = g[x];
pp[2] = b[x];
pp[3] = a[x];
pp += 4;
}
if (TIFFWriteScanline(out, buf, in->ysize - y - 1, 0) < 0)
if (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)
goto bad;
}
}
else
{
uint8_t *pp = (uint8_t *)buf;
} else {
uint8* pp = (uint8*) buf;
r = (short *)_TIFFmalloc(in->xsize * sizeof(short));
for (y = in->ysize - 1; y >= 0; y--)
{
r = (short *)_TIFFmalloc(in->xsize * sizeof (short));
for (y = in->ysize-1; y >= 0; y--) {
getrow(in, r, y, 0);
for (x = in->xsize - 1; x >= 0; x--)
for (x = in->xsize-1; x >= 0; x--)
pp[x] = r[x];
if (TIFFWriteScanline(out, buf, in->ysize - y - 1, 0) < 0)
if (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)
goto bad;
}
}
@ -280,21 +262,20 @@ bad:
return (0);
}
static int cpSeparate(IMAGE *in, TIFF *out)
static int
cpSeparate(IMAGE* in, TIFF* out)
{
tdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));
short *r = (short *)_TIFFmalloc(in->xsize * sizeof(short));
uint8_t *pp = (uint8_t *)buf;
short *r = (short *)_TIFFmalloc(in->xsize * sizeof (short));
uint8* pp = (uint8*) buf;
int x, y, z;
for (z = 0; z < in->zsize; z++)
{
for (y = in->ysize - 1; y >= 0; y--)
{
for (z = 0; z < in->zsize; z++) {
for (y = in->ysize-1; y >= 0; y--) {
getrow(in, r, y, z);
for (x = 0; x < in->xsize; x++)
pp[x] = r[x];
if (TIFFWriteScanline(out, buf, in->ysize - y - 1, z) < 0)
if (TIFFWriteScanline(out, buf, in->ysize-y-1, z) < 0)
goto bad;
}
}
@ -307,34 +288,35 @@ bad:
return (0);
}
char *stuff[] = {
"usage: sgi2tiff [options] input.rgb output.tif",
"where options are:",
" -r # make each strip have no more than # rows",
"",
" -p contig pack samples contiguously (e.g. RGBRGB...)",
" -p separate store samples separately (e.g. RRR...GGG...BBB...)",
"",
" -f lsb2msb force lsb-to-msb FillOrder for output",
" -f msb2lsb force msb-to-lsb FillOrder for output",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c zip[:opts] compress output with deflate encoding",
" -c jpeg[:opts]compress output with JPEG encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"JPEG options:",
" # set compression quality level (0-100, default 75)",
" r output color image as RGB rather than YCbCr",
"",
"LZW and deflate options:",
" # set predictor value",
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
"differencing",
NULL};
char* stuff[] = {
"usage: sgi2tiff [options] input.rgb output.tif",
"where options are:",
" -r # make each strip have no more than # rows",
"",
" -p contig pack samples contiguously (e.g. RGBRGB...)",
" -p separate store samples separately (e.g. RRR...GGG...BBB...)",
"",
" -f lsb2msb force lsb-to-msb FillOrder for output",
" -f msb2lsb force msb-to-lsb FillOrder for output",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c zip[:opts] compress output with deflate encoding",
" -c jpeg[:opts]compress output with JPEG encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"JPEG options:",
" # set compression quality level (0-100, default 75)",
" r output color image as RGB rather than YCbCr",
"",
"LZW and deflate options:",
" # set predictor value",
"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
NULL
};
static void usage(void)
static void
usage(void)
{
char buf[BUFSIZ];
int i;
@ -344,3 +326,10 @@ static void usage(void)
fprintf(stderr, "%s\n", stuff[i]);
exit(-1);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View file

@ -26,41 +26,41 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <gl.h>
#include <ctype.h>
#include "tiffio.h"
typedef unsigned char unsigned char;
typedef unsigned long uint32_t;
typedef unsigned long uint32;
#define streq(a, b) (strcmp(a, b) == 0)
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
#define streq(a,b) (strcmp(a,b) == 0)
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
uint32_t rowsperstrip = (uint32_t)-1;
uint16_t compression = COMPRESSION_PACKBITS;
uint16_t config = PLANARCONFIG_CONTIG;
uint16_t predictor = 0;
uint32 rowsperstrip = (uint32) -1;
uint16 compression = COMPRESSION_PACKBITS;
uint16 config = PLANARCONFIG_CONTIG;
uint16 predictor = 0;
int xmaxscreen;
int ymaxscreen;
uint16_t photometric = PHOTOMETRIC_RGB;
uint16 photometric = PHOTOMETRIC_RGB;
int jpegcolormode = JPEGCOLORMODE_RGB;
int quality = 75; /* JPEG quality */
static void usage(void);
static void tiffsv(char *, int, int, int, int);
static void tiffsv(char*, int, int, int, int);
int main(int argc, char *argv[])
int
main(int argc, char* argv[])
{
int c;
#if !HAVE_DECL_OPTARG
extern int optind;
extern char *optarg;
extern char* optarg;
#endif
while ((c = getopt(argc, argv, "c:p:r:")) != -1)
switch (c)
{
switch (c) {
case 'b': /* save as b&w */
photometric = PHOTOMETRIC_MINISBLACK;
break;
@ -69,23 +69,19 @@ int main(int argc, char *argv[])
compression = COMPRESSION_NONE;
else if (streq(optarg, "packbits"))
compression = COMPRESSION_PACKBITS;
else if (strneq(optarg, "jpeg", 4))
{
char *cp = strchr(optarg, ':');
else if (strneq(optarg, "jpeg", 4)) {
char* cp = strchr(optarg, ':');
if (cp && isdigit(cp[1]))
quality = atoi(cp + 1);
quality = atoi(cp+1);
if (cp && strchr(cp, 'r'))
jpegcolormode = JPEGCOLORMODE_RAW;
compression = COMPRESSION_JPEG;
}
else if (strneq(optarg, "lzw", 3))
{
char *cp = strchr(optarg, ':');
} else if (strneq(optarg, "lzw", 3)) {
char* cp = strchr(optarg, ':');
if (cp)
predictor = atoi(cp + 1);
predictor = atoi(cp+1);
compression = COMPRESSION_LZW;
}
else
} else
usage();
break;
case 'p': /* planar configuration */
@ -105,43 +101,45 @@ int main(int argc, char *argv[])
}
if (argc - optind != 1 && argc - optind != 5)
usage();
xmaxscreen = getgdesc(GD_XPMAX) - 1;
ymaxscreen = getgdesc(GD_YPMAX) - 1;
xmaxscreen = getgdesc(GD_XPMAX)-1;
ymaxscreen = getgdesc(GD_YPMAX)-1;
foreground();
noport();
winopen("tiffsv");
if (argc - optind == 5)
tiffsv(argv[optind], atoi(argv[optind + 1]), atoi(argv[optind + 2]),
atoi(argv[optind + 3]), atoi(argv[optind + 4]));
tiffsv(argv[optind],
atoi(argv[optind+1]), atoi(argv[optind+2]),
atoi(argv[optind+3]), atoi(argv[optind+4]));
else
tiffsv(argv[optind], 0, xmaxscreen, 0, ymaxscreen);
return (0);
}
char *stuff[] = {
"usage: tiffsv [options] outimage.tif [x1 x2 y1 y2] [-b]",
"where options are:",
" -p contig pack samples contiguously (e.g. RGBRGB...)",
" -p separate store samples separately (e.g. RRR...GGG...BBB...)",
"",
" -r # make each strip have no more than # rows",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c jpeg[:opts]compress output with JPEG encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"JPEG options:",
" # set compression quality level (0-100, default 75)",
" r output color image as RGB rather than YCbCr",
"",
"LZW options:",
" # set predictor value for Lempel-Ziv & Welch encoding",
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
"differencing",
NULL};
char* stuff[] = {
"usage: tiffsv [options] outimage.tif [x1 x2 y1 y2] [-b]",
"where options are:",
" -p contig pack samples contiguously (e.g. RGBRGB...)",
" -p separate store samples separately (e.g. RRR...GGG...BBB...)",
"",
" -r # make each strip have no more than # rows",
"",
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
" -c jpeg[:opts]compress output with JPEG encoding",
" -c packbits compress output with packbits encoding",
" -c none use no compression algorithm on output",
"",
"JPEG options:",
" # set compression quality level (0-100, default 75)",
" r output color image as RGB rather than YCbCr",
"",
"LZW options:",
" # set predictor value for Lempel-Ziv & Welch encoding",
"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
NULL
};
static void usage(void)
static void
usage(void)
{
char buf[BUFSIZ];
int i;
@ -152,79 +150,73 @@ static void usage(void)
exit(-1);
}
static void svRGBSeparate(TIFF *tif, uint32_t *ss, int xsize, int ysize)
static void
svRGBSeparate(TIFF* tif, uint32* ss, int xsize, int ysize)
{
tsize_t stripsize = TIFFStripSize(tif);
unsigned char *rbuf = (unsigned char *)_TIFFmalloc(3 * stripsize);
unsigned char *rbuf = (unsigned char *)_TIFFmalloc(3*stripsize);
unsigned char *gbuf = rbuf + stripsize;
unsigned char *bbuf = gbuf + stripsize;
register int y;
for (y = 0; y <= ysize; y += rowsperstrip)
{
for (y = 0; y <= ysize; y += rowsperstrip) {
unsigned char *rp, *gp, *bp;
register int x;
register uint32_t n;
register uint32 n;
n = rowsperstrip;
if (n > ysize - y + 1)
n = ysize - y + 1;
rp = rbuf;
gp = gbuf;
bp = bbuf;
do
{
for (x = 0; x <= xsize; x++)
{
uint32_t v = ss[x];
if (n > ysize-y+1)
n = ysize-y+1;
rp = rbuf; gp = gbuf; bp = bbuf;
do {
for (x = 0; x <= xsize; x++) {
uint32 v = ss[x];
rp[x] = v;
gp[x] = v >> 8;
bp[x] = v >> 16;
}
rp += xsize + 1, gp += xsize + 1, bp += xsize + 1;
ss += xsize + 1;
rp += xsize+1, gp += xsize+1, bp += xsize+1;
ss += xsize+1;
} while (--n);
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 0), rbuf,
stripsize) < 0)
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,0),
rbuf, stripsize) < 0)
break;
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 1), gbuf,
stripsize) < 0)
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,1),
gbuf, stripsize) < 0)
break;
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 2), bbuf,
stripsize) < 0)
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,2),
bbuf, stripsize) < 0)
break;
}
_TIFFfree(rbuf);
}
static void svRGBContig(TIFF *tif, uint32_t *ss, int xsize, int ysize)
static void
svRGBContig(TIFF* tif, uint32* ss, int xsize, int ysize)
{
register int x, y;
tsize_t stripsize = TIFFStripSize(tif);
unsigned char *strip = (unsigned char *)_TIFFmalloc(stripsize);
for (y = 0; y <= ysize; y += rowsperstrip)
{
for (y = 0; y <= ysize; y += rowsperstrip) {
register unsigned char *pp = strip;
register uint32_t n;
register uint32 n;
n = rowsperstrip;
if (n > ysize - y + 1)
n = ysize - y + 1;
do
{
for (x = 0; x <= xsize; x++)
{
uint32_t v = ss[x];
if (n > ysize-y+1)
n = ysize-y+1;
do {
for (x = 0; x <= xsize; x++) {
uint32 v = ss[x];
pp[0] = v;
pp[1] = v >> 8;
pp[2] = v >> 16;
pp += 3;
}
ss += xsize + 1;
ss += xsize+1;
} while (--n);
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 0), strip,
stripsize) < 0)
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,0),
strip, stripsize) < 0)
break;
}
_TIFFfree(strip);
@ -233,65 +225,63 @@ static void svRGBContig(TIFF *tif, uint32_t *ss, int xsize, int ysize)
#undef RED
#undef GREEN
#undef BLUE
#define CVT(x) (((x)*255) / 100)
#define CVT(x) (((x)*255)/100)
#define RED CVT(28) /* 28% */
#define GREEN CVT(59) /* 59% */
#define BLUE CVT(11) /* 11% */
static void svGrey(TIFF *tif, uint32_t *ss, int xsize, int ysize)
static void
svGrey(TIFF* tif, uint32* ss, int xsize, int ysize)
{
register int x, y;
unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif));
for (y = 0; y <= ysize; y++)
{
for (x = 0; x <= xsize; x++)
{
for (y = 0; y <= ysize; y++) {
for (x = 0; x <= xsize; x++) {
unsigned char *cp = (unsigned char *)&ss[x];
buf[x] = (RED * cp[3] + GREEN * cp[2] + BLUE * cp[1]) >> 8;
buf[x] = (RED*cp[3] + GREEN*cp[2] + BLUE*cp[1]) >> 8;
}
if (TIFFWriteScanline(tif, buf, (uint32_t)y, 0) < 0)
if (TIFFWriteScanline(tif, buf, (uint32) y, 0) < 0)
break;
ss += xsize + 1;
ss += xsize+1;
}
_TIFFfree(buf);
}
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) < 0 ? -(x) : (x))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(x) ((x)<0?-(x):(x))
static void tiffsv(char *name, int x1, int x2, int y1, int y2)
static void
tiffsv(char* name, int x1, int x2, int y1, int y2)
{
TIFF *tif;
int xsize, ysize;
int xorg, yorg;
uint32_t *scrbuf;
uint32 *scrbuf;
xorg = MIN(x1, x2);
yorg = MIN(y1, y2);
if (xorg < 0)
xorg = MIN(x1,x2);
yorg = MIN(y1,y2);
if (xorg<0)
xorg = 0;
if (yorg < 0)
if (yorg<0)
yorg = 0;
xsize = ABS(x2 - x1);
ysize = ABS(y2 - y1);
if (xorg + xsize > xmaxscreen)
xsize = xmaxscreen - xorg;
if (yorg + ysize > ymaxscreen)
ysize = ymaxscreen - yorg;
xsize = ABS(x2-x1);
ysize = ABS(y2-y1);
if (xorg+xsize > xmaxscreen)
xsize = xmaxscreen-xorg;
if (yorg+ysize > ymaxscreen)
ysize = ymaxscreen-yorg;
tif = TIFFOpen(name, "w");
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32_t)(xsize + 1));
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32_t)(ysize + 1));
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) (xsize+1));
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32) (ysize+1));
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL,
photometric == PHOTOMETRIC_RGB ? 3 : 1);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, config);
TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);
switch (compression)
{
switch (compression) {
case COMPRESSION_JPEG:
if (photometric == PHOTOMETRIC_RGB &&
jpegcolormode == JPEGCOLORMODE_RGB)
if (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)
photometric = PHOTOMETRIC_YCBCR;
TIFFSetField(tif, TIFFTAG_JPEGQUALITY, quality);
TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
@ -305,18 +295,22 @@ static void tiffsv(char *name, int x1, int x2, int y1, int y2)
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_BOTLEFT);
rowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
scrbuf =
(uint32_t *)_TIFFmalloc((xsize + 1) * (ysize + 1) * sizeof(uint32_t));
readdisplay(xorg, yorg, xorg + xsize, yorg + ysize, scrbuf, RD_FREEZE);
if (photometric == PHOTOMETRIC_RGB)
{
scrbuf = (uint32 *)_TIFFmalloc((xsize+1)*(ysize+1)*sizeof (uint32));
readdisplay(xorg, yorg, xorg+xsize, yorg+ysize, scrbuf, RD_FREEZE);
if (photometric == PHOTOMETRIC_RGB) {
if (config == PLANARCONFIG_SEPARATE)
svRGBSeparate(tif, scrbuf, xsize, ysize);
else
svRGBContig(tif, scrbuf, xsize, ysize);
}
else
} else
svGrey(tif, scrbuf, xsize, ysize);
(void)TIFFClose(tif);
(void) TIFFClose(tif);
_TIFFfree((char *)scrbuf);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View file

@ -1,6 +1,6 @@
float ycbcrCoeffs[3] = {.299, .587, .114};
float ycbcrCoeffs[3] = { .299, .587, .114 };
/* default coding range is CCIR Rec 601-1 with no headroom/footroom */
unsigned long refBlackWhite[6] = {0, 255, 128, 255, 128, 255};
unsigned long refBlackWhite[6] = { 0, 255, 128, 255, 128, 255 };
#define LumaRed ycbcrCoeffs[0]
#define LumaGreen ycbcrCoeffs[1]
@ -22,19 +22,19 @@ unsigned long preveBits = 0;
static void setupLumaTables();
static int abs(int v) { return (v < 0 ? -v : v); }
static double pct(int v, double range) { return (v * 100. / range); }
static double pct(int v,double range) { return (v*100. / range); }
static void check(int R, int G, int B);
float D1, D2;
float D3, D4;
float D5, D6;
int main(int argc, char **argv)
int
main(int argc, char** argv)
{
int R, G, B;
if (argc > 1)
{
if (argc > 1) {
refBlackWhite[0] = 16;
refBlackWhite[1] = 235;
refBlackWhite[2] = 128;
@ -42,33 +42,39 @@ int main(int argc, char **argv)
refBlackWhite[4] = 128;
refBlackWhite[5] = 240;
}
D3 = 2 - 2 * LumaRed;
D4 = 2 - 2 * LumaBlue;
D3 = 2 - 2*LumaRed;
D4 = 2 - 2*LumaBlue;
D1 = 1. / D3;
D2 = 1. / D4;
D5 = D3 * LumaRed / LumaGreen;
D6 = D4 * LumaBlue / LumaGreen;
D5 = D3*LumaRed / LumaGreen;
D6 = D4*LumaBlue / LumaGreen;
setupLumaTables();
for (R = 0; R < 256; R++)
{
for (R = 0; R < 256; R++) {
for (G = 0; G < 256; G++)
for (B = 0; B < 256; B++)
check(R, G, B);
printf("[%3u] c %u/%u b %u/%u (R %u/%d/%u G %u/%d/%u B %u/%d/%u)\n", R,
eCodes - preveCodes, eCodes, eBits - preveBits, eBits,
abs(AbseRtotal - preveRtotal), eRtotal, AbseRtotal,
abs(AbseGtotal - preveGtotal), eGtotal, AbseGtotal,
abs(AbseBtotal - preveBtotal), eBtotal, AbseBtotal);
printf("[%3u] c %u/%u b %u/%u (R %u/%d/%u G %u/%d/%u B %u/%d/%u)\n"
, R
, eCodes - preveCodes, eCodes
, eBits - preveBits, eBits
, abs(AbseRtotal - preveRtotal), eRtotal , AbseRtotal
, abs(AbseGtotal - preveGtotal), eGtotal , AbseGtotal
, abs(AbseBtotal - preveBtotal), eBtotal , AbseBtotal
);
preveRtotal = AbseRtotal;
preveGtotal = AbseGtotal;
preveBtotal = AbseBtotal;
preveCodes = eCodes;
preveBits = eBits;
}
printf("%u total codes\n", 256 * 256 * 256);
printf("total error: %u codes %u bits (R %d/%u G %d/%u B %d/%u)\n", eCodes,
eBits, eRtotal, AbseRtotal, eGtotal, AbseGtotal, eBtotal,
AbseBtotal);
printf("%u total codes\n", 256*256*256);
printf("total error: %u codes %u bits (R %d/%u G %d/%u B %d/%u)\n"
, eCodes
, eBits
, eRtotal , AbseRtotal
, eGtotal , AbseGtotal
, eBtotal , AbseBtotal
);
return (0);
}
@ -76,34 +82,39 @@ float *lumaRed;
float *lumaGreen;
float *lumaBlue;
static float *setupLuma(float c)
static float*
setupLuma(float c)
{
float *v = (float *)_TIFFmalloc(256 * sizeof(float));
float *v = (float *)_TIFFmalloc(256 * sizeof (float));
int i;
for (i = 0; i < 256; i++)
v[i] = c * i;
return (v);
}
static void setupLumaTables(void)
static void
setupLumaTables(void)
{
lumaRed = setupLuma(LumaRed);
lumaGreen = setupLuma(LumaGreen);
lumaBlue = setupLuma(LumaBlue);
}
static unsigned V2Code(float f, unsigned long RB, unsigned long RW, int CR)
static unsigned
V2Code(float f, unsigned long RB, unsigned long RW, int CR)
{
unsigned int c = (unsigned int)((((f) * (RW - RB) / CR) + RB) + .5);
unsigned int c = (unsigned int)((((f)*(RW-RB)/CR)+RB)+.5);
return (c > 255 ? 255 : c);
}
#define Code2V(c, RB, RW, CR) ((((c) - (int)RB) * (float)CR) / (float)(RW - RB))
#define Code2V(c, RB, RW, CR) ((((c)-(int)RB)*(float)CR)/(float)(RW-RB))
#define CLAMP(f, min, max) \
(int)((f) + .5 < (min) ? (min) : (f) + .5 > (max) ? (max) : (f) + .5)
#define CLAMP(f,min,max) \
(int)((f)+.5 < (min) ? (min) : (f)+.5 > (max) ? (max) : (f)+.5)
static void check(int R, int G, int B)
static
void
check(int R, int G, int B)
{
float Y, Cb, Cr;
int iY, iCb, iCr;
@ -112,29 +123,31 @@ static void check(int R, int G, int B)
int eR, eG, eB;
Y = lumaRed[R] + lumaGreen[G] + lumaBlue[B];
Cb = (B - Y) * D2;
Cr = (R - Y) * D1;
Cb = (B - Y)*D2;
Cr = (R - Y)*D1;
iY = V2Code(Y, refBlackWhite[0], refBlackWhite[1], 255);
iCb = V2Code(Cb, refBlackWhite[2], refBlackWhite[3], 127);
iCr = V2Code(Cr, refBlackWhite[4], refBlackWhite[5], 127);
rCb = Code2V(iCb, refBlackWhite[2], refBlackWhite[3], 127);
rCr = Code2V(iCr, refBlackWhite[4], refBlackWhite[5], 127);
rY = Code2V(iY, refBlackWhite[0], refBlackWhite[1], 255);
rR = rY + rCr * D3;
rB = rY + rCb * D4;
rG = rY - rCb * D6 - rCr * D5;
eR = R - CLAMP(rR, 0, 255);
eG = G - CLAMP(rG, 0, 255);
eB = B - CLAMP(rB, 0, 255);
if (abs(eR) > 1 || abs(eG) > 1 || abs(eB) > 1)
{
rR = rY + rCr*D3;
rB = rY + rCb*D4;
rG = rY - rCb*D6 - rCr*D5;
eR = R - CLAMP(rR,0,255);
eG = G - CLAMP(rG,0,255);
eB = B - CLAMP(rB,0,255);
if (abs(eR) > 1 || abs(eG) > 1 || abs(eB) > 1) {
printf("R %u G %u B %u", R, G, B);
printf(" Y %g Cb %g Cr %g", Y, Cb, Cr);
printf(" iY %u iCb %u iCr %u", iY, iCb, iCr);
printf("\n -> Y %g Cb %g Cr %g", rY, rCb, rCr);
printf(" R %g (%u) G %g (%u) B %g (%u) E=[%d %d %d])\n", rR,
CLAMP(rR, 0, 255), rG, CLAMP(rG, 0, 255), rB, CLAMP(rB, 0, 255),
eR, eG, eB);
printf(" R %g (%u) G %g (%u) B %g (%u) E=[%d %d %d])\n"
, rR, CLAMP(rR,0,255)
, rG, CLAMP(rG,0,255)
, rB, CLAMP(rB,0,255)
, eR, eG, eB
);
}
eRtotal += eR;
eGtotal += eG;
@ -146,3 +159,10 @@ static void check(int R, int G, int B)
eCodes++;
eBits += abs(eR) + abs(eG) + abs(eB);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View file

@ -1,27 +1,8 @@
#!/bin/sh
set -x
case `uname` in
Darwin*)
glibtoolize --force --copy
;;
*)
libtoolize --force --copy
;;
esac
libtoolize --force --copy
aclocal -I ./m4
autoheader
automake --foreign --add-missing --copy
autoconf
# Get latest config.guess and config.sub from upstream master since
# these are often out of date.
for file in config.guess config.sub
do
echo "$0: getting $file..."
wget -q --timeout=5 -O config/$file.tmp \
"https://git.savannah.gnu.org/cgit/config.git/plain/${file}" \
&& mv -f config/$file.tmp config/$file \
&& chmod a+x config/$file
retval=$?
rm -f config/$file.tmp
test $retval -eq 0 || exit $retval
done

View file

@ -1,7 +1,6 @@
# C++ library option
# CMake build for libtiff
#
# Copyright © 2015 Open Microscopy Environment / University of Dundee
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
# Written by Roger Leigh <rleigh@codelibre.net>
#
# Permission to use, copy, modify, distribute, and sell this software and
@ -23,10 +22,4 @@
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# C++ support
option(cxx "Enable C++ stream API building (requires C++ compiler)" ON)
set(CXX_SUPPORT FALSE)
if (cxx)
enable_language(CXX)
set(CXX_SUPPORT TRUE)
endif()
extra_dist(README)

View file

@ -1,7 +1,7 @@
# Checks for LERC codec support
#
# Copyright © 2021 Antonio Valentino <antonio.valentino@tiscali.it>
# Written by Antonio Valentino <antonio.valentino@tiscali.it>
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2007, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
@ -22,11 +22,11 @@
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
EXTRA_DIST = \
CMakeLists.txt \
README
SUBDIRS =
# libLerc
set(LERC_SUPPORT FALSE)
find_package(LERC)
option(lerc "use libLerc (required for LERC compression)" ${LERC_FOUND})
if (lerc AND LERC_FOUND AND ZIP_SUPPORT)
set(LERC_SUPPORT TRUE)
endif()

View file

@ -0,0 +1,3 @@
This directory contains scripts and tools needed to build libtiff library
and its utilities in various environments.

Some files were not shown because too many files have changed in this diff Show more