LibTIFF: Update to v4.3.0

This commit is contained in:
Joel16 2022-03-21 12:17:48 -04:00
parent 17feca7efd
commit 1f528581c5
9 changed files with 1116 additions and 174 deletions

Binary file not shown.

155
libs/libtiff/tif_config.h Normal file
View File

@ -0,0 +1,155 @@
/* libtiff/tif_config.h.cmake.in. Not generated, but originated from autoheader. */
/* This file must be kept up-to-date with needed substitutions from libtiff/tif_config.h.in. */
#include "tiffconf.h"
/* Support CCITT Group 3 & 4 algorithms */
#define CCITT_SUPPORT 1
/* Pick up YCbCr subsampling info from the JPEG data stream to support files
lacking the tag (default enabled). */
#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
/* enable partial strip reading for large strips (experimental) */
/* #undef CHUNKY_STRIP_READ_SUPPORT */
/* Support C++ stream API (requires C++ compiler) */
#define CXX_SUPPORT 1
/* enable deferred strip/tile offset/size loading (experimental) */
/* #undef DEFER_STRILE_LOAD */
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. */
#define HAVE_DECL_OPTARG 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
/* #undef HAVE_FSEEKO */
/* Define to 1 if you have the `getopt' function. */
#define HAVE_GETOPT 1
/* Define to 1 if you have the <GLUT/glut.h> header file. */
/* #undef HAVE_GLUT_GLUT_H */
/* Define to 1 if you have the <GL/glut.h> header file. */
/* #undef HAVE_GL_GLUT_H */
/* Define to 1 if you have the <GL/glu.h> header file. */
/* #undef HAVE_GL_GLU_H */
/* Define to 1 if you have the <GL/gl.h> header file. */
#define HAVE_GL_GL_H 1
/* Define to 1 if you have the <io.h> header file. */
/* #undef HAVE_IO_H */
/* Define to 1 if you have the `jbg_newlen' function. */
/* #undef HAVE_JBG_NEWLEN */
/* Define to 1 if you have the `mmap' function. */
/* #undef HAVE_MMAP */
/* Define to 1 if you have the <OpenGL/glu.h> header file. */
/* #undef HAVE_OPENGL_GLU_H */
/* Define to 1 if you have the <OpenGL/gl.h> header file. */
/* #undef HAVE_OPENGL_GL_H */
/* Define to 1 if you have the `setmode' function. */
/* #undef HAVE_SETMODE */
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* 8/12 bit libjpeg dual mode enabled */
/* #undef JPEG_DUAL_MODE_8_12 */
/* Support LERC compression */
/* #undef LERC_SUPPORT */
/* 12bit libjpeg primary include file with path */
#define LIBJPEG_12_PATH ""
/* Support LZMA2 compression */
/* #undef LZMA_SUPPORT */
/* Name of package */
#define PACKAGE "LibTIFF Software"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "tiff@lists.maptools.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "LibTIFF Software"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "LibTIFF Software 4.3.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "tiff"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.3.0"
/* Size of size_t */
#define SIZEOF_SIZE_T 4
/* Default size of the strip in bytes (when strip chopping enabled) */
#define STRIP_SIZE_DEFAULT 8192
/* define to use win32 IO system */
/* #undef USE_WIN32_FILEIO */
/* Version number of package */
#define VERSION "4.3.0"
/* Support WEBP compression */
#define WEBP_SUPPORT 1
/* Support ZSTD compression */
/* #undef ZSTD_SUPPORT */
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
#if !defined(__MINGW32__)
# define TIFF_SIZE_FORMAT "zu"
#endif
#if SIZEOF_SIZE_T == 8
# define TIFF_SSIZE_FORMAT PRId64
# if defined(__MINGW32__)
# define TIFF_SIZE_FORMAT PRIu64
# endif
#elif SIZEOF_SIZE_T == 4
# define TIFF_SSIZE_FORMAT PRId32
# if defined(__MINGW32__)
# define TIFF_SIZE_FORMAT PRIu32
# endif
#else
# error "Unsupported size_t size; please submit a bug report"
#endif

317
libs/libtiff/tif_dir.h Normal file
View File

