Fixing missing files from repo.
This commit is contained in:
parent
6802761e49
commit
42f2b7003c
781 changed files with 123374 additions and 118335 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -23,6 +23,7 @@
|
||||||
# Other Binary
|
# Other Binary
|
||||||
#
|
#
|
||||||
*.exe filter=lfs diff=lfs merge=lfs -text
|
*.exe filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.dll filter=lfs diff=lfs merge=lfs -text
|
||||||
*.dat filter=lfs diff=lfs merge=lfs -text
|
*.dat filter=lfs diff=lfs merge=lfs -text
|
||||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
||||||
*~
|
*~
|
||||||
**/build/
|
**/.builddir/
|
||||||
**/.git-hidden/
|
**/.git-hidden/
|
||||||
**/.github/
|
**/.github/
|
||||||
cmake-build-debug/
|
cmake-build-debug/
|
||||||
|
|
32
INSTALL.txt
32
INSTALL.txt
|
@ -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
|
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.
|
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
|
COMMAND LINE
|
||||||
============
|
============
|
||||||
|
|
13
build-all.sh
13
build-all.sh
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
|
|
||||||
G_BUILDROOT=${PWD}
|
G_BUILDROOT=${PWD}
|
||||||
|
G_BUILDDIR=.builddir
|
||||||
G_TARGET=
|
G_TARGET=
|
||||||
G_GENERATED=
|
G_GENERATED=
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ function buildAll() {
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
G_TARGET=${G_BUILDROOT}/build/${OS}/${ARCH}
|
G_TARGET=${G_BUILDROOT}/${G_BUILDDIR}/${OS}/${ARCH}
|
||||||
G_GENERATED=${G_TARGET}/generated
|
G_GENERATED=${G_TARGET}/generated
|
||||||
TOOLCHAIN=${G_BUILDROOT}/../toolchains/cmake/${TRIPLE}.cmake
|
TOOLCHAIN=${G_BUILDROOT}/../toolchains/cmake/${TRIPLE}.cmake
|
||||||
COMMON="-DCMAKE_INSTALL_PREFIX=${G_TARGET} -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}"
|
COMMON="-DCMAKE_INSTALL_PREFIX=${G_TARGET} -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}"
|
||||||
|
@ -285,9 +286,9 @@ UNUSED
|
||||||
|
|
||||||
|
|
||||||
function clearAndEnterBuild() {
|
function clearAndEnterBuild() {
|
||||||
[[ -d build ]] && rm -rf build
|
[[ -d ${G_BUILDDIR} ]] && rm -rf ${G_BUILDDIR}
|
||||||
mkdir -p build
|
mkdir -p ${G_BUILDDIR}
|
||||||
cd build
|
cd ${G_BUILDDIR}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -409,8 +410,8 @@ function outputLicense() {
|
||||||
|
|
||||||
|
|
||||||
#buildAll linux x86
|
#buildAll linux x86
|
||||||
#buildAll linux x86_64
|
buildAll linux x86_64
|
||||||
buildAll macos aarch64
|
#buildAll macos aarch64
|
||||||
#buildAll macos x86 #***TODO*** Needs older SDL2
|
#buildAll macos x86 #***TODO*** Needs older SDL2
|
||||||
#buildAll macos x86_64 #***TODO*** Needs older SDL2
|
#buildAll macos x86_64 #***TODO*** Needs older SDL2
|
||||||
#buildAll windows x86
|
#buildAll windows x86
|
||||||
|
|
32
thirdparty/SDL2_image/.gitmodules
vendored
32
thirdparty/SDL2_image/.gitmodules
vendored
|
@ -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
|
|
2
thirdparty/SDL2_image/CMakeLists.txt
vendored
2
thirdparty/SDL2_image/CMakeLists.txt
vendored
|
@ -619,8 +619,6 @@ if(SDL2IMAGE_TIF)
|
||||||
target_compile_definitions(SDL2_image PRIVATE LOAD_TIF)
|
target_compile_definitions(SDL2_image PRIVATE LOAD_TIF)
|
||||||
if(SDL2IMAGE_TIF_VENDORED)
|
if(SDL2IMAGE_TIF_VENDORED)
|
||||||
message(STATUS "${PROJECT_NAME}: Using vendored libtiff")
|
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
|
# jpeg variable is used by vendored libtiff
|
||||||
set(jpeg OFF CACHE BOOL "libtiff: jpeg option" FORCE)
|
set(jpeg OFF CACHE BOOL "libtiff: jpeg option" FORCE)
|
||||||
# libdeflate variable is used by vendored libtiff
|
# libdeflate variable is used by vendored libtiff
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)\..\include;external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<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>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||||
|
@ -136,7 +136,7 @@
|
||||||
</Midl>
|
</Midl>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)\..\include;external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<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>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
|
@ -165,7 +165,7 @@
|
||||||
</Midl>
|
</Midl>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)\..\include;external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<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>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||||
|
@ -191,7 +191,7 @@
|
||||||
</Midl>
|
</Midl>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)\..\include;external\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<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>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||||
|
|
|
@ -56,38 +56,24 @@
|
||||||
/*
|
/*
|
||||||
* Intrinsic data types required by the file format:
|
* Intrinsic data types required by the file format:
|
||||||
*
|
*
|
||||||
* 8-bit quantities int8_t/uint_8_t
|
* 8-bit quantities int8/uint8
|
||||||
* 16-bit quantities int16_t/uint_16_t
|
* 16-bit quantities int16/uint16
|
||||||
* 32-bit quantities int32_t/uint_32_t
|
* 32-bit quantities int32/uint32
|
||||||
* 64-bit quantities int64_t/uint_64_t
|
* 64-bit quantities int64/uint64
|
||||||
* strings unsigned char*
|
* 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_INT8_T int8;
|
||||||
typedef TIFF_MSC_DEPRECATED int8_t int8 TIFF_GCC_DEPRECATED;
|
typedef TIFF_UINT8_T uint8;
|
||||||
typedef TIFF_MSC_DEPRECATED uint8_t uint8 TIFF_GCC_DEPRECATED;
|
|
||||||
|
|
||||||
typedef TIFF_MSC_DEPRECATED int16_t int16 TIFF_GCC_DEPRECATED;
|
typedef TIFF_INT16_T int16;
|
||||||
typedef TIFF_MSC_DEPRECATED uint16_t uint16 TIFF_GCC_DEPRECATED;
|
typedef TIFF_UINT16_T uint16;
|
||||||
|
|
||||||
typedef TIFF_MSC_DEPRECATED int32_t int32 TIFF_GCC_DEPRECATED;
|
typedef TIFF_INT32_T int32;
|
||||||
typedef TIFF_MSC_DEPRECATED uint32_t uint32 TIFF_GCC_DEPRECATED;
|
typedef TIFF_UINT32_T uint32;
|
||||||
|
|
||||||
typedef TIFF_MSC_DEPRECATED int64_t int64 TIFF_GCC_DEPRECATED;
|
typedef TIFF_INT64_T int64;
|
||||||
typedef TIFF_MSC_DEPRECATED uint64_t uint64 TIFF_GCC_DEPRECATED;
|
typedef TIFF_UINT64_T uint64;
|
||||||
#endif /* TIFF_DISABLE_DEPRECATED */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some types as promoted in a variable argument list
|
* Some types as promoted in a variable argument list
|
||||||
|
@ -102,26 +88,24 @@ typedef int uint16_vap;
|
||||||
/*
|
/*
|
||||||
* TIFF header.
|
* TIFF header.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
uint16 tiff_magic; /* magic number (defines byte order) */
|
||||||
uint16_t tiff_magic; /* magic number (defines byte order) */
|
uint16 tiff_version; /* TIFF version number */
|
||||||
uint16_t tiff_version; /* TIFF version number */
|
|
||||||
} TIFFHeaderCommon;
|
} TIFFHeaderCommon;
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
uint16 tiff_magic; /* magic number (defines byte order) */
|
||||||
uint16_t tiff_magic; /* magic number (defines byte order) */
|
uint16 tiff_version; /* TIFF version number */
|
||||||
uint16_t tiff_version; /* TIFF version number */
|
uint32 tiff_diroff; /* byte offset to first directory */
|
||||||
uint32_t tiff_diroff; /* byte offset to first directory */
|
|
||||||
} TIFFHeaderClassic;
|
} TIFFHeaderClassic;
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
uint16 tiff_magic; /* magic number (defines byte order) */
|
||||||
uint16_t tiff_magic; /* magic number (defines byte order) */
|
uint16 tiff_version; /* TIFF version number */
|
||||||
uint16_t tiff_version; /* TIFF version number */
|
uint16 tiff_offsetsize; /* size of offsets, should be 8 */
|
||||||
uint16_t tiff_offsetsize; /* size of offsets, should be 8 */
|
uint16 tiff_unused; /* unused word, should be 0 */
|
||||||
uint16_t tiff_unused; /* unused word, should be 0 */
|
uint64 tiff_diroff; /* byte offset to first directory */
|
||||||
uint64_t tiff_diroff; /* byte offset to first directory */
|
|
||||||
} TIFFHeaderBig;
|
} TIFFHeaderBig;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NB: In the comments below,
|
* NB: In the comments below,
|
||||||
* - items marked with a + are obsoleted by revision 5.0,
|
* - 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.
|
* 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
|
* Note2: TIFF_IFD8 data type is used in tiffFields[]-tag definition in order to distinguish the write-handling
|
||||||
distinguish the write-handling of those tags between ClassicTIFF and BigTiff:
|
of those tags between ClassicTIFF and BigTiff:
|
||||||
For ClassicTIFF libtiff writes a 32-bit value and the TIFF_IFD
|
For ClassicTIFF libtiff writes a 32-bit value and the TIFF_IFD type-id into the file
|
||||||
type-id into the file For BigTIFF libtiff writes a 64-bit value and the
|
For BigTIFF libtiff writes a 64-bit value and the TIFF_IFD8 type-id into the file
|
||||||
TIFF_IFD8 type-id into the file
|
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
TIFF_NOTYPE = 0, /* placeholder */
|
TIFF_NOTYPE = 0, /* placeholder */
|
||||||
TIFF_BYTE = 1, /* 8-bit unsigned integer */
|
TIFF_BYTE = 1, /* 8-bit unsigned integer */
|
||||||
TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */
|
TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */
|
||||||
|
@ -166,7 +148,6 @@ typedef enum
|
||||||
/*
|
/*
|
||||||
* TIFF Tag Definitions.
|
* TIFF Tag Definitions.
|
||||||
*/
|
*/
|
||||||
/* clang-format off */ /* for better readability of tag comments */
|
|
||||||
#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */
|
#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */
|
||||||
#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */
|
#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */
|
||||||
#define FILETYPE_PAGE 0x2 /* one page of many */
|
#define FILETYPE_PAGE 0x2 /* one page of many */
|
||||||
|
@ -202,8 +183,9 @@ typedef enum
|
||||||
/* compression codes 32908-32911 are reserved for Pixar */
|
/* compression codes 32908-32911 are reserved for Pixar */
|
||||||
#define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */
|
#define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */
|
||||||
#define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */
|
#define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */
|
||||||
#define COMPRESSION_DEFLATE 32946 /* Deflate compression, legacy tag */
|
#define COMPRESSION_DEFLATE 32946 /* Deflate compression */
|
||||||
#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression, as recognized by Adobe */
|
#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression,
|
||||||
|
as recognized by Adobe */
|
||||||
/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
|
/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
|
||||||
#define COMPRESSION_DCS 32947 /* Kodak DCS encoding */
|
#define COMPRESSION_DCS 32947 /* Kodak DCS encoding */
|
||||||
#define COMPRESSION_JBIG 34661 /* ISO JBIG */
|
#define COMPRESSION_JBIG 34661 /* ISO JBIG */
|
||||||
|
@ -215,7 +197,6 @@ typedef enum
|
||||||
#define COMPRESSION_LZMA 34925 /* LZMA2 */
|
#define COMPRESSION_LZMA 34925 /* LZMA2 */
|
||||||
#define COMPRESSION_ZSTD 50000 /* ZSTD: WARNING not registered in Adobe-maintained registry */
|
#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_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 TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */
|
||||||
#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */
|
#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */
|
||||||
#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */
|
#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */
|
||||||
|
@ -338,10 +319,14 @@ typedef enum
|
||||||
#define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */
|
#define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */
|
||||||
#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */
|
#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */
|
||||||
#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */
|
#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */
|
||||||
#define TIFFTAG_CLIPPATH 343 /* %ClipPath [Adobe TIFF technote 2] */
|
#define TIFFTAG_CLIPPATH 343 /* %ClipPath
|
||||||
#define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits [Adobe TIFF technote 2] */
|
[Adobe TIFF technote 2] */
|
||||||
#define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits [Adobe TIFF technote 2] */
|
#define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits
|
||||||
#define TIFFTAG_INDEXED 346 /* %Indexed [Adobe TIFF Technote 3] */
|
[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_JPEGTABLES 347 /* %JPEG table stream */
|
||||||
#define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */
|
#define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */
|
||||||
/* Tags 400-435 are from the TIFF/FX spec */
|
/* 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 YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */
|
||||||
#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */
|
#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */
|
||||||
#define TIFFTAG_STRIPROWCOUNTS 559 /* !TIFF/FX strip row counts */
|
#define TIFFTAG_STRIPROWCOUNTS 559 /* !TIFF/FX strip row counts */
|
||||||
#define TIFFTAG_XMLPACKET 700 /* %XML packet [Adobe XMP Specification, January 2004 */
|
#define TIFFTAG_XMLPACKET 700 /* %XML packet
|
||||||
#define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID [Adobe TIFF technote] */
|
[Adobe XMP Specification,
|
||||||
/* For eiStream Annotation Specification, Version 1.00.06 see
|
January 2004 */
|
||||||
* http://web.archive.org/web/20050309141348/http://www.kofile.com/support%20pro/faqs/annospec.htm */
|
#define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID
|
||||||
#define TIFFTAG_TIFFANNOTATIONDATA 32932
|
[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 */
|
/* tags 32952-32956 are private tags registered to Island Graphics */
|
||||||
#define TIFFTAG_REFPTS 32953 /* image reference points */
|
#define TIFFTAG_REFPTS 32953 /* image reference points */
|
||||||
#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */
|
#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */
|
||||||
|
@ -425,24 +411,21 @@ typedef enum
|
||||||
#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
|
#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
|
||||||
/* tag 33405 is a private tag registered to Eastman Kodak */
|
/* tag 33405 is a private tag registered to Eastman Kodak */
|
||||||
#define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */
|
#define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */
|
||||||
#define TIFFTAG_CFAREPEATPATTERNDIM 33421 /* (alias for TIFFTAG_EP_CFAREPEATPATTERNDIM)*/
|
#define TIFFTAG_CFAREPEATPATTERNDIM 33421 /* dimensions of CFA pattern */
|
||||||
#define TIFFTAG_CFAPATTERN 33422 /* (alias for TIFFTAG_EP_CFAPATTERN) */
|
#define TIFFTAG_CFAPATTERN 33422 /* color filter array pattern */
|
||||||
#define TIFFTAG_BATTERYLEVEL 33423 /* (alias for TIFFTAG_EP_BATTERYLEVEL) */
|
|
||||||
/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
|
/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
|
||||||
#define TIFFTAG_COPYRIGHT 33432 /* copyright string */
|
#define TIFFTAG_COPYRIGHT 33432 /* copyright string */
|
||||||
/* Tags 33445-33452 are used for Molecular Dynamics GEL fileformat,
|
/* Tags 33445-33452 are used for GEL fileformat, see
|
||||||
* see http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf
|
* 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
|
|
||||||
*/
|
*/
|
||||||
#define TIFFTAG_MD_FILETAG 33445 /* Specifies the pixel data format encoding 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 /* scale factor */
|
#define TIFFTAG_MD_SCALEPIXEL 33446 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
|
||||||
#define TIFFTAG_MD_COLORTABLE 33447 /* conversion from 16bit to 8bit */
|
#define TIFFTAG_MD_COLORTABLE 33447 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
|
||||||
#define TIFFTAG_MD_LABNAME 33448 /* name of the lab that scanned this file. */
|
#define TIFFTAG_MD_LABNAME 33448 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
|
||||||
#define TIFFTAG_MD_SAMPLEINFO 33449 /* information about the scanned GEL sample */
|
#define TIFFTAG_MD_SAMPLEINFO 33449 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
|
||||||
#define TIFFTAG_MD_PREPDATE 33450 /* information about the date the sample was prepared YY/MM/DD */
|
#define TIFFTAG_MD_PREPDATE 33450 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
|
||||||
#define TIFFTAG_MD_PREPTIME 33451 /* information about the time the sample was prepared HH:MM*/
|
#define TIFFTAG_MD_PREPTIME 33451 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
|
||||||
#define TIFFTAG_MD_FILEUNITS 33452 /* Units for data in this file, as used in the GEL file format. */
|
#define TIFFTAG_MD_FILEUNITS 33452 /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */
|
||||||
/* IPTC TAG from RichTIFF specifications */
|
/* IPTC TAG from RichTIFF specifications */
|
||||||
#define TIFFTAG_RICHTIFFIPTC 33723
|
#define TIFFTAG_RICHTIFFIPTC 33723
|
||||||
#define TIFFTAG_INGR_PACKET_DATA_TAG 33918 /* Intergraph Application specific storage. */
|
#define TIFFTAG_INGR_PACKET_DATA_TAG 33918 /* Intergraph Application specific storage. */
|
||||||
|
@ -465,7 +448,8 @@ typedef enum
|
||||||
#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */
|
#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */
|
||||||
#define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */
|
#define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */
|
||||||
#define TIFFTAG_IT8HCUSAGE 34030 /* HC usage indicator */
|
#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 */
|
#define TIFFTAG_IT8CMYKEQUIVALENT 34032 /* CMYK color equivalents */
|
||||||
/* tags 34232-34236 are private tags registered to Texas Instruments */
|
/* tags 34232-34236 are private tags registered to Texas Instruments */
|
||||||
#define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */
|
#define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */
|
||||||
|
@ -479,9 +463,9 @@ typedef enum
|
||||||
#define TIFFTAG_IMAGELAYER 34732 /* !TIFF/FX image layer information */
|
#define TIFFTAG_IMAGELAYER 34732 /* !TIFF/FX image layer information */
|
||||||
/* tag 34750 is a private tag registered to Pixel Magic */
|
/* tag 34750 is a private tag registered to Pixel Magic */
|
||||||
#define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */
|
#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 */
|
/* 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_FAXSUBADDRESS 34909 /* received SubAddr string */
|
||||||
#define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */
|
#define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */
|
||||||
#define TIFFTAG_FAXDCS 34911 /* encoded fax ses. params, Table 2/T.30 */
|
#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 */
|
/* tag 34929 is a private tag registered to FedEx */
|
||||||
#define TIFFTAG_FEDEX_EDR 34929 /* unknown use */
|
#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_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_METADATA 42112 /* Used by the GDAL library */
|
||||||
#define TIFFTAG_GDAL_NODATA 42113 /* 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_SCANJOB_DESCRIPTION 50215 /* Used in the Oce scanning process */
|
||||||
#define TIFFTAG_OCE_APPLICATION_SELECTOR 50216 /* 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_IDENTIFICATION_NUMBER 50217
|
||||||
#define TIFFTAG_OCE_IMAGELOGIC_CHARACTERISTICS 50218
|
#define TIFFTAG_OCE_IMAGELOGIC_CHARACTERISTICS 50218
|
||||||
|
|
||||||
/* tags 50674 to 50677 are reserved for ESRI */
|
/* tags 50674 to 50677 are reserved for ESRI */
|
||||||
#define TIFFTAG_LERC_PARAMETERS 50674 /* Stores LERC version and additional compression method */
|
#define TIFFTAG_LERC_PARAMETERS 50674 /* Stores LERC version and additional compression method */
|
||||||
|
|
||||||
/* Adobe Digital Negative (DNG) format tags */
|
/* Adobe Digital Negative (DNG) format tags */
|
||||||
#define TIFFTAG_DNGVERSION 50706 /* &DNG version number */
|
#define TIFFTAG_DNGVERSION 50706 /* &DNG version number */
|
||||||
#define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */
|
#define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */
|
||||||
#define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */
|
#define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */
|
||||||
#define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model name (UTF-8) */
|
#define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model
|
||||||
#define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space mapping */
|
name */
|
||||||
|
#define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space
|
||||||
|
mapping */
|
||||||
#define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */
|
#define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */
|
||||||
#define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */
|
#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_BLACKLEVEL 50714 /* &zero light encoding level */
|
||||||
#define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level differences (columns) */
|
#define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level
|
||||||
#define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level differences (rows) */
|
differences (columns) */
|
||||||
#define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding level */
|
#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_DEFAULTSCALE 50718 /* &default scale factors */
|
||||||
#define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image area */
|
#define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image
|
||||||
#define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image area */
|
area */
|
||||||
#define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space transformation matrix 1 */
|
#define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image
|
||||||
#define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space transformation matrix 2 */
|
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_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */
|
||||||
#define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */
|
#define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */
|
||||||
#define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction matrix 1 */
|
#define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction
|
||||||
#define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction matrix 2 */
|
matrix 1 */
|
||||||
#define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw values*/
|
#define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction
|
||||||
#define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in linear reference space */
|
matrix 2 */
|
||||||
#define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in x-y chromaticity coordinates */
|
#define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw
|
||||||
#define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero point */
|
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_BASELINENOISE 50731 /* &relative noise level */
|
||||||
#define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of sharpening */
|
#define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of
|
||||||
/* TIFFTAG_BAYERGREENSPLIT: &how closely the values of the green pixels in the blue/green rows
|
sharpening */
|
||||||
* track the values of the green pixels in the red/green rows */
|
#define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of
|
||||||
#define TIFFTAG_BAYERGREENSPLIT 50733
|
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_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */
|
||||||
#define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */
|
#define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */
|
||||||
#define TIFFTAG_LENSINFO 50736 /* info about the lens */
|
#define TIFFTAG_LENSINFO 50736 /* info about the lens */
|
||||||
#define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */
|
#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_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */
|
||||||
#define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */
|
#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_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */
|
||||||
#define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */
|
#define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */
|
||||||
#define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */
|
#define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */
|
||||||
#define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for the raw image data */
|
#define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for
|
||||||
#define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original raw file (UTF-8) */
|
the raw image data */
|
||||||
#define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original raw file */
|
#define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original
|
||||||
#define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels of the sensor */
|
raw file */
|
||||||
#define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates of fully masked pixels */
|
#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_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_CURRENTICCPROFILE 50833 /* & */
|
||||||
#define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */
|
#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_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. */
|
#define TIFFTAG_ALIAS_LAYER_METADATA 50784 /* Alias Sketchbook Pro layer usage description. */
|
||||||
|
|
||||||
/* GeoTIFF DGIWG */
|
/* GeoTIFF DGIWG */
|
||||||
#define TIFFTAG_TIFF_RSID 50908 /* https://www.awaresystems.be/imaging/tiff/tifftags/tiff_rsid.html */
|
#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_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 */
|
#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 */
|
/* tag 65535 is an undefined tag used by Eastman Kodak */
|
||||||
|
@ -772,14 +669,14 @@ typedef enum
|
||||||
#define EXIFTAG_FNUMBER 33437 /* F number */
|
#define EXIFTAG_FNUMBER 33437 /* F number */
|
||||||
#define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */
|
#define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */
|
||||||
#define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */
|
#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_ISOSPEEDRATINGS 34855 /* ISO speed rating */
|
||||||
#define EXIFTAG_PHOTOGRAPHICSENSITIVITY 34855 /* Photographic Sensitivity (new name for tag 34855) */
|
#define EXIFTAG_PHOTOGRAPHICSENSITIVITY 34855 /* Photographic Sensitivity (new name for tag 34855) */
|
||||||
#define EXIFTAG_OECF 34856 /* Optoelectric conversion factor */
|
#define EXIFTAG_OECF 34856 /* Optoelectric conversion factor */
|
||||||
#define EXIFTAG_EXIFVERSION 36864 /* Exif version */
|
#define EXIFTAG_EXIFVERSION 36864 /* Exif version */
|
||||||
#define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original data generation */
|
#define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original
|
||||||
#define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital data generation */
|
data generation */
|
||||||
|
#define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital
|
||||||
|
data generation */
|
||||||
#define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */
|
#define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */
|
||||||
#define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */
|
#define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */
|
||||||
#define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */
|
#define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */
|
||||||
|
@ -843,14 +740,10 @@ typedef enum
|
||||||
#define EXIFTAG_PRESSURE 37890 /* Pressure as the ambient situation at the shot hecto-Pascal (hPa) */
|
#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_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 ambient situation at the shot in units of mGal (10-5 m/s^2) */
|
#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) */
|
||||||
/* EXIFTAG_CAMERAELEVATIONANGLE: Elevation/depression. angle of the orientation of the camera(imaging optical axis)
|
#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. */
|
||||||
* as the ambient situation at the shot in degree from -180deg to +180deg. */
|
|
||||||
#define EXIFTAG_CAMERAELEVATIONANGLE 37893
|
|
||||||
#define EXIFTAG_CAMERAOWNERNAME 42032 /* owner of a camera */
|
#define EXIFTAG_CAMERAOWNERNAME 42032 /* owner of a camera */
|
||||||
#define EXIFTAG_BODYSERIALNUMBER 42033 /* serial number of the body of the 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,
|
#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, */
|
||||||
* and minimum F number in the maximum focal length, */
|
|
||||||
#define EXIFTAG_LENSSPECIFICATION 42034
|
|
||||||
#define EXIFTAG_LENSMAKE 42035 /* the lens manufacturer */
|
#define EXIFTAG_LENSMAKE 42035 /* the lens manufacturer */
|
||||||
#define EXIFTAG_LENSMODEL 42036 /* the lens model name and model number */
|
#define EXIFTAG_LENSMODEL 42036 /* the lens model name and model number */
|
||||||
#define EXIFTAG_LENSSERIALNUMBER 42037 /* the serial number of the interchangeable lens */
|
#define EXIFTAG_LENSSERIALNUMBER 42037 /* the serial number of the interchangeable lens */
|
||||||
|
@ -896,3 +789,12 @@ typedef enum
|
||||||
#define GPSTAG_GPSHPOSITIONINGERROR 31 /* Indicates horizontal positioning errors in meters. */
|
#define GPSTAG_GPSHPOSITIONINGERROR 31 /* Indicates horizontal positioning errors in meters. */
|
||||||
|
|
||||||
#endif /* _TIFF_ */
|
#endif /* _TIFF_ */
|
||||||
|
|
||||||
|
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* mode: c
|
||||||
|
* c-basic-offset: 8
|
||||||
|
* fill-column: 78
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|
|
@ -5,68 +5,50 @@
|
||||||
from this file in your programs.
|
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_
|
#ifndef _TIFFCONF_
|
||||||
#define _TIFFCONF_
|
#define _TIFFCONF_
|
||||||
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Signed 16-bit type */
|
/* Signed 16-bit type */
|
||||||
/* #undef TIFF_INT16_T */
|
#define TIFF_INT16_T signed short
|
||||||
|
|
||||||
/* Signed 32-bit type */
|
/* Signed 32-bit type */
|
||||||
/* #undef TIFF_INT32_T */
|
#define TIFF_INT32_T signed int
|
||||||
|
|
||||||
/* Signed 64-bit type */
|
/* Signed 64-bit type */
|
||||||
/* #undef TIFF_INT64_T */
|
#define TIFF_INT64_T signed long long
|
||||||
|
|
||||||
/* Signed 8-bit type */
|
/* Signed 8-bit type */
|
||||||
/* #undef TIFF_INT8_T */
|
#define TIFF_INT8_T signed char
|
||||||
|
|
||||||
/* Unsigned 16-bit type */
|
/* Unsigned 16-bit type */
|
||||||
/* #undef TIFF_UINT16_T */
|
#define TIFF_UINT16_T unsigned short
|
||||||
|
|
||||||
/* Unsigned 32-bit type */
|
/* Unsigned 32-bit type */
|
||||||
/* #undef TIFF_UINT32_T */
|
#define TIFF_UINT32_T unsigned int
|
||||||
|
|
||||||
/* Unsigned 64-bit type */
|
/* Unsigned 64-bit type */
|
||||||
/* #undef TIFF_UINT64_T */
|
#define TIFF_UINT64_T unsigned long long
|
||||||
|
|
||||||
/* Unsigned 8-bit type */
|
/* Unsigned 8-bit type */
|
||||||
/* #undef TIFF_UINT8_T */
|
#define TIFF_UINT8_T unsigned char
|
||||||
|
|
||||||
/* Signed size type */
|
/* Signed size type */
|
||||||
#if defined _WIN64
|
#if defined _WIN64
|
||||||
#define TIFF_SSIZE_T int64_t
|
#define TIFF_SSIZE_T signed long long
|
||||||
#else
|
#else
|
||||||
#define TIFF_SSIZE_T int32_t
|
#define TIFF_SSIZE_T signed int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Pointer difference type */
|
||||||
|
#define TIFF_PTRDIFF_T ptrdiff_t
|
||||||
|
|
||||||
/* Compatibility stuff. */
|
/* 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 */
|
machine */
|
||||||
#define HAVE_IEEEFP 1
|
#define HAVE_IEEEFP 1
|
||||||
|
|
||||||
/* The concept of HOST_FILLORDER is broken. Since libtiff 4.5.1
|
/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
#define HOST_FILLORDER FILLORDER_LSB2MSB
|
#define HOST_FILLORDER FILLORDER_LSB2MSB
|
||||||
|
|
||||||
/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
|
/* 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) */
|
/* Support JBIG compression (requires JBIG-KIT library) */
|
||||||
/* #undef JBIG_SUPPORT */
|
/* #undef JBIG_SUPPORT */
|
||||||
|
|
||||||
/* Support LERC compression */
|
|
||||||
/* #undef LERC_SUPPORT */
|
|
||||||
|
|
||||||
/* Support LogLuv high dynamic range encoding */
|
/* Support LogLuv high dynamic range encoding */
|
||||||
#define LOGLUV_SUPPORT 1
|
#define LOGLUV_SUPPORT 1
|
||||||
|
|
||||||
|
@ -114,7 +93,7 @@
|
||||||
/* #undef LIBDEFLATE_SUPPORT */
|
/* #undef LIBDEFLATE_SUPPORT */
|
||||||
|
|
||||||
/* Support strip chopping (whether or not to convert single-strip uncompressed
|
/* 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
|
#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
|
||||||
|
|
||||||
/* Enable SubIFD tag (330) support */
|
/* Enable SubIFD tag (330) support */
|
||||||
|
@ -127,7 +106,7 @@
|
||||||
|
|
||||||
/* Pick up YCbCr subsampling info from the JPEG data stream to support files
|
/* Pick up YCbCr subsampling info from the JPEG data stream to support files
|
||||||
lacking the tag (default enabled). */
|
lacking the tag (default enabled). */
|
||||||
#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
|
/* #undef CHECK_JPEG_YCBCR_SUBSAMPLING */
|
||||||
|
|
||||||
/* Support MS MDI magic number files as TIFF */
|
/* Support MS MDI magic number files as TIFF */
|
||||||
#define MDI_SUPPORT 1
|
#define MDI_SUPPORT 1
|
||||||
|
@ -145,5 +124,3 @@
|
||||||
#define IPTC_SUPPORT
|
#define IPTC_SUPPORT
|
||||||
|
|
||||||
#endif /* _TIFFCONF_ */
|
#endif /* _TIFFCONF_ */
|
||||||
|
|
||||||
/* clang-format on */
|
|
||||||
|
|
|
@ -60,18 +60,16 @@ typedef struct tiff TIFF;
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* this is the machine addressing size type, only it's signed, so make it
|
* 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;
|
typedef TIFF_SSIZE_T tmsize_t;
|
||||||
#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
|
typedef uint64 toff_t; /* file offset */
|
||||||
|
|
||||||
typedef uint64_t toff_t; /* file offset */
|
|
||||||
/* the following are deprecated and should be replaced by their defining
|
/* the following are deprecated and should be replaced by their defining
|
||||||
counterparts */
|
counterparts */
|
||||||
typedef uint32_t ttag_t; /* directory tag */
|
typedef uint32 ttag_t; /* directory tag */
|
||||||
typedef uint32_t tdir_t; /* directory index */
|
typedef uint16 tdir_t; /* directory index */
|
||||||
typedef uint16_t tsample_t; /* sample number */
|
typedef uint16 tsample_t; /* sample number */
|
||||||
typedef uint32_t tstrile_t; /* strip or tile number */
|
typedef uint32 tstrile_t; /* strip or tile number */
|
||||||
typedef tstrile_t tstrip_t; /* strip number */
|
typedef tstrile_t tstrip_t; /* strip number */
|
||||||
typedef tstrile_t ttile_t; /* tile number */
|
typedef tstrile_t ttile_t; /* tile number */
|
||||||
typedef tmsize_t tsize_t; /* i/o size in bytes */
|
typedef tmsize_t tsize_t; /* i/o size in bytes */
|
||||||
|
@ -89,8 +87,7 @@ typedef void *tdata_t; /* image data ref */
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
|
#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
|
||||||
#if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && \
|
# if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
|
||||||
!defined(USE_WIN32_FILEIO)
|
|
||||||
# define AVOID_WIN32_FILEIO
|
# define AVOID_WIN32_FILEIO
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -138,15 +135,14 @@ typedef void *thandle_t; /* client data handle */
|
||||||
|
|
||||||
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
|
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
float d_mat[3][3]; /* XYZ -> luminance matrix */
|
float d_mat[3][3]; /* XYZ -> luminance matrix */
|
||||||
float d_YCR; /* Light o/p for reference white */
|
float d_YCR; /* Light o/p for reference white */
|
||||||
float d_YCG;
|
float d_YCG;
|
||||||
float d_YCB;
|
float d_YCB;
|
||||||
uint32_t d_Vrwr; /* Pixel values for ref. white */
|
uint32 d_Vrwr; /* Pixel values for ref. white */
|
||||||
uint32_t d_Vrwg;
|
uint32 d_Vrwg;
|
||||||
uint32_t d_Vrwb;
|
uint32 d_Vrwb;
|
||||||
float d_Y0R; /* Residual light for black pixel */
|
float d_Y0R; /* Residual light for black pixel */
|
||||||
float d_Y0G;
|
float d_Y0G;
|
||||||
float d_Y0B;
|
float d_Y0B;
|
||||||
|
@ -155,18 +151,16 @@ typedef struct
|
||||||
float d_gammaB;
|
float d_gammaB;
|
||||||
} TIFFDisplay;
|
} TIFFDisplay;
|
||||||
|
|
||||||
typedef struct
|
typedef struct { /* YCbCr->RGB support */
|
||||||
{ /* YCbCr->RGB support */
|
|
||||||
TIFFRGBValue* clamptab; /* range clamping table */
|
TIFFRGBValue* clamptab; /* range clamping table */
|
||||||
int* Cr_r_tab;
|
int* Cr_r_tab;
|
||||||
int* Cb_b_tab;
|
int* Cb_b_tab;
|
||||||
int32_t *Cr_g_tab;
|
int32* Cr_g_tab;
|
||||||
int32_t *Cb_g_tab;
|
int32* Cb_g_tab;
|
||||||
int32_t *Y_tab;
|
int32* Y_tab;
|
||||||
} TIFFYCbCrToRGB;
|
} TIFFYCbCrToRGB;
|
||||||
|
|
||||||
typedef struct
|
typedef struct { /* CIE Lab 1976->RGB support */
|
||||||
{ /* CIE Lab 1976->RGB support */
|
|
||||||
int range; /* Size of conversion table */
|
int range; /* Size of conversion table */
|
||||||
#define CIELABTORGB_TABLE_RANGE 1500
|
#define CIELABTORGB_TABLE_RANGE 1500
|
||||||
float rstep, gstep, bstep;
|
float rstep, gstep, bstep;
|
||||||
|
@ -191,49 +185,46 @@ typedef struct _TIFFRGBAImage TIFFRGBAImage;
|
||||||
* different format or, for example, unpack the data
|
* different format or, for example, unpack the data
|
||||||
* and draw the unpacked raster on the display.
|
* and draw the unpacked raster on the display.
|
||||||
*/
|
*/
|
||||||
typedef void (*tileContigRoutine)(TIFFRGBAImage *, uint32_t *, uint32_t,
|
typedef void (*tileContigRoutine)
|
||||||
uint32_t, uint32_t, uint32_t, int32_t,
|
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
|
||||||
int32_t, unsigned char *);
|
unsigned char*);
|
||||||
typedef void (*tileSeparateRoutine)(TIFFRGBAImage *, uint32_t *, uint32_t,
|
typedef void (*tileSeparateRoutine)
|
||||||
uint32_t, uint32_t, uint32_t, int32_t,
|
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
|
||||||
int32_t, unsigned char *, unsigned char *,
|
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
|
||||||
unsigned char *, unsigned char *);
|
|
||||||
/*
|
/*
|
||||||
* RGBA-reader state.
|
* RGBA-reader state.
|
||||||
*/
|
*/
|
||||||
struct _TIFFRGBAImage
|
struct _TIFFRGBAImage {
|
||||||
{
|
|
||||||
TIFF* tif; /* image handle */
|
TIFF* tif; /* image handle */
|
||||||
int stoponerr; /* stop on read error */
|
int stoponerr; /* stop on read error */
|
||||||
int isContig; /* data is packed/separate */
|
int isContig; /* data is packed/separate */
|
||||||
int alpha; /* type of alpha data present */
|
int alpha; /* type of alpha data present */
|
||||||
uint32_t width; /* image width */
|
uint32 width; /* image width */
|
||||||
uint32_t height; /* image height */
|
uint32 height; /* image height */
|
||||||
uint16_t bitspersample; /* image bits/sample */
|
uint16 bitspersample; /* image bits/sample */
|
||||||
uint16_t samplesperpixel; /* image samples/pixel */
|
uint16 samplesperpixel; /* image samples/pixel */
|
||||||
uint16_t orientation; /* image orientation */
|
uint16 orientation; /* image orientation */
|
||||||
uint16_t req_orientation; /* requested orientation */
|
uint16 req_orientation; /* requested orientation */
|
||||||
uint16_t photometric; /* image photometric interp */
|
uint16 photometric; /* image photometric interp */
|
||||||
uint16_t *redcmap; /* colormap palette */
|
uint16* redcmap; /* colormap palette */
|
||||||
uint16_t *greencmap;
|
uint16* greencmap;
|
||||||
uint16_t *bluecmap;
|
uint16* bluecmap;
|
||||||
/* get image data routine */
|
/* get image data routine */
|
||||||
int (*get)(TIFFRGBAImage *, uint32_t *, uint32_t, uint32_t);
|
int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||||
/* put decoded strip/tile */
|
/* put decoded strip/tile */
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
void (*any)(TIFFRGBAImage*);
|
void (*any)(TIFFRGBAImage*);
|
||||||
tileContigRoutine contig;
|
tileContigRoutine contig;
|
||||||
tileSeparateRoutine separate;
|
tileSeparateRoutine separate;
|
||||||
} put;
|
} put;
|
||||||
TIFFRGBValue* Map; /* sample mapping array */
|
TIFFRGBValue* Map; /* sample mapping array */
|
||||||
uint32_t **BWmap; /* black&white map */
|
uint32** BWmap; /* black&white map */
|
||||||
uint32_t **PALmap; /* palette image map */
|
uint32** PALmap; /* palette image map */
|
||||||
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
|
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
|
||||||
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
|
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
|
||||||
|
|
||||||
uint8_t *UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
|
uint8* UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
|
||||||
uint8_t *Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
|
uint8* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
|
||||||
|
|
||||||
int row_offset;
|
int row_offset;
|
||||||
int col_offset;
|
int col_offset;
|
||||||
|
@ -256,42 +247,31 @@ struct _TIFFRGBAImage
|
||||||
* and/or the builtin implementations may be overridden.
|
* and/or the builtin implementations may be overridden.
|
||||||
*/
|
*/
|
||||||
typedef int (*TIFFInitMethod)(TIFF*, int);
|
typedef int (*TIFFInitMethod)(TIFF*, int);
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
char* name;
|
char* name;
|
||||||
uint16_t scheme;
|
uint16 scheme;
|
||||||
TIFFInitMethod init;
|
TIFFInitMethod init;
|
||||||
} TIFFCodec;
|
} TIFFCodec;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t uNum;
|
|
||||||
uint32_t uDenom;
|
|
||||||
} TIFFRational_t;
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
/* share internal LogLuv conversion routines? */
|
/* share internal LogLuv conversion routines? */
|
||||||
#ifndef LOGLUV_PUBLIC
|
#ifndef LOGLUV_PUBLIC
|
||||||
#define LOGLUV_PUBLIC 1
|
#define LOGLUV_PUBLIC 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) || defined(__attribute__)
|
#if defined(__GNUC__) || defined(__clang__) || defined(__attribute__)
|
||||||
# define TIFF_ATTRIBUTE(x) __attribute__(x)
|
# define TIFF_ATTRIBUTE(x) __attribute__(x)
|
||||||
#else
|
#else
|
||||||
# define TIFF_ATTRIBUTE(x) /*nothing*/
|
# define TIFF_ATTRIBUTE(x) /*nothing*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
|
typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
|
||||||
typedef void (*TIFFErrorHandlerExt)(thandle_t, const char *, const char *,
|
typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
|
||||||
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 tmsize_t (*TIFFReadWriteProc)(thandle_t, void*, tmsize_t);
|
||||||
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
|
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
|
||||||
typedef int (*TIFFCloseProc)(thandle_t);
|
typedef int (*TIFFCloseProc)(thandle_t);
|
||||||
|
@ -302,10 +282,10 @@ extern "C"
|
||||||
|
|
||||||
extern const char* TIFFGetVersion(void);
|
extern const char* TIFFGetVersion(void);
|
||||||
|
|
||||||
extern const TIFFCodec *TIFFFindCODEC(uint16_t);
|
extern const TIFFCodec* TIFFFindCODEC(uint16);
|
||||||
extern TIFFCodec *TIFFRegisterCODEC(uint16_t, const char *, TIFFInitMethod);
|
extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
|
||||||
extern void TIFFUnRegisterCODEC(TIFFCodec*);
|
extern void TIFFUnRegisterCODEC(TIFFCodec*);
|
||||||
extern int TIFFIsCODECConfigured(uint16_t);
|
extern int TIFFIsCODECConfigured(uint16);
|
||||||
extern TIFFCodec* TIFFGetConfiguredCODECs(void);
|
extern TIFFCodec* TIFFGetConfiguredCODECs(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -324,42 +304,34 @@ extern "C"
|
||||||
** Stuff, related to tag handling and creating custom tags.
|
** Stuff, related to tag handling and creating custom tags.
|
||||||
*/
|
*/
|
||||||
extern int TIFFGetTagListCount( TIFF * );
|
extern int TIFFGetTagListCount( TIFF * );
|
||||||
extern uint32_t TIFFGetTagListEntry(TIFF *, int tag_index);
|
extern uint32 TIFFGetTagListEntry( TIFF *, int tag_index );
|
||||||
|
|
||||||
#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
|
#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
|
||||||
#define TIFF_VARIABLE -1 /* marker for variable length tags */
|
#define TIFF_VARIABLE -1 /* marker for variable length tags */
|
||||||
#define TIFF_SPP -2 /* marker for SamplesPerPixel 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
|
#define FIELD_CUSTOM 65
|
||||||
|
|
||||||
typedef struct _TIFFField TIFFField;
|
typedef struct _TIFFField TIFFField;
|
||||||
typedef struct _TIFFFieldArray TIFFFieldArray;
|
typedef struct _TIFFFieldArray TIFFFieldArray;
|
||||||
|
|
||||||
extern const TIFFField *TIFFFindField(TIFF *, uint32_t, TIFFDataType);
|
extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType);
|
||||||
extern const TIFFField *TIFFFieldWithTag(TIFF *, uint32_t);
|
extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32);
|
||||||
extern const TIFFField* TIFFFieldWithName(TIFF*, const char *);
|
extern const TIFFField* TIFFFieldWithName(TIFF*, const char *);
|
||||||
|
|
||||||
extern uint32_t TIFFFieldTag(const TIFFField *);
|
extern uint32 TIFFFieldTag(const TIFFField*);
|
||||||
extern const char* TIFFFieldName(const TIFFField*);
|
extern const char* TIFFFieldName(const TIFFField*);
|
||||||
extern TIFFDataType TIFFFieldDataType(const TIFFField*);
|
extern TIFFDataType TIFFFieldDataType(const TIFFField*);
|
||||||
extern int TIFFFieldPassCount(const TIFFField*);
|
extern int TIFFFieldPassCount(const TIFFField*);
|
||||||
extern int TIFFFieldReadCount(const TIFFField*);
|
extern int TIFFFieldReadCount(const TIFFField*);
|
||||||
extern int TIFFFieldWriteCount(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 *);
|
|
||||||
|
|
||||||
typedef int (*TIFFVSetMethod)(TIFF *, uint32_t, va_list);
|
typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list);
|
||||||
typedef int (*TIFFVGetMethod)(TIFF *, uint32_t, va_list);
|
typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list);
|
||||||
typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
|
typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
TIFFVSetMethod vsetfield; /* tag set routine */
|
TIFFVSetMethod vsetfield; /* tag set routine */
|
||||||
TIFFVGetMethod vgetfield; /* tag get routine */
|
TIFFVGetMethod vgetfield; /* tag get routine */
|
||||||
TIFFPrintMethod printdir; /* directory print routine */
|
TIFFPrintMethod printdir; /* directory print routine */
|
||||||
|
@ -373,33 +345,32 @@ extern "C"
|
||||||
extern void TIFFClose(TIFF* tif);
|
extern void TIFFClose(TIFF* tif);
|
||||||
extern int TIFFFlush(TIFF* tif);
|
extern int TIFFFlush(TIFF* tif);
|
||||||
extern int TIFFFlushData(TIFF* tif);
|
extern int TIFFFlushData(TIFF* tif);
|
||||||
extern int TIFFGetField(TIFF *tif, uint32_t tag, ...);
|
extern int TIFFGetField(TIFF* tif, uint32 tag, ...);
|
||||||
extern int TIFFVGetField(TIFF *tif, uint32_t tag, va_list ap);
|
extern int TIFFVGetField(TIFF* tif, uint32 tag, va_list ap);
|
||||||
extern int TIFFGetFieldDefaulted(TIFF *tif, uint32_t tag, ...);
|
extern int TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...);
|
||||||
extern int TIFFVGetFieldDefaulted(TIFF *tif, uint32_t tag, va_list ap);
|
extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap);
|
||||||
extern int TIFFReadDirectory(TIFF* tif);
|
extern int TIFFReadDirectory(TIFF* tif);
|
||||||
extern int TIFFReadCustomDirectory(TIFF *tif, toff_t diroff,
|
extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray);
|
||||||
const TIFFFieldArray *infoarray);
|
|
||||||
extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff);
|
extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff);
|
||||||
extern int TIFFReadGPSDirectory(TIFF* tif, toff_t diroff);
|
extern int TIFFReadGPSDirectory(TIFF* tif, toff_t diroff);
|
||||||
extern uint64_t TIFFScanlineSize64(TIFF *tif);
|
extern uint64 TIFFScanlineSize64(TIFF* tif);
|
||||||
extern tmsize_t TIFFScanlineSize(TIFF* tif);
|
extern tmsize_t TIFFScanlineSize(TIFF* tif);
|
||||||
extern uint64_t TIFFRasterScanlineSize64(TIFF *tif);
|
extern uint64 TIFFRasterScanlineSize64(TIFF* tif);
|
||||||
extern tmsize_t TIFFRasterScanlineSize(TIFF* tif);
|
extern tmsize_t TIFFRasterScanlineSize(TIFF* tif);
|
||||||
extern uint64_t TIFFStripSize64(TIFF *tif);
|
extern uint64 TIFFStripSize64(TIFF* tif);
|
||||||
extern tmsize_t TIFFStripSize(TIFF* tif);
|
extern tmsize_t TIFFStripSize(TIFF* tif);
|
||||||
extern uint64_t TIFFRawStripSize64(TIFF *tif, uint32_t strip);
|
extern uint64 TIFFRawStripSize64(TIFF* tif, uint32 strip);
|
||||||
extern tmsize_t TIFFRawStripSize(TIFF *tif, uint32_t strip);
|
extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32 strip);
|
||||||
extern uint64_t TIFFVStripSize64(TIFF *tif, uint32_t nrows);
|
extern uint64 TIFFVStripSize64(TIFF* tif, uint32 nrows);
|
||||||
extern tmsize_t TIFFVStripSize(TIFF *tif, uint32_t nrows);
|
extern tmsize_t TIFFVStripSize(TIFF* tif, uint32 nrows);
|
||||||
extern uint64_t TIFFTileRowSize64(TIFF *tif);
|
extern uint64 TIFFTileRowSize64(TIFF* tif);
|
||||||
extern tmsize_t TIFFTileRowSize(TIFF* tif);
|
extern tmsize_t TIFFTileRowSize(TIFF* tif);
|
||||||
extern uint64_t TIFFTileSize64(TIFF *tif);
|
extern uint64 TIFFTileSize64(TIFF* tif);
|
||||||
extern tmsize_t TIFFTileSize(TIFF* tif);
|
extern tmsize_t TIFFTileSize(TIFF* tif);
|
||||||
extern uint64_t TIFFVTileSize64(TIFF *tif, uint32_t nrows);
|
extern uint64 TIFFVTileSize64(TIFF* tif, uint32 nrows);
|
||||||
extern tmsize_t TIFFVTileSize(TIFF *tif, uint32_t nrows);
|
extern tmsize_t TIFFVTileSize(TIFF* tif, uint32 nrows);
|
||||||
extern uint32_t TIFFDefaultStripSize(TIFF *tif, uint32_t request);
|
extern uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request);
|
||||||
extern void TIFFDefaultTileSize(TIFF *, uint32_t *, uint32_t *);
|
extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
|
||||||
extern int TIFFFileno(TIFF*);
|
extern int TIFFFileno(TIFF*);
|
||||||
extern int TIFFSetFileno(TIFF*, int);
|
extern int TIFFSetFileno(TIFF*, int);
|
||||||
extern thandle_t TIFFClientdata(TIFF*);
|
extern thandle_t TIFFClientdata(TIFF*);
|
||||||
|
@ -411,7 +382,6 @@ extern "C"
|
||||||
extern int TIFFIsUpSampled(TIFF*);
|
extern int TIFFIsUpSampled(TIFF*);
|
||||||
extern int TIFFIsMSB2LSB(TIFF*);
|
extern int TIFFIsMSB2LSB(TIFF*);
|
||||||
extern int TIFFIsBigEndian(TIFF*);
|
extern int TIFFIsBigEndian(TIFF*);
|
||||||
extern int TIFFIsBigTIFF(TIFF *);
|
|
||||||
extern TIFFReadWriteProc TIFFGetReadProc(TIFF*);
|
extern TIFFReadWriteProc TIFFGetReadProc(TIFF*);
|
||||||
extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
|
extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
|
||||||
extern TIFFSeekProc TIFFGetSeekProc(TIFF*);
|
extern TIFFSeekProc TIFFGetSeekProc(TIFF*);
|
||||||
|
@ -419,12 +389,12 @@ extern "C"
|
||||||
extern TIFFSizeProc TIFFGetSizeProc(TIFF*);
|
extern TIFFSizeProc TIFFGetSizeProc(TIFF*);
|
||||||
extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
|
extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
|
||||||
extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
|
extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
|
||||||
extern uint32_t TIFFCurrentRow(TIFF *);
|
extern uint32 TIFFCurrentRow(TIFF*);
|
||||||
extern tdir_t TIFFCurrentDirectory(TIFF *);
|
extern uint16 TIFFCurrentDirectory(TIFF*);
|
||||||
extern tdir_t TIFFNumberOfDirectories(TIFF *);
|
extern uint16 TIFFNumberOfDirectories(TIFF*);
|
||||||
extern uint64_t TIFFCurrentDirOffset(TIFF *);
|
extern uint64 TIFFCurrentDirOffset(TIFF*);
|
||||||
extern uint32_t TIFFCurrentStrip(TIFF *);
|
extern uint32 TIFFCurrentStrip(TIFF*);
|
||||||
extern uint32_t TIFFCurrentTile(TIFF *tif);
|
extern uint32 TIFFCurrentTile(TIFF* tif);
|
||||||
extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size);
|
extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size);
|
||||||
extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size);
|
extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size);
|
||||||
extern int TIFFSetupStrips(TIFF *);
|
extern int TIFFSetupStrips(TIFF *);
|
||||||
|
@ -435,14 +405,14 @@ extern "C"
|
||||||
extern int TIFFCreateEXIFDirectory(TIFF*);
|
extern int TIFFCreateEXIFDirectory(TIFF*);
|
||||||
extern int TIFFCreateGPSDirectory(TIFF*);
|
extern int TIFFCreateGPSDirectory(TIFF*);
|
||||||
extern int TIFFLastDirectory(TIFF*);
|
extern int TIFFLastDirectory(TIFF*);
|
||||||
extern int TIFFSetDirectory(TIFF *, tdir_t);
|
extern int TIFFSetDirectory(TIFF*, uint16);
|
||||||
extern int TIFFSetSubDirectory(TIFF *, uint64_t);
|
extern int TIFFSetSubDirectory(TIFF*, uint64);
|
||||||
extern int TIFFUnlinkDirectory(TIFF *, tdir_t);
|
extern int TIFFUnlinkDirectory(TIFF*, uint16);
|
||||||
extern int TIFFSetField(TIFF *, uint32_t, ...);
|
extern int TIFFSetField(TIFF*, uint32, ...);
|
||||||
extern int TIFFVSetField(TIFF *, uint32_t, va_list);
|
extern int TIFFVSetField(TIFF*, uint32, va_list);
|
||||||
extern int TIFFUnsetField(TIFF *, uint32_t);
|
extern int TIFFUnsetField(TIFF*, uint32);
|
||||||
extern int TIFFWriteDirectory(TIFF *);
|
extern int TIFFWriteDirectory(TIFF *);
|
||||||
extern int TIFFWriteCustomDirectory(TIFF *, uint64_t *);
|
extern int TIFFWriteCustomDirectory(TIFF *, uint64 *);
|
||||||
extern int TIFFCheckpointDirectory(TIFF *);
|
extern int TIFFCheckpointDirectory(TIFF *);
|
||||||
extern int TIFFRewriteDirectory(TIFF *);
|
extern int TIFFRewriteDirectory(TIFF *);
|
||||||
extern int TIFFDeferStrileArrayWriting(TIFF *);
|
extern int TIFFDeferStrileArrayWriting(TIFF *);
|
||||||
|
@ -450,145 +420,87 @@ extern "C"
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
|
extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
|
||||||
extern int TIFFReadScanline(TIFF *tif, void *buf, uint32_t row,
|
extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0);
|
||||||
uint16_t sample = 0);
|
extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0);
|
||||||
extern int TIFFWriteScanline(TIFF *tif, void *buf, uint32_t row,
|
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
|
||||||
uint16_t sample = 0);
|
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
|
||||||
extern int TIFFReadRGBAImage(TIFF *, uint32_t, uint32_t, uint32_t *,
|
|
||||||
int = 0);
|
|
||||||
extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
|
|
||||||
int = ORIENTATION_BOTLEFT, int = 0);
|
int = ORIENTATION_BOTLEFT, int = 0);
|
||||||
#else
|
#else
|
||||||
extern void TIFFPrintDirectory(TIFF*, FILE*, long);
|
extern void TIFFPrintDirectory(TIFF*, FILE*, long);
|
||||||
extern int TIFFReadScanline(TIFF *tif, void *buf, uint32_t row,
|
extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample);
|
||||||
uint16_t sample);
|
extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample);
|
||||||
extern int TIFFWriteScanline(TIFF *tif, void *buf, uint32_t row,
|
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
|
||||||
uint16_t sample);
|
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
|
||||||
extern int TIFFReadRGBAImage(TIFF *, uint32_t, uint32_t, uint32_t *, int);
|
|
||||||
extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
|
|
||||||
int, int);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int TIFFReadRGBAStrip(TIFF *, uint32_t, uint32_t *);
|
extern int TIFFReadRGBAStrip(TIFF*, uint32, uint32 * );
|
||||||
extern int TIFFReadRGBATile(TIFF *, uint32_t, uint32_t, uint32_t *);
|
extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
|
||||||
extern int TIFFReadRGBAStripExt(TIFF *, uint32_t, uint32_t *,
|
extern int TIFFReadRGBAStripExt(TIFF*, uint32, uint32 *, int stop_on_error );
|
||||||
int stop_on_error);
|
extern int TIFFReadRGBATileExt(TIFF*, uint32, uint32, uint32 *, 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 TIFFRGBAImageOK(TIFF*, char [1024]);
|
||||||
extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
|
extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
|
||||||
extern int TIFFRGBAImageGet(TIFFRGBAImage *, uint32_t *, uint32_t,
|
extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||||
uint32_t);
|
|
||||||
extern void TIFFRGBAImageEnd(TIFFRGBAImage*);
|
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,
|
||||||
|
TIFFMapFileProc, TIFFUnmapFileProc);
|
||||||
extern const char* TIFFFileName(TIFF*);
|
extern const char* TIFFFileName(TIFF*);
|
||||||
extern const char* TIFFSetFileName(TIFF*, const char *);
|
extern const char* TIFFSetFileName(TIFF*, const char *);
|
||||||
extern void TIFFError(const char *, const char *, ...)
|
extern void TIFFError(const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,2,3)));
|
||||||
TIFF_ATTRIBUTE((__format__(__printf__, 2, 3)));
|
extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,3,4)));
|
||||||
extern void TIFFErrorExt(thandle_t, const char *, const char *, ...)
|
extern void TIFFWarning(const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,2,3)));
|
||||||
TIFF_ATTRIBUTE((__format__(__printf__, 3, 4)));
|
extern void TIFFWarningExt(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 TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
|
||||||
extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
|
extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
|
||||||
extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
|
extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
|
||||||
extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
|
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,
|
|
||||||
TIFFReadWriteProc, TIFFReadWriteProc,
|
|
||||||
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 TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
|
||||||
extern uint32_t TIFFComputeTile(TIFF *tif, uint32_t x, uint32_t y,
|
extern uint32 TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s);
|
||||||
uint32_t z, uint16_t s);
|
extern int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s);
|
||||||
extern int TIFFCheckTile(TIFF *tif, uint32_t x, uint32_t y, uint32_t z,
|
extern uint32 TIFFNumberOfTiles(TIFF*);
|
||||||
uint16_t s);
|
extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s);
|
||||||
extern uint32_t TIFFNumberOfTiles(TIFF *);
|
extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s);
|
||||||
extern tmsize_t TIFFReadTile(TIFF *tif, void *buf, uint32_t x, uint32_t y,
|
extern uint32 TIFFComputeStrip(TIFF*, uint32, uint16);
|
||||||
uint32_t z, uint16_t s);
|
extern uint32 TIFFNumberOfStrips(TIFF*);
|
||||||
extern tmsize_t TIFFWriteTile(TIFF *tif, void *buf, uint32_t x, uint32_t y,
|
extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size);
|
||||||
uint32_t z, uint16_t s);
|
extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size);
|
||||||
extern uint32_t TIFFComputeStrip(TIFF *, uint32_t, uint16_t);
|
extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size);
|
||||||
extern uint32_t TIFFNumberOfStrips(TIFF *);
|
extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size);
|
||||||
extern tmsize_t TIFFReadEncodedStrip(TIFF *tif, uint32_t strip, void *buf,
|
extern int TIFFReadFromUserBuffer(TIFF* tif, uint32 strile,
|
||||||
tmsize_t size);
|
void* inbuf, tmsize_t insize,
|
||||||
extern tmsize_t TIFFReadRawStrip(TIFF *tif, uint32_t strip, void *buf,
|
void* outbuf, tmsize_t outsize);
|
||||||
tmsize_t size);
|
extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc);
|
||||||
extern tmsize_t TIFFReadEncodedTile(TIFF *tif, uint32_t tile, void *buf,
|
extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc);
|
||||||
tmsize_t size);
|
extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc);
|
||||||
extern tmsize_t TIFFReadRawTile(TIFF *tif, uint32_t tile, void *buf,
|
extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc);
|
||||||
tmsize_t size);
|
extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
|
||||||
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 TIFFSetWriteOffset(TIFF* tif, toff_t off);
|
||||||
extern void TIFFSwabShort(uint16_t *);
|
extern void TIFFSwabShort(uint16*);
|
||||||
extern void TIFFSwabLong(uint32_t *);
|
extern void TIFFSwabLong(uint32*);
|
||||||
extern void TIFFSwabLong8(uint64_t *);
|
extern void TIFFSwabLong8(uint64*);
|
||||||
extern void TIFFSwabFloat(float*);
|
extern void TIFFSwabFloat(float*);
|
||||||
extern void TIFFSwabDouble(double*);
|
extern void TIFFSwabDouble(double*);
|
||||||
extern void TIFFSwabArrayOfShort(uint16_t *wp, tmsize_t n);
|
extern void TIFFSwabArrayOfShort(uint16* wp, tmsize_t n);
|
||||||
extern void TIFFSwabArrayOfTriples(uint8_t *tp, tmsize_t n);
|
extern void TIFFSwabArrayOfTriples(uint8* tp, tmsize_t n);
|
||||||
extern void TIFFSwabArrayOfLong(uint32_t *lp, tmsize_t n);
|
extern void TIFFSwabArrayOfLong(uint32* lp, tmsize_t n);
|
||||||
extern void TIFFSwabArrayOfLong8(uint64_t *lp, tmsize_t n);
|
extern void TIFFSwabArrayOfLong8(uint64* lp, tmsize_t n);
|
||||||
extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n);
|
extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n);
|
||||||
extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n);
|
extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n);
|
||||||
extern void TIFFReverseBits(uint8_t *cp, tmsize_t n);
|
extern void TIFFReverseBits(uint8* cp, tmsize_t n);
|
||||||
extern const unsigned char* TIFFGetBitRevTable(int);
|
extern const unsigned char* TIFFGetBitRevTable(int);
|
||||||
|
|
||||||
extern uint64_t TIFFGetStrileOffset(TIFF *tif, uint32_t strile);
|
extern uint64 TIFFGetStrileOffset(TIFF *tif, uint32 strile);
|
||||||
extern uint64_t TIFFGetStrileByteCount(TIFF *tif, uint32_t strile);
|
extern uint64 TIFFGetStrileByteCount(TIFF *tif, uint32 strile);
|
||||||
extern uint64_t TIFFGetStrileOffsetWithErr(TIFF *tif, uint32_t strile,
|
extern uint64 TIFFGetStrileOffsetWithErr(TIFF *tif, uint32 strile, int *pbErr);
|
||||||
int *pbErr);
|
extern uint64 TIFFGetStrileByteCountWithErr(TIFF *tif, uint32 strile, int *pbErr);
|
||||||
extern uint64_t TIFFGetStrileByteCountWithErr(TIFF *tif, uint32_t strile,
|
|
||||||
int *pbErr);
|
|
||||||
|
|
||||||
#ifdef LOGLUV_PUBLIC
|
#ifdef LOGLUV_PUBLIC
|
||||||
#define U_NEU 0.210526316
|
#define U_NEU 0.210526316
|
||||||
|
@ -596,44 +508,42 @@ extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
|
||||||
#define UVSCALE 410.
|
#define UVSCALE 410.
|
||||||
extern double LogL16toY(int);
|
extern double LogL16toY(int);
|
||||||
extern double LogL10toY(int);
|
extern double LogL10toY(int);
|
||||||
extern void XYZtoRGB24(float *, uint8_t *);
|
extern void XYZtoRGB24(float*, uint8*);
|
||||||
extern int uv_decode(double*, double*, int);
|
extern int uv_decode(double*, double*, int);
|
||||||
extern void LogLuv24toXYZ(uint32_t, float *);
|
extern void LogLuv24toXYZ(uint32, float*);
|
||||||
extern void LogLuv32toXYZ(uint32_t, float *);
|
extern void LogLuv32toXYZ(uint32, float*);
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
|
extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
|
||||||
extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
|
extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
|
||||||
extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
|
extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
|
||||||
extern uint32_t LogLuv24fromXYZ(float *, int = SGILOGENCODE_NODITHER);
|
extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
|
||||||
extern uint32_t LogLuv32fromXYZ(float *, int = SGILOGENCODE_NODITHER);
|
extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
|
||||||
#else
|
#else
|
||||||
extern int LogL16fromY(double, int);
|
extern int LogL16fromY(double, int);
|
||||||
extern int LogL10fromY(double, int);
|
extern int LogL10fromY(double, int);
|
||||||
extern int uv_encode(double, double, int);
|
extern int uv_encode(double, double, int);
|
||||||
extern uint32_t LogLuv24fromXYZ(float *, int);
|
extern uint32 LogLuv24fromXYZ(float*, int);
|
||||||
extern uint32_t LogLuv32fromXYZ(float *, int);
|
extern uint32 LogLuv32fromXYZ(float*, int);
|
||||||
#endif
|
#endif
|
||||||
#endif /* LOGLUV_PUBLIC */
|
#endif /* LOGLUV_PUBLIC */
|
||||||
|
|
||||||
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB *, const TIFFDisplay *,
|
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*);
|
||||||
float *);
|
extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
|
||||||
extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32_t, int32_t, int32_t,
|
|
||||||
float *, float *, float *);
|
float *, float *, float *);
|
||||||
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float, uint32_t *,
|
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
|
||||||
uint32_t *, uint32_t *);
|
uint32 *, uint32 *, uint32 *);
|
||||||
|
|
||||||
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
|
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
|
||||||
extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32_t, int32_t, int32_t,
|
extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
|
||||||
uint32_t *, uint32_t *, uint32_t *);
|
uint32 *, uint32 *, uint32 *);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* O B S O L E T E D I N T E R F A C E S
|
* 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
|
* Don't use this stuff in your applications, it may be removed in the future
|
||||||
*future libtiff versions.
|
* libtiff versions.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
ttag_t field_tag; /* field's tag */
|
ttag_t field_tag; /* field's tag */
|
||||||
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
|
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
|
||||||
short field_writecount; /* write count/TIFF_VARIABLE */
|
short field_writecount; /* write count/TIFF_VARIABLE */
|
||||||
|
@ -644,10 +554,19 @@ extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
|
||||||
char *field_name; /* ASCII name */
|
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)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _TIFFIO_ */
|
#endif /* _TIFFIO_ */
|
||||||
|
|
||||||
|
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* mode: c
|
||||||
|
* c-basic-offset: 8
|
||||||
|
* fill-column: 78
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
/* clang-format off */
|
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.2.0\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
|
||||||
|
|
||||||
/* 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."
|
|
||||||
/*
|
/*
|
||||||
* This define can be used in code that requires
|
* This define can be used in code that requires
|
||||||
* compilation-related definitions specific to a
|
* compilation-related definitions specific to a
|
||||||
|
@ -11,20 +6,4 @@
|
||||||
* version checking should be done based on the
|
* version checking should be done based on the
|
||||||
* string returned by TIFFGetVersion.
|
* string returned by TIFFGetVersion.
|
||||||
*/
|
*/
|
||||||
#define TIFFLIB_VERSION 20230609
|
#define TIFFLIB_VERSION 20201219
|
||||||
|
|
||||||
/* 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 */
|
|
||||||
|
|
BIN
thirdparty/SDL2_image/VisualC/external/optional/x64/libtiff-5.dll
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/SDL2_image/VisualC/external/optional/x64/libtiff-5.dll
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
thirdparty/SDL2_image/VisualC/external/optional/x86/libtiff-5.dll
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/SDL2_image/VisualC/external/optional/x86/libtiff-5.dll
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
Binary file not shown.
27
thirdparty/SDL2_image/configure
vendored
27
thirdparty/SDL2_image/configure
vendored
|
@ -14503,10 +14503,16 @@ fi
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-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*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
|
avif_lib=`find_lib "libavif-[0-9]*.dll"`
|
||||||
|
if test x$avif_lib = x; then
|
||||||
avif_lib=`find_lib "libavif*.dll"`
|
avif_lib=`find_lib "libavif*.dll"`
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
avif_lib=`find_lib "libavif[0-9]*.so.*"`
|
avif_lib=`find_lib "libavif[0-9]*.so.*"`
|
||||||
|
@ -14726,7 +14732,10 @@ fi
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-darwin*)
|
||||||
|
jpg_lib=`find_lib "libjpeg.[0-9]*.dylib"`
|
||||||
|
if test x$jpg_lib = x; then
|
||||||
jpg_lib=`find_lib libjpeg.dylib`
|
jpg_lib=`find_lib libjpeg.dylib`
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-cygwin* | *-*-mingw*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
jpg_lib=`find_lib "libjpeg*.dll"`
|
jpg_lib=`find_lib "libjpeg*.dll"`
|
||||||
|
@ -14938,10 +14947,16 @@ fi
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-darwin*)
|
||||||
|
jxl_lib=`find_lib "libjxl.[0-9]*.dylib"`
|
||||||
|
if test x$jxl_lib = x; then
|
||||||
jxl_lib=`find_lib libjxl.dylib`
|
jxl_lib=`find_lib libjxl.dylib`
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-cygwin* | *-*-mingw*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
|
jxl_lib=`find_lib "libjxl-[0-9]*.dll"`
|
||||||
|
if test x$jxl_lib = x; then
|
||||||
jxl_lib=`find_lib "libjxl.dll"`
|
jxl_lib=`find_lib "libjxl.dll"`
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
jxl_lib=`find_lib "libjxl[0-9]*.so.*"`
|
jxl_lib=`find_lib "libjxl[0-9]*.so.*"`
|
||||||
|
@ -15158,7 +15173,10 @@ fi
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-darwin*)
|
||||||
|
png_lib=`find_lib "libpng[0-9]*.dylib"`
|
||||||
|
if test x$png_lib = x; then
|
||||||
png_lib=`find_lib libpng.dylib`
|
png_lib=`find_lib libpng.dylib`
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-cygwin* | *-*-mingw*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
png_lib=`find_lib "libpng*.dll"`
|
png_lib=`find_lib "libpng*.dll"`
|
||||||
|
@ -15368,7 +15386,10 @@ fi
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-darwin*)
|
||||||
|
tif_lib=`find_lib "libtiff.[0-9]*.dylib"`
|
||||||
|
if test x$tif_lib = x; then
|
||||||
tif_lib=`find_lib libtiff.dylib`
|
tif_lib=`find_lib libtiff.dylib`
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-cygwin* | *-*-mingw*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
tif_lib=`find_lib "libtiff-*.dll"`
|
tif_lib=`find_lib "libtiff-*.dll"`
|
||||||
|
@ -15754,8 +15775,12 @@ fi
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-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`
|
webpdemux_lib=`find_lib libwebpdemux.dylib`
|
||||||
webp_lib=`find_lib libwebp.dylib`
|
webp_lib=`find_lib libwebp.dylib`
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-cygwin* | *-*-mingw*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
webpdemux_lib=`find_lib "libwebpdemux-*.dll"`
|
webpdemux_lib=`find_lib "libwebpdemux-*.dll"`
|
||||||
|
|
27
thirdparty/SDL2_image/configure.ac
vendored
27
thirdparty/SDL2_image/configure.ac
vendored
|
@ -339,10 +339,16 @@ if test x$enable_avif = xyes; then
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-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*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
|
avif_lib=[`find_lib "libavif-[0-9]*.dll"`]
|
||||||
|
if test x$avif_lib = x; then
|
||||||
avif_lib=[`find_lib "libavif*.dll"`]
|
avif_lib=[`find_lib "libavif*.dll"`]
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
avif_lib=[`find_lib "libavif[0-9]*.so.*"`]
|
avif_lib=[`find_lib "libavif[0-9]*.so.*"`]
|
||||||
|
@ -391,7 +397,10 @@ if test x$enable_jpg = xyes; then
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-darwin*)
|
||||||
|
jpg_lib=[`find_lib "libjpeg.[0-9]*.dylib"`]
|
||||||
|
if test x$jpg_lib = x; then
|
||||||
jpg_lib=[`find_lib libjpeg.dylib`]
|
jpg_lib=[`find_lib libjpeg.dylib`]
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-cygwin* | *-*-mingw*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
jpg_lib=[`find_lib "libjpeg*.dll"`]
|
jpg_lib=[`find_lib "libjpeg*.dll"`]
|
||||||
|
@ -435,10 +444,16 @@ if test x$enable_jxl = xyes; then
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-darwin*)
|
||||||
|
jxl_lib=[`find_lib "libjxl.[0-9]*.dylib"`]
|
||||||
|
if test x$jxl_lib = x; then
|
||||||
jxl_lib=[`find_lib libjxl.dylib`]
|
jxl_lib=[`find_lib libjxl.dylib`]
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-cygwin* | *-*-mingw*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
|
jxl_lib=[`find_lib "libjxl-[0-9]*.dll"`]
|
||||||
|
if test x$jxl_lib = x; then
|
||||||
jxl_lib=[`find_lib "libjxl.dll"`]
|
jxl_lib=[`find_lib "libjxl.dll"`]
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
jxl_lib=[`find_lib "libjxl[0-9]*.so.*"`]
|
jxl_lib=[`find_lib "libjxl[0-9]*.so.*"`]
|
||||||
|
@ -484,7 +499,10 @@ if test x$enable_png = xyes; then
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-darwin*)
|
||||||
|
png_lib=[`find_lib "libpng[0-9]*.dylib"`]
|
||||||
|
if test x$png_lib = x; then
|
||||||
png_lib=[`find_lib libpng.dylib`]
|
png_lib=[`find_lib libpng.dylib`]
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-cygwin* | *-*-mingw*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
png_lib=[`find_lib "libpng*.dll"`]
|
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
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-darwin*)
|
||||||
|
tif_lib=[`find_lib "libtiff.[0-9]*.dylib"`]
|
||||||
|
if test x$tif_lib = x; then
|
||||||
tif_lib=[`find_lib libtiff.dylib`]
|
tif_lib=[`find_lib libtiff.dylib`]
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-cygwin* | *-*-mingw*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
tif_lib=[`find_lib "libtiff-*.dll"`]
|
tif_lib=[`find_lib "libtiff-*.dll"`]
|
||||||
|
@ -580,8 +601,12 @@ if test x$enable_webp = xyes; then
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-darwin*)
|
*-*-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`]
|
webpdemux_lib=[`find_lib libwebpdemux.dylib`]
|
||||||
webp_lib=[`find_lib libwebp.dylib`]
|
webp_lib=[`find_lib libwebp.dylib`]
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*-*-cygwin* | *-*-mingw*)
|
*-*-cygwin* | *-*-mingw*)
|
||||||
webpdemux_lib=[`find_lib "libwebpdemux-*.dll"`]
|
webpdemux_lib=[`find_lib "libwebpdemux-*.dll"`]
|
||||||
|
|
36
thirdparty/SDL2_image/external/Get-GitModules.ps1
vendored
Normal file
36
thirdparty/SDL2_image/external/Get-GitModules.ps1
vendored
Normal 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
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
|
|
@ -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
|
|
18
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android
vendored
Normal file
18
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android
vendored
Normal 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
|
18
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm
vendored
Normal file
18
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm
vendored
Normal 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
|
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.lsan
vendored
Normal file
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.lsan
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
mode = .lsan
|
||||||
|
extra_cflags = -fsanitize=leak
|
||||||
|
extra_ldflags = -fsanitize=leak
|
||||||
|
include build/android-arm
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.neon-vfpv4
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.neon-vfpv4
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .neon-vfpv4
|
||||||
|
extra_cflags = -mfpu=neon-vfpv4
|
||||||
|
include build/android-arm
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.neon-vfpv4-O3
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.neon-vfpv4-O3
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .neon-vfpv4-O3
|
||||||
|
extra_cflags = -mfpu=neon-vfpv4 -O3
|
||||||
|
include build/android-arm
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.portable
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.portable
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .portable
|
||||||
|
extra_cflags = -DSKCMS_PORTABLE
|
||||||
|
include build/android-arm
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.tiny
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.tiny
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .tiny
|
||||||
|
extra_cflags = -g0 -DNDEBUG -fno-unwind-tables -fno-asynchronous-unwind-tables
|
||||||
|
include build/android-arm
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.vfpv2
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android-arm.vfpv2
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .vfpv2
|
||||||
|
extra_cflags = -mfpu=vfpv2
|
||||||
|
include build/android-arm
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android.fp16
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android.fp16
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .fp16
|
||||||
|
extra_cflags = -march=armv8.2a+fp16 -DSKCMS_OPT_INTO_NEON_FP16
|
||||||
|
include build/android
|
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android.lsan
vendored
Normal file
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android.lsan
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
mode = .lsan
|
||||||
|
extra_cflags = -fsanitize=leak
|
||||||
|
extra_ldflags = -fsanitize=leak
|
||||||
|
include build/android
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android.nofp16
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android.nofp16
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .nofp16
|
||||||
|
extra_cflags = -march=armv8.2a+fp16
|
||||||
|
include build/android
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android.portable
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android.portable
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .portable
|
||||||
|
extra_cflags = -DSKCMS_PORTABLE
|
||||||
|
include build/android
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android.tiny
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/android.tiny
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .tiny
|
||||||
|
extra_cflags = -g0 -DNDEBUG -fno-unwind-tables -fno-asynchronous-unwind-tables
|
||||||
|
include build/android
|
7
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang
vendored
Normal file
7
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
cc = clang
|
||||||
|
cxx = clang++
|
||||||
|
cflags = -fcolor-diagnostics -Weverything
|
||||||
|
out = out/clang$mode
|
||||||
|
|
||||||
|
include build/local
|
||||||
|
include build/common
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.O0
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.O0
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .O0
|
||||||
|
extra_cflags = -O0
|
||||||
|
include build/clang
|
5
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.avx512
vendored
Normal file
5
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.avx512
vendored
Normal 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)
|
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.lsan
vendored
Normal file
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.lsan
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
mode = .lsan
|
||||||
|
extra_cflags = -fsanitize=leak
|
||||||
|
extra_ldflags = -fsanitize=leak
|
||||||
|
include build/clang
|
6
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.m32
vendored
Normal file
6
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.m32
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
mode = .m32
|
||||||
|
extra_cflags = -m32 -msse2
|
||||||
|
extra_ldflags = -m32
|
||||||
|
include build/clang
|
||||||
|
|
||||||
|
disabled = (uname | grep -qv Linux)
|
7
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.m32-O0
vendored
Normal file
7
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.m32-O0
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
mode = .m32-O0
|
||||||
|
extra_cflags = -m32 -msse2 -O0
|
||||||
|
extra_ldflags = -m32
|
||||||
|
include build/clang
|
||||||
|
|
||||||
|
disabled = (uname | grep -qv Linux)
|
||||||
|
|
6
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.msan
vendored
Normal file
6
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.msan
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
mode = .msan
|
||||||
|
extra_cflags = -fsanitize=memory
|
||||||
|
extra_ldflags = -fsanitize=memory
|
||||||
|
include build/clang
|
||||||
|
|
||||||
|
disabled = (uname | grep -qv Linux)
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.native
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.native
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .native
|
||||||
|
extra_cflags = -march=native
|
||||||
|
include build/clang
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.portable
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.portable
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .portable
|
||||||
|
extra_cflags = -DSKCMS_PORTABLE
|
||||||
|
include build/clang
|
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.sse2
vendored
Normal file
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.sse2
vendored
Normal 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
|
||||||
|
|
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.sse41
vendored
Normal file
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.sse41
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
mode = .sse41
|
||||||
|
extra_cflags = -msse4.1 -DSKCMS_NO_RUNTIME_CPU_DETECTION
|
||||||
|
include build/clang
|
||||||
|
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.tiny
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.tiny
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .tiny
|
||||||
|
extra_cflags = -g0 -DNDEBUG -fno-unwind-tables -fno-asynchronous-unwind-tables
|
||||||
|
include build/clang
|
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.xsan
vendored
Normal file
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.xsan
vendored
Normal 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
|
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.xsan-portable
vendored
Normal file
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/clang.xsan-portable
vendored
Normal 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
|
35
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/common
vendored
Normal file
35
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/common
vendored
Normal 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
|
19
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/emscripten
vendored
Normal file
19
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/emscripten
vendored
Normal 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)
|
5
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/emscripten.simd
vendored
Normal file
5
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/emscripten.simd
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
mode = .simd
|
||||||
|
extra_cflags = -s SIMD=1
|
||||||
|
extra_ldflags = -s SIMD=1
|
||||||
|
|
||||||
|
include build/emscripten
|
9
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc
vendored
Normal file
9
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc
vendored
Normal 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)
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.O0
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.O0
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .O0
|
||||||
|
extra_cflags = -O0
|
||||||
|
include build/gcc
|
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.m32
vendored
Normal file
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.m32
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
mode = .m32
|
||||||
|
extra_cflags = -m32 -msse2 -mfpmath=sse
|
||||||
|
extra_ldflags = -m32
|
||||||
|
include build/gcc
|
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.m32-O0
vendored
Normal file
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.m32-O0
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
mode = .m32-O0
|
||||||
|
extra_cflags = -m32 -msse2 -mfpmath=sse -O0
|
||||||
|
extra_ldflags = -m32
|
||||||
|
include build/gcc
|
16
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.mips64el
vendored
Normal file
16
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.mips64el
vendored
Normal 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)
|
16
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.mips64el-O3
vendored
Normal file
16
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.mips64el-O3
vendored
Normal 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)
|
6
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.musl
vendored
Normal file
6
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.musl
vendored
Normal 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
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.native
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.native
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .native
|
||||||
|
extra_cflags = -march=native
|
||||||
|
include build/gcc
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.portable
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.portable
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .portable
|
||||||
|
extra_cflags = -DSKCMS_PORTABLE
|
||||||
|
include build/gcc
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.tiny
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.tiny
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .tiny
|
||||||
|
extra_cflags = -g0 -DNDEBUG -fno-unwind-tables -fno-asynchronous-unwind-tables
|
||||||
|
include build/gcc
|
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.xsan
vendored
Normal file
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/gcc.xsan
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
mode = .xsan
|
||||||
|
extra_cflags = -fsanitize=address,undefined -fno-sanitize-recover=all
|
||||||
|
extra_ldflags = -fsanitize=address,undefined
|
||||||
|
include build/gcc
|
11
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/ios
vendored
Normal file
11
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/ios
vendored
Normal 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)
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/ios.portable
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/ios.portable
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .portable
|
||||||
|
extra_cflags = -DSKCMS_PORTABLE
|
||||||
|
include build/ios
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/ios.tiny
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/ios.tiny
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .tiny
|
||||||
|
extra_cflags = -g0 -DNDEBUG -fno-unwind-tables -fno-asynchronous-unwind-tables
|
||||||
|
include build/ios
|
7
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/ios.xsan
vendored
Normal file
7
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/ios.xsan
vendored
Normal 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++
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/local
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/local
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
rule run
|
||||||
|
command = $disabled && touch $out || ./$in > $out
|
||||||
|
description = run $in
|
27
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/msvs
vendored
Normal file
27
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/msvs
vendored
Normal 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
|
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/msvs.analyze
vendored
Normal file
4
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/msvs.analyze
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
mode = .analyze
|
||||||
|
extra_cflags = /analyze /RTCcsu /guard:cf
|
||||||
|
extra_ldflags = /guard:cf
|
||||||
|
include build/msvs
|
5
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/msvs.clang
vendored
Normal file
5
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/msvs.clang
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
mode = .clang
|
||||||
|
|
||||||
|
include build/msvs
|
||||||
|
|
||||||
|
cl = "../clang_win/bin/clang-cl.exe"
|
6
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/msvs.clang-fast
vendored
Normal file
6
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/msvs.clang-fast
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
mode = .clang-fast
|
||||||
|
extra_cflags = /O2 /Zc:inline
|
||||||
|
|
||||||
|
include build/msvs
|
||||||
|
|
||||||
|
cl = "../clang_win/bin/clang-cl.exe"
|
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/msvs.fast
vendored
Normal file
3
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/msvs.fast
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mode = .fast
|
||||||
|
extra_cflags = /O2 /Zc:inline
|
||||||
|
include build/msvs
|
30
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/targets
vendored
Normal file
30
thirdparty/SDL2_image/external/libjxl/third_party/skcms/build/targets
vendored
Normal 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
|
|
@ -24,14 +24,14 @@ environment:
|
||||||
shared: OFF
|
shared: OFF
|
||||||
- compiler: vc14-cmake
|
- compiler: vc14-cmake
|
||||||
configuration: Release
|
configuration: Release
|
||||||
arch: x64
|
|
||||||
generator: Visual Studio 16 2019
|
generator: Visual Studio 16 2019
|
||||||
shared: ON
|
shared: ON
|
||||||
- compiler: vc14-cmake
|
- compiler: vc14-cmake
|
||||||
configuration: Debug
|
configuration: Debug
|
||||||
arch: Win32
|
|
||||||
generator: Visual Studio 16 2019
|
generator: Visual Studio 16 2019
|
||||||
shared: OFF
|
shared: OFF
|
||||||
|
- compiler: vc14-nmake
|
||||||
|
configuration: Release
|
||||||
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
|
@ -50,34 +50,51 @@ init:
|
||||||
- git config --global core.autocrlf input
|
- git config --global core.autocrlf input
|
||||||
|
|
||||||
before_build:
|
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_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'
|
- 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\Cygwin64\bin\cygpath -u %AV_TIFF_INSTALL%`) DO SET AV_TIFF_CYG_INSTALL=%%F'
|
||||||
- 'if %compiler%==cygwin-cmake C:\cygwin64\setup-x86_64 -q -R C:\cygwin64 -s http://cygwin.mirror.constant.com -l %AV_TIFF_DOWNLOAD%\cygwin -P cmake,libjpeg-devel,zlib-devel'
|
- 'if %compiler%==cygwin-cmake C:\Cygwin64\setup-x86_64 -q -R C:\Cygwin64 -s http://cygwin.mirror.constant.com -l %AV_TIFF_DOWNLOAD%\cygwin -P cmake,libjpeg-devel,zlib-devel'
|
||||||
- 'if %compiler%==cygwin-cmake set "PATH=C:\cygwin64\bin;%PATH%"'
|
- 'if %compiler%==cygwin-cmake set "PATH=C:\Cygwin64\bin;%PATH%"'
|
||||||
- set
|
- 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 cygpath --version || echo cygpath not found'
|
||||||
- 'if %compiler%==cygwin-cmake cmake --version || echo CMake not found'
|
- 'if %compiler%==cygwin-cmake cmake --version || echo CMake not found'
|
||||||
- set "AV_CMAKE_ARGS=-DBUILD_SHARED_LIBS:BOOL=%shared%"
|
- set "AV_CMAKE_ARGS=-DBUILD_SHARED_LIBS:BOOL=%shared%"
|
||||||
- 'if %compiler%==cygwin-cmake set "AV_CMAKE_ARGS=%AV_CMAKE_ARGS% -Dfatal-warnings=ON"'
|
- set "AV_CMAKE_ARGS=-DBUILD_SHARED_LIBS:BOOL=%shared%"
|
||||||
- 'if %compiler%==mingw32-cmake set "AV_CMAKE_ARGS=%AV_CMAKE_ARGS% -Dfatal-warnings=ON"'
|
|
||||||
- set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_SOURCE%"
|
- set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_SOURCE%"
|
||||||
- set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_INSTALL%"
|
- 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_SOURCE=%AV_TIFF_CYG_SOURCE%'
|
||||||
- 'if %compiler%==cygwin-cmake set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_CYG_INSTALL%'
|
- 'if %compiler%==cygwin-cmake set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_CYG_INSTALL%'
|
||||||
- 'if %compiler%==mingw-cmake set "PATH=C:\MinGW\bin;%PATH%"'
|
- 'if %compiler%==mingw-cmake set "PATH=C:\MinGW\bin;%PATH%"'
|
||||||
|
- 'if %compiler%==vc14-nmake call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %platform%'
|
||||||
- mkdir %AV_TIFF_BUILD%
|
- mkdir %AV_TIFF_BUILD%
|
||||||
- cd %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%==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%==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:
|
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%==cygwin-cmake bash -c "cmake --build . --config %configuration% --target install"'
|
||||||
- 'if %compiler%==mingw-cmake 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%==vc14-cmake cmake --build . --config %configuration% --target install'
|
||||||
- 'if %compiler%==vc9-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
|
# scripts to run after build
|
||||||
after_build:
|
after_build:
|
||||||
|
@ -92,6 +109,7 @@ before_test:
|
||||||
- 'if %compiler%==mingw-cmake ctest -V -C %configuration%'
|
- 'if %compiler%==mingw-cmake ctest -V -C %configuration%'
|
||||||
- 'if %compiler%==vc14-cmake ctest -V -C %configuration%'
|
- 'if %compiler%==vc14-cmake ctest -V -C %configuration%'
|
||||||
- 'if %compiler%==vc9-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
|
# AppVeyor don't yet have a configurable retention policy, so this will
|
||||||
# eventually use up all the storage allowance.
|
# eventually use up all the storage allowance.
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
---
|
|
||||||
BasedOnStyle: llvm
|
|
||||||
IndentWidth: 4
|
|
||||||
ColumnLimit: 80
|
|
||||||
BreakBeforeBraces: Allman
|
|
||||||
IndentCaseLabels: true
|
|
|
@ -1,4 +0,0 @@
|
||||||
42173d6ace476b5228d866640b5355f74e5a108d
|
|
||||||
b0ae5d7071890160da67d2e833d84a400e0406d0
|
|
||||||
dee020782c17c1388ca5774f9904d318b51b288b
|
|
||||||
aee0113f5ec1fd39b97458539bd79a1447425ac4
|
|
|
@ -4,8 +4,6 @@ configure
|
||||||
Makefile.in
|
Makefile.in
|
||||||
config/compile
|
config/compile
|
||||||
config/config.guess
|
config/config.guess
|
||||||
config/config.h
|
|
||||||
config/config.h.in
|
|
||||||
config/config.sub
|
config/config.sub
|
||||||
config/depcomp
|
config/depcomp
|
||||||
config/install-sh
|
config/install-sh
|
||||||
|
@ -32,6 +30,7 @@ libtiff/mkg3states
|
||||||
libtiff/stamp-h1
|
libtiff/stamp-h1
|
||||||
libtiff/stamp-h2
|
libtiff/stamp-h2
|
||||||
libtiff/tif_config.h
|
libtiff/tif_config.h
|
||||||
|
libtiff/tif_config.h.in
|
||||||
libtiff/tiffconf.h
|
libtiff/tiffconf.h
|
||||||
libtool
|
libtool
|
||||||
m4/libtool.m4
|
m4/libtool.m4
|
||||||
|
@ -76,7 +75,3 @@ test/*.log
|
||||||
test/*.trs
|
test/*.trs
|
||||||
test/o-*
|
test/o-*
|
||||||
*~
|
*~
|
||||||
.idea
|
|
||||||
.vs
|
|
||||||
cmake-build*
|
|
||||||
build*
|
|
||||||
|
|
|
@ -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:
|
stages:
|
||||||
- build
|
- build
|
||||||
- static-analysis
|
|
||||||
- pages
|
- pages
|
||||||
|
|
||||||
|
autoconf:
|
||||||
autoconf-current:
|
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- sh build/gitlab-ci autoconf
|
- sh build/gitlab-ci autoconf
|
||||||
after_script:
|
after_script:
|
||||||
- 'cat autoconf-build/test/test-suite.log'
|
- 'cat autoconf-build/test/test-suite.log'
|
||||||
artifacts:
|
|
||||||
name: distribution
|
|
||||||
paths:
|
|
||||||
- distribution
|
|
||||||
|
|
||||||
autoconf-old:
|
cmake-makefiles:
|
||||||
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:
|
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- sh build/gitlab-ci cmake "Unix Makefiles" Release
|
- sh build/gitlab-ci cmake "Unix Makefiles" Release
|
||||||
|
|
||||||
cmake-ninja-current:
|
cmake-ninja:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- sh build/gitlab-ci cmake "Ninja" Debug
|
- 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:
|
pages:
|
||||||
stage: pages
|
stage: pages
|
||||||
script:
|
script:
|
||||||
- sh build/gitlab-ci cmake "Ninja" Debug
|
- cp -r html public
|
||||||
- cp -r cmake-install/share/doc/tiff/manual/html public
|
|
||||||
artifacts:
|
artifacts:
|
||||||
name: $CI_PROJECT_NAME-$CI_JOB_NAME
|
name: $CI_PROJECT_NAME-$CI_JOB_NAME
|
||||||
paths:
|
paths:
|
||||||
|
|
|
@ -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
|
|
||||||
)
|
|
29
thirdparty/SDL2_image/external/libtiff/.travis.yml
vendored
Normal file
29
thirdparty/SDL2_image/external/libtiff/.travis.yml
vendored
Normal 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"
|
|
@ -2,7 +2,6 @@
|
||||||
# Run "cmake" to generate the build files for your platform
|
# Run "cmake" to generate the build files for your platform
|
||||||
#
|
#
|
||||||
# Copyright © 2015 Open Microscopy Environment / University of Dundee
|
# Copyright © 2015 Open Microscopy Environment / University of Dundee
|
||||||
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
|
|
||||||
# Written by Roger Leigh <rleigh@codelibre.net>
|
# Written by Roger Leigh <rleigh@codelibre.net>
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, distribute, and sell this software and
|
# 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
|
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
# OF THIS SOFTWARE.
|
# 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
|
# Default policy is from 2.8.9
|
||||||
cmake_policy(VERSION 3.9.0)
|
cmake_policy(VERSION 2.8.9)
|
||||||
|
# Set MacOSX @rpath usage globally.
|
||||||
# Find CMake modules in cmake/
|
if (POLICY CMP0020)
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
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.
|
# Read version information from configure.ac.
|
||||||
include(AutotoolsVersion)
|
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" configure REGEX "^LIBTIFF_.*=")
|
||||||
message(STATUS "Building tiff version ${LIBTIFF_VERSION_FULL}")
|
foreach(line ${configure})
|
||||||
message(STATUS "libtiff library version ${SO_VERSION}")
|
foreach(var LIBTIFF_MAJOR_VERSION LIBTIFF_MINOR_VERSION LIBTIFF_MICRO_VERSION LIBTIFF_ALPHA_VERSION
|
||||||
string(TIMESTAMP BUILD_DATE "%Y%m%d")
|
LIBTIFF_CURRENT LIBTIFF_REVISION LIBTIFF_AGE)
|
||||||
message(STATUS "libtiff build date: ${BUILD_DATE}")
|
if(NOT ${var} AND line MATCHES "^${var}=(.*)")
|
||||||
|
set(${var} "${CMAKE_MATCH_1}")
|
||||||
# Project definition
|
break()
|
||||||
set(CMAKE_C_STANDARD 99)
|
|
||||||
project(tiff
|
|
||||||
VERSION "${LIBTIFF_VERSION}"
|
|
||||||
LANGUAGES C CXX)
|
|
||||||
|
|
||||||
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()
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
option(tiff-tools "build TIFF tools" ON)
|
math(EXPR SO_MAJOR "${LIBTIFF_CURRENT} - ${LIBTIFF_AGE}")
|
||||||
option(tiff-tests "build TIFF tests" ON)
|
set(SO_MINOR "${LIBTIFF_AGE}")
|
||||||
option(tiff-contrib "build TIFF contrib" ON)
|
set(SO_REVISION "${LIBTIFF_REVISION}")
|
||||||
option(tiff-docs "build TIFF documentation" ON)
|
|
||||||
option(tiff-deprecated "build TIFF deprecated features" OFF)
|
|
||||||
option(tiff-install "install TIFF targets" ${TIFF_INSTALL_DEFAULT})
|
|
||||||
|
|
||||||
# Disable deprecated features to ensure clean build
|
message(STATUS "Building tiff version ${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}${LIBTIFF_ALPHA_VERSION}")
|
||||||
if (tiff-deprecated)
|
message(STATUS "libtiff library version ${SO_MAJOR}.${SO_MINOR}.${SO_REVISION}")
|
||||||
add_definitions(-DTIFF_DISABLE_DEPRECATED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Autotools compatibility
|
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
|
||||||
include(AutotoolsCompat)
|
|
||||||
|
|
||||||
# Compiler checks (warning flags, etc.)
|
# Project version
|
||||||
include(CompilerChecks)
|
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}")
|
||||||
|
|
||||||
# Linker checks (version script, etc.)
|
# the other tiff_VERSION_* variables are set automatically
|
||||||
include(LinkerChecks)
|
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}")
|
||||||
|
|
||||||
# Processor checks (endianness, fill order, floating point, etc.)
|
# For autotools header compatibility
|
||||||
include(ProcessorChecks)
|
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")
|
||||||
|
|
||||||
# Checks for headers
|
|
||||||
include(IncludeChecks)
|
|
||||||
|
|
||||||
# Checks for functions and other symbols
|
|
||||||
include(SymbolChecks)
|
|
||||||
|
|
||||||
# Standard installation paths
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
# Documentation install directory (default to cmake project docdir)
|
include(CheckCCompilerFlag)
|
||||||
set(LIBTIFF_DOCDIR "${CMAKE_INSTALL_DOCDIR}")
|
include(CheckCSourceCompiles)
|
||||||
|
include(CheckIncludeFile)
|
||||||
# CTest testing
|
include(CheckLibraryExists)
|
||||||
|
include(CheckTypeSize)
|
||||||
|
include(CheckSymbolExists)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
# Checks for type presence and size
|
macro(current_date var)
|
||||||
include(TypeSizeChecks)
|
if(UNIX)
|
||||||
|
execute_process(COMMAND "date" +"%Y%m%d" OUTPUT_VARIABLE ${var})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# Check for POSIX Large File Support (LFS)
|
current_date(RELEASE_DATE)
|
||||||
include(LargeFileSupport)
|
|
||||||
|
|
||||||
# Options for internal codec support
|
macro(extra_dist)
|
||||||
include(InternalCodecs)
|
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
|
set(EXTRA_DIST
|
||||||
include(DeflateCodec)
|
HOWTO-RELEASE
|
||||||
|
Makefile.vc
|
||||||
|
SConstruct
|
||||||
|
autogen.sh
|
||||||
|
configure.com
|
||||||
|
nmake.opt
|
||||||
|
libtiff-4.pc.in)
|
||||||
|
|
||||||
# Check for PixarLog codec
|
# These are annoyingly verbose, produce false positives or don't work
|
||||||
include(PixarLogCodec)
|
# nicely with all supported compiler versions, so are disabled unless
|
||||||
|
# explicitly enabled.
|
||||||
|
option(extra-warnings "Enable extra compiler warnings" OFF)
|
||||||
|
|
||||||
# Check for JPEG codec
|
# This will cause the compiler to fail when an error occurs.
|
||||||
include(JPEGCodec)
|
option(fatal-warnings "Compiler warnings are errors" OFF)
|
||||||
|
|
||||||
# Check for JBIG codec
|
# Check if the compiler supports each of the following additional
|
||||||
include(JBIGCodec)
|
# 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
|
foreach(flag ${test_flags})
|
||||||
include(LERCCodec)
|
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
|
if(MSVC)
|
||||||
include(LZMACodec)
|
set(CMAKE_DEBUG_POSTFIX "d")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Check for ZSTD codec
|
option(ld-version-script "Enable linker version script" ON)
|
||||||
include(ZSTDCodec)
|
# Check if LD supports linker scripts.
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
|
||||||
|
global: sym;
|
||||||
|
};
|
||||||
|
|
||||||
# Check for WebP codec
|
VERS_2 {
|
||||||
include(WebPCodec)
|
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
|
# Find libm, if available
|
||||||
include(CXXLibrary)
|
if(NOT WIN32)
|
||||||
|
find_library(M_LIBRARY m)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Checks for OpenGL support
|
check_include_file(assert.h HAVE_ASSERT_H)
|
||||||
include(OpenGLChecks)
|
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
|
# Inspired from /usr/share/autoconf/autoconf/c.m4
|
||||||
include(WindowsSupport)
|
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
|
# 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
|
set(STRIPCHOP_DEFAULT)
|
||||||
find_package(CMath REQUIRED)
|
if(strip-chopping)
|
||||||
|
set(STRIPCHOP_DEFAULT TRUE)
|
||||||
|
if(TIFF_DEFAULT_STRIP_SIZE)
|
||||||
|
set(STRIP_SIZE_DEFAULT "${TIFF_DEFAULT_STRIP_SIZE}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Release support
|
# Defer loading of strip/tile offsets
|
||||||
include(Release)
|
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
|
# Process subdirectories
|
||||||
add_subdirectory(port)
|
add_subdirectory(port)
|
||||||
add_subdirectory(libtiff)
|
add_subdirectory(libtiff)
|
||||||
if(tiff-tools)
|
#add_subdirectory(tools)
|
||||||
add_subdirectory(tools)
|
#add_subdirectory(test)
|
||||||
endif()
|
#add_subdirectory(contrib)
|
||||||
if(tiff-tests)
|
#add_subdirectory(build)
|
||||||
add_subdirectory(test)
|
#add_subdirectory(man)
|
||||||
endif()
|
#add_subdirectory(html)
|
||||||
if(tiff-contrib)
|
|
||||||
add_subdirectory(contrib)
|
|
||||||
endif()
|
|
||||||
add_subdirectory(build)
|
|
||||||
if(tiff-docs)
|
|
||||||
add_subdirectory(doc)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# pkg-config support
|
#message(STATUS "EXTRA_DIST: ${EXTRA_DIST}")
|
||||||
include(PkgConfig)
|
|
||||||
|
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS "Libtiff is now configured for ${CMAKE_SYSTEM}")
|
message(STATUS "Libtiff is now configured for ${host}")
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS " Installation directory: ${prefix}")
|
message(STATUS " Installation directory: ${prefix}")
|
||||||
message(STATUS " Documentation directory: ${LIBTIFF_DOCDIR}")
|
message(STATUS " Documentation directory: ${LIBTIFF_DOCDIR}")
|
||||||
message(STATUS " C compiler: ${CMAKE_C_COMPILER}")
|
message(STATUS " C compiler: ${CMAKE_C_COMPILER}")
|
||||||
message(STATUS " C++ compiler: ${CMAKE_CXX_COMPILER}")
|
message(STATUS " C++ compiler: ${CMAKE_CXX_COMPILER}")
|
||||||
message(STATUS " Build shared libraries: ${BUILD_SHARED_LIBS}")
|
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 " Enable linker symbol versioning: ${HAVE_LD_VERSION_SCRIPT}")
|
||||||
message(STATUS " Support Microsoft Document Imaging: ${mdi}")
|
message(STATUS " Support Microsoft Document Imaging: ${mdi}")
|
||||||
message(STATUS " Use win32 IO: ${USE_WIN32_FILEIO}")
|
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 " LogLuv high dynamic range encoding: ${logluv}")
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS " Support for external codecs:")
|
message(STATUS " Support for external codecs:")
|
||||||
message(STATUS " ZLIB support: Requested:${zlib} Availability:${ZLIB_FOUND} Support:${ZLIB_SUPPORT}")
|
message(STATUS " ZLIB support: ${zlib} (requested) ${ZLIB_FOUND} (availability)")
|
||||||
if(ZLIB_SUPPORT)
|
message(STATUS " libdeflate support: ${libdeflate} (requested) ${LIBDEFLATE_SUPPORT} (availability)")
|
||||||
message(STATUS " libdeflate support: Requested:${libdeflate} Availability:${DEFLATE_FOUND} Support:${LIBDEFLATE_SUPPORT}")
|
message(STATUS " Pixar log-format algorithm: ${pixarlog} (requested) ${PIXARLOG_SUPPORT} (availability)")
|
||||||
else()
|
message(STATUS " JPEG support: ${jpeg} (requested) ${JPEG_FOUND} (availability)")
|
||||||
message(STATUS " libdeflate support: Requested:${libdeflate} Availability:${DEFLATE_FOUND} Support:${LIBDEFLATE_SUPPORT} (Depends on ZLIB Support)")
|
message(STATUS " Old JPEG support: ${old-jpeg} (requested) ${JPEG_FOUND} (availability)")
|
||||||
endif()
|
message(STATUS " JPEG 8/12 bit dual mode: ${jpeg12} (requested) ${JPEG12_FOUND} (availability)")
|
||||||
if(ZLIB_SUPPORT)
|
message(STATUS " ISO JBIG support: ${jbig} (requested) ${JBIG_FOUND} (availability)")
|
||||||
message(STATUS " Pixar log-format algorithm: Requested:${pixarlog} Availability:${ZLIB_FOUND} Support:${PIXARLOG_SUPPORT}")
|
message(STATUS " LZMA2 support: ${lzma} (requested) ${LIBLZMA_FOUND} (availability)")
|
||||||
else()
|
message(STATUS " ZSTD support: ${zstd} (requested) ${ZSTD_FOUND} (availability)")
|
||||||
message(STATUS " Pixar log-format algorithm: Requested:${pixarlog} Availability:${ZLIB_FOUND} Support:${PIXARLOG_SUPPORT} (Depends on ZLIB Support)")
|
message(STATUS " WEBP support: ${webp} (requested) ${WEBP_FOUND} (availability)")
|
||||||
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 "")
|
message(STATUS "")
|
||||||
message(STATUS " C++ support: ${cxx} (requested) ${CXX_SUPPORT} (availability)")
|
message(STATUS " C++ support: ${cxx} (requested) ${CXX_SUPPORT} (availability)")
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
# message(STATUS " X Athena Widgets support: ${HAVE_XAW}")
|
# 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 "")
|
message(STATUS "")
|
||||||
|
|
|
@ -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``.
|
|
|
@ -1,7 +1,5 @@
|
||||||
# LibTIFF license
|
Copyright (c) 1988-1997 Sam Leffler
|
||||||
|
Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||||
Copyright © 1988-1997 Sam Leffler\
|
|
||||||
Copyright © 1991-1997 Silicon Graphics, Inc.
|
|
||||||
|
|
||||||
Permission to use, copy, modify, distribute, and sell this software and
|
Permission to use, copy, modify, distribute, and sell this software and
|
||||||
its documentation for any purpose is hereby granted without fee, provided
|
its documentation for any purpose is hereby granted without fee, provided
|
4453
thirdparty/SDL2_image/external/libtiff/ChangeLog
vendored
4453
thirdparty/SDL2_image/external/libtiff/ChangeLog
vendored
File diff suppressed because it is too large
Load diff
|
@ -25,11 +25,7 @@ Notes on releasing.
|
||||||
1. Commit any unsaved changes.
|
1. Commit any unsaved changes.
|
||||||
|
|
||||||
2. Use gnulib's gitlog-to-changelog script to add new (since the last
|
2. Use gnulib's gitlog-to-changelog script to add new (since the last
|
||||||
release) entries to the traditional ChangeLog file.
|
release) entries to the traditional ChangeLog file. Take note of
|
||||||
|
|
||||||
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/gitlog-to-changelog
|
|
||||||
|
|
||||||
Take note of
|
|
||||||
the most recent change note time stamp and use that as the starting
|
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
|
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
|
may be used to help produce the release notes (in next step). For
|
||||||
|
@ -41,14 +37,13 @@ Notes on releasing.
|
||||||
mv ChangeLog.new ChangeLog
|
mv ChangeLog.new ChangeLog
|
||||||
rm ChangeLog.added
|
rm ChangeLog.added
|
||||||
|
|
||||||
3. Create doc/releases/vX.X.rst and add it to git with 'git add doc/releases/vX.X.rst'.
|
3. Create html/vX.X.html and add it to git with 'git add html/vX.X.html'.
|
||||||
Update doc/releases/index.rst to point to the new file
|
Take ChangeLog entries and html-ify in there.
|
||||||
Take ChangeLog entries and rst-ify in there.
|
Easist thing to do is take html/vX.(X-1).html and use it as a template.
|
||||||
Easist thing to do is take doc/releases/vX.(X-1).rst 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
|
6. Increment the release version in configure.ac. Put 'alpha' or
|
||||||
'beta' after the version, if applicable. For example:
|
'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
|
16. Sign the release files in the build tree using your private key
|
||||||
|
|
||||||
export GPG_TTY=$(tty)
|
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 ; \
|
gpg2 --output ${file}.sig --detach-sig $file ; \
|
||||||
done
|
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 ; \
|
gpg2 --verify ${file}.sig $file ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
17. Copy release packages from the build tree to the
|
17. Copy release packages from the build tree to the
|
||||||
ftp.remotesensing.org ftp site.
|
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
|
bfriesen@upload.osgeo.org:/osgeo/download/libtiff
|
||||||
|
|
||||||
18. Announce to list: tiff@lists.osgeo.org
|
18. Announce to list, tiff@lists.maptools.org
|
||||||
|
|
|
@ -29,30 +29,30 @@ AUTOMAKE_OPTIONS = 1.12 dist-zip foreign
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
docfiles = \
|
docfiles = \
|
||||||
|
COPYRIGHT \
|
||||||
ChangeLog \
|
ChangeLog \
|
||||||
LICENSE.md \
|
|
||||||
README.md \
|
README.md \
|
||||||
RELEASE-DATE \
|
RELEASE-DATE \
|
||||||
TODO \
|
TODO \
|
||||||
VERSION
|
VERSION
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
placeholder.h \
|
|
||||||
cmake \
|
|
||||||
CMakeLists.txt \
|
CMakeLists.txt \
|
||||||
HOWTO-RELEASE \
|
HOWTO-RELEASE \
|
||||||
|
Makefile.vc \
|
||||||
|
SConstruct \
|
||||||
autogen.sh \
|
autogen.sh \
|
||||||
libtiff-4.pc.in
|
configure.com \
|
||||||
|
libtiff-4.pc.in \
|
||||||
|
nmake.opt
|
||||||
|
|
||||||
if TIFF_DOCS
|
|
||||||
dist_doc_DATA = $(docfiles)
|
dist_doc_DATA = $(docfiles)
|
||||||
endif
|
|
||||||
|
|
||||||
distcheck-hook:
|
distcheck-hook:
|
||||||
if [ -x "$(CMAKE)" ]; then \
|
if [ -x "$(CMAKE)" ]; then \
|
||||||
mkdir $(distdir)/_build/cmake \
|
mkdir $(distdir)/_build/cmake \
|
||||||
&& cd $(distdir)/_build/cmake \
|
&& cd $(distdir)/_build/cmake \
|
||||||
&& cmake -Dsphinx=OFF ../.. \
|
&& cmake ../.. \
|
||||||
&& $(MAKE) \
|
&& $(MAKE) \
|
||||||
&& ctest -V \
|
&& ctest -V \
|
||||||
&& $(MAKE) DESTDIR=../../_inst/cmake install ; \
|
&& $(MAKE) DESTDIR=../../_inst/cmake install ; \
|
||||||
|
@ -60,12 +60,12 @@ distcheck-hook:
|
||||||
rm -rf $(distdir)/_build/cmake
|
rm -rf $(distdir)/_build/cmake
|
||||||
rm -rf $(distdir)/_inst/cmake
|
rm -rf $(distdir)/_inst/cmake
|
||||||
|
|
||||||
SUBDIRS = port libtiff tools build contrib test doc
|
SUBDIRS = port libtiff tools build contrib test man html
|
||||||
|
|
||||||
release:
|
release:
|
||||||
(rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)
|
(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)/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
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = libtiff-4.pc
|
pkgconfig_DATA = libtiff-4.pc
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
# Checks for symbols
|
|
||||||
#
|
#
|
||||||
# Copyright © 2015 Open Microscopy Environment / University of Dundee
|
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
|
||||||
# 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
|
# Permission to use, copy, modify, distribute, and sell this software and
|
||||||
# its documentation for any purpose is hereby granted without fee, provided
|
# 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
|
# 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
|
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
# OF THIS SOFTWARE.
|
# 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
|
lib: port
|
||||||
check_symbol_exists(getopt "unistd.h;stdio.h" HAVE_GETOPT)
|
cd libtiff
|
||||||
check_symbol_exists(optarg "getopt.h" HAVE_DECL_OPTARG)
|
$(MAKE) /f Makefile.vc
|
||||||
if (HAVE_DECL_OPTARG)
|
cd..
|
||||||
set(HAVE_DECL_OPTARG 1)
|
|
||||||
else()
|
|
||||||
set(HAVE_DECL_OPTARG 0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Check for mmap
|
tools: lib
|
||||||
check_symbol_exists(mmap "sys/mman.h" HAVE_MMAP)
|
cd tools
|
||||||
|
$(MAKE) /f Makefile.vc
|
||||||
|
cd ..
|
||||||
|
|
||||||
# Check for setmode
|
clean:
|
||||||
check_symbol_exists(setmode "unistd.h" HAVE_SETMODE)
|
cd port
|
||||||
|
$(MAKE) /f Makefile.vc clean
|
||||||
|
cd..
|
||||||
|
cd libtiff
|
||||||
|
$(MAKE) /f Makefile.vc clean
|
||||||
|
cd..
|
||||||
|
cd tools
|
||||||
|
$(MAKE) /f Makefile.vc clean
|
||||||
|
cd ..
|
|
@ -1 +1 @@
|
||||||
20230609
|
20201219
|
||||||
|
|
169
thirdparty/SDL2_image/external/libtiff/SConstruct
vendored
Normal file
169
thirdparty/SDL2_image/external/libtiff/SConstruct
vendored
Normal 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')
|
|
@ -1 +1 @@
|
||||||
4.5.1
|
4.2.0
|
||||||
|
|
|
@ -28,13 +28,13 @@
|
||||||
|
|
||||||
#include "tif_config.h"
|
#include "tif_config.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
@ -56,8 +56,8 @@
|
||||||
# include "libport.h"
|
# include "libport.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "tiffio.h"
|
|
||||||
#include "tiffiop.h"
|
#include "tiffiop.h"
|
||||||
|
#include "tiffio.h"
|
||||||
|
|
||||||
#ifndef O_BINARY
|
#ifndef O_BINARY
|
||||||
# define O_BINARY 0
|
# define O_BINARY 0
|
||||||
|
@ -76,7 +76,7 @@ enum BMPType
|
||||||
* BMPInfoHeader structure. An array of BMPColorEntry structures (also called
|
* BMPInfoHeader structure. An array of BMPColorEntry structures (also called
|
||||||
* a colour table) follows the bitmap information header structure. The colour
|
* a colour table) follows the bitmap information header structure. The colour
|
||||||
* table is followed by a second array of indexes into the colour table (the
|
* table is followed by a second array of indexes into the colour table (the
|
||||||
* actual bitmap data). Data may be compressed, for 4-bpp and 8-bpp used RLE
|
* actual bitmap data). Data may be comressed, for 4-bpp and 8-bpp used RLE
|
||||||
* compression.
|
* compression.
|
||||||
*
|
*
|
||||||
* +---------------------+
|
* +---------------------+
|
||||||
|
@ -117,9 +117,9 @@ enum BMPLCSType /* Type of logical color space. */
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int32_t iCIEX;
|
int32 iCIEX;
|
||||||
int32_t iCIEY;
|
int32 iCIEY;
|
||||||
int32_t iCIEZ;
|
int32 iCIEZ;
|
||||||
} BMPCIEXYZ;
|
} BMPCIEXYZ;
|
||||||
|
|
||||||
typedef struct /* This structure contains the x, y, and z */
|
typedef struct /* This structure contains the x, y, and z */
|
||||||
|
@ -133,13 +133,13 @@ typedef struct /* This structure contains the x, y, and z */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char bType[2]; /* Signature "BM" */
|
char bType[2]; /* Signature "BM" */
|
||||||
uint32_t iSize; /* Size in bytes of the bitmap file. Should
|
uint32 iSize; /* Size in bytes of the bitmap file. Should
|
||||||
* always be ignored while reading because
|
* always be ignored while reading because
|
||||||
* of error in Windows 3.0 SDK's description
|
* of error in Windows 3.0 SDK's description
|
||||||
* of this field */
|
* of this field */
|
||||||
uint16_t iReserved1; /* Reserved, set as 0 */
|
uint16 iReserved1; /* Reserved, set as 0 */
|
||||||
uint16_t iReserved2; /* Reserved, set as 0 */
|
uint16 iReserved2; /* Reserved, set as 0 */
|
||||||
uint32_t iOffBits; /* Offset of the image from file start in bytes */
|
uint32 iOffBits; /* Offset of the image from file start in bytes */
|
||||||
} BMPFileHeader;
|
} BMPFileHeader;
|
||||||
|
|
||||||
/* File header size in bytes: */
|
/* File header size in bytes: */
|
||||||
|
@ -147,29 +147,29 @@ const int BFH_SIZE = 14;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t iSize; /* Size of BMPInfoHeader structure in bytes.
|
uint32 iSize; /* Size of BMPInfoHeader structure in bytes.
|
||||||
* Should be used to determine start of the
|
* Should be used to determine start of the
|
||||||
* colour table */
|
* colour table */
|
||||||
int32_t iWidth; /* Image width */
|
int32 iWidth; /* Image width */
|
||||||
int32_t iHeight; /* Image height. If positive, image has bottom
|
int32 iHeight; /* Image height. If positive, image has bottom
|
||||||
* left origin, if negative --- top left. */
|
* left origin, if negative --- top left. */
|
||||||
int16_t iPlanes; /* Number of image planes (must be set to 1) */
|
int16 iPlanes; /* Number of image planes (must be set to 1) */
|
||||||
int16_t iBitCount; /* Number of bits per pixel (1, 4, 8, 16, 24
|
int16 iBitCount; /* Number of bits per pixel (1, 4, 8, 16, 24
|
||||||
* or 32). If 0 then the number of bits per
|
* or 32). If 0 then the number of bits per
|
||||||
* pixel is specified or is implied by the
|
* pixel is specified or is implied by the
|
||||||
* JPEG or PNG format. */
|
* JPEG or PNG format. */
|
||||||
uint32_t iCompression; /* Compression method */
|
uint32 iCompression; /* Compression method */
|
||||||
uint32_t iSizeImage; /* Size of uncomressed image in bytes. May
|
uint32 iSizeImage; /* Size of uncomressed image in bytes. May
|
||||||
* be 0 for BMPC_RGB bitmaps. If iCompression
|
* be 0 for BMPC_RGB bitmaps. If iCompression
|
||||||
* is BI_JPEG or BI_PNG, iSizeImage indicates
|
* is BI_JPEG or BI_PNG, iSizeImage indicates
|
||||||
* the size of the JPEG or PNG image buffer. */
|
* the size of the JPEG or PNG image buffer. */
|
||||||
int32_t iXPelsPerMeter; /* X resolution, pixels per meter (0 if not used) */
|
int32 iXPelsPerMeter; /* X resolution, pixels per meter (0 if not used) */
|
||||||
int32_t iYPelsPerMeter; /* Y resolution, pixels per meter (0 if not used) */
|
int32 iYPelsPerMeter; /* Y resolution, pixels per meter (0 if not used) */
|
||||||
uint32_t iClrUsed; /* Size of colour table. If 0, iBitCount should
|
uint32 iClrUsed; /* Size of colour table. If 0, iBitCount should
|
||||||
* be used to calculate this value
|
* be used to calculate this value
|
||||||
* (1<<iBitCount). This value should be
|
* (1<<iBitCount). This value should be
|
||||||
* unsigned for proper shifting. */
|
* unsigned for proper shifting. */
|
||||||
int32_t iClrImportant; /* Number of important colours. If 0, all
|
int32 iClrImportant; /* Number of important colours. If 0, all
|
||||||
* colours are required */
|
* colours are required */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -177,23 +177,23 @@ typedef struct
|
||||||
* and earlier. Windows 98/Me, Windows 2000/XP introduces additional fields:
|
* and earlier. Windows 98/Me, Windows 2000/XP introduces additional fields:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int32_t iRedMask; /* Colour mask that specifies the red component
|
int32 iRedMask; /* Colour mask that specifies the red component
|
||||||
* of each pixel, valid only if iCompression
|
* of each pixel, valid only if iCompression
|
||||||
* is set to BI_BITFIELDS. */
|
* is set to BI_BITFIELDS. */
|
||||||
int32_t iGreenMask; /* The same for green component */
|
int32 iGreenMask; /* The same for green component */
|
||||||
int32_t iBlueMask; /* The same for blue component */
|
int32 iBlueMask; /* The same for blue component */
|
||||||
int32_t iAlphaMask; /* Colour mask that specifies the alpha
|
int32 iAlphaMask; /* Colour mask that specifies the alpha
|
||||||
* component of each pixel. */
|
* component of each pixel. */
|
||||||
uint32_t iCSType; /* Colour space of the DIB. */
|
uint32 iCSType; /* Colour space of the DIB. */
|
||||||
BMPCIEXYZTriple sEndpoints; /* This member is ignored unless the iCSType
|
BMPCIEXYZTriple sEndpoints; /* This member is ignored unless the iCSType
|
||||||
* member specifies BMPLT_CALIBRATED_RGB. */
|
* member specifies BMPLT_CALIBRATED_RGB. */
|
||||||
int32_t iGammaRed; /* Toned response curve for red. This member
|
int32 iGammaRed; /* Toned response curve for red. This member
|
||||||
* is ignored unless color values are
|
* is ignored unless color values are
|
||||||
* calibrated RGB values and iCSType is set to
|
* calibrated RGB values and iCSType is set to
|
||||||
* BMPLT_CALIBRATED_RGB. Specified
|
* BMPLT_CALIBRATED_RGB. Specified
|
||||||
* in 16^16 format. */
|
* in 16^16 format. */
|
||||||
int32_t iGammaGreen; /* Toned response curve for green. */
|
int32 iGammaGreen; /* Toned response curve for green. */
|
||||||
int32_t iGammaBlue; /* Toned response curve for blue. */
|
int32 iGammaBlue; /* Toned response curve for blue. */
|
||||||
} BMPInfoHeader;
|
} BMPInfoHeader;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -216,22 +216,23 @@ typedef struct
|
||||||
char bReserved; /* Must be 0 */
|
char bReserved; /* Must be 0 */
|
||||||
} BMPColorEntry;
|
} BMPColorEntry;
|
||||||
|
|
||||||
static uint16_t compression = (uint16_t)-1;
|
static uint16 compression = (uint16) -1;
|
||||||
static int jpegcolormode = JPEGCOLORMODE_RGB;
|
static int jpegcolormode = JPEGCOLORMODE_RGB;
|
||||||
static int quality = 75; /* JPEG quality */
|
static int quality = 75; /* JPEG quality */
|
||||||
static uint16_t predictor = 0;
|
static uint16 predictor = 0;
|
||||||
|
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
static int processCompressOptions(char*);
|
static int processCompressOptions(char*);
|
||||||
static void rearrangePixels(char *, uint32_t, uint32_t);
|
static void rearrangePixels(char *, uint32, uint32);
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
uint32_t width, length;
|
uint32 width, length;
|
||||||
uint16_t nbands = 1; /* number of bands in input image */
|
uint16 nbands = 1; /* number of bands in input image */
|
||||||
uint16_t depth = 8; /* bits per pixel in input image */
|
uint16 depth = 8; /* bits per pixel in input image */
|
||||||
uint32_t rowsperstrip = (uint32_t)-1;
|
uint32 rowsperstrip = (uint32) -1;
|
||||||
uint16_t photometric = PHOTOMETRIC_MINISBLACK;
|
uint16 photometric = PHOTOMETRIC_MINISBLACK;
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
_TIFF_stat_s instat;
|
_TIFF_stat_s instat;
|
||||||
char *outfilename = NULL, *infilename = NULL;
|
char *outfilename = NULL, *infilename = NULL;
|
||||||
|
@ -240,10 +241,10 @@ int main(int argc, char *argv[])
|
||||||
BMPFileHeader file_hdr;
|
BMPFileHeader file_hdr;
|
||||||
BMPInfoHeader info_hdr;
|
BMPInfoHeader info_hdr;
|
||||||
int bmp_type;
|
int bmp_type;
|
||||||
uint32_t clr_tbl_size, n_clr_elems = 3;
|
uint32 clr_tbl_size, n_clr_elems = 3;
|
||||||
unsigned char *clr_tbl;
|
unsigned char *clr_tbl;
|
||||||
unsigned short *red_tbl = NULL, *green_tbl = NULL, *blue_tbl = NULL;
|
unsigned short *red_tbl = NULL, *green_tbl = NULL, *blue_tbl = NULL;
|
||||||
uint32_t row, clr;
|
uint32 row, clr;
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
#if !HAVE_DECL_OPTARG
|
#if !HAVE_DECL_OPTARG
|
||||||
|
@ -251,10 +252,8 @@ int main(int argc, char *argv[])
|
||||||
extern char* optarg;
|
extern char* optarg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "c:r:o:h")) != -1)
|
while ((c = getopt(argc, argv, "c:r:o:h")) != -1) {
|
||||||
{
|
switch (c) {
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case 'c': /* compression scheme */
|
case 'c': /* compression scheme */
|
||||||
if (!processCompressOptions(optarg))
|
if (!processCompressOptions(optarg))
|
||||||
usage();
|
usage();
|
||||||
|
@ -278,48 +277,41 @@ int main(int argc, char *argv[])
|
||||||
if (outfilename == NULL)
|
if (outfilename == NULL)
|
||||||
outfilename = argv[argc-1];
|
outfilename = argv[argc-1];
|
||||||
out = TIFFOpen(outfilename, "w");
|
out = TIFFOpen(outfilename, "w");
|
||||||
if (out == NULL)
|
if (out == NULL) {
|
||||||
{
|
TIFFError(infilename, "Cannot open file %s for output",
|
||||||
TIFFError(infilename, "Cannot open file %s for output", outfilename);
|
outfilename);
|
||||||
goto bad3;
|
goto bad3;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (optind < argc - 1)
|
|
||||||
{
|
while (optind < argc-1) {
|
||||||
infilename = argv[optind];
|
infilename = argv[optind];
|
||||||
optind++;
|
optind++;
|
||||||
|
|
||||||
fd = open(infilename, O_RDONLY|O_BINARY, 0);
|
fd = open(infilename, O_RDONLY|O_BINARY, 0);
|
||||||
if (fd < 0)
|
if (fd < 0) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Cannot open input file");
|
TIFFError(infilename, "Cannot open input file");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (read(fd, file_hdr.bType, 2) != 2)
|
if (read(fd, file_hdr.bType, 2) != 2) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to read from file (%s)",
|
TIFFError(infilename, "Failed to read from file (%s)",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if (file_hdr.bType[0] != 'B' || file_hdr.bType[1] != 'M')
|
if(file_hdr.bType[0] != 'B' || file_hdr.bType[1] != 'M') {
|
||||||
{
|
|
||||||
TIFFError(infilename, "File is not BMP");
|
TIFFError(infilename, "File is not BMP");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------
|
/* -------------------------------------------------------------------- */
|
||||||
*/
|
|
||||||
/* Read the BMPFileHeader. We need iOffBits value only */
|
/* Read the BMPFileHeader. We need iOffBits value only */
|
||||||
/* --------------------------------------------------------------------
|
/* -------------------------------------------------------------------- */
|
||||||
*/
|
if (_TIFF_lseek_f(fd, 10, SEEK_SET) == (_TIFF_off_t)-1) {
|
||||||
if (_TIFF_lseek_f(fd, 10, SEEK_SET) == (_TIFF_off_t)-1)
|
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to seek to offset");
|
TIFFError(infilename, "Failed to seek to offset");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if (read(fd, &file_hdr.iOffBits, 4) != 4)
|
if (read(fd, &file_hdr.iOffBits, 4) != 4) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to read from file (%s)",
|
TIFFError(infilename, "Failed to read from file (%s)",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
|
@ -327,26 +319,21 @@ int main(int argc, char *argv[])
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
TIFFSwabLong(&file_hdr.iOffBits);
|
TIFFSwabLong(&file_hdr.iOffBits);
|
||||||
#endif
|
#endif
|
||||||
if (_TIFF_fstat_f(fd, &instat) == -1)
|
if (_TIFF_fstat_f(fd, &instat) == -1) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed obtain file information");
|
TIFFError(infilename, "Failed obtain file information");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
file_hdr.iSize = instat.st_size;
|
file_hdr.iSize = instat.st_size;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------
|
/* -------------------------------------------------------------------- */
|
||||||
*/
|
|
||||||
/* Read the BMPInfoHeader. */
|
/* Read the BMPInfoHeader. */
|
||||||
/* --------------------------------------------------------------------
|
/* -------------------------------------------------------------------- */
|
||||||
*/
|
|
||||||
|
|
||||||
if (_TIFF_lseek_f(fd, BFH_SIZE, SEEK_SET) == (_TIFF_off_t)-1)
|
if (_TIFF_lseek_f(fd, BFH_SIZE, SEEK_SET) == (_TIFF_off_t)-1) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to seek to offset");
|
TIFFError(infilename, "Failed to seek to offset");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if (read(fd, &info_hdr.iSize, 4) != 4)
|
if (read(fd, &info_hdr.iSize, 4) != 4) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to read from file (%s)",
|
TIFFError(infilename, "Failed to read from file (%s)",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
|
@ -359,14 +346,15 @@ int main(int argc, char *argv[])
|
||||||
bmp_type = BMPT_WIN4;
|
bmp_type = BMPT_WIN4;
|
||||||
else if (info_hdr.iSize == BIH_OS21SIZE)
|
else if (info_hdr.iSize == BIH_OS21SIZE)
|
||||||
bmp_type = BMPT_OS21;
|
bmp_type = BMPT_OS21;
|
||||||
else if (info_hdr.iSize == BIH_OS22SIZE || info_hdr.iSize == 16)
|
else if (info_hdr.iSize == BIH_OS22SIZE
|
||||||
|
|| info_hdr.iSize == 16)
|
||||||
bmp_type = BMPT_OS22;
|
bmp_type = BMPT_OS22;
|
||||||
else
|
else
|
||||||
bmp_type = BMPT_WIN5;
|
bmp_type = BMPT_WIN5;
|
||||||
|
|
||||||
if (bmp_type == BMPT_WIN4 || bmp_type == BMPT_WIN5 ||
|
if (bmp_type == BMPT_WIN4
|
||||||
bmp_type == BMPT_OS22)
|
|| bmp_type == BMPT_WIN5
|
||||||
{
|
|| bmp_type == BMPT_OS22) {
|
||||||
if ((read(fd, &info_hdr.iWidth, 4) != 4) ||
|
if ((read(fd, &info_hdr.iWidth, 4) != 4) ||
|
||||||
(read(fd, &info_hdr.iHeight, 4) != 4) ||
|
(read(fd, &info_hdr.iHeight, 4) != 4) ||
|
||||||
(read(fd, &info_hdr.iPlanes, 2) != 2) ||
|
(read(fd, &info_hdr.iPlanes, 2) != 2) ||
|
||||||
|
@ -376,29 +364,27 @@ int main(int argc, char *argv[])
|
||||||
(read(fd, &info_hdr.iXPelsPerMeter, 4) != 4) ||
|
(read(fd, &info_hdr.iXPelsPerMeter, 4) != 4) ||
|
||||||
(read(fd, &info_hdr.iYPelsPerMeter, 4) != 4) ||
|
(read(fd, &info_hdr.iYPelsPerMeter, 4) != 4) ||
|
||||||
(read(fd, &info_hdr.iClrUsed, 4) != 4) ||
|
(read(fd, &info_hdr.iClrUsed, 4) != 4) ||
|
||||||
(read(fd, &info_hdr.iClrImportant, 4) != 4))
|
(read(fd, &info_hdr.iClrImportant, 4) != 4)) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to read from file (%s)",
|
TIFFError(infilename, "Failed to read from file (%s)",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
TIFFSwabLong((uint32_t *)&info_hdr.iWidth);
|
TIFFSwabLong((uint32*) &info_hdr.iWidth);
|
||||||
TIFFSwabLong((uint32_t *)&info_hdr.iHeight);
|
TIFFSwabLong((uint32*) &info_hdr.iHeight);
|
||||||
TIFFSwabShort((uint16_t *)&info_hdr.iPlanes);
|
TIFFSwabShort((uint16*) &info_hdr.iPlanes);
|
||||||
TIFFSwabShort((uint16_t *)&info_hdr.iBitCount);
|
TIFFSwabShort((uint16*) &info_hdr.iBitCount);
|
||||||
TIFFSwabLong((uint32_t *)&info_hdr.iCompression);
|
TIFFSwabLong((uint32*) &info_hdr.iCompression);
|
||||||
TIFFSwabLong((uint32_t *)&info_hdr.iSizeImage);
|
TIFFSwabLong((uint32*) &info_hdr.iSizeImage);
|
||||||
TIFFSwabLong((uint32_t *)&info_hdr.iXPelsPerMeter);
|
TIFFSwabLong((uint32*) &info_hdr.iXPelsPerMeter);
|
||||||
TIFFSwabLong((uint32_t *)&info_hdr.iYPelsPerMeter);
|
TIFFSwabLong((uint32*) &info_hdr.iYPelsPerMeter);
|
||||||
TIFFSwabLong((uint32_t *)&info_hdr.iClrUsed);
|
TIFFSwabLong((uint32*) &info_hdr.iClrUsed);
|
||||||
TIFFSwabLong((uint32_t *)&info_hdr.iClrImportant);
|
TIFFSwabLong((uint32*) &info_hdr.iClrImportant);
|
||||||
#endif
|
#endif
|
||||||
n_clr_elems = 4;
|
n_clr_elems = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bmp_type == BMPT_OS22)
|
if (bmp_type == BMPT_OS22) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* FIXME: different info in different documents
|
* FIXME: different info in different documents
|
||||||
* regarding this!
|
* regarding this!
|
||||||
|
@ -406,48 +392,43 @@ int main(int argc, char *argv[])
|
||||||
n_clr_elems = 3;
|
n_clr_elems = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bmp_type == BMPT_OS21)
|
if (bmp_type == BMPT_OS21) {
|
||||||
{
|
int16 iShort;
|
||||||
int16_t iShort;
|
|
||||||
|
|
||||||
if (read(fd, &iShort, 2) != 2)
|
if ( read(fd, &iShort, 2) != 2 ) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to read from file (%s)",
|
TIFFError(infilename, "Failed to read from file (%s)",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
TIFFSwabShort((uint16_t *)&iShort);
|
TIFFSwabShort((uint16*) &iShort);
|
||||||
#endif
|
#endif
|
||||||
info_hdr.iWidth = iShort;
|
info_hdr.iWidth = iShort;
|
||||||
if (read(fd, &iShort, 2) != 2)
|
if ( read(fd, &iShort, 2) != 2 ) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to read from file (%s)",
|
TIFFError(infilename, "Failed to read from file (%s)",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
TIFFSwabShort((uint16_t *)&iShort);
|
TIFFSwabShort((uint16*) &iShort);
|
||||||
#endif
|
#endif
|
||||||
info_hdr.iHeight = iShort;
|
info_hdr.iHeight = iShort;
|
||||||
if (read(fd, &iShort, 2) != 2)
|
if (read(fd, &iShort, 2) != 2 ) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to read from file (%s)",
|
TIFFError(infilename, "Failed to read from file (%s)",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
TIFFSwabShort((uint16_t *)&iShort);
|
TIFFSwabShort((uint16*) &iShort);
|
||||||
#endif
|
#endif
|
||||||
info_hdr.iPlanes = iShort;
|
info_hdr.iPlanes = iShort;
|
||||||
if (read(fd, &iShort, 2) != 2)
|
if ( read(fd, &iShort, 2) != 2 ) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to read from file (%s)",
|
TIFFError(infilename, "Failed to read from file (%s)",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
TIFFSwabShort((uint16_t *)&iShort);
|
TIFFSwabShort((uint16*) &iShort);
|
||||||
#endif
|
#endif
|
||||||
info_hdr.iBitCount = iShort;
|
info_hdr.iBitCount = iShort;
|
||||||
info_hdr.iCompression = BMPC_RGB;
|
info_hdr.iCompression = BMPC_RGB;
|
||||||
|
@ -456,9 +437,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (info_hdr.iBitCount != 1 && info_hdr.iBitCount != 4 &&
|
if (info_hdr.iBitCount != 1 && info_hdr.iBitCount != 4 &&
|
||||||
info_hdr.iBitCount != 8 && info_hdr.iBitCount != 16 &&
|
info_hdr.iBitCount != 8 && info_hdr.iBitCount != 16 &&
|
||||||
info_hdr.iBitCount != 24 && info_hdr.iBitCount != 32)
|
info_hdr.iBitCount != 24 && info_hdr.iBitCount != 32) {
|
||||||
{
|
TIFFError(infilename,
|
||||||
TIFFError(infilename, "Cannot process BMP file with bit count %d",
|
"Cannot process BMP file with bit count %d",
|
||||||
info_hdr.iBitCount);
|
info_hdr.iBitCount);
|
||||||
close(fd);
|
close(fd);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -468,7 +449,8 @@ int main(int argc, char *argv[])
|
||||||
length = (info_hdr.iHeight > 0) ? info_hdr.iHeight : -info_hdr.iHeight;
|
length = (info_hdr.iHeight > 0) ? info_hdr.iHeight : -info_hdr.iHeight;
|
||||||
if( width <= 0 || length <= 0 )
|
if( width <= 0 || length <= 0 )
|
||||||
{
|
{
|
||||||
TIFFError(infilename, "Invalid dimensions of BMP file");
|
TIFFError(infilename,
|
||||||
|
"Invalid dimensions of BMP file" );
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -483,64 +465,57 @@ int main(int argc, char *argv[])
|
||||||
photometric = PHOTOMETRIC_PALETTE;
|
photometric = PHOTOMETRIC_PALETTE;
|
||||||
/* Allocate memory for colour table and read it. */
|
/* Allocate memory for colour table and read it. */
|
||||||
if (info_hdr.iClrUsed)
|
if (info_hdr.iClrUsed)
|
||||||
clr_tbl_size = ((uint32_t)(1 << depth) < info_hdr.iClrUsed)
|
clr_tbl_size =
|
||||||
? (uint32_t)(1 << depth)
|
((uint32)(1<<depth)<info_hdr.iClrUsed)
|
||||||
|
? (uint32) (1 << depth)
|
||||||
: info_hdr.iClrUsed;
|
: info_hdr.iClrUsed;
|
||||||
else
|
else
|
||||||
clr_tbl_size = 1 << depth;
|
clr_tbl_size = 1 << depth;
|
||||||
clr_tbl =
|
clr_tbl = (unsigned char *)
|
||||||
(unsigned char *)_TIFFmalloc(n_clr_elems * clr_tbl_size);
|
_TIFFmalloc(n_clr_elems * clr_tbl_size);
|
||||||
if (!clr_tbl)
|
if (!clr_tbl) {
|
||||||
{
|
|
||||||
TIFFError(infilename,
|
TIFFError(infilename,
|
||||||
"Can't allocate space for color table");
|
"Can't allocate space for color table");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_TIFF_lseek_f(fd, BFH_SIZE + info_hdr.iSize, SEEK_SET) ==
|
if (_TIFF_lseek_f(fd, BFH_SIZE + info_hdr.iSize, SEEK_SET) == (_TIFF_off_t)-1) {
|
||||||
(_TIFF_off_t)-1)
|
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to seek to offset");
|
TIFFError(infilename, "Failed to seek to offset");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if (read(fd, clr_tbl, n_clr_elems * clr_tbl_size) !=
|
if ( read(fd, clr_tbl, n_clr_elems * clr_tbl_size)
|
||||||
(long)(n_clr_elems * clr_tbl_size))
|
!= (long) (n_clr_elems * clr_tbl_size) ) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to read from file (%s)",
|
TIFFError(infilename, "Failed to read from file (%s)",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
red_tbl = (unsigned short *)_TIFFmalloc(
|
red_tbl = (unsigned short*)
|
||||||
((tmsize_t)1) << depth * sizeof(unsigned short));
|
_TIFFmalloc(((tmsize_t)1)<<depth * sizeof(unsigned short));
|
||||||
if (!red_tbl)
|
if (!red_tbl) {
|
||||||
{
|
|
||||||
TIFFError(infilename,
|
TIFFError(infilename,
|
||||||
"Can't allocate space for red component table");
|
"Can't allocate space for red component table");
|
||||||
_TIFFfree(clr_tbl);
|
_TIFFfree(clr_tbl);
|
||||||
goto bad1;
|
goto bad1;
|
||||||
}
|
}
|
||||||
green_tbl = (unsigned short *)_TIFFmalloc(
|
green_tbl = (unsigned short*)
|
||||||
((tmsize_t)1) << depth * sizeof(unsigned short));
|
_TIFFmalloc(((tmsize_t)1)<<depth * sizeof(unsigned short));
|
||||||
if (!green_tbl)
|
if (!green_tbl) {
|
||||||
{
|
|
||||||
TIFFError(infilename,
|
TIFFError(infilename,
|
||||||
"Can't allocate space for green component table");
|
"Can't allocate space for green component table");
|
||||||
_TIFFfree(clr_tbl);
|
_TIFFfree(clr_tbl);
|
||||||
goto bad2;
|
goto bad2;
|
||||||
}
|
}
|
||||||
blue_tbl = (unsigned short *)_TIFFmalloc(
|
blue_tbl = (unsigned short*)
|
||||||
((tmsize_t)1) << depth * sizeof(unsigned short));
|
_TIFFmalloc(((tmsize_t)1)<<depth * sizeof(unsigned short));
|
||||||
if (!blue_tbl)
|
if (!blue_tbl) {
|
||||||
{
|
|
||||||
TIFFError(infilename,
|
TIFFError(infilename,
|
||||||
"Can't allocate space for blue component table");
|
"Can't allocate space for blue component table");
|
||||||
_TIFFfree(clr_tbl);
|
_TIFFfree(clr_tbl);
|
||||||
goto bad3;
|
goto bad3;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (clr = 0; clr < clr_tbl_size; clr++)
|
for(clr = 0; clr < clr_tbl_size; clr++) {
|
||||||
{
|
|
||||||
red_tbl[clr] = 257*clr_tbl[clr*n_clr_elems+2];
|
red_tbl[clr] = 257*clr_tbl[clr*n_clr_elems+2];
|
||||||
green_tbl[clr] = 257*clr_tbl[clr*n_clr_elems+1];
|
green_tbl[clr] = 257*clr_tbl[clr*n_clr_elems+1];
|
||||||
blue_tbl[clr] = 257*clr_tbl[clr*n_clr_elems];
|
blue_tbl[clr] = 257*clr_tbl[clr*n_clr_elems];
|
||||||
|
@ -563,11 +538,9 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------
|
/* -------------------------------------------------------------------- */
|
||||||
*/
|
|
||||||
/* Create output file. */
|
/* Create output file. */
|
||||||
/* --------------------------------------------------------------------
|
/* -------------------------------------------------------------------- */
|
||||||
*/
|
|
||||||
|
|
||||||
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);
|
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);
|
||||||
TIFFSetField(out, TIFFTAG_IMAGELENGTH, length);
|
TIFFSetField(out, TIFFTAG_IMAGELENGTH, length);
|
||||||
|
@ -579,40 +552,35 @@ int main(int argc, char *argv[])
|
||||||
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
|
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
|
||||||
TIFFDefaultStripSize(out, rowsperstrip));
|
TIFFDefaultStripSize(out, rowsperstrip));
|
||||||
|
|
||||||
if (red_tbl && green_tbl && blue_tbl)
|
if (red_tbl && green_tbl && blue_tbl) {
|
||||||
{
|
TIFFSetField(out, TIFFTAG_COLORMAP,
|
||||||
TIFFSetField(out, TIFFTAG_COLORMAP, red_tbl, green_tbl, blue_tbl);
|
red_tbl, green_tbl, blue_tbl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compression == (uint16_t)-1)
|
if (compression == (uint16) -1)
|
||||||
compression = COMPRESSION_PACKBITS;
|
compression = COMPRESSION_PACKBITS;
|
||||||
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
|
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
|
||||||
switch (compression)
|
switch (compression) {
|
||||||
{
|
|
||||||
case COMPRESSION_JPEG:
|
case COMPRESSION_JPEG:
|
||||||
if (photometric == PHOTOMETRIC_RGB &&
|
if (photometric == PHOTOMETRIC_RGB
|
||||||
jpegcolormode == JPEGCOLORMODE_RGB)
|
&& jpegcolormode == JPEGCOLORMODE_RGB)
|
||||||
photometric = PHOTOMETRIC_YCBCR;
|
photometric = PHOTOMETRIC_YCBCR;
|
||||||
TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
|
TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
|
||||||
TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
|
TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
|
||||||
break;
|
break;
|
||||||
case COMPRESSION_LZW:
|
case COMPRESSION_LZW:
|
||||||
case COMPRESSION_ADOBE_DEFLATE:
|
|
||||||
case COMPRESSION_DEFLATE:
|
case COMPRESSION_DEFLATE:
|
||||||
if (predictor != 0)
|
if (predictor != 0)
|
||||||
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
|
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------
|
/* -------------------------------------------------------------------- */
|
||||||
*/
|
|
||||||
/* Read uncompressed image data. */
|
/* Read uncompressed image data. */
|
||||||
/* --------------------------------------------------------------------
|
/* -------------------------------------------------------------------- */
|
||||||
*/
|
|
||||||
|
|
||||||
if (info_hdr.iCompression == BMPC_RGB)
|
if (info_hdr.iCompression == BMPC_RGB) {
|
||||||
{
|
uint32 offset, size;
|
||||||
uint32_t offset, size;
|
|
||||||
char *scanbuf;
|
char *scanbuf;
|
||||||
|
|
||||||
/* XXX: Avoid integer overflow. We can calculate size
|
/* XXX: Avoid integer overflow. We can calculate size
|
||||||
|
@ -624,48 +592,46 @@ int main(int argc, char *argv[])
|
||||||
* conditions during calculation.
|
* conditions during calculation.
|
||||||
*/
|
*/
|
||||||
size = width * info_hdr.iBitCount + 31;
|
size = width * info_hdr.iBitCount + 31;
|
||||||
if (!width || !info_hdr.iBitCount ||
|
if (!width || !info_hdr.iBitCount
|
||||||
(size - 31) / info_hdr.iBitCount != width)
|
|| (size - 31) / info_hdr.iBitCount != width ) {
|
||||||
{
|
TIFFError(infilename,
|
||||||
TIFFError(infilename, "Wrong image parameters; can't "
|
"Wrong image parameters; can't "
|
||||||
"allocate space for scanline buffer");
|
"allocate space for scanline buffer");
|
||||||
goto bad3;
|
goto bad3;
|
||||||
}
|
}
|
||||||
size = (size & ~31) / 8;
|
size = (size & ~31) / 8;
|
||||||
|
|
||||||
scanbuf = (char *) _TIFFmalloc(size);
|
scanbuf = (char *) _TIFFmalloc(size);
|
||||||
if (!scanbuf)
|
if (!scanbuf) {
|
||||||
{
|
|
||||||
TIFFError(infilename,
|
TIFFError(infilename,
|
||||||
"Can't allocate space for scanline buffer");
|
"Can't allocate space for scanline buffer");
|
||||||
goto bad3;
|
goto bad3;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (row = 0; row < length; row++)
|
for (row = 0; row < length; row++) {
|
||||||
{
|
|
||||||
if (info_hdr.iHeight > 0)
|
if (info_hdr.iHeight > 0)
|
||||||
offset = file_hdr.iOffBits+(length-row-1)*size;
|
offset = file_hdr.iOffBits+(length-row-1)*size;
|
||||||
else
|
else
|
||||||
offset = file_hdr.iOffBits + row * size;
|
offset = file_hdr.iOffBits + row * size;
|
||||||
if (_TIFF_lseek_f(fd, offset, SEEK_SET) == (_TIFF_off_t)-1)
|
if (_TIFF_lseek_f(fd, offset, SEEK_SET) == (_TIFF_off_t)-1) {
|
||||||
{
|
TIFFError(infilename,
|
||||||
TIFFError(infilename, "scanline %lu: Seek error",
|
"scanline %lu: Seek error",
|
||||||
(unsigned long) row);
|
(unsigned long) row);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (read(fd, scanbuf, size) != (long)size)
|
if (read(fd, scanbuf, size) != (long) size) {
|
||||||
{
|
TIFFError(infilename,
|
||||||
TIFFError(infilename, "scanline %lu: Read error",
|
"scanline %lu: Read error",
|
||||||
(unsigned long) row);
|
(unsigned long) row);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rearrangePixels(scanbuf, width, info_hdr.iBitCount);
|
rearrangePixels(scanbuf, width, info_hdr.iBitCount);
|
||||||
|
|
||||||
if (TIFFWriteScanline(out, scanbuf, row, 0) < 0)
|
if (TIFFWriteScanline(out, scanbuf, row, 0)<0) {
|
||||||
{
|
TIFFError(infilename,
|
||||||
TIFFError(infilename, "scanline %lu: Write error",
|
"scanline %lu: Write error",
|
||||||
(unsigned long) row);
|
(unsigned long) row);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -673,106 +639,87 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
_TIFFfree(scanbuf);
|
_TIFFfree(scanbuf);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------
|
/* -------------------------------------------------------------------- */
|
||||||
*/
|
|
||||||
/* Read compressed image data. */
|
/* Read compressed image data. */
|
||||||
/* --------------------------------------------------------------------
|
/* -------------------------------------------------------------------- */
|
||||||
*/
|
|
||||||
}
|
} else if ( info_hdr.iCompression == BMPC_RLE8
|
||||||
else if (info_hdr.iCompression == BMPC_RLE8 ||
|
|| info_hdr.iCompression == BMPC_RLE4 ) {
|
||||||
info_hdr.iCompression == BMPC_RLE4)
|
uint32 i, j, k, runlength;
|
||||||
{
|
uint32 compr_size, uncompr_size;
|
||||||
uint32_t i, j, k, runlength;
|
|
||||||
uint32_t compr_size, uncompr_size;
|
|
||||||
unsigned char *comprbuf;
|
unsigned char *comprbuf;
|
||||||
unsigned char *uncomprbuf;
|
unsigned char *uncomprbuf;
|
||||||
|
|
||||||
compr_size = file_hdr.iSize - file_hdr.iOffBits;
|
compr_size = file_hdr.iSize - file_hdr.iOffBits;
|
||||||
uncompr_size = width * length;
|
uncompr_size = width * length;
|
||||||
/* Detect int overflow */
|
/* Detect int overflow */
|
||||||
if (uncompr_size / width != length)
|
if( uncompr_size / width != length ) {
|
||||||
{
|
TIFFError(infilename,
|
||||||
TIFFError(infilename, "Invalid dimensions of BMP file");
|
"Invalid dimensions of BMP file" );
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((compr_size == 0) || (compr_size > ((uint32_t)~0) >> 1) ||
|
if ( (compr_size == 0) ||
|
||||||
(uncompr_size == 0) || (uncompr_size > ((uint32_t)~0) >> 1))
|
(compr_size > ((uint32) ~0) >> 1) ||
|
||||||
{
|
(uncompr_size == 0) ||
|
||||||
TIFFError(infilename, "Invalid dimensions of BMP file");
|
(uncompr_size > ((uint32) ~0) >> 1) ) {
|
||||||
|
TIFFError(infilename,
|
||||||
|
"Invalid dimensions of BMP file" );
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
comprbuf = (unsigned char *) _TIFFmalloc( compr_size );
|
comprbuf = (unsigned char *) _TIFFmalloc( compr_size );
|
||||||
if (!comprbuf)
|
if (!comprbuf) {
|
||||||
{
|
TIFFError(infilename,
|
||||||
TIFFError(
|
|
||||||
infilename,
|
|
||||||
"Can't allocate space for compressed scanline buffer");
|
"Can't allocate space for compressed scanline buffer");
|
||||||
goto bad3;
|
goto bad3;
|
||||||
}
|
}
|
||||||
uncomprbuf = (unsigned char *)_TIFFmalloc(uncompr_size);
|
uncomprbuf = (unsigned char *)_TIFFmalloc(uncompr_size);
|
||||||
if (!uncomprbuf)
|
if (!uncomprbuf) {
|
||||||
{
|
TIFFError(infilename,
|
||||||
TIFFError(
|
|
||||||
infilename,
|
|
||||||
"Can't allocate space for uncompressed scanline buffer");
|
"Can't allocate space for uncompressed scanline buffer");
|
||||||
goto bad3;
|
goto bad3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_TIFF_lseek_f(fd, file_hdr.iOffBits, SEEK_SET) ==
|
if (_TIFF_lseek_f(fd, file_hdr.iOffBits, SEEK_SET) == (_TIFF_off_t)-1) {
|
||||||
(_TIFF_off_t)-1)
|
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to seek to offset");
|
TIFFError(infilename, "Failed to seek to offset");
|
||||||
goto bad3;
|
goto bad3;
|
||||||
}
|
}
|
||||||
if (read(fd, comprbuf, compr_size) != (long)compr_size)
|
if ( read(fd, comprbuf, compr_size) != (long) compr_size ) {
|
||||||
{
|
|
||||||
TIFFError(infilename, "Failed to read from file (%s)",
|
TIFFError(infilename, "Failed to read from file (%s)",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
if (info_hdr.iBitCount == 8)
|
if (info_hdr.iBitCount == 8) { /* RLE8 */
|
||||||
{ /* RLE8 */
|
while(j < uncompr_size && i < compr_size) {
|
||||||
while (j < uncompr_size && i < compr_size)
|
if ( comprbuf[i] ) {
|
||||||
{
|
|
||||||
if (comprbuf[i])
|
|
||||||
{
|
|
||||||
runlength = comprbuf[i++];
|
runlength = comprbuf[i++];
|
||||||
while (runlength > 0 && j < uncompr_size &&
|
while( runlength > 0
|
||||||
i < compr_size)
|
&& j < uncompr_size
|
||||||
{
|
&& i < compr_size ) {
|
||||||
uncomprbuf[j++] = comprbuf[i];
|
uncomprbuf[j++] = comprbuf[i];
|
||||||
runlength--;
|
runlength--;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
i++;
|
i++;
|
||||||
if (comprbuf[i] == 0) /* Next scanline */
|
if (comprbuf[i] == 0) /* Next scanline */
|
||||||
i++;
|
i++;
|
||||||
else if (comprbuf[i] == 1) /* End of image */
|
else if (comprbuf[i] == 1) /* End of image */
|
||||||
break;
|
break;
|
||||||
else if (comprbuf[i] == 2)
|
else if (comprbuf[i] == 2) { /* Move to... */
|
||||||
{ /* Move to... */
|
|
||||||
i++;
|
i++;
|
||||||
if (i < compr_size - 1)
|
if (i < compr_size - 1) {
|
||||||
{
|
|
||||||
j+=comprbuf[i]+comprbuf[i+1]*width;
|
j+=comprbuf[i]+comprbuf[i+1]*width;
|
||||||
i += 2;
|
i += 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
} else { /* Absolute mode */
|
||||||
else
|
|
||||||
{ /* Absolute mode */
|
|
||||||
runlength = comprbuf[i++];
|
runlength = comprbuf[i++];
|
||||||
for (k = 0; k < runlength && j < uncompr_size &&
|
for (k = 0; k < runlength && j < uncompr_size && i < compr_size; k++)
|
||||||
i < compr_size;
|
|
||||||
k++)
|
|
||||||
uncomprbuf[j++] = comprbuf[i++];
|
uncomprbuf[j++] = comprbuf[i++];
|
||||||
if ( k & 0x01 )
|
if ( k & 0x01 )
|
||||||
i++;
|
i++;
|
||||||
|
@ -780,16 +727,11 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else { /* RLE4 */
|
||||||
{ /* RLE4 */
|
while( j < uncompr_size && i < compr_size ) {
|
||||||
while (j < uncompr_size && i < compr_size)
|
if ( comprbuf[i] ) {
|
||||||
{
|
|
||||||
if (comprbuf[i])
|
|
||||||
{
|
|
||||||
runlength = comprbuf[i++];
|
runlength = comprbuf[i++];
|
||||||
while (runlength > 0 && j < uncompr_size &&
|
while( runlength > 0 && j < uncompr_size && i < compr_size ) {
|
||||||
i < compr_size)
|
|
||||||
{
|
|
||||||
if ( runlength & 0x01 )
|
if ( runlength & 0x01 )
|
||||||
uncomprbuf[j++] = (comprbuf[i] & 0xF0) >> 4;
|
uncomprbuf[j++] = (comprbuf[i] & 0xF0) >> 4;
|
||||||
else
|
else
|
||||||
|
@ -797,32 +739,23 @@ int main(int argc, char *argv[])
|
||||||
runlength--;
|
runlength--;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
i++;
|
i++;
|
||||||
if (comprbuf[i] == 0) /* Next scanline */
|
if (comprbuf[i] == 0) /* Next scanline */
|
||||||
i++;
|
i++;
|
||||||
else if (comprbuf[i] == 1) /* End of image */
|
else if (comprbuf[i] == 1) /* End of image */
|
||||||
break;
|
break;
|
||||||
else if (comprbuf[i] == 2)
|
else if (comprbuf[i] == 2) { /* Move to... */
|
||||||
{ /* Move to... */
|
|
||||||
i++;
|
i++;
|
||||||
if (i < compr_size - 1)
|
if (i < compr_size - 1) {
|
||||||
{
|
|
||||||
j+=comprbuf[i]+comprbuf[i+1]*width;
|
j+=comprbuf[i]+comprbuf[i+1]*width;
|
||||||
i += 2;
|
i += 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
} else { /* Absolute mode */
|
||||||
else
|
|
||||||
{ /* Absolute mode */
|
|
||||||
runlength = comprbuf[i++];
|
runlength = comprbuf[i++];
|
||||||
for (k = 0; k < runlength && j < uncompr_size &&
|
for (k = 0; k < runlength && j < uncompr_size && i < compr_size; k++) {
|
||||||
i < compr_size;
|
|
||||||
k++)
|
|
||||||
{
|
|
||||||
if (k & 0x01)
|
if (k & 0x01)
|
||||||
uncomprbuf[j++] = comprbuf[i++] & 0x0F;
|
uncomprbuf[j++] = comprbuf[i++] & 0x0F;
|
||||||
else
|
else
|
||||||
|
@ -837,13 +770,12 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
_TIFFfree(comprbuf);
|
_TIFFfree(comprbuf);
|
||||||
|
|
||||||
for (row = 0; row < length; row++)
|
for (row = 0; row < length; row++) {
|
||||||
{
|
|
||||||
if (TIFFWriteScanline(out,
|
if (TIFFWriteScanline(out,
|
||||||
uncomprbuf + (length - row - 1) * width,
|
uncomprbuf + (length - row - 1) * width,
|
||||||
row, 0) < 0)
|
row, 0) < 0) {
|
||||||
{
|
TIFFError(infilename,
|
||||||
TIFFError(infilename, "scanline %lu: Write error.\n",
|
"scanline %lu: Write error.\n",
|
||||||
(unsigned long) row);
|
(unsigned long) row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -851,18 +783,15 @@ int main(int argc, char *argv[])
|
||||||
_TIFFfree(uncomprbuf);
|
_TIFFfree(uncomprbuf);
|
||||||
}
|
}
|
||||||
TIFFWriteDirectory(out);
|
TIFFWriteDirectory(out);
|
||||||
if (blue_tbl)
|
if (blue_tbl) {
|
||||||
{
|
|
||||||
_TIFFfree(blue_tbl);
|
_TIFFfree(blue_tbl);
|
||||||
blue_tbl=NULL;
|
blue_tbl=NULL;
|
||||||
}
|
}
|
||||||
if (green_tbl)
|
if (green_tbl) {
|
||||||
{
|
|
||||||
_TIFFfree(green_tbl);
|
_TIFFfree(green_tbl);
|
||||||
green_tbl=NULL;
|
green_tbl=NULL;
|
||||||
}
|
}
|
||||||
if (red_tbl)
|
if (red_tbl) {
|
||||||
{
|
|
||||||
_TIFFfree(red_tbl);
|
_TIFFfree(red_tbl);
|
||||||
red_tbl=NULL;
|
red_tbl=NULL;
|
||||||
}
|
}
|
||||||
|
@ -889,18 +818,17 @@ bad:
|
||||||
* Image data in BMP file stored in BGR (or ABGR) format. We should rearrange
|
* Image data in BMP file stored in BGR (or ABGR) format. We should rearrange
|
||||||
* pixels to RGB (RGBA) format.
|
* pixels to RGB (RGBA) format.
|
||||||
*/
|
*/
|
||||||
static void rearrangePixels(char *buf, uint32_t width, uint32_t bit_count)
|
static void
|
||||||
|
rearrangePixels(char *buf, uint32 width, uint32 bit_count)
|
||||||
{
|
{
|
||||||
char tmp;
|
char tmp;
|
||||||
uint32_t i;
|
uint32 i;
|
||||||
|
|
||||||
switch (bit_count)
|
switch(bit_count) {
|
||||||
{
|
|
||||||
case 16: /* FIXME: need a sample file */
|
case 16: /* FIXME: need a sample file */
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
for (i = 0; i < width; i++, buf += 3)
|
for (i = 0; i < width; i++, buf += 3) {
|
||||||
{
|
|
||||||
tmp = *buf;
|
tmp = *buf;
|
||||||
*buf = *(buf + 2);
|
*buf = *(buf + 2);
|
||||||
*(buf + 2) = tmp;
|
*(buf + 2) = tmp;
|
||||||
|
@ -910,8 +838,7 @@ static void rearrangePixels(char *buf, uint32_t width, uint32_t bit_count)
|
||||||
{
|
{
|
||||||
char *buf1 = buf;
|
char *buf1 = buf;
|
||||||
|
|
||||||
for (i = 0; i < width; i++, buf += 4)
|
for (i = 0; i < width; i++, buf += 4) {
|
||||||
{
|
|
||||||
tmp = *buf;
|
tmp = *buf;
|
||||||
*buf1++ = *(buf + 2);
|
*buf1++ = *(buf + 2);
|
||||||
*buf1++ = *(buf + 1);
|
*buf1++ = *(buf + 1);
|
||||||
|
@ -924,14 +851,14 @@ static void rearrangePixels(char *buf, uint32_t width, uint32_t bit_count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int processCompressOptions(char *opt)
|
static int
|
||||||
|
processCompressOptions(char* opt)
|
||||||
{
|
{
|
||||||
if (strcmp(opt, "none") == 0)
|
if (strcmp(opt, "none") == 0)
|
||||||
compression = COMPRESSION_NONE;
|
compression = COMPRESSION_NONE;
|
||||||
else if (strcmp(opt, "packbits") == 0)
|
else if (strcmp(opt, "packbits") == 0)
|
||||||
compression = COMPRESSION_PACKBITS;
|
compression = COMPRESSION_PACKBITS;
|
||||||
else if (strncmp(opt, "jpeg", 4) == 0)
|
else if (strncmp(opt, "jpeg", 4) == 0) {
|
||||||
{
|
|
||||||
char* cp = strchr(opt, ':');
|
char* cp = strchr(opt, ':');
|
||||||
|
|
||||||
compression = COMPRESSION_JPEG;
|
compression = COMPRESSION_JPEG;
|
||||||
|
@ -946,22 +873,17 @@ static int processCompressOptions(char *opt)
|
||||||
|
|
||||||
cp = strchr(cp+1,':');
|
cp = strchr(cp+1,':');
|
||||||
}
|
}
|
||||||
}
|
} else if (strncmp(opt, "lzw", 3) == 0) {
|
||||||
else if (strncmp(opt, "lzw", 3) == 0)
|
|
||||||
{
|
|
||||||
char* cp = strchr(opt, ':');
|
char* cp = strchr(opt, ':');
|
||||||
if (cp)
|
if (cp)
|
||||||
predictor = atoi(cp+1);
|
predictor = atoi(cp+1);
|
||||||
compression = COMPRESSION_LZW;
|
compression = COMPRESSION_LZW;
|
||||||
}
|
} else if (strncmp(opt, "zip", 3) == 0) {
|
||||||
else if (strncmp(opt, "zip", 3) == 0)
|
|
||||||
{
|
|
||||||
char* cp = strchr(opt, ':');
|
char* cp = strchr(opt, ':');
|
||||||
if (cp)
|
if (cp)
|
||||||
predictor = atoi(cp+1);
|
predictor = atoi(cp+1);
|
||||||
compression = COMPRESSION_ADOBE_DEFLATE;
|
compression = COMPRESSION_DEFLATE;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return (0);
|
return (0);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -981,18 +903,18 @@ static char *stuff[] = {
|
||||||
"JPEG options:",
|
"JPEG options:",
|
||||||
" # set compression quality level (0-100, default 75)",
|
" # set compression quality level (0-100, default 75)",
|
||||||
" r output color image as RGB rather than YCbCr",
|
" r output color image as RGB rather than YCbCr",
|
||||||
"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. "
|
"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
|
||||||
"quality",
|
|
||||||
"",
|
"",
|
||||||
"LZW and deflate options:",
|
"LZW and deflate options:",
|
||||||
" # set predictor value",
|
" # set predictor value",
|
||||||
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
|
"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
|
||||||
"differencing",
|
|
||||||
" -o out.tif write output to out.tif",
|
" -o out.tif write output to out.tif",
|
||||||
" -h this help message",
|
" -h this help message",
|
||||||
NULL};
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static void usage(void)
|
static void
|
||||||
|
usage(void)
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
int i;
|
int i;
|
||||||
|
@ -1003,3 +925,12 @@ static void usage(void)
|
||||||
fprintf(stderr, "%s\n", stuff[i]);
|
fprintf(stderr, "%s\n", stuff[i]);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* mode: c
|
||||||
|
* c-basic-offset: 8
|
||||||
|
* fill-column: 78
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|
|
@ -33,11 +33,11 @@
|
||||||
*/
|
*/
|
||||||
#include "tif_config.h"
|
#include "tif_config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
@ -58,7 +58,8 @@
|
||||||
|
|
||||||
unsigned short gamtab[256];
|
unsigned short gamtab[256];
|
||||||
|
|
||||||
void makegamtab(float gam)
|
void
|
||||||
|
makegamtab(float gam)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -78,11 +79,12 @@ char *stuff[] = {
|
||||||
"",
|
"",
|
||||||
"LZW and deflate options:",
|
"LZW and deflate options:",
|
||||||
" # set predictor value",
|
" # set predictor value",
|
||||||
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
|
"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
|
||||||
"differencing",
|
NULL
|
||||||
NULL};
|
};
|
||||||
|
|
||||||
static void usage(void)
|
static void
|
||||||
|
usage(void)
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
int i;
|
int i;
|
||||||
|
@ -115,9 +117,9 @@ unsigned short green[COLSIZE];
|
||||||
unsigned short blue[COLSIZE];
|
unsigned short blue[COLSIZE];
|
||||||
char *filename, *imagename;
|
char *filename, *imagename;
|
||||||
|
|
||||||
static uint16_t compression = COMPRESSION_PACKBITS;
|
static uint16 compression = COMPRESSION_PACKBITS;
|
||||||
static uint16_t predictor = 0;
|
static uint16 predictor = 0;
|
||||||
static uint32_t rowsperstrip = (uint32_t)-1;
|
static uint32 rowsperstrip = (uint32) -1;
|
||||||
static int processCompressOptions(char*);
|
static int processCompressOptions(char*);
|
||||||
|
|
||||||
int convert(void);
|
int convert(void);
|
||||||
|
@ -130,7 +132,8 @@ int process(int, unsigned char **);
|
||||||
void initcolors(unsigned char [COLSIZE][3], int);
|
void initcolors(unsigned char [COLSIZE][3], int);
|
||||||
void rasterize(int, char*);
|
void rasterize(int, char*);
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
#if !HAVE_DECL_OPTARG
|
#if !HAVE_DECL_OPTARG
|
||||||
extern int optind;
|
extern int optind;
|
||||||
|
@ -140,8 +143,7 @@ int main(int argc, char *argv[])
|
||||||
int c, status;
|
int c, status;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "c:r:")) != -1)
|
while ((c = getopt(argc, argv, "c:r:")) != -1)
|
||||||
switch (c)
|
switch (c) {
|
||||||
{
|
|
||||||
case 'c': /* compression scheme */
|
case 'c': /* compression scheme */
|
||||||
if (!processCompressOptions(optarg))
|
if (!processCompressOptions(optarg))
|
||||||
usage();
|
usage();
|
||||||
|
@ -159,18 +161,15 @@ int main(int argc, char *argv[])
|
||||||
makegamtab(GIFGAMMA);
|
makegamtab(GIFGAMMA);
|
||||||
filename = argv[optind];
|
filename = argv[optind];
|
||||||
imagename = argv[optind+1];
|
imagename = argv[optind+1];
|
||||||
if ((infile = fopen(imagename, "rb")) != NULL)
|
if ((infile = fopen(imagename, "rb")) != NULL) {
|
||||||
{
|
|
||||||
int c;
|
int c;
|
||||||
fclose(infile);
|
fclose(infile);
|
||||||
printf("overwrite %s? ", imagename);
|
printf("overwrite %s? ", imagename); fflush(stdout);
|
||||||
fflush(stdout);
|
|
||||||
c = getc(stdin);
|
c = getc(stdin);
|
||||||
if (c != 'y' && c != 'Y')
|
if (c != 'y' && c != 'Y')
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
if ((infile = fopen(filename, "rb")) == NULL)
|
if ((infile = fopen(filename, "rb")) == NULL) {
|
||||||
{
|
|
||||||
perror(filename);
|
perror(filename);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -179,32 +178,30 @@ int main(int argc, char *argv[])
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int processCompressOptions(char *opt)
|
static int
|
||||||
|
processCompressOptions(char* opt)
|
||||||
{
|
{
|
||||||
if (streq(opt, "none"))
|
if (streq(opt, "none"))
|
||||||
compression = COMPRESSION_NONE;
|
compression = COMPRESSION_NONE;
|
||||||
else if (streq(opt, "packbits"))
|
else if (streq(opt, "packbits"))
|
||||||
compression = COMPRESSION_PACKBITS;
|
compression = COMPRESSION_PACKBITS;
|
||||||
else if (strneq(opt, "lzw", 3))
|
else if (strneq(opt, "lzw", 3)) {
|
||||||
{
|
|
||||||
char* cp = strchr(opt, ':');
|
char* cp = strchr(opt, ':');
|
||||||
if (cp)
|
if (cp)
|
||||||
predictor = atoi(cp+1);
|
predictor = atoi(cp+1);
|
||||||
compression = COMPRESSION_LZW;
|
compression = COMPRESSION_LZW;
|
||||||
}
|
} else if (strneq(opt, "zip", 3)) {
|
||||||
else if (strneq(opt, "zip", 3))
|
|
||||||
{
|
|
||||||
char* cp = strchr(opt, ':');
|
char* cp = strchr(opt, ':');
|
||||||
if (cp)
|
if (cp)
|
||||||
predictor = atoi(cp+1);
|
predictor = atoi(cp+1);
|
||||||
compression = COMPRESSION_ADOBE_DEFLATE;
|
compression = COMPRESSION_DEFLATE;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return (0);
|
return (0);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int convert(void)
|
int
|
||||||
|
convert(void)
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
char* mode = "w";
|
char* mode = "w";
|
||||||
|
@ -213,46 +210,38 @@ int convert(void)
|
||||||
return (-1);
|
return (-1);
|
||||||
if (!readscreen())
|
if (!readscreen())
|
||||||
return (-1);
|
return (-1);
|
||||||
while ((ch = getc(infile)) != ';' && ch != EOF)
|
while ((ch = getc(infile)) != ';' && ch != EOF) {
|
||||||
{
|
switch (ch) {
|
||||||
switch (ch)
|
case '\0': break; /* this kludge for non-standard files */
|
||||||
{
|
case ',': if (!readgifimage(mode))
|
||||||
case '\0':
|
|
||||||
break; /* this kludge for non-standard files */
|
|
||||||
case ',':
|
|
||||||
if (!readgifimage(mode))
|
|
||||||
return (-1);
|
return (-1);
|
||||||
mode = "a"; /* subsequent images append */
|
mode = "a"; /* subsequent images append */
|
||||||
break;
|
break;
|
||||||
case '!':
|
case '!': if (!readextension())
|
||||||
if (!readextension())
|
|
||||||
return (-1);
|
return (-1);
|
||||||
break;
|
break;
|
||||||
default:
|
default: fprintf(stderr, "illegal GIF block type\n");
|
||||||
fprintf(stderr, "illegal GIF block type\n");
|
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int checksignature(void)
|
int
|
||||||
|
checksignature(void)
|
||||||
{
|
{
|
||||||
char buf[6];
|
char buf[6];
|
||||||
|
|
||||||
if (fread(buf, 1, 6, infile) != 6)
|
if (fread(buf,1,6,infile) != 6) {
|
||||||
{
|
fprintf(stderr, "short read from file %s (%s)\n",
|
||||||
fprintf(stderr, "short read from file %s (%s)\n", filename,
|
filename, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strncmp(buf, "GIF", 3))
|
if (strncmp(buf,"GIF",3)) {
|
||||||
{
|
|
||||||
fprintf(stderr, "file is not a GIF file\n");
|
fprintf(stderr, "file is not a GIF file\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strncmp(&buf[3], "87a", 3))
|
if (strncmp(&buf[3],"87a",3)) {
|
||||||
{
|
|
||||||
fprintf(stderr, "unknown GIF version number\n");
|
fprintf(stderr, "unknown GIF version number\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -264,32 +253,31 @@ int checksignature(void)
|
||||||
* Get information which is global to all the images stored
|
* Get information which is global to all the images stored
|
||||||
* in the file
|
* in the file
|
||||||
*/
|
*/
|
||||||
int readscreen(void)
|
int
|
||||||
|
readscreen(void)
|
||||||
{
|
{
|
||||||
unsigned char buf[7];
|
unsigned char buf[7];
|
||||||
|
|
||||||
if (fread(buf, 1, 7, infile) != 7)
|
if (fread(buf,1,7,infile) != 7) {
|
||||||
{
|
fprintf(stderr, "short read from file %s (%s)\n",
|
||||||
fprintf(stderr, "short read from file %s (%s)\n", filename,
|
filename, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
global = buf[4] & 0x80;
|
global = buf[4] & 0x80;
|
||||||
if (global)
|
if (global) {
|
||||||
{
|
|
||||||
globalbits = (buf[4] & 0x07) + 1;
|
globalbits = (buf[4] & 0x07) + 1;
|
||||||
if (fread(globalmap,3,((size_t)1)<<globalbits,infile) !=
|
if (fread(globalmap,3,((size_t)1)<<globalbits,infile) !=
|
||||||
((size_t)1) << globalbits)
|
((size_t)1)<<globalbits) {
|
||||||
{
|
fprintf(stderr, "short read from file %s (%s)\n",
|
||||||
fprintf(stderr, "short read from file %s (%s)\n", filename,
|
filename, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int readgifimage(char *mode)
|
int
|
||||||
|
readgifimage(char* mode)
|
||||||
{
|
{
|
||||||
unsigned char buf[9];
|
unsigned char buf[9];
|
||||||
int local, interleaved;
|
int local, interleaved;
|
||||||
|
@ -298,57 +286,46 @@ int readgifimage(char *mode)
|
||||||
int status;
|
int status;
|
||||||
size_t raster_size;
|
size_t raster_size;
|
||||||
|
|
||||||
if (fread(buf, 1, 9, infile) != 9)
|
if (fread(buf, 1, 9, infile) != 9) {
|
||||||
{
|
fprintf(stderr, "short read from file %s (%s)\n",
|
||||||
fprintf(stderr, "short read from file %s (%s)\n", filename,
|
filename, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
width = (buf[4] + (buf[5] << 8)) & 0xffff; /* 16 bit */
|
width = (buf[4] + (buf[5] << 8)) & 0xffff; /* 16 bit */
|
||||||
height = (buf[6] + (buf[7] << 8)) & 0xffff; /* 16 bit */
|
height = (buf[6] + (buf[7] << 8)) & 0xffff; /* 16 bit */
|
||||||
local = buf[8] & 0x80;
|
local = buf[8] & 0x80;
|
||||||
interleaved = buf[8] & 0x40;
|
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");
|
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");
|
fprintf(stderr, "no colormap present for image\n");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
raster_size=width*height;
|
raster_size=width*height;
|
||||||
if ((raster_size / width) == height)
|
if ((raster_size/width) == height) {
|
||||||
{
|
|
||||||
raster_size += EXTRAFUDGE; /* Add elbow room */
|
raster_size += EXTRAFUDGE; /* Add elbow room */
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
raster_size=0;
|
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");
|
fprintf(stderr, "not enough memory for image\n");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
if (local)
|
if (local) {
|
||||||
{
|
|
||||||
localbits = (buf[8] & 0x7) + 1;
|
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) !=
|
if (fread(localmap, 3, ((size_t)1)<<localbits, infile) !=
|
||||||
((size_t)1) << localbits)
|
((size_t)1)<<localbits) {
|
||||||
{
|
fprintf(stderr, "short read from file %s (%s)\n",
|
||||||
fprintf(stderr, "short read from file %s (%s)\n", filename,
|
filename, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
initcolors(localmap, 1<<localbits);
|
initcolors(localmap, 1<<localbits);
|
||||||
}
|
} else if (global) {
|
||||||
else if (global)
|
|
||||||
{
|
|
||||||
initcolors(globalmap, 1<<globalbits);
|
initcolors(globalmap, 1<<globalbits);
|
||||||
}
|
}
|
||||||
if ((status = readraster()))
|
if ((status = readraster()))
|
||||||
|
@ -362,7 +339,8 @@ int readgifimage(char *mode)
|
||||||
* Read a GIF extension block (and do nothing with it).
|
* Read a GIF extension block (and do nothing with it).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int readextension(void)
|
int
|
||||||
|
readextension(void)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
char buf[255];
|
char buf[255];
|
||||||
|
@ -370,10 +348,9 @@ int readextension(void)
|
||||||
|
|
||||||
(void) getc(infile);
|
(void) getc(infile);
|
||||||
while ((count = getc(infile)) && count <= 255)
|
while ((count = getc(infile)) && count <= 255)
|
||||||
if (fread(buf, 1, count, infile) != (size_t)count)
|
if (fread(buf, 1, count, infile) != (size_t) count) {
|
||||||
{
|
fprintf(stderr, "short read from file %s (%s)\n",
|
||||||
fprintf(stderr, "short read from file %s (%s)\n", filename,
|
filename, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
status = 0;
|
status = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -385,7 +362,8 @@ int readextension(void)
|
||||||
* Decode a raster image
|
* Decode a raster image
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int readraster(void)
|
int
|
||||||
|
readraster(void)
|
||||||
{
|
{
|
||||||
unsigned char *fill = raster;
|
unsigned char *fill = raster;
|
||||||
unsigned char buf[255];
|
unsigned char buf[255];
|
||||||
|
@ -404,49 +382,40 @@ int readraster(void)
|
||||||
oldcode = -1;
|
oldcode = -1;
|
||||||
codesize = datasize + 1;
|
codesize = datasize + 1;
|
||||||
codemask = (1 << codesize) - 1;
|
codemask = (1 << codesize) - 1;
|
||||||
for (code = 0; code < clear; code++)
|
for (code = 0; code < clear; code++) {
|
||||||
{
|
|
||||||
prefix[code] = 0;
|
prefix[code] = 0;
|
||||||
suffix[code] = code;
|
suffix[code] = code;
|
||||||
}
|
}
|
||||||
stackp = stack;
|
stackp = stack;
|
||||||
for (count = getc(infile); count > 0 && count <= 255; count = getc(infile))
|
for (count = getc(infile); count > 0 && count <= 255; count = getc(infile)) {
|
||||||
{
|
if (fread(buf,1,count,infile) != (size_t)count) {
|
||||||
if (fread(buf, 1, count, infile) != (size_t)count)
|
fprintf(stderr, "short read from file %s (%s)\n",
|
||||||
{
|
filename, strerror(errno));
|
||||||
fprintf(stderr, "short read from file %s (%s)\n", filename,
|
|
||||||
strerror(errno));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for (ch = buf; count-- > 0; ch++)
|
for (ch=buf; count-- > 0; ch++) {
|
||||||
{
|
|
||||||
datum += (unsigned long) *ch << bits;
|
datum += (unsigned long) *ch << bits;
|
||||||
bits += 8;
|
bits += 8;
|
||||||
while (bits >= codesize)
|
while (bits >= codesize) {
|
||||||
{
|
|
||||||
code = datum & codemask;
|
code = datum & codemask;
|
||||||
datum >>= codesize;
|
datum >>= codesize;
|
||||||
bits -= codesize;
|
bits -= codesize;
|
||||||
if (code == eoi)
|
if (code == eoi) { /* This kludge put in */
|
||||||
{ /* This kludge put in */
|
|
||||||
goto exitloop; /* because some GIF files*/
|
goto exitloop; /* because some GIF files*/
|
||||||
} /* aren't standard */
|
} /* aren't standard */
|
||||||
if (!process(code, &fill))
|
if (!process(code, &fill)) {
|
||||||
{
|
|
||||||
status = 0;
|
status = 0;
|
||||||
goto exitloop;
|
goto exitloop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fill >= raster + width * height)
|
if (fill >= raster + width*height) {
|
||||||
{
|
|
||||||
fprintf(stderr, "raster full before eoi code\n");
|
fprintf(stderr, "raster full before eoi code\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exitloop:
|
exitloop:
|
||||||
if (fill != raster + width * height)
|
if (fill != raster + width*height) {
|
||||||
{
|
|
||||||
fprintf(stderr, "warning: wrong rastersize: %ld bytes\n",
|
fprintf(stderr, "warning: wrong rastersize: %ld bytes\n",
|
||||||
(long) (fill-raster));
|
(long) (fill-raster));
|
||||||
fprintf(stderr, " instead of %ld bytes\n",
|
fprintf(stderr, " instead of %ld bytes\n",
|
||||||
|
@ -461,13 +430,13 @@ exitloop:
|
||||||
* Otherwise make a new code table entry, and output the bytes
|
* Otherwise make a new code table entry, and output the bytes
|
||||||
* associated with the code.
|
* associated with the code.
|
||||||
*/
|
*/
|
||||||
int process(register int code, unsigned char **fill)
|
int
|
||||||
|
process(register int code, unsigned char** fill)
|
||||||
{
|
{
|
||||||
int incode;
|
int incode;
|
||||||
static unsigned char firstchar;
|
static unsigned char firstchar;
|
||||||
|
|
||||||
if (code == clear)
|
if (code == clear) {
|
||||||
{
|
|
||||||
codesize = datasize + 1;
|
codesize = datasize + 1;
|
||||||
codemask = (1 << codesize) - 1;
|
codemask = (1 << codesize) - 1;
|
||||||
avail = clear + 2;
|
avail = clear + 2;
|
||||||
|
@ -475,16 +444,12 @@ int process(register int code, unsigned char **fill)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldcode == -1)
|
if (oldcode == -1) {
|
||||||
{
|
if (code >= clear) {
|
||||||
if (code >= clear)
|
fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",code, clear);
|
||||||
{
|
|
||||||
fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",
|
|
||||||
code, clear);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (*fill >= raster + width * height)
|
if (*fill >= raster + width*height) {
|
||||||
{
|
|
||||||
fprintf(stderr, "raster full before eoi code\n");
|
fprintf(stderr, "raster full before eoi code\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -492,20 +457,17 @@ int process(register int code, unsigned char **fill)
|
||||||
firstchar = oldcode = code;
|
firstchar = oldcode = code;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (code > avail)
|
if (code > avail) {
|
||||||
{
|
|
||||||
fprintf(stderr, "code %d too large for %d\n", code, avail);
|
fprintf(stderr, "code %d too large for %d\n", code, avail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
incode = code;
|
incode = code;
|
||||||
if (code == avail)
|
if (code == avail) { /* the first code is always < avail */
|
||||||
{ /* the first code is always < avail */
|
|
||||||
*stackp++ = firstchar;
|
*stackp++ = firstchar;
|
||||||
code = oldcode;
|
code = oldcode;
|
||||||
}
|
}
|
||||||
while (code > clear)
|
while (code > clear) {
|
||||||
{
|
|
||||||
*stackp++ = suffix[code];
|
*stackp++ = suffix[code];
|
||||||
code = prefix[code];
|
code = prefix[code];
|
||||||
}
|
}
|
||||||
|
@ -515,16 +477,13 @@ int process(register int code, unsigned char **fill)
|
||||||
suffix[avail] = firstchar;
|
suffix[avail] = firstchar;
|
||||||
avail++;
|
avail++;
|
||||||
|
|
||||||
if (((avail & codemask) == 0) && (avail < 4096))
|
if (((avail & codemask) == 0) && (avail < 4096)) {
|
||||||
{
|
|
||||||
codesize++;
|
codesize++;
|
||||||
codemask += avail;
|
codemask += avail;
|
||||||
}
|
}
|
||||||
oldcode = incode;
|
oldcode = incode;
|
||||||
do
|
do {
|
||||||
{
|
if (*fill >= raster + width*height) {
|
||||||
if (*fill >= raster + width * height)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "raster full before eoi code\n");
|
fprintf(stderr, "raster full before eoi code\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -539,19 +498,20 @@ int process(register int code, unsigned char **fill)
|
||||||
* values.
|
* values.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void initcolors(unsigned char colormap[COLSIZE][3], int ncolors)
|
void
|
||||||
|
initcolors(unsigned char colormap[COLSIZE][3], int ncolors)
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
|
||||||
for (i = 0; i < ncolors; i++)
|
for (i = 0; i < ncolors; i++) {
|
||||||
{
|
|
||||||
red[i] = gamtab[colormap[i][0]];
|
red[i] = gamtab[colormap[i][0]];
|
||||||
green[i] = gamtab[colormap[i][1]];
|
green[i] = gamtab[colormap[i][1]];
|
||||||
blue[i] = gamtab[colormap[i][2]];
|
blue[i] = gamtab[colormap[i][2]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rasterize(int interleaved, char *mode)
|
void
|
||||||
|
rasterize(int interleaved, char* mode)
|
||||||
{
|
{
|
||||||
register unsigned long row;
|
register unsigned long row;
|
||||||
unsigned char *newras;
|
unsigned char *newras;
|
||||||
|
@ -560,40 +520,33 @@ void rasterize(int interleaved, char *mode)
|
||||||
tstrip_t strip;
|
tstrip_t strip;
|
||||||
tsize_t stripsize;
|
tsize_t stripsize;
|
||||||
|
|
||||||
if ((newras = (unsigned char *)_TIFFmalloc(width * height + EXTRAFUDGE)) ==
|
if ((newras = (unsigned char*) _TIFFmalloc(width*height+EXTRAFUDGE)) == NULL) {
|
||||||
NULL)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "not enough memory for image\n");
|
fprintf(stderr, "not enough memory for image\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#define DRAWSEGMENT(offset, step) \
|
#define DRAWSEGMENT(offset, step) { \
|
||||||
{ \
|
for (row = offset; row < height; row += step) { \
|
||||||
for (row = offset; row < height; row += step) \
|
|
||||||
{ \
|
|
||||||
_TIFFmemcpy(newras + row*width, ras, width);\
|
_TIFFmemcpy(newras + row*width, ras, width);\
|
||||||
ras += width; \
|
ras += width; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
ras = raster;
|
ras = raster;
|
||||||
if (interleaved)
|
if (interleaved) {
|
||||||
{
|
|
||||||
DRAWSEGMENT(0, 8);
|
DRAWSEGMENT(0, 8);
|
||||||
DRAWSEGMENT(4, 8);
|
DRAWSEGMENT(4, 8);
|
||||||
DRAWSEGMENT(2, 4);
|
DRAWSEGMENT(2, 4);
|
||||||
DRAWSEGMENT(1, 2);
|
DRAWSEGMENT(1, 2);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
DRAWSEGMENT(0, 1);
|
DRAWSEGMENT(0, 1);
|
||||||
#undef DRAWSEGMENT
|
#undef DRAWSEGMENT
|
||||||
|
|
||||||
tif = TIFFOpen(imagename, mode);
|
tif = TIFFOpen(imagename, mode);
|
||||||
if (!tif)
|
if (!tif) {
|
||||||
{
|
|
||||||
TIFFError(imagename,"Can not open output image");
|
TIFFError(imagename,"Can not open output image");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32_t)width);
|
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) width);
|
||||||
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32_t)height);
|
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32) height);
|
||||||
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
|
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
|
||||||
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||||
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
|
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
|
||||||
|
@ -601,10 +554,8 @@ void rasterize(int interleaved, char *mode)
|
||||||
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP,
|
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP,
|
||||||
rowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip));
|
rowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip));
|
||||||
TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);
|
TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);
|
||||||
switch (compression)
|
switch (compression) {
|
||||||
{
|
|
||||||
case COMPRESSION_LZW:
|
case COMPRESSION_LZW:
|
||||||
case COMPRESSION_ADOBE_DEFLATE:
|
|
||||||
case COMPRESSION_DEFLATE:
|
case COMPRESSION_DEFLATE:
|
||||||
if (predictor != 0)
|
if (predictor != 0)
|
||||||
TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor);
|
TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor);
|
||||||
|
@ -614,15 +565,12 @@ void rasterize(int interleaved, char *mode)
|
||||||
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
||||||
strip = 0;
|
strip = 0;
|
||||||
stripsize = TIFFStripSize(tif);
|
stripsize = TIFFStripSize(tif);
|
||||||
for (row = 0; row < height; row += rowsperstrip)
|
for (row=0; row<height; row += rowsperstrip) {
|
||||||
{
|
if (rowsperstrip > height-row) {
|
||||||
if (rowsperstrip > height - row)
|
|
||||||
{
|
|
||||||
rowsperstrip = height-row;
|
rowsperstrip = height-row;
|
||||||
stripsize = TIFFVStripSize(tif, rowsperstrip);
|
stripsize = TIFFVStripSize(tif, rowsperstrip);
|
||||||
}
|
}
|
||||||
if (TIFFWriteEncodedStrip(tif, strip, newras + row * width, stripsize) <
|
if (TIFFWriteEncodedStrip(tif, strip, newras+row*width, stripsize) < 0)
|
||||||
0)
|
|
||||||
break;
|
break;
|
||||||
strip++;
|
strip++;
|
||||||
}
|
}
|
||||||
|
@ -630,3 +578,12 @@ void rasterize(int interleaved, char *mode)
|
||||||
|
|
||||||
_TIFFfree(newras);
|
_TIFFfree(newras);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* mode: c
|
||||||
|
* c-basic-offset: 4
|
||||||
|
* fill-column: 78
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
|
|
||||||
#include "tif_config.h"
|
#include "tif_config.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
@ -47,15 +47,16 @@
|
||||||
#define streq(a,b) (strcmp(a,b) == 0)
|
#define streq(a,b) (strcmp(a,b) == 0)
|
||||||
#define strneq(a,b,n) (strncmp(a,b,n) == 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 jpegcolormode = JPEGCOLORMODE_RGB;
|
||||||
static int quality = 75; /* JPEG quality */
|
static int quality = 75; /* JPEG quality */
|
||||||
static uint16_t predictor = 0;
|
static uint16 predictor = 0;
|
||||||
|
|
||||||
static void usage(void);
|
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;
|
long row;
|
||||||
|
@ -63,9 +64,9 @@ int main(int argc, char *argv[])
|
||||||
TIFF *out;
|
TIFF *out;
|
||||||
FILE *in;
|
FILE *in;
|
||||||
struct rasterfile h;
|
struct rasterfile h;
|
||||||
uint16_t photometric;
|
uint16 photometric;
|
||||||
uint16_t config = PLANARCONFIG_CONTIG;
|
uint16 config = PLANARCONFIG_CONTIG;
|
||||||
uint32_t rowsperstrip = (uint32_t)-1;
|
uint32 rowsperstrip = (uint32) -1;
|
||||||
int c;
|
int c;
|
||||||
#if !HAVE_DECL_OPTARG
|
#if !HAVE_DECL_OPTARG
|
||||||
extern int optind;
|
extern int optind;
|
||||||
|
@ -73,8 +74,7 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "c:r:h")) != -1)
|
while ((c = getopt(argc, argv, "c:r:h")) != -1)
|
||||||
switch (c)
|
switch (c) {
|
||||||
{
|
|
||||||
case 'c': /* compression scheme */
|
case 'c': /* compression scheme */
|
||||||
if (!processCompressOptions(optarg))
|
if (!processCompressOptions(optarg))
|
||||||
usage();
|
usage();
|
||||||
|
@ -89,62 +89,56 @@ int main(int argc, char *argv[])
|
||||||
if (argc - optind != 2)
|
if (argc - optind != 2)
|
||||||
usage();
|
usage();
|
||||||
in = fopen(argv[optind], "rb");
|
in = fopen(argv[optind], "rb");
|
||||||
if (in == NULL)
|
if (in == NULL) {
|
||||||
{
|
|
||||||
fprintf(stderr, "%s: Can not open.\n", argv[optind]);
|
fprintf(stderr, "%s: Can not open.\n", argv[optind]);
|
||||||
return (-1);
|
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]);
|
fprintf(stderr, "%s: Can not read header.\n", argv[optind]);
|
||||||
fclose(in);
|
fclose(in);
|
||||||
return (-2);
|
return (-2);
|
||||||
}
|
}
|
||||||
if (strcmp(h.ras_magic, RAS_MAGIC) == 0)
|
if (strcmp(h.ras_magic, RAS_MAGIC) == 0) {
|
||||||
{
|
|
||||||
#ifndef WORDS_BIGENDIAN
|
#ifndef WORDS_BIGENDIAN
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_width);
|
TIFFSwabLong((uint32 *)&h.ras_width);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_height);
|
TIFFSwabLong((uint32 *)&h.ras_height);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_depth);
|
TIFFSwabLong((uint32 *)&h.ras_depth);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_length);
|
TIFFSwabLong((uint32 *)&h.ras_length);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_type);
|
TIFFSwabLong((uint32 *)&h.ras_type);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_maptype);
|
TIFFSwabLong((uint32 *)&h.ras_maptype);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_maplength);
|
TIFFSwabLong((uint32 *)&h.ras_maplength);
|
||||||
#endif
|
#endif
|
||||||
}
|
} else if (strcmp(h.ras_magic, RAS_MAGIC_INV) == 0) {
|
||||||
else if (strcmp(h.ras_magic, RAS_MAGIC_INV) == 0)
|
|
||||||
{
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_width);
|
TIFFSwabLong((uint32 *)&h.ras_width);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_height);
|
TIFFSwabLong((uint32 *)&h.ras_height);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_depth);
|
TIFFSwabLong((uint32 *)&h.ras_depth);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_length);
|
TIFFSwabLong((uint32 *)&h.ras_length);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_type);
|
TIFFSwabLong((uint32 *)&h.ras_type);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_maptype);
|
TIFFSwabLong((uint32 *)&h.ras_maptype);
|
||||||
TIFFSwabLong((uint32_t *)&h.ras_maplength);
|
TIFFSwabLong((uint32 *)&h.ras_maplength);
|
||||||
#endif
|
#endif
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(stderr, "%s: Not a rasterfile.\n", argv[optind]);
|
fprintf(stderr, "%s: Not a rasterfile.\n", argv[optind]);
|
||||||
fclose(in);
|
fclose(in);
|
||||||
return (-3);
|
return (-3);
|
||||||
}
|
}
|
||||||
if ((h.ras_width <= 0) || (h.ras_width >= INT_MAX) || (h.ras_height <= 0) ||
|
if ((h.ras_width <= 0) || (h.ras_width >= INT_MAX) ||
|
||||||
(h.ras_height >= INT_MAX) || (h.ras_depth <= 0) ||
|
(h.ras_height <= 0) || (h.ras_height >= INT_MAX) ||
|
||||||
(h.ras_depth >= INT_MAX) || (h.ras_length <= 0) ||
|
(h.ras_depth <= 0) || (h.ras_depth >= INT_MAX) ||
|
||||||
(h.ras_length >= INT_MAX) || (h.ras_type <= 0) ||
|
(h.ras_length <= 0) || (h.ras_length >= INT_MAX) ||
|
||||||
(h.ras_maptype <= 0) || (h.ras_maplength <= 0) ||
|
(h.ras_type <= 0) ||
|
||||||
(h.ras_maplength >= INT_MAX))
|
(h.ras_maptype <= 0) ||
|
||||||
{
|
(h.ras_maplength <= 0) || (h.ras_maplength >= INT_MAX)) {
|
||||||
fprintf(stderr, "%s: Improper image header.\n", argv[optind]);
|
fprintf(stderr, "%s: Improper image header.\n", argv[optind]);
|
||||||
fclose(in);
|
fclose(in);
|
||||||
return (-2);
|
return (-2);
|
||||||
}
|
}
|
||||||
if ((h.ras_depth != 1) && (h.ras_depth != 8) && (h.ras_depth != 24))
|
if ((h.ras_depth != 1) &&
|
||||||
{
|
(h.ras_depth != 8) &&
|
||||||
fprintf(stderr, "%s: Improper image depth (%d).\n", argv[optind],
|
(h.ras_depth != 24)) {
|
||||||
h.ras_depth);
|
fprintf(stderr, "%s: Improper image depth (%d).\n",
|
||||||
|
argv[optind], h.ras_depth);
|
||||||
fclose(in);
|
fclose(in);
|
||||||
return (-2);
|
return (-2);
|
||||||
}
|
}
|
||||||
|
@ -154,91 +148,73 @@ int main(int argc, char *argv[])
|
||||||
fclose(in);
|
fclose(in);
|
||||||
return (-4);
|
return (-4);
|
||||||
}
|
}
|
||||||
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32_t)h.ras_width);
|
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) h.ras_width);
|
||||||
TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32_t)h.ras_height);
|
TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) h.ras_height);
|
||||||
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
||||||
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, h.ras_depth > 8 ? 3 : 1);
|
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, h.ras_depth > 8 ? 3 : 1);
|
||||||
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, h.ras_depth > 1 ? 8 : 1);
|
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, h.ras_depth > 1 ? 8 : 1);
|
||||||
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
|
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
|
||||||
if (h.ras_maptype != RMT_NONE)
|
if (h.ras_maptype != RMT_NONE) {
|
||||||
{
|
uint16* red;
|
||||||
uint16_t *red;
|
register uint16* map;
|
||||||
register uint16_t *map;
|
|
||||||
register int i, j;
|
register int i, j;
|
||||||
int mapsize;
|
int mapsize;
|
||||||
|
|
||||||
buf = (unsigned char *)_TIFFmalloc(h.ras_maplength);
|
buf = (unsigned char *)_TIFFmalloc(h.ras_maplength);
|
||||||
if (buf == NULL)
|
if (buf == NULL) {
|
||||||
{
|
|
||||||
fprintf(stderr, "No space to read in colormap.\n");
|
fprintf(stderr, "No space to read in colormap.\n");
|
||||||
fclose(in);
|
|
||||||
(void)TIFFClose(out);
|
|
||||||
return (-5);
|
return (-5);
|
||||||
}
|
}
|
||||||
if (fread(buf, h.ras_maplength, 1, in) != 1)
|
if (fread(buf, h.ras_maplength, 1, in) != 1) {
|
||||||
{
|
fprintf(stderr, "%s: Read error on colormap.\n",
|
||||||
fprintf(stderr, "%s: Read error on colormap.\n", argv[optind]);
|
argv[optind]);
|
||||||
fclose(in);
|
|
||||||
(void)TIFFClose(out);
|
|
||||||
return (-6);
|
return (-6);
|
||||||
}
|
}
|
||||||
mapsize = 1<<h.ras_depth;
|
mapsize = 1<<h.ras_depth;
|
||||||
if (h.ras_maplength > mapsize * 3)
|
if (h.ras_maplength > mapsize*3) {
|
||||||
{
|
fprintf(stderr,
|
||||||
fprintf(stderr, "%s: Huh, %d colormap entries, should be %d?\n",
|
"%s: Huh, %d colormap entries, should be %d?\n",
|
||||||
argv[optind], h.ras_maplength, mapsize*3);
|
argv[optind], h.ras_maplength, mapsize*3);
|
||||||
fclose(in);
|
|
||||||
(void)TIFFClose(out);
|
|
||||||
return (-7);
|
return (-7);
|
||||||
}
|
}
|
||||||
red = (uint16_t *)_TIFFmalloc(mapsize * 3 * sizeof(uint16_t));
|
red = (uint16*)_TIFFmalloc(mapsize * 3 * sizeof (uint16));
|
||||||
if (red == NULL)
|
if (red == NULL) {
|
||||||
{
|
|
||||||
fprintf(stderr, "No space for colormap.\n");
|
fprintf(stderr, "No space for colormap.\n");
|
||||||
fclose(in);
|
|
||||||
(void)TIFFClose(out);
|
|
||||||
return (-8);
|
return (-8);
|
||||||
}
|
}
|
||||||
map = red;
|
map = red;
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++) {
|
||||||
{
|
|
||||||
#define SCALE(x) (((x)*((1L<<16)-1))/255)
|
#define SCALE(x) (((x)*((1L<<16)-1))/255)
|
||||||
for (i = h.ras_maplength/3; i-- > 0;)
|
for (i = h.ras_maplength/3; i-- > 0;)
|
||||||
*map++ = SCALE(*buf++);
|
*map++ = SCALE(*buf++);
|
||||||
if ((i = h.ras_maplength / 3) < mapsize)
|
if ((i = h.ras_maplength/3) < mapsize) {
|
||||||
{
|
|
||||||
i = mapsize - i;
|
i = mapsize - i;
|
||||||
_TIFFmemset(map, 0, i * sizeof(uint16_t));
|
_TIFFmemset(map, 0, i*sizeof (uint16));
|
||||||
map += i;
|
map += i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TIFFSetField(out, TIFFTAG_COLORMAP, red, red + mapsize,
|
TIFFSetField(out, TIFFTAG_COLORMAP,
|
||||||
red + 2 * mapsize);
|
red, red + mapsize, red + 2*mapsize);
|
||||||
photometric = PHOTOMETRIC_PALETTE;
|
photometric = PHOTOMETRIC_PALETTE;
|
||||||
if (compression == (uint16_t)-1)
|
if (compression == (uint16) -1)
|
||||||
compression = COMPRESSION_PACKBITS;
|
compression = COMPRESSION_PACKBITS;
|
||||||
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
|
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/* XXX this is bogus... */
|
/* XXX this is bogus... */
|
||||||
photometric =
|
photometric = h.ras_depth == 24 ?
|
||||||
h.ras_depth == 24 ? PHOTOMETRIC_RGB : PHOTOMETRIC_MINISBLACK;
|
PHOTOMETRIC_RGB : PHOTOMETRIC_MINISBLACK;
|
||||||
if (compression == (uint16_t)-1)
|
if (compression == (uint16) -1)
|
||||||
compression = COMPRESSION_LZW;
|
compression = COMPRESSION_LZW;
|
||||||
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
|
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
|
||||||
}
|
}
|
||||||
switch (compression)
|
switch (compression) {
|
||||||
{
|
|
||||||
case COMPRESSION_JPEG:
|
case COMPRESSION_JPEG:
|
||||||
if (photometric == PHOTOMETRIC_RGB &&
|
if (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)
|
||||||
jpegcolormode == JPEGCOLORMODE_RGB)
|
|
||||||
photometric = PHOTOMETRIC_YCBCR;
|
photometric = PHOTOMETRIC_YCBCR;
|
||||||
TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
|
TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
|
||||||
TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
|
TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
|
||||||
break;
|
break;
|
||||||
case COMPRESSION_LZW:
|
case COMPRESSION_LZW:
|
||||||
case COMPRESSION_ADOBE_DEFLATE:
|
|
||||||
case COMPRESSION_DEFLATE:
|
case COMPRESSION_DEFLATE:
|
||||||
if (predictor != 0)
|
if (predictor != 0)
|
||||||
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
|
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
|
||||||
|
@ -247,35 +223,24 @@ int main(int argc, char *argv[])
|
||||||
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);
|
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);
|
scanline = TIFFScanlineSize(out);
|
||||||
if (scanline > linebytes)
|
if (scanline > linebytes) {
|
||||||
{
|
|
||||||
buf = (unsigned char *)_TIFFmalloc(scanline);
|
buf = (unsigned char *)_TIFFmalloc(scanline);
|
||||||
_TIFFmemset(buf+linebytes, 0, scanline-linebytes);
|
_TIFFmemset(buf+linebytes, 0, scanline-linebytes);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
buf = (unsigned char *)_TIFFmalloc(linebytes);
|
buf = (unsigned char *)_TIFFmalloc(linebytes);
|
||||||
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
|
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
|
||||||
TIFFDefaultStripSize(out, rowsperstrip));
|
TIFFDefaultStripSize(out, rowsperstrip));
|
||||||
for (row = 0; row < h.ras_height; row++)
|
for (row = 0; row < h.ras_height; row++) {
|
||||||
{
|
if (fread(buf, linebytes, 1, in) != 1) {
|
||||||
if (fread(buf, linebytes, 1, in) != 1)
|
fprintf(stderr, "%s: scanline %ld: Read error.\n",
|
||||||
{
|
argv[optind], row);
|
||||||
fprintf(stderr, "%s: scanline %ld: Read error.\n", argv[optind],
|
|
||||||
row);
|
|
||||||
break;
|
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;
|
tsize_t cc = h.ras_width;
|
||||||
unsigned char* cp = buf;
|
unsigned char* cp = buf;
|
||||||
#define SWAP(a, b) \
|
#define SWAP(a,b) { unsigned char t = (a); (a) = (b); (b) = t; }
|
||||||
{ \
|
do {
|
||||||
unsigned char t = (a); \
|
|
||||||
(a) = (b); \
|
|
||||||
(b) = t; \
|
|
||||||
}
|
|
||||||
do
|
|
||||||
{
|
|
||||||
SWAP(cp[0], cp[2]);
|
SWAP(cp[0], cp[2]);
|
||||||
cp += 3;
|
cp += 3;
|
||||||
} while (--cc);
|
} while (--cc);
|
||||||
|
@ -288,14 +253,14 @@ int main(int argc, char *argv[])
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int processCompressOptions(char *opt)
|
static int
|
||||||
|
processCompressOptions(char* opt)
|
||||||
{
|
{
|
||||||
if (streq(opt, "none"))
|
if (streq(opt, "none"))
|
||||||
compression = COMPRESSION_NONE;
|
compression = COMPRESSION_NONE;
|
||||||
else if (streq(opt, "packbits"))
|
else if (streq(opt, "packbits"))
|
||||||
compression = COMPRESSION_PACKBITS;
|
compression = COMPRESSION_PACKBITS;
|
||||||
else if (strneq(opt, "jpeg", 4))
|
else if (strneq(opt, "jpeg", 4)) {
|
||||||
{
|
|
||||||
char* cp = strchr(opt, ':');
|
char* cp = strchr(opt, ':');
|
||||||
|
|
||||||
compression = COMPRESSION_JPEG;
|
compression = COMPRESSION_JPEG;
|
||||||
|
@ -310,22 +275,17 @@ static int processCompressOptions(char *opt)
|
||||||
|
|
||||||
cp = strchr(cp+1,':');
|
cp = strchr(cp+1,':');
|
||||||
}
|
}
|
||||||
}
|
} else if (strneq(opt, "lzw", 3)) {
|
||||||
else if (strneq(opt, "lzw", 3))
|
|
||||||
{
|
|
||||||
char* cp = strchr(opt, ':');
|
char* cp = strchr(opt, ':');
|
||||||
if (cp)
|
if (cp)
|
||||||
predictor = atoi(cp+1);
|
predictor = atoi(cp+1);
|
||||||
compression = COMPRESSION_LZW;
|
compression = COMPRESSION_LZW;
|
||||||
}
|
} else if (strneq(opt, "zip", 3)) {
|
||||||
else if (strneq(opt, "zip", 3))
|
|
||||||
{
|
|
||||||
char* cp = strchr(opt, ':');
|
char* cp = strchr(opt, ':');
|
||||||
if (cp)
|
if (cp)
|
||||||
predictor = atoi(cp+1);
|
predictor = atoi(cp+1);
|
||||||
compression = COMPRESSION_ADOBE_DEFLATE;
|
compression = COMPRESSION_DEFLATE;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return (0);
|
return (0);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -344,17 +304,17 @@ char *stuff[] = {
|
||||||
"JPEG options:",
|
"JPEG options:",
|
||||||
" # set compression quality level (0-100, default 75)",
|
" # set compression quality level (0-100, default 75)",
|
||||||
" r output color image as RGB rather than YCbCr",
|
" r output color image as RGB rather than YCbCr",
|
||||||
"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. "
|
"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
|
||||||
"quality",
|
|
||||||
"",
|
"",
|
||||||
"LZW and deflate options:",
|
"LZW and deflate options:",
|
||||||
" # set predictor value",
|
" # set predictor value",
|
||||||
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
|
"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
|
||||||
"differencing",
|
|
||||||
" -h this help message",
|
" -h this help message",
|
||||||
NULL};
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static void usage(void)
|
static void
|
||||||
|
usage(void)
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
int i;
|
int i;
|
||||||
|
@ -365,3 +325,12 @@ static void usage(void)
|
||||||
fprintf(stderr, "%s\n", stuff[i]);
|
fprintf(stderr, "%s\n", stuff[i]);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* mode: c
|
||||||
|
* c-basic-offset: 8
|
||||||
|
* fill-column: 78
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|
|
@ -3,16 +3,15 @@
|
||||||
/*
|
/*
|
||||||
* Description of header for files containing raster images
|
* Description of header for files containing raster images
|
||||||
*/
|
*/
|
||||||
struct rasterfile
|
struct rasterfile {
|
||||||
{
|
|
||||||
char ras_magic[4]; /* magic number */
|
char ras_magic[4]; /* magic number */
|
||||||
int32_t ras_width; /* width (pixels) of image */
|
int32 ras_width; /* width (pixels) of image */
|
||||||
int32_t ras_height; /* height (pixels) of image */
|
int32 ras_height; /* height (pixels) of image */
|
||||||
int32_t ras_depth; /* depth (1, 8, or 24 bits) of pixel */
|
int32 ras_depth; /* depth (1, 8, or 24 bits) of pixel */
|
||||||
int32_t ras_length; /* length (bytes) of image */
|
int32 ras_length; /* length (bytes) of image */
|
||||||
int32_t ras_type; /* type of file; see RT_* below */
|
int32 ras_type; /* type of file; see RT_* below */
|
||||||
int32_t ras_maptype; /* type of colormap; see RMT_* below */
|
int32 ras_maptype; /* type of colormap; see RMT_* below */
|
||||||
int32_t ras_maplength; /* length (bytes) of following map */
|
int32 ras_maplength; /* length (bytes) of following map */
|
||||||
/* color map follows for ras_maplength bytes, followed by image */
|
/* color map follows for ras_maplength bytes, followed by image */
|
||||||
};
|
};
|
||||||
#define RAS_MAGIC "\x59\xa6\x6a\x95"
|
#define RAS_MAGIC "\x59\xa6\x6a\x95"
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <gl/image.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <gl/image.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "tiffio.h"
|
#include "tiffio.h"
|
||||||
|
|
||||||
|
@ -34,13 +34,13 @@
|
||||||
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
|
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
|
||||||
|
|
||||||
static short config = PLANARCONFIG_CONTIG;
|
static short config = PLANARCONFIG_CONTIG;
|
||||||
static uint16_t compression = COMPRESSION_PACKBITS;
|
static uint16 compression = COMPRESSION_PACKBITS;
|
||||||
static uint16_t predictor = 0;
|
static uint16 predictor = 0;
|
||||||
static uint16_t fillorder = 0;
|
static uint16 fillorder = 0;
|
||||||
static uint32_t rowsperstrip = (uint32_t)-1;
|
static uint32 rowsperstrip = (uint32) -1;
|
||||||
static int jpegcolormode = JPEGCOLORMODE_RGB;
|
static int jpegcolormode = JPEGCOLORMODE_RGB;
|
||||||
static int quality = 75; /* JPEG quality */
|
static int quality = 75; /* JPEG quality */
|
||||||
static uint16_t photometric;
|
static uint16 photometric;
|
||||||
|
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
static int cpContig(IMAGE*, TIFF*);
|
static int cpContig(IMAGE*, TIFF*);
|
||||||
|
@ -52,7 +52,8 @@ extern IMAGE *iopen(const char *, const char *);
|
||||||
extern void iclose(IMAGE*);
|
extern void iclose(IMAGE*);
|
||||||
extern void getrow(IMAGE*, short*, int, int);
|
extern void getrow(IMAGE*, short*, int, int);
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
IMAGE *in;
|
IMAGE *in;
|
||||||
TIFF *out;
|
TIFF *out;
|
||||||
|
@ -63,8 +64,7 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "c:p:r:")) != -1)
|
while ((c = getopt(argc, argv, "c:p:r:")) != -1)
|
||||||
switch (c)
|
switch (c) {
|
||||||
{
|
|
||||||
case 'c': /* compression scheme */
|
case 'c': /* compression scheme */
|
||||||
if (!processCompressOptions(optarg))
|
if (!processCompressOptions(optarg))
|
||||||
usage();
|
usage();
|
||||||
|
@ -100,25 +100,22 @@ int main(int argc, char *argv[])
|
||||||
out = TIFFOpen(argv[optind+1], "w");
|
out = TIFFOpen(argv[optind+1], "w");
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
return (-2);
|
return (-2);
|
||||||
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32_t)in->xsize);
|
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) in->xsize);
|
||||||
TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32_t)in->ysize);
|
TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) in->ysize);
|
||||||
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
|
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
|
||||||
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
|
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
|
||||||
if (in->zsize == 1)
|
if (in->zsize == 1)
|
||||||
photometric = PHOTOMETRIC_MINISBLACK;
|
photometric = PHOTOMETRIC_MINISBLACK;
|
||||||
else
|
else
|
||||||
photometric = PHOTOMETRIC_RGB;
|
photometric = PHOTOMETRIC_RGB;
|
||||||
switch (compression)
|
switch (compression) {
|
||||||
{
|
|
||||||
case COMPRESSION_JPEG:
|
case COMPRESSION_JPEG:
|
||||||
if (photometric == PHOTOMETRIC_RGB &&
|
if (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)
|
||||||
jpegcolormode == JPEGCOLORMODE_RGB)
|
|
||||||
photometric = PHOTOMETRIC_YCBCR;
|
photometric = PHOTOMETRIC_YCBCR;
|
||||||
TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
|
TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
|
||||||
TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
|
TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
|
||||||
break;
|
break;
|
||||||
case COMPRESSION_LZW:
|
case COMPRESSION_LZW:
|
||||||
case COMPRESSION_ADOBE_DEFLATE:
|
|
||||||
case COMPRESSION_DEFLATE:
|
case COMPRESSION_DEFLATE:
|
||||||
if (predictor != 0)
|
if (predictor != 0)
|
||||||
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
|
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
|
||||||
|
@ -129,14 +126,13 @@ int main(int argc, char *argv[])
|
||||||
TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
|
TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
|
||||||
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
||||||
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, in->zsize);
|
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, in->zsize);
|
||||||
if (in->zsize > 3)
|
if (in->zsize > 3) {
|
||||||
{
|
uint16 v[1];
|
||||||
uint16_t v[1];
|
|
||||||
v[0] = EXTRASAMPLE_UNASSALPHA;
|
v[0] = EXTRASAMPLE_UNASSALPHA;
|
||||||
TIFFSetField(out, TIFFTAG_EXTRASAMPLES, 1, v);
|
TIFFSetField(out, TIFFTAG_EXTRASAMPLES, 1, v);
|
||||||
}
|
}
|
||||||
TIFFSetField(out, TIFFTAG_MINSAMPLEVALUE, (uint16_t)in->min);
|
TIFFSetField(out, TIFFTAG_MINSAMPLEVALUE, (uint16) in->min);
|
||||||
TIFFSetField(out, TIFFTAG_MAXSAMPLEVALUE, (uint16_t)in->max);
|
TIFFSetField(out, TIFFTAG_MAXSAMPLEVALUE, (uint16) in->max);
|
||||||
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
|
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
|
||||||
if (config != PLANARCONFIG_SEPARATE)
|
if (config != PLANARCONFIG_SEPARATE)
|
||||||
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
|
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
|
||||||
|
@ -154,14 +150,14 @@ int main(int argc, char *argv[])
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int processCompressOptions(char *opt)
|
static int
|
||||||
|
processCompressOptions(char* opt)
|
||||||
{
|
{
|
||||||
if (streq(opt, "none"))
|
if (streq(opt, "none"))
|
||||||
compression = COMPRESSION_NONE;
|
compression = COMPRESSION_NONE;
|
||||||
else if (streq(opt, "packbits"))
|
else if (streq(opt, "packbits"))
|
||||||
compression = COMPRESSION_PACKBITS;
|
compression = COMPRESSION_PACKBITS;
|
||||||
else if (strneq(opt, "jpeg", 4))
|
else if (strneq(opt, "jpeg", 4)) {
|
||||||
{
|
|
||||||
char* cp = strchr(opt, ':');
|
char* cp = strchr(opt, ':');
|
||||||
|
|
||||||
defcompression = COMPRESSION_JPEG;
|
defcompression = COMPRESSION_JPEG;
|
||||||
|
@ -176,48 +172,41 @@ static int processCompressOptions(char *opt)
|
||||||
|
|
||||||
cp = strchr(cp+1,':');
|
cp = strchr(cp+1,':');
|
||||||
}
|
}
|
||||||
}
|
} else if (strneq(opt, "lzw", 3)) {
|
||||||
else if (strneq(opt, "lzw", 3))
|
|
||||||
{
|
|
||||||
char* cp = strchr(opt, ':');
|
char* cp = strchr(opt, ':');
|
||||||
if (cp)
|
if (cp)
|
||||||
predictor = atoi(cp+1);
|
predictor = atoi(cp+1);
|
||||||
compression = COMPRESSION_LZW;
|
compression = COMPRESSION_LZW;
|
||||||
}
|
} else if (strneq(opt, "zip", 3)) {
|
||||||
else if (strneq(opt, "zip", 3))
|
|
||||||
{
|
|
||||||
char* cp = strchr(opt, ':');
|
char* cp = strchr(opt, ':');
|
||||||
if (cp)
|
if (cp)
|
||||||
predictor = atoi(cp+1);
|
predictor = atoi(cp+1);
|
||||||
compression = COMPRESSION_ADOBE_DEFLATE;
|
compression = COMPRESSION_DEFLATE;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return (0);
|
return (0);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cpContig(IMAGE *in, TIFF *out)
|
static int
|
||||||
|
cpContig(IMAGE* in, TIFF* out)
|
||||||
{
|
{
|
||||||
tdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));
|
tdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));
|
||||||
short *r = NULL;
|
short *r = NULL;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (in->zsize == 3)
|
if (in->zsize == 3) {
|
||||||
{
|
|
||||||
short *g, *b;
|
short *g, *b;
|
||||||
|
|
||||||
r = (short *)_TIFFmalloc(3 * in->xsize * sizeof (short));
|
r = (short *)_TIFFmalloc(3 * in->xsize * sizeof (short));
|
||||||
g = r + in->xsize;
|
g = r + in->xsize;
|
||||||
b = g + in->xsize;
|
b = g + in->xsize;
|
||||||
for (y = in->ysize - 1; y >= 0; y--)
|
for (y = in->ysize-1; y >= 0; y--) {
|
||||||
{
|
uint8* pp = (uint8*) buf;
|
||||||
uint8_t *pp = (uint8_t *)buf;
|
|
||||||
|
|
||||||
getrow(in, r, y, 0);
|
getrow(in, r, y, 0);
|
||||||
getrow(in, g, y, 1);
|
getrow(in, g, y, 1);
|
||||||
getrow(in, b, y, 2);
|
getrow(in, b, y, 2);
|
||||||
for (x = 0; x < in->xsize; x++)
|
for (x = 0; x < in->xsize; x++) {
|
||||||
{
|
|
||||||
pp[0] = r[x];
|
pp[0] = r[x];
|
||||||
pp[1] = g[x];
|
pp[1] = g[x];
|
||||||
pp[2] = b[x];
|
pp[2] = b[x];
|
||||||
|
@ -226,25 +215,21 @@ static int cpContig(IMAGE *in, TIFF *out)
|
||||||
if (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)
|
if (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
}
|
} else if (in->zsize == 4) {
|
||||||
else if (in->zsize == 4)
|
|
||||||
{
|
|
||||||
short *g, *b, *a;
|
short *g, *b, *a;
|
||||||
|
|
||||||
r = (short *)_TIFFmalloc(4 * in->xsize * sizeof (short));
|
r = (short *)_TIFFmalloc(4 * in->xsize * sizeof (short));
|
||||||
g = r + in->xsize;
|
g = r + in->xsize;
|
||||||
b = g + in->xsize;
|
b = g + in->xsize;
|
||||||
a = b + in->xsize;
|
a = b + in->xsize;
|
||||||
for (y = in->ysize - 1; y >= 0; y--)
|
for (y = in->ysize-1; y >= 0; y--) {
|
||||||
{
|
uint8* pp = (uint8*) buf;
|
||||||
uint8_t *pp = (uint8_t *)buf;
|
|
||||||
|
|
||||||
getrow(in, r, y, 0);
|
getrow(in, r, y, 0);
|
||||||
getrow(in, g, y, 1);
|
getrow(in, g, y, 1);
|
||||||
getrow(in, b, y, 2);
|
getrow(in, b, y, 2);
|
||||||
getrow(in, a, y, 3);
|
getrow(in, a, y, 3);
|
||||||
for (x = 0; x < in->xsize; x++)
|
for (x = 0; x < in->xsize; x++) {
|
||||||
{
|
|
||||||
pp[0] = r[x];
|
pp[0] = r[x];
|
||||||
pp[1] = g[x];
|
pp[1] = g[x];
|
||||||
pp[2] = b[x];
|
pp[2] = b[x];
|
||||||
|
@ -254,14 +239,11 @@ static int cpContig(IMAGE *in, TIFF *out)
|
||||||
if (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)
|
if (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
uint8* pp = (uint8*) buf;
|
||||||
{
|
|
||||||
uint8_t *pp = (uint8_t *)buf;
|
|
||||||
|
|
||||||
r = (short *)_TIFFmalloc(in->xsize * sizeof (short));
|
r = (short *)_TIFFmalloc(in->xsize * sizeof (short));
|
||||||
for (y = in->ysize - 1; y >= 0; y--)
|
for (y = in->ysize-1; y >= 0; y--) {
|
||||||
{
|
|
||||||
getrow(in, r, y, 0);
|
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];
|
pp[x] = r[x];
|
||||||
|
@ -280,17 +262,16 @@ bad:
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cpSeparate(IMAGE *in, TIFF *out)
|
static int
|
||||||
|
cpSeparate(IMAGE* in, TIFF* out)
|
||||||
{
|
{
|
||||||
tdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));
|
tdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));
|
||||||
short *r = (short *)_TIFFmalloc(in->xsize * sizeof (short));
|
short *r = (short *)_TIFFmalloc(in->xsize * sizeof (short));
|
||||||
uint8_t *pp = (uint8_t *)buf;
|
uint8* pp = (uint8*) buf;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
|
|
||||||
for (z = 0; z < in->zsize; z++)
|
for (z = 0; z < in->zsize; z++) {
|
||||||
{
|
for (y = in->ysize-1; y >= 0; y--) {
|
||||||
for (y = in->ysize - 1; y >= 0; y--)
|
|
||||||
{
|
|
||||||
getrow(in, r, y, z);
|
getrow(in, r, y, z);
|
||||||
for (x = 0; x < in->xsize; x++)
|
for (x = 0; x < in->xsize; x++)
|
||||||
pp[x] = r[x];
|
pp[x] = r[x];
|
||||||
|
@ -330,11 +311,12 @@ char *stuff[] = {
|
||||||
"",
|
"",
|
||||||
"LZW and deflate options:",
|
"LZW and deflate options:",
|
||||||
" # set predictor value",
|
" # set predictor value",
|
||||||
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
|
"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
|
||||||
"differencing",
|
NULL
|
||||||
NULL};
|
};
|
||||||
|
|
||||||
static void usage(void)
|
static void
|
||||||
|
usage(void)
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
int i;
|
int i;
|
||||||
|
@ -344,3 +326,10 @@ static void usage(void)
|
||||||
fprintf(stderr, "%s\n", stuff[i]);
|
fprintf(stderr, "%s\n", stuff[i]);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* mode: c
|
||||||
|
* c-basic-offset: 8
|
||||||
|
* fill-column: 78
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|
|
@ -26,31 +26,32 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <gl.h>
|
#include <gl.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "tiffio.h"
|
#include "tiffio.h"
|
||||||
|
|
||||||
typedef unsigned char unsigned char;
|
typedef unsigned char unsigned char;
|
||||||
typedef unsigned long uint32_t;
|
typedef unsigned long uint32;
|
||||||
|
|
||||||
#define streq(a,b) (strcmp(a,b) == 0)
|
#define streq(a,b) (strcmp(a,b) == 0)
|
||||||
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
|
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
|
||||||
|
|
||||||
uint32_t rowsperstrip = (uint32_t)-1;
|
uint32 rowsperstrip = (uint32) -1;
|
||||||
uint16_t compression = COMPRESSION_PACKBITS;
|
uint16 compression = COMPRESSION_PACKBITS;
|
||||||
uint16_t config = PLANARCONFIG_CONTIG;
|
uint16 config = PLANARCONFIG_CONTIG;
|
||||||
uint16_t predictor = 0;
|
uint16 predictor = 0;
|
||||||
int xmaxscreen;
|
int xmaxscreen;
|
||||||
int ymaxscreen;
|
int ymaxscreen;
|
||||||
uint16_t photometric = PHOTOMETRIC_RGB;
|
uint16 photometric = PHOTOMETRIC_RGB;
|
||||||
int jpegcolormode = JPEGCOLORMODE_RGB;
|
int jpegcolormode = JPEGCOLORMODE_RGB;
|
||||||
int quality = 75; /* JPEG quality */
|
int quality = 75; /* JPEG quality */
|
||||||
|
|
||||||
static void usage(void);
|
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;
|
int c;
|
||||||
#if !HAVE_DECL_OPTARG
|
#if !HAVE_DECL_OPTARG
|
||||||
|
@ -59,8 +60,7 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "c:p:r:")) != -1)
|
while ((c = getopt(argc, argv, "c:p:r:")) != -1)
|
||||||
switch (c)
|
switch (c) {
|
||||||
{
|
|
||||||
case 'b': /* save as b&w */
|
case 'b': /* save as b&w */
|
||||||
photometric = PHOTOMETRIC_MINISBLACK;
|
photometric = PHOTOMETRIC_MINISBLACK;
|
||||||
break;
|
break;
|
||||||
|
@ -69,23 +69,19 @@ int main(int argc, char *argv[])
|
||||||
compression = COMPRESSION_NONE;
|
compression = COMPRESSION_NONE;
|
||||||
else if (streq(optarg, "packbits"))
|
else if (streq(optarg, "packbits"))
|
||||||
compression = COMPRESSION_PACKBITS;
|
compression = COMPRESSION_PACKBITS;
|
||||||
else if (strneq(optarg, "jpeg", 4))
|
else if (strneq(optarg, "jpeg", 4)) {
|
||||||
{
|
|
||||||
char* cp = strchr(optarg, ':');
|
char* cp = strchr(optarg, ':');
|
||||||
if (cp && isdigit(cp[1]))
|
if (cp && isdigit(cp[1]))
|
||||||
quality = atoi(cp+1);
|
quality = atoi(cp+1);
|
||||||
if (cp && strchr(cp, 'r'))
|
if (cp && strchr(cp, 'r'))
|
||||||
jpegcolormode = JPEGCOLORMODE_RAW;
|
jpegcolormode = JPEGCOLORMODE_RAW;
|
||||||
compression = COMPRESSION_JPEG;
|
compression = COMPRESSION_JPEG;
|
||||||
}
|
} else if (strneq(optarg, "lzw", 3)) {
|
||||||
else if (strneq(optarg, "lzw", 3))
|
|
||||||
{
|
|
||||||
char* cp = strchr(optarg, ':');
|
char* cp = strchr(optarg, ':');
|
||||||
if (cp)
|
if (cp)
|
||||||
predictor = atoi(cp+1);
|
predictor = atoi(cp+1);
|
||||||
compression = COMPRESSION_LZW;
|
compression = COMPRESSION_LZW;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
usage();
|
usage();
|
||||||
break;
|
break;
|
||||||
case 'p': /* planar configuration */
|
case 'p': /* planar configuration */
|
||||||
|
@ -111,7 +107,8 @@ int main(int argc, char *argv[])
|
||||||
noport();
|
noport();
|
||||||
winopen("tiffsv");
|
winopen("tiffsv");
|
||||||
if (argc - optind == 5)
|
if (argc - optind == 5)
|
||||||
tiffsv(argv[optind], atoi(argv[optind + 1]), atoi(argv[optind + 2]),
|
tiffsv(argv[optind],
|
||||||
|
atoi(argv[optind+1]), atoi(argv[optind+2]),
|
||||||
atoi(argv[optind+3]), atoi(argv[optind+4]));
|
atoi(argv[optind+3]), atoi(argv[optind+4]));
|
||||||
else
|
else
|
||||||
tiffsv(argv[optind], 0, xmaxscreen, 0, ymaxscreen);
|
tiffsv(argv[optind], 0, xmaxscreen, 0, ymaxscreen);
|
||||||
|
@ -137,11 +134,12 @@ char *stuff[] = {
|
||||||
"",
|
"",
|
||||||
"LZW options:",
|
"LZW options:",
|
||||||
" # set predictor value for Lempel-Ziv & Welch encoding",
|
" # set predictor value for Lempel-Ziv & Welch encoding",
|
||||||
"For example, -c lzw:2 to get LZW-encoded data with horizontal "
|
"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
|
||||||
"differencing",
|
NULL
|
||||||
NULL};
|
};
|
||||||
|
|
||||||
static void usage(void)
|
static void
|
||||||
|
usage(void)
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
int i;
|
int i;
|
||||||
|
@ -152,7 +150,8 @@ static void usage(void)
|
||||||
exit(-1);
|
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);
|
tsize_t stripsize = TIFFStripSize(tif);
|
||||||
unsigned char *rbuf = (unsigned char *)_TIFFmalloc(3*stripsize);
|
unsigned char *rbuf = (unsigned char *)_TIFFmalloc(3*stripsize);
|
||||||
|
@ -160,23 +159,18 @@ static void svRGBSeparate(TIFF *tif, uint32_t *ss, int xsize, int ysize)
|
||||||
unsigned char *bbuf = gbuf + stripsize;
|
unsigned char *bbuf = gbuf + stripsize;
|
||||||
register int y;
|
register int y;
|
||||||
|
|
||||||
for (y = 0; y <= ysize; y += rowsperstrip)
|
for (y = 0; y <= ysize; y += rowsperstrip) {
|
||||||
{
|
|
||||||
unsigned char *rp, *gp, *bp;
|
unsigned char *rp, *gp, *bp;
|
||||||
register int x;
|
register int x;
|
||||||
register uint32_t n;
|
register uint32 n;
|
||||||
|
|
||||||
n = rowsperstrip;
|
n = rowsperstrip;
|
||||||
if (n > ysize-y+1)
|
if (n > ysize-y+1)
|
||||||
n = ysize-y+1;
|
n = ysize-y+1;
|
||||||
rp = rbuf;
|
rp = rbuf; gp = gbuf; bp = bbuf;
|
||||||
gp = gbuf;
|
do {
|
||||||
bp = bbuf;
|
for (x = 0; x <= xsize; x++) {
|
||||||
do
|
uint32 v = ss[x];
|
||||||
{
|
|
||||||
for (x = 0; x <= xsize; x++)
|
|
||||||
{
|
|
||||||
uint32_t v = ss[x];
|
|
||||||
rp[x] = v;
|
rp[x] = v;
|
||||||
gp[x] = v >> 8;
|
gp[x] = v >> 8;
|
||||||
bp[x] = v >> 16;
|
bp[x] = v >> 16;
|
||||||
|
@ -184,38 +178,36 @@ static void svRGBSeparate(TIFF *tif, uint32_t *ss, int xsize, int ysize)
|
||||||
rp += xsize+1, gp += xsize+1, bp += xsize+1;
|
rp += xsize+1, gp += xsize+1, bp += xsize+1;
|
||||||
ss += xsize+1;
|
ss += xsize+1;
|
||||||
} while (--n);
|
} while (--n);
|
||||||
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 0), rbuf,
|
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,0),
|
||||||
stripsize) < 0)
|
rbuf, stripsize) < 0)
|
||||||
break;
|
break;
|
||||||
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 1), gbuf,
|
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,1),
|
||||||
stripsize) < 0)
|
gbuf, stripsize) < 0)
|
||||||
break;
|
break;
|
||||||
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 2), bbuf,
|
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,2),
|
||||||
stripsize) < 0)
|
bbuf, stripsize) < 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_TIFFfree(rbuf);
|
_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;
|
register int x, y;
|
||||||
tsize_t stripsize = TIFFStripSize(tif);
|
tsize_t stripsize = TIFFStripSize(tif);
|
||||||
unsigned char *strip = (unsigned char *)_TIFFmalloc(stripsize);
|
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 unsigned char *pp = strip;
|
||||||
register uint32_t n;
|
register uint32 n;
|
||||||
|
|
||||||
n = rowsperstrip;
|
n = rowsperstrip;
|
||||||
if (n > ysize-y+1)
|
if (n > ysize-y+1)
|
||||||
n = ysize-y+1;
|
n = ysize-y+1;
|
||||||
do
|
do {
|
||||||
{
|
for (x = 0; x <= xsize; x++) {
|
||||||
for (x = 0; x <= xsize; x++)
|
uint32 v = ss[x];
|
||||||
{
|
|
||||||
uint32_t v = ss[x];
|
|
||||||
pp[0] = v;
|
pp[0] = v;
|
||||||
pp[1] = v >> 8;
|
pp[1] = v >> 8;
|
||||||
pp[2] = v >> 16;
|
pp[2] = v >> 16;
|
||||||
|
@ -223,8 +215,8 @@ static void svRGBContig(TIFF *tif, uint32_t *ss, int xsize, int ysize)
|
||||||
}
|
}
|
||||||
ss += xsize+1;
|
ss += xsize+1;
|
||||||
} while (--n);
|
} while (--n);
|
||||||
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif, y, 0), strip,
|
if (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,0),
|
||||||
stripsize) < 0)
|
strip, stripsize) < 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_TIFFfree(strip);
|
_TIFFfree(strip);
|
||||||
|
@ -238,19 +230,18 @@ static void svRGBContig(TIFF *tif, uint32_t *ss, int xsize, int ysize)
|
||||||
#define GREEN CVT(59) /* 59% */
|
#define GREEN CVT(59) /* 59% */
|
||||||
#define BLUE CVT(11) /* 11% */
|
#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;
|
register int x, y;
|
||||||
unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif));
|
unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif));
|
||||||
|
|
||||||
for (y = 0; y <= ysize; y++)
|
for (y = 0; y <= ysize; y++) {
|
||||||
{
|
for (x = 0; x <= xsize; x++) {
|
||||||
for (x = 0; x <= xsize; x++)
|
|
||||||
{
|
|
||||||
unsigned char *cp = (unsigned char *)&ss[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;
|
break;
|
||||||
ss += xsize+1;
|
ss += xsize+1;
|
||||||
}
|
}
|
||||||
|
@ -260,12 +251,13 @@ static void svGrey(TIFF *tif, uint32_t *ss, int xsize, int ysize)
|
||||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||||
#define ABS(x) ((x)<0?-(x):(x))
|
#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;
|
TIFF *tif;
|
||||||
int xsize, ysize;
|
int xsize, ysize;
|
||||||
int xorg, yorg;
|
int xorg, yorg;
|
||||||
uint32_t *scrbuf;
|
uint32 *scrbuf;
|
||||||
|
|
||||||
xorg = MIN(x1,x2);
|
xorg = MIN(x1,x2);
|
||||||
yorg = MIN(y1,y2);
|
yorg = MIN(y1,y2);
|
||||||
|
@ -280,18 +272,16 @@ static void tiffsv(char *name, int x1, int x2, int y1, int y2)
|
||||||
if (yorg+ysize > ymaxscreen)
|
if (yorg+ysize > ymaxscreen)
|
||||||
ysize = ymaxscreen-yorg;
|
ysize = ymaxscreen-yorg;
|
||||||
tif = TIFFOpen(name, "w");
|
tif = TIFFOpen(name, "w");
|
||||||
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32_t)(xsize + 1));
|
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) (xsize+1));
|
||||||
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32_t)(ysize + 1));
|
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32) (ysize+1));
|
||||||
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
|
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
|
||||||
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL,
|
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL,
|
||||||
photometric == PHOTOMETRIC_RGB ? 3 : 1);
|
photometric == PHOTOMETRIC_RGB ? 3 : 1);
|
||||||
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, config);
|
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, config);
|
||||||
TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);
|
TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);
|
||||||
switch (compression)
|
switch (compression) {
|
||||||
{
|
|
||||||
case COMPRESSION_JPEG:
|
case COMPRESSION_JPEG:
|
||||||
if (photometric == PHOTOMETRIC_RGB &&
|
if (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)
|
||||||
jpegcolormode == JPEGCOLORMODE_RGB)
|
|
||||||
photometric = PHOTOMETRIC_YCBCR;
|
photometric = PHOTOMETRIC_YCBCR;
|
||||||
TIFFSetField(tif, TIFFTAG_JPEGQUALITY, quality);
|
TIFFSetField(tif, TIFFTAG_JPEGQUALITY, quality);
|
||||||
TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
|
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);
|
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_BOTLEFT);
|
||||||
rowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip);
|
rowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip);
|
||||||
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
|
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
|
||||||
scrbuf =
|
scrbuf = (uint32 *)_TIFFmalloc((xsize+1)*(ysize+1)*sizeof (uint32));
|
||||||
(uint32_t *)_TIFFmalloc((xsize + 1) * (ysize + 1) * sizeof(uint32_t));
|
|
||||||
readdisplay(xorg, yorg, xorg+xsize, yorg+ysize, scrbuf, RD_FREEZE);
|
readdisplay(xorg, yorg, xorg+xsize, yorg+ysize, scrbuf, RD_FREEZE);
|
||||||
if (photometric == PHOTOMETRIC_RGB)
|
if (photometric == PHOTOMETRIC_RGB) {
|
||||||
{
|
|
||||||
if (config == PLANARCONFIG_SEPARATE)
|
if (config == PLANARCONFIG_SEPARATE)
|
||||||
svRGBSeparate(tif, scrbuf, xsize, ysize);
|
svRGBSeparate(tif, scrbuf, xsize, ysize);
|
||||||
else
|
else
|
||||||
svRGBContig(tif, scrbuf, xsize, ysize);
|
svRGBContig(tif, scrbuf, xsize, ysize);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
svGrey(tif, scrbuf, xsize, ysize);
|
svGrey(tif, scrbuf, xsize, ysize);
|
||||||
(void) TIFFClose(tif);
|
(void) TIFFClose(tif);
|
||||||
_TIFFfree((char *)scrbuf);
|
_TIFFfree((char *)scrbuf);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* mode: c
|
||||||
|
* c-basic-offset: 8
|
||||||
|
* fill-column: 78
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|
|
@ -29,12 +29,12 @@ float D1, D2;
|
||||||
float D3, D4;
|
float D3, D4;
|
||||||
float D5, D6;
|
float D5, D6;
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int R, G, B;
|
int R, G, B;
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1) {
|
||||||
{
|
|
||||||
refBlackWhite[0] = 16;
|
refBlackWhite[0] = 16;
|
||||||
refBlackWhite[1] = 235;
|
refBlackWhite[1] = 235;
|
||||||
refBlackWhite[2] = 128;
|
refBlackWhite[2] = 128;
|
||||||
|
@ -49,16 +49,18 @@ int main(int argc, char **argv)
|
||||||
D5 = D3*LumaRed / LumaGreen;
|
D5 = D3*LumaRed / LumaGreen;
|
||||||
D6 = D4*LumaBlue / LumaGreen;
|
D6 = D4*LumaBlue / LumaGreen;
|
||||||
setupLumaTables();
|
setupLumaTables();
|
||||||
for (R = 0; R < 256; R++)
|
for (R = 0; R < 256; R++) {
|
||||||
{
|
|
||||||
for (G = 0; G < 256; G++)
|
for (G = 0; G < 256; G++)
|
||||||
for (B = 0; B < 256; B++)
|
for (B = 0; B < 256; B++)
|
||||||
check(R, G, 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,
|
printf("[%3u] c %u/%u b %u/%u (R %u/%d/%u G %u/%d/%u B %u/%d/%u)\n"
|
||||||
eCodes - preveCodes, eCodes, eBits - preveBits, eBits,
|
, R
|
||||||
abs(AbseRtotal - preveRtotal), eRtotal, AbseRtotal,
|
, eCodes - preveCodes, eCodes
|
||||||
abs(AbseGtotal - preveGtotal), eGtotal, AbseGtotal,
|
, eBits - preveBits, eBits
|
||||||
abs(AbseBtotal - preveBtotal), eBtotal, AbseBtotal);
|
, abs(AbseRtotal - preveRtotal), eRtotal , AbseRtotal
|
||||||
|
, abs(AbseGtotal - preveGtotal), eGtotal , AbseGtotal
|
||||||
|
, abs(AbseBtotal - preveBtotal), eBtotal , AbseBtotal
|
||||||
|
);
|
||||||
preveRtotal = AbseRtotal;
|
preveRtotal = AbseRtotal;
|
||||||
preveGtotal = AbseGtotal;
|
preveGtotal = AbseGtotal;
|
||||||
preveBtotal = AbseBtotal;
|
preveBtotal = AbseBtotal;
|
||||||
|
@ -66,9 +68,13 @@ int main(int argc, char **argv)
|
||||||
preveBits = eBits;
|
preveBits = eBits;
|
||||||
}
|
}
|
||||||
printf("%u total codes\n", 256*256*256);
|
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,
|
printf("total error: %u codes %u bits (R %d/%u G %d/%u B %d/%u)\n"
|
||||||
eBits, eRtotal, AbseRtotal, eGtotal, AbseGtotal, eBtotal,
|
, eCodes
|
||||||
AbseBtotal);
|
, eBits
|
||||||
|
, eRtotal , AbseRtotal
|
||||||
|
, eGtotal , AbseGtotal
|
||||||
|
, eBtotal , AbseBtotal
|
||||||
|
);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +82,8 @@ float *lumaRed;
|
||||||
float *lumaGreen;
|
float *lumaGreen;
|
||||||
float *lumaBlue;
|
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;
|
int i;
|
||||||
|
@ -85,14 +92,16 @@ static float *setupLuma(float c)
|
||||||
return (v);
|
return (v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setupLumaTables(void)
|
static void
|
||||||
|
setupLumaTables(void)
|
||||||
{
|
{
|
||||||
lumaRed = setupLuma(LumaRed);
|
lumaRed = setupLuma(LumaRed);
|
||||||
lumaGreen = setupLuma(LumaGreen);
|
lumaGreen = setupLuma(LumaGreen);
|
||||||
lumaBlue = setupLuma(LumaBlue);
|
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);
|
return (c > 255 ? 255 : c);
|
||||||
|
@ -103,7 +112,9 @@ static unsigned V2Code(float f, unsigned long RB, unsigned long RW, int CR)
|
||||||
#define CLAMP(f,min,max) \
|
#define CLAMP(f,min,max) \
|
||||||
(int)((f)+.5 < (min) ? (min) : (f)+.5 > (max) ? (max) : (f)+.5)
|
(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;
|
float Y, Cb, Cr;
|
||||||
int iY, iCb, iCr;
|
int iY, iCb, iCr;
|
||||||
|
@ -126,15 +137,17 @@ static void check(int R, int G, int B)
|
||||||
eR = R - CLAMP(rR,0,255);
|
eR = R - CLAMP(rR,0,255);
|
||||||
eG = G - CLAMP(rG,0,255);
|
eG = G - CLAMP(rG,0,255);
|
||||||
eB = B - CLAMP(rB,0,255);
|
eB = B - CLAMP(rB,0,255);
|
||||||
if (abs(eR) > 1 || abs(eG) > 1 || abs(eB) > 1)
|
if (abs(eR) > 1 || abs(eG) > 1 || abs(eB) > 1) {
|
||||||
{
|
|
||||||
printf("R %u G %u B %u", R, G, B);
|
printf("R %u G %u B %u", R, G, B);
|
||||||
printf(" Y %g Cb %g Cr %g", Y, Cb, Cr);
|
printf(" Y %g Cb %g Cr %g", Y, Cb, Cr);
|
||||||
printf(" iY %u iCb %u iCr %u", iY, iCb, iCr);
|
printf(" iY %u iCb %u iCr %u", iY, iCb, iCr);
|
||||||
printf("\n -> Y %g Cb %g Cr %g", rY, rCb, rCr);
|
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,
|
printf(" R %g (%u) G %g (%u) B %g (%u) E=[%d %d %d])\n"
|
||||||
CLAMP(rR, 0, 255), rG, CLAMP(rG, 0, 255), rB, CLAMP(rB, 0, 255),
|
, rR, CLAMP(rR,0,255)
|
||||||
eR, eG, eB);
|
, rG, CLAMP(rG,0,255)
|
||||||
|
, rB, CLAMP(rB,0,255)
|
||||||
|
, eR, eG, eB
|
||||||
|
);
|
||||||
}
|
}
|
||||||
eRtotal += eR;
|
eRtotal += eR;
|
||||||
eGtotal += eG;
|
eGtotal += eG;
|
||||||
|
@ -146,3 +159,10 @@ static void check(int R, int G, int B)
|
||||||
eCodes++;
|
eCodes++;
|
||||||
eBits += abs(eR) + abs(eG) + abs(eB);
|
eBits += abs(eR) + abs(eG) + abs(eB);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* mode: c
|
||||||
|
* c-basic-offset: 8
|
||||||
|
* fill-column: 78
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|
|
@ -1,27 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -x
|
set -x
|
||||||
case `uname` in
|
|
||||||
Darwin*)
|
|
||||||
glibtoolize --force --copy
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
libtoolize --force --copy
|
libtoolize --force --copy
|
||||||
;;
|
|
||||||
esac
|
|
||||||
aclocal -I ./m4
|
aclocal -I ./m4
|
||||||
autoheader
|
autoheader
|
||||||
automake --foreign --add-missing --copy
|
automake --foreign --add-missing --copy
|
||||||
autoconf
|
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
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# C++ library option
|
# CMake build for libtiff
|
||||||
#
|
#
|
||||||
# Copyright © 2015 Open Microscopy Environment / University of Dundee
|
# Copyright © 2015 Open Microscopy Environment / University of Dundee
|
||||||
# Copyright © 2021 Roger Leigh <rleigh@codelibre.net>
|
|
||||||
# Written by Roger Leigh <rleigh@codelibre.net>
|
# Written by Roger Leigh <rleigh@codelibre.net>
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, distribute, and sell this software and
|
# 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
|
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
# OF THIS SOFTWARE.
|
# OF THIS SOFTWARE.
|
||||||
|
|
||||||
# C++ support
|
extra_dist(README)
|
||||||
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()
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Checks for LERC codec support
|
|
||||||
#
|
#
|
||||||
# Copyright © 2021 Antonio Valentino <antonio.valentino@tiscali.it>
|
# Tag Image File Format (TIFF) Software
|
||||||
# Written by Antonio Valentino <antonio.valentino@tiscali.it>
|
#
|
||||||
|
# Copyright (C) 2007, Andrey Kiselev <dron@ak4719.spb.edu>
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, distribute, and sell this software and
|
# Permission to use, copy, modify, distribute, and sell this software and
|
||||||
# its documentation for any purpose is hereby granted without fee, provided
|
# 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
|
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
# OF THIS SOFTWARE.
|
# 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()
|
|
3
thirdparty/SDL2_image/external/libtiff/build/README
vendored
Normal file
3
thirdparty/SDL2_image/external/libtiff/build/README
vendored
Normal 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
Loading…
Add table
Reference in a new issue