@ -0,0 +1,317 @@
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _TIFFDIR_
#define _TIFFDIR_
#include "tiff.h"
#include "tiffio.h"
/*
* ``Library-private'' Directory-related Definitions.
*/
typedef struct {
const TIFFField *info;
int count;
void *value;
} TIFFTagValue;
/*
* TIFF Image File Directories are comprised of a table of field
* descriptors of the form shown below. The table is sorted in
* ascending order by tag. The values associated with each entry are
* disjoint and may appear anywhere in the file (so long as they are
* placed on a word boundary).
*
* If the value is 4 bytes or less, in ClassicTIFF, or 8 bytes or less in
* BigTIFF, then it is placed in the offset field to save space. If so,
* it is left-justified in the offset field.
*/
typedef struct {
uint16_t tdir_tag; /* see below */
uint16_t tdir_type; /* data type; see below */
uint64_t tdir_count; /* number of items; length in spec */
union {
uint16_t toff_short;
uint32_t toff_long;
uint64_t toff_long8;
} tdir_offset; /* either offset or the data itself if fits */
uint8_t tdir_ignore; /* flag status to ignore tag when parsing tags in tif_dirread.c */
} TIFFDirEntry;
/*
* Internal format of a TIFF directory entry.
*/
typedef struct {
#define FIELD_SETLONGS 4
/* bit vector of fields that are set */
unsigned long td_fieldsset[FIELD_SETLONGS];
uint32_t td_imagewidth, td_imagelength, td_imagedepth;
uint32_t td_tilewidth, td_tilelength, td_tiledepth;
uint32_t td_subfiletype;
uint16_t td_bitspersample;
uint16_t td_sampleformat;
uint16_t td_compression;
uint16_t td_photometric;
uint16_t td_threshholding;
uint16_t td_fillorder;
uint16_t td_orientation;
uint16_t td_samplesperpixel;
uint32_t td_rowsperstrip;
uint16_t td_minsamplevalue, td_maxsamplevalue;
double* td_sminsamplevalue;
double* td_smaxsamplevalue;
float td_xresolution, td_yresolution;
uint16_t td_resolutionunit;
uint16_t td_planarconfig;
float td_xposition, td_yposition;
uint16_t td_pagenumber[2];
uint16_t* td_colormap[3];
uint16_t td_halftonehints[2];
uint16_t td_extrasamples;
uint16_t* td_sampleinfo;
/* even though the name is misleading, td_stripsperimage is the number
* of striles (=strips or tiles) per plane, and td_nstrips the total
* number of striles */
uint32_t td_stripsperimage;
uint32_t td_nstrips; /* size of offset & bytecount arrays */
uint64_t* td_stripoffset_p; /* should be accessed with TIFFGetStrileOffset */
uint64_t* td_stripbytecount_p; /* should be accessed with TIFFGetStrileByteCount */
uint32_t td_stripoffsetbyteallocsize; /* number of elements currently allocated for td_stripoffset/td_stripbytecount. Only used if TIFF_LAZYSTRILELOAD is set */
#ifdef STRIPBYTECOUNTSORTED_UNUSED
int td_stripbytecountsorted; /* is the bytecount array sorted ascending? */
#endif
TIFFDirEntry td_stripoffset_entry; /* for deferred loading */
TIFFDirEntry td_stripbytecount_entry; /* for deferred loading */
uint16_t td_nsubifd;
uint64_t* td_subifd;
/* YCbCr parameters */
uint16_t td_ycbcrsubsampling[2];
uint16_t td_ycbcrpositioning;
/* Colorimetry parameters */
uint16_t* td_transferfunction[3];
float* td_refblackwhite;
/* CMYK parameters */
int td_inknameslen;
char* td_inknames;
int td_customValueCount;
TIFFTagValue *td_customValues;
unsigned char td_deferstrilearraywriting; /* see TIFFDeferStrileArrayWriting() */
} TIFFDirectory;
/*
* Field flags used to indicate fields that have been set in a directory, and
* to reference fields when manipulating a directory.
*/
/*
* FIELD_IGNORE is used to signify tags that are to be processed but otherwise
* ignored. This permits antiquated tags to be quietly read and discarded.
* Note that a bit *is* allocated for ignored tags; this is understood by the
* directory reading logic which uses this fact to avoid special-case handling
*/
#define FIELD_IGNORE 0
/* multi-item fields */
#define FIELD_IMAGEDIMENSIONS 1
#define FIELD_TILEDIMENSIONS 2
#define FIELD_RESOLUTION 3
#define FIELD_POSITION 4
/* single-item fields */
#define FIELD_SUBFILETYPE 5
#define FIELD_BITSPERSAMPLE 6
#define FIELD_COMPRESSION 7
#define FIELD_PHOTOMETRIC 8
#define FIELD_THRESHHOLDING 9
#define FIELD_FILLORDER 10
#define FIELD_ORIENTATION 15
#define FIELD_SAMPLESPERPIXEL 16
#define FIELD_ROWSPERSTRIP 17
#define FIELD_MINSAMPLEVALUE 18
#define FIELD_MAXSAMPLEVALUE 19
#define FIELD_PLANARCONFIG 20
#define FIELD_RESOLUTIONUNIT 22
#define FIELD_PAGENUMBER 23
#define FIELD_STRIPBYTECOUNTS 24
#define FIELD_STRIPOFFSETS 25
#define FIELD_COLORMAP 26
#define FIELD_EXTRASAMPLES 31
#define FIELD_SAMPLEFORMAT 32
#define FIELD_SMINSAMPLEVALUE 33
#define FIELD_SMAXSAMPLEVALUE 34
#define FIELD_IMAGEDEPTH 35
#define FIELD_TILEDEPTH 36
#define FIELD_HALFTONEHINTS 37
#define FIELD_YCBCRSUBSAMPLING 39
#define FIELD_YCBCRPOSITIONING 40
#define FIELD_REFBLACKWHITE 41
#define FIELD_TRANSFERFUNCTION 44
#define FIELD_INKNAMES 46
#define FIELD_SUBIFD 49
/* FIELD_CUSTOM (see tiffio.h) 65 */
/* end of support for well-known tags; codec-private tags follow */
#define FIELD_CODEC 66 /* base of codec-private tags */
/*
* Pseudo-tags don't normally need field bits since they are not written to an
* output file (by definition). The library also has express logic to always
* query a codec for a pseudo-tag so allocating a field bit for one is a
* waste. If codec wants to promote the notion of a pseudo-tag being ``set''
* or ``unset'' then it can do using internal state flags without polluting
* the field bit space defined for real tags.
*/
#define FIELD_PSEUDO 0
#define FIELD_LAST (32*FIELD_SETLONGS-1)
#define BITn(n) (((unsigned long)1L)<<((n)&0x1f))
#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n)/32])
#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
#define FieldSet(fields, f) (fields[(f)/32] & BITn(f))
#define ResetFieldBit(fields, f) (fields[(f)/32] &= ~BITn(f))
typedef enum {
TIFF_SETGET_UNDEFINED = 0,
TIFF_SETGET_ASCII = 1,
TIFF_SETGET_UINT8 = 2,
TIFF_SETGET_SINT8 = 3,
TIFF_SETGET_UINT16 = 4,
TIFF_SETGET_SINT16 = 5,
TIFF_SETGET_UINT32 = 6,
TIFF_SETGET_SINT32 = 7,
TIFF_SETGET_UINT64 = 8,
TIFF_SETGET_SINT64 = 9,
TIFF_SETGET_FLOAT = 10,
TIFF_SETGET_DOUBLE = 11,
TIFF_SETGET_IFD8 = 12,
TIFF_SETGET_INT = 13,
TIFF_SETGET_UINT16_PAIR = 14,
TIFF_SETGET_C0_ASCII = 15,
TIFF_SETGET_C0_UINT8 = 16,
TIFF_SETGET_C0_SINT8 = 17,
TIFF_SETGET_C0_UINT16 = 18,
TIFF_SETGET_C0_SINT16 = 19,
TIFF_SETGET_C0_UINT32 = 20,
TIFF_SETGET_C0_SINT32 = 21,
TIFF_SETGET_C0_UINT64 = 22,
TIFF_SETGET_C0_SINT64 = 23,
TIFF_SETGET_C0_FLOAT = 24,
TIFF_SETGET_C0_DOUBLE = 25,
TIFF_SETGET_C0_IFD8 = 26,
TIFF_SETGET_C16_ASCII = 27,
TIFF_SETGET_C16_UINT8 = 28,
TIFF_SETGET_C16_SINT8 = 29,
TIFF_SETGET_C16_UINT16 = 30,
TIFF_SETGET_C16_SINT16 = 31,
TIFF_SETGET_C16_UINT32 = 32,
TIFF_SETGET_C16_SINT32 = 33,
TIFF_SETGET_C16_UINT64 = 34,
TIFF_SETGET_C16_SINT64 = 35,
TIFF_SETGET_C16_FLOAT = 36,
TIFF_SETGET_C16_DOUBLE = 37,
TIFF_SETGET_C16_IFD8 = 38,
TIFF_SETGET_C32_ASCII = 39,
TIFF_SETGET_C32_UINT8 = 40,
TIFF_SETGET_C32_SINT8 = 41,
TIFF_SETGET_C32_UINT16 = 42,
TIFF_SETGET_C32_SINT16 = 43,
TIFF_SETGET_C32_UINT32 = 44,
TIFF_SETGET_C32_SINT32 = 45,
TIFF_SETGET_C32_UINT64 = 46,
TIFF_SETGET_C32_SINT64 = 47,
TIFF_SETGET_C32_FLOAT = 48,
TIFF_SETGET_C32_DOUBLE = 49,
TIFF_SETGET_C32_IFD8 = 50,
TIFF_SETGET_OTHER = 51
} TIFFSetGetFieldType;
#if defined(__cplusplus)
extern "C" {
#endif
extern const TIFFFieldArray* _TIFFGetFields(void);
extern const TIFFFieldArray* _TIFFGetExifFields(void);
extern const TIFFFieldArray* _TIFFGetGpsFields(void);
extern void _TIFFSetupFields(TIFF* tif, const TIFFFieldArray* infoarray);
extern void _TIFFPrintFieldInfo(TIFF*, FILE*);
extern int _TIFFFillStriles(TIFF*);
typedef enum {
tfiatImage,
tfiatExif,
tfiatGps, /* EXIF-GPS fields array type */
tfiatOther
} TIFFFieldArrayType;
struct _TIFFFieldArray {
TIFFFieldArrayType type; /* array type, will be used to determine if IFD is image and such */
uint32_t allocated_size; /* 0 if array is constant, other if modified by future definition extension support */
uint32_t count; /* number of elements in fields array */
TIFFField* fields; /* actual field info */
};
struct _TIFFField {
uint32_t field_tag; /* field's tag */
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
short field_writecount; /* write count/TIFF_VARIABLE */
TIFFDataType field_type; /* type of associated data */
uint32_t reserved; /* reserved for future extension */
TIFFSetGetFieldType set_field_type; /* type to be passed to TIFFSetField */
TIFFSetGetFieldType get_field_type; /* type to be passed to TIFFGetField */
unsigned short field_bit; /* bit in fieldsset bit vector */
unsigned char field_oktochange; /* if true, can change while writing */
unsigned char field_passcount; /* if true, pass dir count on set */
char* field_name; /* ASCII name */
TIFFFieldArray* field_subfields; /* if field points to child ifds, child ifd field definition array */
};
extern int _TIFFMergeFields(TIFF*, const TIFFField[], uint32_t);
extern const TIFFField* _TIFFFindOrRegisterField(TIFF *, uint32_t, TIFFDataType);
extern TIFFField* _TIFFCreateAnonField(TIFF *, uint32_t, TIFFDataType);
extern int _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag);
#if defined(__cplusplus)
}
#endif
#endif /* _TIFFDIR_ */
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -56,24 +56,37 @@
/* /*
* Intrinsic data types required by the file format: * Intrinsic data types required by the file format:
* *
* 8-bit quantities int8/uint8 * 8-bit quantities int8_t/uint_8_t
* 16-bit quantities int16/uint16 * 16-bit quantities int16_t/uint_16_t
* 32-bit quantities int32/uint32 * 32-bit quantities int32_t/uint_32_t
* 64-bit quantities int64/uint64 * 64-bit quantities int64_t/uint_64_t
* 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
typedef TIFF_INT8_T int8; #ifndef TIFF_DISABLE_DEPRECATED
typedef TIFF_UINT8_T uint8; typedef TIFF_MSC_DEPRECATED int8_t int8 TIFF_GCC_DEPRECATED;
typedef TIFF_MSC_DEPRECATED uint8_t uint8 TIFF_GCC_DEPRECATED;
typedef TIFF_INT16_T int16; typedef TIFF_MSC_DEPRECATED int16_t int16 TIFF_GCC_DEPRECATED;
typedef TIFF_UINT16_T uint16; typedef TIFF_MSC_DEPRECATED uint16_t uint16 TIFF_GCC_DEPRECATED;
typedef TIFF_INT32_T int32; typedef TIFF_MSC_DEPRECATED int32_t int32 TIFF_GCC_DEPRECATED;
typedef TIFF_UINT32_T uint32; typedef TIFF_MSC_DEPRECATED uint32_t uint32 TIFF_GCC_DEPRECATED;
typedef TIFF_MSC_DEPRECATED int64_t int64 TIFF_GCC_DEPRECATED;
typedef TIFF_MSC_DEPRECATED uint64_t uint64 TIFF_GCC_DEPRECATED;
#endif /* TIFF_DISABLE_DEPRECATED */
typedef TIFF_INT64_T int64;
typedef TIFF_UINT64_T uint64;
/* /*
* Some types as promoted in a variable argument list * Some types as promoted in a variable argument list
@ -89,20 +102,20 @@ 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;
@ -197,6 +210,7 @@ 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 */
@ -465,7 +479,7 @@ typedef enum {
#define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */ #define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */
#define TIFFTAG_GPSIFD 34853 /* Pointer to 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. parms */ #define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. params */
#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 */

View File

@ -1,4 +1,3 @@
/* libtiff/tiffconf.h. Generated from tiffconf.h.in by configure. */
/* /*
Configuration defines for installed libtiff. Configuration defines for installed libtiff.
This file maintained for backward compatibility. Do not use definitions This file maintained for backward compatibility. Do not use definitions
@ -8,44 +7,47 @@
#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 */
#define TIFF_INT16_T signed short #define TIFF_INT16_T int16_t
/* Signed 32-bit type */ /* Signed 32-bit type */
#define TIFF_INT32_T signed int #define TIFF_INT32_T int32_t
/* Signed 64-bit type */ /* Signed 64-bit type */
#define TIFF_INT64_T signed long long #define TIFF_INT64_T int64_t
/* Signed 8-bit type */ /* Signed 8-bit type */
#define TIFF_INT8_T signed char #define TIFF_INT8_T int8_t
/* Unsigned 16-bit type */ /* Unsigned 16-bit type */
#define TIFF_UINT16_T unsigned short #define TIFF_UINT16_T uint16_t
/* Unsigned 32-bit type */ /* Unsigned 32-bit type */
#define TIFF_UINT32_T unsigned int #define TIFF_UINT32_T uint32_t
/* Unsigned 64-bit type */ /* Unsigned 64-bit type */
#define TIFF_UINT64_T unsigned long long #define TIFF_UINT64_T uint64_t
/* Unsigned 8-bit type */ /* Unsigned 8-bit type */
#define TIFF_UINT8_T unsigned char #define TIFF_UINT8_T uint8_t
/* Signed size type */ /* Signed size type */
#define TIFF_SSIZE_T signed int #define TIFF_SSIZE_T int32_t
/* Pointer difference type */
#define TIFF_PTRDIFF_T ptrdiff_t
/* Compatibility stuff. */ /* Compatibility stuff. */
/* Define as 0 or 1 according to the floating point format suported by the /* Define as 0 or 1 according to the floating point format supported by the
machine */ machine */
#define HAVE_IEEEFP 1 #define HAVE_IEEEFP 1
/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ /* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
#define HOST_FILLORDER FILLORDER_MSB2LSB #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
(Intel) */ (Intel) */
@ -60,6 +62,9 @@
/* 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
@ -89,8 +94,8 @@
/* #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 mutiple strips of ~8Kb to reduce memory usage) */ images to multiple strips of ~8Kb to reduce memory usage) */
#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP #define STRIPCHOP_DEFAULT 1
/* Enable SubIFD tag (330) support */ /* Enable SubIFD tag (330) support */
#define SUBIFD_SUPPORT 1 #define SUBIFD_SUPPORT 1

View File

@ -60,16 +60,18 @@ 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 on 32bit machines, int64 on 64bit machines * int32_t on 32bit machines, int64_t on 64bit machines
*/ */
typedef TIFF_SSIZE_T tmsize_t; typedef TIFF_SSIZE_T tmsize_t;
typedef uint64 toff_t; /* file offset */ #define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
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 ttag_t; /* directory tag */ typedef uint32_t ttag_t; /* directory tag */
typedef uint16 tdir_t; /* directory index */ typedef uint16_t tdir_t; /* directory index */
typedef uint16 tsample_t; /* sample number */ typedef uint16_t tsample_t; /* sample number */
typedef uint32 tstrile_t; /* strip or tile number */ typedef uint32_t 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 */
@ -140,9 +142,9 @@ typedef struct {
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 d_Vrwr; /* Pixel values for ref. white */ uint32_t d_Vrwr; /* Pixel values for ref. white */
uint32 d_Vrwg; uint32_t d_Vrwg;
uint32 d_Vrwb; uint32_t 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,9 +157,9 @@ typedef struct { /* 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* Cr_g_tab; int32_t* Cr_g_tab;
int32* Cb_g_tab; int32_t* Cb_g_tab;
int32* Y_tab; int32_t* Y_tab;
} TIFFYCbCrToRGB; } TIFFYCbCrToRGB;
typedef struct { /* CIE Lab 1976->RGB support */ typedef struct { /* CIE Lab 1976->RGB support */
@ -186,11 +188,11 @@ typedef struct _TIFFRGBAImage TIFFRGBAImage;
* and draw the unpacked raster on the display. * and draw the unpacked raster on the display.
*/ */
typedef void (*tileContigRoutine) typedef void (*tileContigRoutine)
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32, (TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t, uint32_t, uint32_t, int32_t, int32_t,
unsigned char*); unsigned char*);
typedef void (*tileSeparateRoutine) typedef void (*tileSeparateRoutine)
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32, (TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t, uint32_t, uint32_t, int32_t, int32_t,
unsigned char*, unsigned char*, unsigned char*, unsigned char*); unsigned char*, unsigned char*, unsigned char*, unsigned char*);
/* /*
* RGBA-reader state. * RGBA-reader state.
*/ */
@ -199,18 +201,18 @@ struct _TIFFRGBAImage {
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 width; /* image width */ uint32_t width; /* image width */
uint32 height; /* image height */ uint32_t height; /* image height */
uint16 bitspersample; /* image bits/sample */ uint16_t bitspersample; /* image bits/sample */
uint16 samplesperpixel; /* image samples/pixel */ uint16_t samplesperpixel; /* image samples/pixel */
uint16 orientation; /* image orientation */ uint16_t orientation; /* image orientation */
uint16 req_orientation; /* requested orientation */ uint16_t req_orientation; /* requested orientation */
uint16 photometric; /* image photometric interp */ uint16_t photometric; /* image photometric interp */
uint16* redcmap; /* colormap palette */ uint16_t* redcmap; /* colormap palette */
uint16* greencmap; uint16_t* greencmap;
uint16* bluecmap; uint16_t* bluecmap;
/* get image data routine */ /* get image data routine */
int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32); int (*get)(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
/* put decoded strip/tile */ /* put decoded strip/tile */
union { union {
void (*any)(TIFFRGBAImage*); void (*any)(TIFFRGBAImage*);
@ -218,13 +220,13 @@ struct _TIFFRGBAImage {
tileSeparateRoutine separate; tileSeparateRoutine separate;
} put; } put;
TIFFRGBValue* Map; /* sample mapping array */ TIFFRGBValue* Map; /* sample mapping array */
uint32** BWmap; /* black&white map */ uint32_t** BWmap; /* black&white map */
uint32** PALmap; /* palette image map */ uint32_t** 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* UaToAa; /* Unassociated alpha to associated alpha conversion LUT */ uint8_t* UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
uint8* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */ uint8_t* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
int row_offset; int row_offset;
int col_offset; int col_offset;
@ -249,7 +251,7 @@ struct _TIFFRGBAImage {
typedef int (*TIFFInitMethod)(TIFF*, int); typedef int (*TIFFInitMethod)(TIFF*, int);
typedef struct { typedef struct {
char* name; char* name;
uint16 scheme; uint16_t scheme;
TIFFInitMethod init; TIFFInitMethod init;
} TIFFCodec; } TIFFCodec;
@ -282,10 +284,10 @@ typedef void (*TIFFExtendProc)(TIFF*);
extern const char* TIFFGetVersion(void); extern const char* TIFFGetVersion(void);
extern const TIFFCodec* TIFFFindCODEC(uint16); extern const TIFFCodec* TIFFFindCODEC(uint16_t);
extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod); extern TIFFCodec* TIFFRegisterCODEC(uint16_t, const char*, TIFFInitMethod);
extern void TIFFUnRegisterCODEC(TIFFCodec*); extern void TIFFUnRegisterCODEC(TIFFCodec*);
extern int TIFFIsCODECConfigured(uint16); extern int TIFFIsCODECConfigured(uint16_t);
extern TIFFCodec* TIFFGetConfiguredCODECs(void); extern TIFFCodec* TIFFGetConfiguredCODECs(void);
/* /*
@ -304,31 +306,31 @@ extern void _TIFFfree(void* p);
** 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 TIFFGetTagListEntry( TIFF *, int tag_index ); extern uint32_t 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 var-length tags */ #define TIFF_VARIABLE2 -3 /* marker for uint32_t 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, TIFFDataType); extern const TIFFField* TIFFFindField(TIFF *, uint32_t, TIFFDataType);
extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32); extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32_t);
extern const TIFFField* TIFFFieldWithName(TIFF*, const char *); extern const TIFFField* TIFFFieldWithName(TIFF*, const char *);
extern uint32 TIFFFieldTag(const TIFFField*); extern uint32_t 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*);
typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list); typedef int (*TIFFVSetMethod)(TIFF*, uint32_t, va_list);
typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list); typedef int (*TIFFVGetMethod)(TIFF*, uint32_t, va_list);
typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long); typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
typedef struct { typedef struct {
@ -345,32 +347,32 @@ extern void TIFFCleanup(TIFF* tif);
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 tag, ...); extern int TIFFGetField(TIFF* tif, uint32_t tag, ...);
extern int TIFFVGetField(TIFF* tif, uint32 tag, va_list ap); extern int TIFFVGetField(TIFF* tif, uint32_t tag, va_list ap);
extern int TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...); extern int TIFFGetFieldDefaulted(TIFF* tif, uint32_t tag, ...);
extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap); extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32_t tag, va_list ap);
extern int TIFFReadDirectory(TIFF* tif); extern int TIFFReadDirectory(TIFF* tif);
extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray); extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, 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 TIFFScanlineSize64(TIFF* tif); extern uint64_t TIFFScanlineSize64(TIFF* tif);
extern tmsize_t TIFFScanlineSize(TIFF* tif); extern tmsize_t TIFFScanlineSize(TIFF* tif);
extern uint64 TIFFRasterScanlineSize64(TIFF* tif); extern uint64_t TIFFRasterScanlineSize64(TIFF* tif);
extern tmsize_t TIFFRasterScanlineSize(TIFF* tif); extern tmsize_t TIFFRasterScanlineSize(TIFF* tif);
extern uint64 TIFFStripSize64(TIFF* tif); extern uint64_t TIFFStripSize64(TIFF* tif);
extern tmsize_t TIFFStripSize(TIFF* tif); extern tmsize_t TIFFStripSize(TIFF* tif);
extern uint64 TIFFRawStripSize64(TIFF* tif, uint32 strip); extern uint64_t TIFFRawStripSize64(TIFF* tif, uint32_t strip);
extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32 strip); extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32_t strip);
extern uint64 TIFFVStripSize64(TIFF* tif, uint32 nrows); extern uint64_t TIFFVStripSize64(TIFF* tif, uint32_t nrows);
extern tmsize_t TIFFVStripSize(TIFF* tif, uint32 nrows); extern tmsize_t TIFFVStripSize(TIFF* tif, uint32_t nrows);
extern uint64 TIFFTileRowSize64(TIFF* tif); extern uint64_t TIFFTileRowSize64(TIFF* tif);
extern tmsize_t TIFFTileRowSize(TIFF* tif); extern tmsize_t TIFFTileRowSize(TIFF* tif);
extern uint64 TIFFTileSize64(TIFF* tif); extern uint64_t TIFFTileSize64(TIFF* tif);
extern tmsize_t TIFFTileSize(TIFF* tif); extern tmsize_t TIFFTileSize(TIFF* tif);
extern uint64 TIFFVTileSize64(TIFF* tif, uint32 nrows); extern uint64_t TIFFVTileSize64(TIFF* tif, uint32_t nrows);
extern tmsize_t TIFFVTileSize(TIFF* tif, uint32 nrows); extern tmsize_t TIFFVTileSize(TIFF* tif, uint32_t nrows);
extern uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request); extern uint32_t TIFFDefaultStripSize(TIFF* tif, uint32_t request);
extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*); extern void TIFFDefaultTileSize(TIFF*, uint32_t*, uint32_t*);
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*);
@ -389,12 +391,12 @@ extern TIFFCloseProc TIFFGetCloseProc(TIFF*);
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 TIFFCurrentRow(TIFF*); extern uint32_t TIFFCurrentRow(TIFF*);
extern uint16 TIFFCurrentDirectory(TIFF*); extern uint16_t TIFFCurrentDirectory(TIFF*);
extern uint16 TIFFNumberOfDirectories(TIFF*); extern uint16_t TIFFNumberOfDirectories(TIFF*);
extern uint64 TIFFCurrentDirOffset(TIFF*); extern uint64_t TIFFCurrentDirOffset(TIFF*);
extern uint32 TIFFCurrentStrip(TIFF*); extern uint32_t TIFFCurrentStrip(TIFF*);
extern uint32 TIFFCurrentTile(TIFF* tif); extern uint32_t 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 *);
@ -405,14 +407,14 @@ extern int TIFFCreateCustomDirectory(TIFF*,const TIFFFieldArray*);
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*, uint16); extern int TIFFSetDirectory(TIFF*, uint16_t);
extern int TIFFSetSubDirectory(TIFF*, uint64); extern int TIFFSetSubDirectory(TIFF*, uint64_t);
extern int TIFFUnlinkDirectory(TIFF*, uint16); extern int TIFFUnlinkDirectory(TIFF*, uint16_t);
extern int TIFFSetField(TIFF*, uint32, ...); extern int TIFFSetField(TIFF*, uint32_t, ...);
extern int TIFFVSetField(TIFF*, uint32, va_list); extern int TIFFVSetField(TIFF*, uint32_t, va_list);
extern int TIFFUnsetField(TIFF*, uint32); extern int TIFFUnsetField(TIFF*, uint32_t);
extern int TIFFWriteDirectory(TIFF *); extern int TIFFWriteDirectory(TIFF *);
extern int TIFFWriteCustomDirectory(TIFF *, uint64 *); extern int TIFFWriteCustomDirectory(TIFF *, uint64_t *);
extern int TIFFCheckpointDirectory(TIFF *); extern int TIFFCheckpointDirectory(TIFF *);
extern int TIFFRewriteDirectory(TIFF *); extern int TIFFRewriteDirectory(TIFF *);
extern int TIFFDeferStrileArrayWriting(TIFF *); extern int TIFFDeferStrileArrayWriting(TIFF *);
@ -420,26 +422,26 @@ extern int TIFFForceStrileArrayWriting(TIFF* );
#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 row, uint16 sample = 0); extern int TIFFReadScanline(TIFF* tif, void* buf, uint32_t row, 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, uint16_t sample = 0);
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0); extern int TIFFReadRGBAImage(TIFF*, uint32_t, uint32_t, uint32_t*, int = 0);
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, 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 row, uint16 sample); extern int TIFFReadScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample);
extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample); extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample);
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int); extern int TIFFReadRGBAImage(TIFF*, uint32_t, uint32_t, uint32_t*, int);
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int); extern int TIFFReadRGBAImageOriented(TIFF*, uint32_t, uint32_t, uint32_t*, int, int);
#endif #endif
extern int TIFFReadRGBAStrip(TIFF*, uint32, uint32 * ); extern int TIFFReadRGBAStrip(TIFF*, uint32_t, uint32_t * );
extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * ); extern int TIFFReadRGBATile(TIFF*, uint32_t, uint32_t, uint32_t * );
extern int TIFFReadRGBAStripExt(TIFF*, uint32, uint32 *, int stop_on_error ); extern int TIFFReadRGBAStripExt(TIFF*, uint32_t, uint32_t *, 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*, uint32, uint32); extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
extern void TIFFRGBAImageEnd(TIFFRGBAImage*); extern void TIFFRGBAImageEnd(TIFFRGBAImage*);
extern TIFF* TIFFOpen(const char*, const char*); extern TIFF* TIFFOpen(const char*, const char*);
# ifdef __WIN32__ # ifdef __WIN32__
@ -463,44 +465,44 @@ extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler); extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt); extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc); extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
extern uint32 TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s); extern uint32_t TIFFComputeTile(TIFF* tif, uint32_t x, uint32_t y, 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, uint16_t s);
extern uint32 TIFFNumberOfTiles(TIFF*); extern uint32_t TIFFNumberOfTiles(TIFF*);
extern tmsize_t TIFFReadTile(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, uint32_t z, uint16_t s);
extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s); extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
extern uint32 TIFFComputeStrip(TIFF*, uint32, uint16); extern uint32_t TIFFComputeStrip(TIFF*, uint32_t, uint16_t);
extern uint32 TIFFNumberOfStrips(TIFF*); extern uint32_t TIFFNumberOfStrips(TIFF*);
extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32_t strip, void* buf, tmsize_t size);
extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32_t strip, void* buf, tmsize_t size);
extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32_t tile, void* buf, tmsize_t size);
extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32_t tile, void* buf, tmsize_t size);
extern int TIFFReadFromUserBuffer(TIFF* tif, uint32 strile, extern int TIFFReadFromUserBuffer(TIFF* tif, uint32_t strile,
void* inbuf, tmsize_t insize, void* inbuf, tmsize_t insize,
void* outbuf, tmsize_t outsize); void* outbuf, tmsize_t outsize);
extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc); extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32_t strip, void* data, tmsize_t cc);
extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32 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 tile, 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 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 */ extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
extern void TIFFSetWriteOffset(TIFF* tif, toff_t off); extern void TIFFSetWriteOffset(TIFF* tif, toff_t off);
extern void TIFFSwabShort(uint16*); extern void TIFFSwabShort(uint16_t*);
extern void TIFFSwabLong(uint32*); extern void TIFFSwabLong(uint32_t*);
extern void TIFFSwabLong8(uint64*); extern void TIFFSwabLong8(uint64_t*);
extern void TIFFSwabFloat(float*); extern void TIFFSwabFloat(float*);
extern void TIFFSwabDouble(double*); extern void TIFFSwabDouble(double*);
extern void TIFFSwabArrayOfShort(uint16* wp, tmsize_t n); extern void TIFFSwabArrayOfShort(uint16_t* wp, tmsize_t n);
extern void TIFFSwabArrayOfTriples(uint8* tp, tmsize_t n); extern void TIFFSwabArrayOfTriples(uint8_t* tp, tmsize_t n);
extern void TIFFSwabArrayOfLong(uint32* lp, tmsize_t n); extern void TIFFSwabArrayOfLong(uint32_t* lp, tmsize_t n);
extern void TIFFSwabArrayOfLong8(uint64* lp, tmsize_t n); extern void TIFFSwabArrayOfLong8(uint64_t* 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* cp, tmsize_t n); extern void TIFFReverseBits(uint8_t* cp, tmsize_t n);
extern const unsigned char* TIFFGetBitRevTable(int); extern const unsigned char* TIFFGetBitRevTable(int);
extern uint64 TIFFGetStrileOffset(TIFF *tif, uint32 strile); extern uint64_t TIFFGetStrileOffset(TIFF *tif, uint32_t strile);
extern uint64 TIFFGetStrileByteCount(TIFF *tif, uint32 strile); extern uint64_t TIFFGetStrileByteCount(TIFF *tif, uint32_t strile);
extern uint64 TIFFGetStrileOffsetWithErr(TIFF *tif, uint32 strile, int *pbErr); extern uint64_t TIFFGetStrileOffsetWithErr(TIFF *tif, uint32_t strile, 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
@ -508,34 +510,34 @@ extern uint64 TIFFGetStrileByteCountWithErr(TIFF *tif, uint32 strile, int *pbErr
#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*); extern void XYZtoRGB24(float*, uint8_t*);
extern int uv_decode(double*, double*, int); extern int uv_decode(double*, double*, int);
extern void LogLuv24toXYZ(uint32, float*); extern void LogLuv24toXYZ(uint32_t, float*);
extern void LogLuv32toXYZ(uint32, float*); extern void LogLuv32toXYZ(uint32_t, 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 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER); extern uint32_t LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER); extern uint32_t 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 LogLuv24fromXYZ(float*, int); extern uint32_t LogLuv24fromXYZ(float*, int);
extern uint32 LogLuv32fromXYZ(float*, int); extern uint32_t LogLuv32fromXYZ(float*, int);
#endif #endif
#endif /* LOGLUV_PUBLIC */ #endif /* LOGLUV_PUBLIC */
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*); extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, 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, extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
uint32 *, uint32 *, uint32 *); uint32_t *, uint32_t *, uint32_t *);
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*); extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32, extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32_t, int32_t, int32_t,
uint32 *, uint32 *, uint32 *); uint32_t *, uint32_t *, uint32_t *);
/**************************************************************************** /****************************************************************************
* 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
@ -554,7 +556,7 @@ typedef struct {
char *field_name; /* ASCII name */ char *field_name; /* ASCII name */
} TIFFFieldInfo; } TIFFFieldInfo;
extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32); extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32_t);
#if defined(c_plusplus) || defined(__cplusplus) #if defined(c_plusplus) || defined(__cplusplus)
} }

448
libs/libtiff/tiffiop.h Normal file
View File

@ -0,0 +1,448 @@
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _TIFFIOP_
#define _TIFFIOP_
/*
* ``Library-private'' definitions.
*/
#include "tif_config.h"
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <string.h>
#ifdef HAVE_ASSERT_H
# include <assert.h>
#else
# define assert(x)
#endif
#include "tiffio.h"
#include "tif_dir.h"
#ifndef STRIP_SIZE_DEFAULT
# define STRIP_SIZE_DEFAULT 8192
#endif
#define streq(a,b) (strcmp(a,b) == 0)
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
typedef struct client_info {
struct client_info *next;
void *data;
char *name;
} TIFFClientInfoLink;
/*
* Typedefs for ``method pointers'' used internally.
* these are deprecated and provided only for backwards compatibility.
*/
typedef unsigned char tidataval_t; /* internal image data value type */
typedef tidataval_t* tidata_t; /* reference to internal image data */
typedef void (*TIFFVoidMethod)(TIFF*);
typedef int (*TIFFBoolMethod)(TIFF*);
typedef int (*TIFFPreMethod)(TIFF*, uint16_t);
typedef int (*TIFFCodeMethod)(TIFF* tif, uint8_t* buf, tmsize_t size, uint16_t sample);
typedef int (*TIFFSeekMethod)(TIFF*, uint32_t);
typedef void (*TIFFPostMethod)(TIFF* tif, uint8_t* buf, tmsize_t size);
typedef uint32_t (*TIFFStripMethod)(TIFF*, uint32_t);
typedef void (*TIFFTileMethod)(TIFF*, uint32_t*, uint32_t*);
struct tiff {
char* tif_name; /* name of open file */
int tif_fd; /* open file descriptor */
int tif_mode; /* open mode (O_*) */
uint32_t tif_flags;
#define TIFF_FILLORDER 0x00003U /* natural bit fill order for machine */
#define TIFF_DIRTYHEADER 0x00004U /* header must be written on close */
#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
#define TIFF_BUFFERSETUP 0x00010U /* data buffers setup */
#define TIFF_CODERSETUP 0x00020U /* encoder/decoder setup done */
#define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
#define TIFF_SWAB 0x00080U /* byte swap file information */
#define TIFF_NOBITREV 0x00100U /* inhibit bit reversal logic */
#define TIFF_MYBUFFER 0x00200U /* my raw data buffer; free on close */
#define TIFF_ISTILED 0x00400U /* file is tile, not strip- based */
#define TIFF_MAPPED 0x00800U /* file is mapped into memory */
#define TIFF_POSTENCODE 0x01000U /* need call to postencode routine */
#define TIFF_INSUBIFD 0x02000U /* currently writing a subifd */
#define TIFF_UPSAMPLED 0x04000U /* library is doing data up-sampling */
#define TIFF_STRIPCHOP 0x08000U /* enable strip chopping support */
#define TIFF_HEADERONLY 0x10000U /* read header only, do not process the first directory */
#define TIFF_NOREADRAW 0x20000U /* skip reading of raw uncompressed image data */
#define TIFF_INCUSTOMIFD 0x40000U /* currently writing a custom IFD */
#define TIFF_BIGTIFF 0x80000U /* read/write bigtiff */
#define TIFF_BUF4WRITE 0x100000U /* rawcc bytes are for writing */
#define TIFF_DIRTYSTRIP 0x200000U /* stripoffsets/stripbytecount dirty*/
#define TIFF_PERSAMPLE 0x400000U /* get/set per sample tags as arrays */
#define TIFF_BUFFERMMAP 0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
#define TIFF_DEFERSTRILELOAD 0x1000000U /* defer strip/tile offset/bytecount array loading. */
#define TIFF_LAZYSTRILELOAD 0x2000000U /* lazy/ondemand loading of strip/tile offset/bytecount values. Only used if TIFF_DEFERSTRILELOAD is set and in read-only mode */
#define TIFF_CHOPPEDUPARRAYS 0x4000000U /* set when allocChoppedUpStripArrays() has modified strip array */
uint64_t tif_diroff; /* file offset of current directory */
uint64_t tif_nextdiroff; /* file offset of following directory */
uint64_t* tif_dirlist; /* list of offsets to already seen directories to prevent IFD looping */
uint16_t tif_dirlistsize; /* number of entries in offset list */
uint16_t tif_dirnumber; /* number of already seen directories */
TIFFDirectory tif_dir; /* internal rep of current directory */
TIFFDirectory tif_customdir; /* custom IFDs are separated from the main ones */
union {
TIFFHeaderCommon common;
TIFFHeaderClassic classic;
TIFFHeaderBig big;
} tif_header;
uint16_t tif_header_size; /* file's header block and its length */
uint32_t tif_row; /* current scanline */
uint16_t tif_curdir; /* current directory (index) */
uint32_t tif_curstrip; /* current strip for read/write */
uint64_t tif_curoff; /* current offset for read/write */
uint64_t tif_dataoff; /* current offset for writing dir */
/* SubIFD support */
uint16_t tif_nsubifd; /* remaining subifds to write */
uint64_t tif_subifdoff; /* offset for patching SubIFD link */
/* tiling support */
uint32_t tif_col; /* current column (offset by row too) */
uint32_t tif_curtile; /* current tile for read/write */
tmsize_t tif_tilesize; /* # of bytes in a tile */
/* compression scheme hooks */
int tif_decodestatus;
TIFFBoolMethod tif_fixuptags; /* called in TIFFReadDirectory */
TIFFBoolMethod tif_setupdecode; /* called once before predecode */
TIFFPreMethod tif_predecode; /* pre- row/strip/tile decoding */
TIFFBoolMethod tif_setupencode; /* called once before preencode */
int tif_encodestatus;
TIFFPreMethod tif_preencode; /* pre- row/strip/tile encoding */
TIFFBoolMethod tif_postencode; /* post- row/strip/tile encoding */
TIFFCodeMethod tif_decoderow; /* scanline decoding routine */
TIFFCodeMethod tif_encoderow; /* scanline encoding routine */
TIFFCodeMethod tif_decodestrip; /* strip decoding routine */
TIFFCodeMethod tif_encodestrip; /* strip encoding routine */
TIFFCodeMethod tif_decodetile; /* tile decoding routine */
TIFFCodeMethod tif_encodetile; /* tile encoding routine */
TIFFVoidMethod tif_close; /* cleanup-on-close routine */
TIFFSeekMethod tif_seek; /* position within a strip routine */
TIFFVoidMethod tif_cleanup; /* cleanup state routine */
TIFFStripMethod tif_defstripsize; /* calculate/constrain strip size */
TIFFTileMethod tif_deftilesize; /* calculate/constrain tile size */
uint8_t* tif_data; /* compression scheme private data */
/* input/output buffering */
tmsize_t tif_scanlinesize; /* # of bytes in a scanline */
tmsize_t tif_scanlineskew; /* scanline skew for reading strips */
uint8_t* tif_rawdata; /* raw data buffer */
tmsize_t tif_rawdatasize; /* # of bytes in raw data buffer */
tmsize_t tif_rawdataoff; /* rawdata offset within strip */
tmsize_t tif_rawdataloaded;/* amount of data in rawdata */
uint8_t* tif_rawcp; /* current spot in raw buffer */
tmsize_t tif_rawcc; /* bytes unread from raw buffer */
/* memory-mapped file support */
uint8_t* tif_base; /* base of mapped file */
tmsize_t tif_size; /* size of mapped file region (bytes, thus tmsize_t) */
TIFFMapFileProc tif_mapproc; /* map file method */
TIFFUnmapFileProc tif_unmapproc; /* unmap file method */
/* input/output callback methods */
thandle_t tif_clientdata; /* callback parameter */
TIFFReadWriteProc tif_readproc; /* read method */
TIFFReadWriteProc tif_writeproc; /* write method */
TIFFSeekProc tif_seekproc; /* lseek method */
TIFFCloseProc tif_closeproc; /* close method */
TIFFSizeProc tif_sizeproc; /* filesize method */
/* post-decoding support */
TIFFPostMethod tif_postdecode; /* post decoding routine */
/* tag support */
TIFFField** tif_fields; /* sorted table of registered tags */
size_t tif_nfields; /* # entries in registered tag table */
const TIFFField* tif_foundfield; /* cached pointer to already found tag */
TIFFTagMethods tif_tagmethods; /* tag get/set/print routines */
TIFFClientInfoLink* tif_clientinfo; /* extra client information. */
/* Backward compatibility stuff. We need these two fields for
* setting up an old tag extension scheme. */
TIFFFieldArray* tif_fieldscompat;
size_t tif_nfieldscompat;
};
#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
#define TIFFReadFile(tif, buf, size) \
((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
#define TIFFWriteFile(tif, buf, size) \
((*(tif)->tif_writeproc)((tif)->tif_clientdata,(buf),(size)))
#define TIFFSeekFile(tif, off, whence) \
((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))
#define TIFFCloseFile(tif) \
((*(tif)->tif_closeproc)((tif)->tif_clientdata))
#define TIFFGetFileSize(tif) \
((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
#define TIFFMapFileContents(tif, paddr, psize) \
((*(tif)->tif_mapproc)((tif)->tif_clientdata,(paddr),(psize)))
#define TIFFUnmapFileContents(tif, addr, size) \
((*(tif)->tif_unmapproc)((tif)->tif_clientdata,(addr),(size)))
/*
* Default Read/Seek/Write definitions.
*/
#ifndef ReadOK
#define ReadOK(tif, buf, size) \
(TIFFReadFile((tif),(buf),(size))==(size))
#endif
#ifndef SeekOK
#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
#endif
#ifndef WriteOK
#define WriteOK(tif, buf, size) \
(TIFFWriteFile((tif),(buf),(size))==(size))
#endif
/* NB: the uint32_t casts are to silence certain ANSI-C compilers */
#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
0U)
/* Variant of TIFFhowmany_32() that doesn't return 0 if x close to MAXUINT. */
/* Caution: TIFFhowmany_32_maxuint_compat(x,y)*y might overflow */
#define TIFFhowmany_32_maxuint_compat(x, y) \
(((uint32_t)(x) / (uint32_t)(y)) + ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
#define TIFFhowmany8_32(x) (((x)&0x07)?((uint32_t)(x)>>3)+1:(uint32_t)(x)>>3)
#define TIFFroundup_32(x, y) (TIFFhowmany_32(x,y)*(y))
#define TIFFhowmany_64(x, y) ((((uint64_t)(x))+(((uint64_t)(y))-1))/((uint64_t)(y)))
#define TIFFhowmany8_64(x) (((x)&0x07)?((uint64_t)(x)>>3)+1:(uint64_t)(x)>>3)
#define TIFFroundup_64(x, y) (TIFFhowmany_64(x,y)*(y))
/* Safe multiply which returns zero if there is an *unsigned* integer overflow. This macro is not safe for *signed* integer types */
#define TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
#define TIFFmax(A,B) ((A)>(B)?(A):(B))
#define TIFFmin(A,B) ((A)<(B)?(A):(B))
#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
/*
Support for large files.
Windows read/write APIs support only 'unsigned int' rather than 'size_t'.
Windows off_t is only 32-bit, even in 64-bit builds.
*/
#if defined(HAVE_FSEEKO)
/*
Use fseeko() and ftello() if they are available since they use
'off_t' rather than 'long'. It is wrong to use fseeko() and
ftello() only on systems with special LFS support since some systems
(e.g. FreeBSD) support a 64-bit off_t by default.
For MinGW, __MSVCRT_VERSION__ must be at least 0x800 to expose these
interfaces. The MinGW compiler must support the requested version. MinGW
does not distribute the CRT (it is supplied by Microsoft) so the correct CRT
must be available on the target computer in order for the program to run.
*/
#if defined(HAVE_FSEEKO)
# define fseek(stream,offset,whence) fseeko(stream,offset,whence)
# define ftell(stream,offset,whence) ftello(stream,offset,whence)
#endif
#endif
#if defined(__WIN32__) && \
!(defined(_MSC_VER) && _MSC_VER < 1400) && \
!(defined(__MSVCRT_VERSION__) && __MSVCRT_VERSION__ < 0x800)
typedef unsigned int TIFFIOSize_t;
#define _TIFF_lseek_f(fildes,offset,whence) _lseeki64(fildes,/* __int64 */ offset,whence)
/* #define _TIFF_tell_f(fildes) /\* __int64 *\/ _telli64(fildes) */
#define _TIFF_fseek_f(stream,offset,whence) _fseeki64(stream,/* __int64 */ offset,whence)
#define _TIFF_fstat_f(fildes,stat_buff) _fstati64(fildes,/* struct _stati64 */ stat_buff)
/* #define _TIFF_ftell_f(stream) /\* __int64 *\/ _ftelli64(stream) */
/* #define _TIFF_stat_f(path,stat_buff) _stati64(path,/\* struct _stati64 *\/ stat_buff) */
#define _TIFF_stat_s struct _stati64
#define _TIFF_off_t __int64
#else
typedef size_t TIFFIOSize_t;
#define _TIFF_lseek_f(fildes,offset,whence) lseek(fildes,offset,whence)
/* #define _TIFF_tell_f(fildes) (_TIFF_lseek_f(fildes,0,SEEK_CUR)) */
#define _TIFF_fseek_f(stream,offset,whence) fseek(stream,offset,whence)
#define _TIFF_fstat_f(fildes,stat_buff) fstat(fildes,stat_buff)
/* #define _TIFF_ftell_f(stream) ftell(stream) */
/* #define _TIFF_stat_f(path,stat_buff) stat(path,stat_buff) */
#define _TIFF_stat_s struct stat
#define _TIFF_off_t off_t
#endif
#if defined(__has_attribute) && defined(__clang__)
#if __has_attribute(no_sanitize)
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW __attribute__((no_sanitize("unsigned-integer-overflow")))
#else
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
#endif
#else
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
#endif
#if defined(__cplusplus)
extern "C" {
#endif
extern int _TIFFgetMode(const char* mode, const char* module);
extern int _TIFFNoRowEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
extern int _TIFFNoStripEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
extern int _TIFFNoTileEncode(TIFF*, uint8_t* pp, tmsize_t cc, uint16_t s);
extern int _TIFFNoRowDecode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
extern int _TIFFNoStripDecode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
extern int _TIFFNoTileDecode(TIFF*, uint8_t* pp, tmsize_t cc, uint16_t s);
extern void _TIFFNoPostDecode(TIFF* tif, uint8_t* buf, tmsize_t cc);
extern int _TIFFNoPreCode(TIFF* tif, uint16_t s);
extern int _TIFFNoSeek(TIFF* tif, uint32_t off);
extern void _TIFFSwab16BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
extern void _TIFFSwab24BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
extern void _TIFFSwab32BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
extern void _TIFFSwab64BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
extern int TIFFFlushData1(TIFF* tif);
extern int TIFFDefaultDirectory(TIFF* tif);
extern void _TIFFSetDefaultCompressionState(TIFF* tif);
extern int _TIFFRewriteField(TIFF *, uint16_t, TIFFDataType, tmsize_t, void *);
extern int TIFFSetCompressionScheme(TIFF* tif, int scheme);
extern int TIFFSetDefaultCompressionState(TIFF* tif);
extern uint32_t _TIFFDefaultStripSize(TIFF* tif, uint32_t s);
extern void _TIFFDefaultTileSize(TIFF* tif, uint32_t* tw, uint32_t* th);
extern int _TIFFDataSize(TIFFDataType type);
/*--: Rational2Double: Return size of TIFFSetGetFieldType in bytes. */
extern int _TIFFSetGetFieldSize(TIFFSetGetFieldType setgettype);
extern void _TIFFsetByteArray(void**, void*, uint32_t);
extern void _TIFFsetString(char**, char*);
extern void _TIFFsetShortArray(uint16_t**, uint16_t*, uint32_t);
extern void _TIFFsetLongArray(uint32_t**, uint32_t*, uint32_t);
extern void _TIFFsetFloatArray(float**, float*, uint32_t);
extern void _TIFFsetDoubleArray(double**, double*, uint32_t);
extern void _TIFFprintAscii(FILE*, const char*);
extern void _TIFFprintAsciiTag(FILE*, const char*, const char*);
extern TIFFErrorHandler _TIFFwarningHandler;
extern TIFFErrorHandler _TIFFerrorHandler;
extern TIFFErrorHandlerExt _TIFFwarningHandlerExt;
extern TIFFErrorHandlerExt _TIFFerrorHandlerExt;
extern uint32_t _TIFFMultiply32(TIFF*, uint32_t, uint32_t, const char*);
extern uint64_t _TIFFMultiply64(TIFF*, uint64_t, uint64_t, const char*);
extern tmsize_t _TIFFMultiplySSize(TIFF*, tmsize_t, tmsize_t, const char*);
extern tmsize_t _TIFFCastUInt64ToSSize(TIFF*, uint64_t, const char*);
extern void* _TIFFCheckMalloc(TIFF*, tmsize_t, tmsize_t, const char*);
extern void* _TIFFCheckRealloc(TIFF*, void*, tmsize_t, tmsize_t, const char*);
extern double _TIFFUInt64ToDouble(uint64_t);
extern float _TIFFUInt64ToFloat(uint64_t);
extern float _TIFFClampDoubleToFloat(double);
extern tmsize_t
_TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32_t strip,
void **buf, tmsize_t bufsizetoalloc,
tmsize_t size_to_read);
extern tmsize_t
_TIFFReadEncodedTileAndAllocBuffer(TIFF* tif, uint32_t tile,
void **buf, tmsize_t bufsizetoalloc,
tmsize_t size_to_read);
extern tmsize_t
_TIFFReadTileAndAllocBuffer(TIFF* tif,
void **buf, tmsize_t bufsizetoalloc,
uint32_t x, uint32_t y, uint32_t z, uint16_t s);
extern int _TIFFSeekOK(TIFF* tif, toff_t off);
extern int TIFFInitDumpMode(TIFF*, int);
#ifdef PACKBITS_SUPPORT
extern int TIFFInitPackBits(TIFF*, int);
#endif
#ifdef CCITT_SUPPORT
extern int TIFFInitCCITTRLE(TIFF*, int), TIFFInitCCITTRLEW(TIFF*, int);
extern int TIFFInitCCITTFax3(TIFF*, int), TIFFInitCCITTFax4(TIFF*, int);
#endif
#ifdef THUNDER_SUPPORT
extern int TIFFInitThunderScan(TIFF*, int);
#endif
#ifdef NEXT_SUPPORT
extern int TIFFInitNeXT(TIFF*, int);
#endif
#ifdef LZW_SUPPORT
extern int TIFFInitLZW(TIFF*, int);
#endif
#ifdef OJPEG_SUPPORT
extern int TIFFInitOJPEG(TIFF*, int);
#endif
#ifdef JPEG_SUPPORT
extern int TIFFInitJPEG(TIFF*, int);
extern int TIFFJPEGIsFullStripRequired(TIFF*);
#endif
#ifdef JBIG_SUPPORT
extern int TIFFInitJBIG(TIFF*, int);
#endif
#ifdef ZIP_SUPPORT
extern int TIFFInitZIP(TIFF*, int);
#endif
#ifdef PIXARLOG_SUPPORT
extern int TIFFInitPixarLog(TIFF*, int);
#endif
#ifdef LOGLUV_SUPPORT
extern int TIFFInitSGILog(TIFF*, int);
#endif
#ifdef LERC_SUPPORT
extern int TIFFInitLERC(TIFF* tif, int);
#endif
#ifdef LZMA_SUPPORT
extern int TIFFInitLZMA(TIFF*, int);
#endif
#ifdef ZSTD_SUPPORT
extern int TIFFInitZSTD(TIFF*, int);
#endif
#ifdef WEBP_SUPPORT
extern int TIFFInitWebP(TIFF*, int);
#endif
extern const TIFFCodec _TIFFBuiltinCODECS[];
#if defined(__cplusplus)
}
#endif
#endif /* _TIFFIOP_ */
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,4 +1,4 @@
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.2.0\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." #define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.3.0\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
@ -6,4 +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 20201219 #define TIFFLIB_VERSION 20210416

View File

@ -42,6 +42,7 @@
// TIFF // TIFF
#include "tiffio.h" #include "tiffio.h"
#include "tiffiop.h"
// WEBP // WEBP
#include <webp/decode.h> #include <webp/decode.h>
@ -285,7 +286,7 @@ namespace Textures {
ICO::bitmap_get_bpp ICO::bitmap_get_bpp
}; };
uint16_t width = 0, height = 0; SceUInt16 width = 0, height = 0;
ico_collection ico; ico_collection ico;
bmp_result code = BMP_OK; bmp_result code = BMP_OK;
bmp_image *bmp; bmp_image *bmp;
@ -401,14 +402,14 @@ namespace Textures {
static bool LoadImageTIFF(const std::string &path, Tex &texture) { static bool LoadImageTIFF(const std::string &path, Tex &texture) {
TIFF *tif = TIFFOpen(path.c_str(), "r"); TIFF *tif = TIFFOpen(path.c_str(), "r");
if (tif) { if (tif) {
size_t num_pixels = 0; size_t pixel_count = 0;
uint32 *raster = nullptr; SceUInt32 *raster = nullptr;
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &texture.width); TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &texture.width);
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &texture.height); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &texture.height);
num_pixels = texture.width * texture.height; pixel_count = texture.width * texture.height;
raster = static_cast<uint32 *>(_TIFFmalloc(num_pixels * sizeof(uint32))); raster = (SceUInt32 *)_TIFFCheckMalloc(tif, pixel_count, sizeof(SceUInt32), "raster buffer");
if (raster != nullptr) { if (raster != nullptr) {
if (TIFFReadRGBAImageOriented(tif, texture.width, texture.height, raster, ORIENTATION_TOPLEFT)) { if (TIFFReadRGBAImageOriented(tif, texture.width, texture.height, raster, ORIENTATION_TOPLEFT)) {
Textures::Create(reinterpret_cast<unsigned char*>(raster), GL_RGBA, texture); Textures::Create(reinterpret_cast<unsigned char*>(raster), GL_RGBA, texture);