ReactOS 0.4.15-dev-5666-gc548b97
tiffio.h File Reference
#include "tiff.h"
#include "tiffvers.h"
#include <stdio.h>
#include <stdarg.h>
Include dependency graph for tiffio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TIFFDisplay
 
struct  TIFFYCbCrToRGB
 
struct  TIFFCIELabToRGB
 
struct  _TIFFRGBAImage
 
struct  TIFFCodec
 
struct  TIFFTagMethods
 
struct  TIFFFieldInfo
 

Macros

#define TIFFPRINT_NONE   0x0 /* no extra info */
 
#define TIFFPRINT_STRIPS   0x1 /* strips/tiles info */
 
#define TIFFPRINT_CURVES   0x2 /* color/gray response curves */
 
#define TIFFPRINT_COLORMAP   0x4 /* colormap */
 
#define TIFFPRINT_JPEGQTABLES   0x100 /* JPEG Q matrices */
 
#define TIFFPRINT_JPEGACTABLES   0x200 /* JPEG AC tables */
 
#define TIFFPRINT_JPEGDCTABLES   0x200 /* JPEG DC tables */
 
#define D65_X0   (95.0470F)
 
#define D65_Y0   (100.0F)
 
#define D65_Z0   (108.8827F)
 
#define D50_X0   (96.4250F)
 
#define D50_Y0   (100.0F)
 
#define D50_Z0   (82.4680F)
 
#define CIELABTORGB_TABLE_RANGE   1500
 
#define TIFFGetR(abgr)   ((abgr) & 0xff)
 
#define TIFFGetG(abgr)   (((abgr) >> 8) & 0xff)
 
#define TIFFGetB(abgr)   (((abgr) >> 16) & 0xff)
 
#define TIFFGetA(abgr)   (((abgr) >> 24) & 0xff)
 
#define LOGLUV_PUBLIC   1
 
#define __attribute__(x)   /*nothing*/
 
#define TIFF_ANY   TIFF_NOTYPE /* for field descriptor searching */
 
#define TIFF_VARIABLE   -1 /* marker for variable length tags */
 
#define TIFF_SPP   -2 /* marker for SamplesPerPixel tags */
 
#define TIFF_VARIABLE2   -3 /* marker for uint32 var-length tags */
 
#define FIELD_CUSTOM   65
 
#define U_NEU   0.210526316
 
#define V_NEU   0.473684211
 
#define UVSCALE   410.
 

Typedefs

typedef struct tiff TIFF
 
typedef TIFF_SSIZE_T tmsize_t
 
typedef uint64 toff_t
 
typedef uint32 ttag_t
 
typedef uint16 tdir_t
 
typedef uint16 tsample_t
 
typedef uint32 tstrile_t
 
typedef tstrile_t tstrip_t
 
typedef tstrile_t ttile_t
 
typedef tmsize_t tsize_t
 
typedef voidtdata_t
 
typedef voidthandle_t
 
typedef unsigned char TIFFRGBValue
 
typedef struct _TIFFRGBAImage TIFFRGBAImage
 
typedef void(* tileContigRoutine) (TIFFRGBAImage *, uint32 *, uint32, uint32, uint32, uint32, int32, int32, unsigned char *)
 
typedef void(* tileSeparateRoutine) (TIFFRGBAImage *, uint32 *, uint32, uint32, uint32, uint32, int32, int32, unsigned char *, unsigned char *, unsigned char *, unsigned char *)
 
typedef int(* TIFFInitMethod) (TIFF *, int)
 
typedef void(* TIFFErrorHandler) (const char *, const char *, va_list)
 
typedef void(* TIFFErrorHandlerExt) (thandle_t, const char *, const char *, va_list)
 
typedef tmsize_t(* TIFFReadWriteProc) (thandle_t, void *, tmsize_t)
 
typedef toff_t(* TIFFSeekProc) (thandle_t, toff_t, int)
 
typedef int(* TIFFCloseProc) (thandle_t)
 
typedef toff_t(* TIFFSizeProc) (thandle_t)
 
typedef int(* TIFFMapFileProc) (thandle_t, void **base, toff_t *size)
 
typedef void(* TIFFUnmapFileProc) (thandle_t, void *base, toff_t size)
 
typedef void(* TIFFExtendProc) (TIFF *)
 
typedef struct _TIFFField TIFFField
 
typedef struct _TIFFFieldArray TIFFFieldArray
 
typedef int(* TIFFVSetMethod) (TIFF *, uint32, va_list)
 
typedef int(* TIFFVGetMethod) (TIFF *, uint32, va_list)
 
typedef void(* TIFFPrintMethod) (TIFF *, FILE *, long)
 

Functions

const charTIFFGetVersion (void)
 
const TIFFCodecTIFFFindCODEC (uint16)
 
TIFFCodecTIFFRegisterCODEC (uint16, const char *, TIFFInitMethod)
 
void TIFFUnRegisterCODEC (TIFFCodec *)
 
int TIFFIsCODECConfigured (uint16)
 
TIFFCodecTIFFGetConfiguredCODECs (void)
 
void_TIFFmalloc (tmsize_t s)
 
void_TIFFcalloc (tmsize_t nmemb, tmsize_t siz)
 
void_TIFFrealloc (void *p, tmsize_t s)
 
void _TIFFmemset (void *p, int v, tmsize_t c)
 
void _TIFFmemcpy (void *d, const void *s, tmsize_t c)
 
int _TIFFmemcmp (const void *p1, const void *p2, tmsize_t c)
 
void _TIFFfree (void *p)
 
int TIFFGetTagListCount (TIFF *)
 
uint32 TIFFGetTagListEntry (TIFF *, int tag_index)
 
const TIFFFieldTIFFFindField (TIFF *, uint32, TIFFDataType)
 
const TIFFFieldTIFFFieldWithTag (TIFF *, uint32)
 
const TIFFFieldTIFFFieldWithName (TIFF *, const char *)
 
uint32 TIFFFieldTag (const TIFFField *)
 
const charTIFFFieldName (const TIFFField *)
 
TIFFDataType TIFFFieldDataType (const TIFFField *)
 
int TIFFFieldPassCount (const TIFFField *)
 
int TIFFFieldReadCount (const TIFFField *)
 
int TIFFFieldWriteCount (const TIFFField *)
 
TIFFTagMethodsTIFFAccessTagMethods (TIFF *)
 
voidTIFFGetClientInfo (TIFF *, const char *)
 
void TIFFSetClientInfo (TIFF *, void *, const char *)
 
void TIFFCleanup (TIFF *tif)
 
void TIFFClose (TIFF *tif)
 
int TIFFFlush (TIFF *tif)
 
int TIFFFlushData (TIFF *tif)
 
int TIFFGetField (TIFF *tif, uint32 tag,...)
 
int TIFFVGetField (TIFF *tif, uint32 tag, va_list ap)
 
int TIFFGetFieldDefaulted (TIFF *tif, uint32 tag,...)
 
int TIFFVGetFieldDefaulted (TIFF *tif, uint32 tag, va_list ap)
 
int TIFFReadDirectory (TIFF *tif)
 
int TIFFReadCustomDirectory (TIFF *tif, toff_t diroff, const TIFFFieldArray *infoarray)
 
int TIFFReadEXIFDirectory (TIFF *tif, toff_t diroff)
 
uint64 TIFFScanlineSize64 (TIFF *tif)
 
tmsize_t TIFFScanlineSize (TIFF *tif)
 
uint64 TIFFRasterScanlineSize64 (TIFF *tif)
 
tmsize_t TIFFRasterScanlineSize (TIFF *tif)
 
uint64 TIFFStripSize64 (TIFF *tif)
 
tmsize_t TIFFStripSize (TIFF *tif)
 
uint64 TIFFRawStripSize64 (TIFF *tif, uint32 strip)
 
tmsize_t TIFFRawStripSize (TIFF *tif, uint32 strip)
 
uint64 TIFFVStripSize64 (TIFF *tif, uint32 nrows)
 
tmsize_t TIFFVStripSize (TIFF *tif, uint32 nrows)
 
uint64 TIFFTileRowSize64 (TIFF *tif)
 
tmsize_t TIFFTileRowSize (TIFF *tif)
 
uint64 TIFFTileSize64 (TIFF *tif)
 
tmsize_t TIFFTileSize (TIFF *tif)
 
uint64 TIFFVTileSize64 (TIFF *tif, uint32 nrows)
 
tmsize_t TIFFVTileSize (TIFF *tif, uint32 nrows)
 
uint32 TIFFDefaultStripSize (TIFF *tif, uint32 request)
 
void TIFFDefaultTileSize (TIFF *, uint32 *, uint32 *)
 
int TIFFFileno (TIFF *)
 
int TIFFSetFileno (TIFF *, int)
 
thandle_t TIFFClientdata (TIFF *)
 
thandle_t TIFFSetClientdata (TIFF *, thandle_t)
 
int TIFFGetMode (TIFF *)
 
int TIFFSetMode (TIFF *, int)
 
int TIFFIsTiled (TIFF *)
 
int TIFFIsByteSwapped (TIFF *)
 
int TIFFIsUpSampled (TIFF *)
 
int TIFFIsMSB2LSB (TIFF *)
 
int TIFFIsBigEndian (TIFF *)
 
TIFFReadWriteProc TIFFGetReadProc (TIFF *)
 
TIFFReadWriteProc TIFFGetWriteProc (TIFF *)
 
TIFFSeekProc TIFFGetSeekProc (TIFF *)
 
TIFFCloseProc TIFFGetCloseProc (TIFF *)
 
TIFFSizeProc TIFFGetSizeProc (TIFF *)
 
TIFFMapFileProc TIFFGetMapFileProc (TIFF *)
 
TIFFUnmapFileProc TIFFGetUnmapFileProc (TIFF *)
 
uint32 TIFFCurrentRow (TIFF *)
 
uint16 TIFFCurrentDirectory (TIFF *)
 
uint16 TIFFNumberOfDirectories (TIFF *)
 
uint64 TIFFCurrentDirOffset (TIFF *)
 
uint32 TIFFCurrentStrip (TIFF *)
 
uint32 TIFFCurrentTile (TIFF *tif)
 
int TIFFReadBufferSetup (TIFF *tif, void *bp, tmsize_t size)
 
int TIFFWriteBufferSetup (TIFF *tif, void *bp, tmsize_t size)
 
int TIFFSetupStrips (TIFF *)
 
int TIFFWriteCheck (TIFF *, int, const char *)
 
void TIFFFreeDirectory (TIFF *)
 
int TIFFCreateDirectory (TIFF *)
 
int TIFFCreateCustomDirectory (TIFF *, const TIFFFieldArray *)
 
int TIFFCreateEXIFDirectory (TIFF *)
 
int TIFFLastDirectory (TIFF *)
 
int TIFFSetDirectory (TIFF *, uint16)
 
int TIFFSetSubDirectory (TIFF *, uint64)
 
int TIFFUnlinkDirectory (TIFF *, uint16)
 
int TIFFSetField (TIFF *, uint32,...)
 
int TIFFVSetField (TIFF *, uint32, va_list)
 
int TIFFUnsetField (TIFF *, uint32)
 
int TIFFWriteDirectory (TIFF *)
 
int TIFFWriteCustomDirectory (TIFF *, uint64 *)
 
int TIFFCheckpointDirectory (TIFF *)
 
int TIFFRewriteDirectory (TIFF *)
 
int TIFFDeferStrileArrayWriting (TIFF *)
 
int TIFFForceStrileArrayWriting (TIFF *)
 
void TIFFPrintDirectory (TIFF *, FILE *, long)
 
int TIFFReadScanline (TIFF *tif, void *buf, uint32 row, uint16 sample)
 
int TIFFWriteScanline (TIFF *tif, void *buf, uint32 row, uint16 sample)
 
int TIFFReadRGBAImage (TIFF *, uint32, uint32, uint32 *, int)
 
int TIFFReadRGBAImageOriented (TIFF *, uint32, uint32, uint32 *, int, int)
 
int TIFFReadRGBAStrip (TIFF *, uint32, uint32 *)
 
int TIFFReadRGBATile (TIFF *, uint32, uint32, uint32 *)
 
int TIFFReadRGBAStripExt (TIFF *, uint32, uint32 *, int stop_on_error)
 
int TIFFReadRGBATileExt (TIFF *, uint32, uint32, uint32 *, int stop_on_error)
 
int TIFFRGBAImageOK (TIFF *, char[1024])
 
int TIFFRGBAImageBegin (TIFFRGBAImage *, TIFF *, int, char[1024])
 
int TIFFRGBAImageGet (TIFFRGBAImage *, uint32 *, uint32, uint32)
 
void TIFFRGBAImageEnd (TIFFRGBAImage *)
 
TIFFTIFFOpen (const char *, const char *)
 
TIFFTIFFFdOpen (int, const char *, const char *)
 
TIFFTIFFClientOpen (const char *, const char *, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc)
 
const charTIFFFileName (TIFF *)
 
const charTIFFSetFileName (TIFF *, const char *)
 
void TIFFError (const char *, const char *,...) __attribute__((__format__(__printf__
 
void void TIFFErrorExt (thandle_t, const char *, const char *,...) __attribute__((__format__(__printf__
 
void void void TIFFWarning (const char *, const char *,...) __attribute__((__format__(__printf__
 
void void void void TIFFWarningExt (thandle_t, const char *, const char *,...) __attribute__((__format__(__printf__
 
void void void void TIFFErrorHandler TIFFSetErrorHandler (TIFFErrorHandler)
 
TIFFErrorHandlerExt TIFFSetErrorHandlerExt (TIFFErrorHandlerExt)
 
TIFFErrorHandler TIFFSetWarningHandler (TIFFErrorHandler)
 
TIFFErrorHandlerExt TIFFSetWarningHandlerExt (TIFFErrorHandlerExt)
 
TIFFExtendProc TIFFSetTagExtender (TIFFExtendProc)
 
uint32 TIFFComputeTile (TIFF *tif, uint32 x, uint32 y, uint32 z, uint16 s)
 
int TIFFCheckTile (TIFF *tif, uint32 x, uint32 y, uint32 z, uint16 s)
 
uint32 TIFFNumberOfTiles (TIFF *)
 
tmsize_t TIFFReadTile (TIFF *tif, void *buf, uint32 x, uint32 y, uint32 z, uint16 s)
 
tmsize_t TIFFWriteTile (TIFF *tif, void *buf, uint32 x, uint32 y, uint32 z, uint16 s)
 
uint32 TIFFComputeStrip (TIFF *, uint32, uint16)
 
uint32 TIFFNumberOfStrips (TIFF *)
 
tmsize_t TIFFReadEncodedStrip (TIFF *tif, uint32 strip, void *buf, tmsize_t size)
 
tmsize_t TIFFReadRawStrip (TIFF *tif, uint32 strip, void *buf, tmsize_t size)
 
tmsize_t TIFFReadEncodedTile (TIFF *tif, uint32 tile, void *buf, tmsize_t size)
 
tmsize_t TIFFReadRawTile (TIFF *tif, uint32 tile, void *buf, tmsize_t size)
 
int TIFFReadFromUserBuffer (TIFF *tif, uint32 strile, void *inbuf, tmsize_t insize, void *outbuf, tmsize_t outsize)
 
tmsize_t TIFFWriteEncodedStrip (TIFF *tif, uint32 strip, void *data, tmsize_t cc)
 
tmsize_t TIFFWriteRawStrip (TIFF *tif, uint32 strip, void *data, tmsize_t cc)
 
tmsize_t TIFFWriteEncodedTile (TIFF *tif, uint32 tile, void *data, tmsize_t cc)
 
tmsize_t TIFFWriteRawTile (TIFF *tif, uint32 tile, void *data, tmsize_t cc)
 
int TIFFDataWidth (TIFFDataType)
 
void TIFFSetWriteOffset (TIFF *tif, toff_t off)
 
void TIFFSwabShort (uint16 *)
 
void TIFFSwabLong (uint32 *)
 
void TIFFSwabLong8 (uint64 *)
 
void TIFFSwabFloat (float *)
 
void TIFFSwabDouble (double *)
 
void TIFFSwabArrayOfShort (uint16 *wp, tmsize_t n)
 
void TIFFSwabArrayOfTriples (uint8 *tp, tmsize_t n)
 
void TIFFSwabArrayOfLong (uint32 *lp, tmsize_t n)
 
void TIFFSwabArrayOfLong8 (uint64 *lp, tmsize_t n)
 
void TIFFSwabArrayOfFloat (float *fp, tmsize_t n)
 
void TIFFSwabArrayOfDouble (double *dp, tmsize_t n)
 
void TIFFReverseBits (uint8 *cp, tmsize_t n)
 
const unsigned charTIFFGetBitRevTable (int)
 
uint64 TIFFGetStrileOffset (TIFF *tif, uint32 strile)
 
uint64 TIFFGetStrileByteCount (TIFF *tif, uint32 strile)
 
uint64 TIFFGetStrileOffsetWithErr (TIFF *tif, uint32 strile, int *pbErr)
 
uint64 TIFFGetStrileByteCountWithErr (TIFF *tif, uint32 strile, int *pbErr)
 
double LogL16toY (int)
 
double LogL10toY (int)
 
void XYZtoRGB24 (float *, uint8 *)
 
int uv_decode (double *, double *, int)
 
void LogLuv24toXYZ (uint32, float *)
 
void LogLuv32toXYZ (uint32, float *)
 
int LogL16fromY (double, int)
 
int LogL10fromY (double, int)
 
int uv_encode (double, double, int)
 
uint32 LogLuv24fromXYZ (float *, int)
 
uint32 LogLuv32fromXYZ (float *, int)
 
int TIFFCIELabToRGBInit (TIFFCIELabToRGB *, const TIFFDisplay *, float *)
 
void TIFFCIELabToXYZ (TIFFCIELabToRGB *, uint32, int32, int32, float *, float *, float *)
 
void TIFFXYZToRGB (TIFFCIELabToRGB *, float, float, float, uint32 *, uint32 *, uint32 *)
 
int TIFFYCbCrToRGBInit (TIFFYCbCrToRGB *, float *, float *)
 
void TIFFYCbCrtoRGB (TIFFYCbCrToRGB *, uint32, int32, int32, uint32 *, uint32 *, uint32 *)
 
int TIFFMergeFieldInfo (TIFF *, const TIFFFieldInfo[], uint32)
 

Macro Definition Documentation

◆ __attribute__

#define __attribute__ (   x)    /*nothing*/

Definition at line 265 of file tiffio.h.

◆ CIELABTORGB_TABLE_RANGE

#define CIELABTORGB_TABLE_RANGE   1500

Definition at line 165 of file tiffio.h.

◆ D50_X0

#define D50_X0   (96.4250F)

Definition at line 130 of file tiffio.h.

◆ D50_Y0

#define D50_Y0   (100.0F)

Definition at line 131 of file tiffio.h.

◆ D50_Z0

#define D50_Z0   (82.4680F)

Definition at line 132 of file tiffio.h.

◆ D65_X0

#define D65_X0   (95.0470F)

Definition at line 126 of file tiffio.h.

◆ D65_Y0

#define D65_Y0   (100.0F)

Definition at line 127 of file tiffio.h.

◆ D65_Z0

#define D65_Z0   (108.8827F)

Definition at line 128 of file tiffio.h.

◆ FIELD_CUSTOM

#define FIELD_CUSTOM   65

Definition at line 312 of file tiffio.h.

◆ LOGLUV_PUBLIC

#define LOGLUV_PUBLIC   1

Definition at line 261 of file tiffio.h.

◆ TIFF_ANY

#define TIFF_ANY   TIFF_NOTYPE /* for field descriptor searching */

Definition at line 307 of file tiffio.h.

◆ TIFF_SPP

#define TIFF_SPP   -2 /* marker for SamplesPerPixel tags */

Definition at line 309 of file tiffio.h.

◆ TIFF_VARIABLE

#define TIFF_VARIABLE   -1 /* marker for variable length tags */

Definition at line 308 of file tiffio.h.

◆ TIFF_VARIABLE2

#define TIFF_VARIABLE2   -3 /* marker for uint32 var-length tags */

Definition at line 310 of file tiffio.h.

◆ TIFFGetA

#define TIFFGetA (   abgr)    (((abgr) >> 24) & 0xff)

Definition at line 240 of file tiffio.h.

◆ TIFFGetB

#define TIFFGetB (   abgr)    (((abgr) >> 16) & 0xff)

Definition at line 239 of file tiffio.h.

◆ TIFFGetG

#define TIFFGetG (   abgr)    (((abgr) >> 8) & 0xff)

Definition at line 238 of file tiffio.h.

◆ TIFFGetR

#define TIFFGetR (   abgr)    ((abgr) & 0xff)

Definition at line 237 of file tiffio.h.

◆ TIFFPRINT_COLORMAP

#define TIFFPRINT_COLORMAP   0x4 /* colormap */

Definition at line 116 of file tiffio.h.

◆ TIFFPRINT_CURVES

#define TIFFPRINT_CURVES   0x2 /* color/gray response curves */

Definition at line 115 of file tiffio.h.

◆ TIFFPRINT_JPEGACTABLES

#define TIFFPRINT_JPEGACTABLES   0x200 /* JPEG AC tables */

Definition at line 118 of file tiffio.h.

◆ TIFFPRINT_JPEGDCTABLES

#define TIFFPRINT_JPEGDCTABLES   0x200 /* JPEG DC tables */

Definition at line 119 of file tiffio.h.

◆ TIFFPRINT_JPEGQTABLES

#define TIFFPRINT_JPEGQTABLES   0x100 /* JPEG Q matrices */

Definition at line 117 of file tiffio.h.

◆ TIFFPRINT_NONE

#define TIFFPRINT_NONE   0x0 /* no extra info */

Definition at line 113 of file tiffio.h.

◆ TIFFPRINT_STRIPS

#define TIFFPRINT_STRIPS   0x1 /* strips/tiles info */

Definition at line 114 of file tiffio.h.

◆ U_NEU

#define U_NEU   0.210526316

Definition at line 502 of file tiffio.h.

◆ UVSCALE

#define UVSCALE   410.

Definition at line 504 of file tiffio.h.

◆ V_NEU

#define V_NEU   0.473684211

Definition at line 503 of file tiffio.h.

Typedef Documentation

◆ tdata_t

typedef void* tdata_t

Definition at line 76 of file tiffio.h.

◆ tdir_t

typedef uint16 tdir_t

Definition at line 70 of file tiffio.h.

◆ thandle_t

typedef void* thandle_t

Definition at line 104 of file tiffio.h.

◆ TIFF

typedef struct tiff TIFF

Definition at line 38 of file tiffio.h.

◆ TIFFCloseProc

typedef int(* TIFFCloseProc) (thandle_t)

Definition at line 275 of file tiffio.h.

◆ TIFFErrorHandler

typedef void(* TIFFErrorHandler) (const char *, const char *, va_list)

Definition at line 271 of file tiffio.h.

◆ TIFFErrorHandlerExt

typedef void(* TIFFErrorHandlerExt) (thandle_t, const char *, const char *, va_list)

Definition at line 272 of file tiffio.h.

◆ TIFFExtendProc

typedef void(* TIFFExtendProc) (TIFF *)

Definition at line 279 of file tiffio.h.

◆ TIFFField

Definition at line 314 of file tiffio.h.

◆ TIFFFieldArray

Definition at line 315 of file tiffio.h.

◆ TIFFInitMethod

typedef int(* TIFFInitMethod) (TIFF *, int)

Definition at line 249 of file tiffio.h.

◆ TIFFMapFileProc

typedef int(* TIFFMapFileProc) (thandle_t, void **base, toff_t *size)

Definition at line 277 of file tiffio.h.

◆ TIFFPrintMethod

typedef void(* TIFFPrintMethod) (TIFF *, FILE *, long)

Definition at line 330 of file tiffio.h.

◆ TIFFReadWriteProc

typedef tmsize_t(* TIFFReadWriteProc) (thandle_t, void *, tmsize_t)

Definition at line 273 of file tiffio.h.

◆ TIFFRGBAImage

Definition at line 177 of file tiffio.h.

◆ TIFFRGBValue

Definition at line 136 of file tiffio.h.

◆ TIFFSeekProc

typedef toff_t(* TIFFSeekProc) (thandle_t, toff_t, int)

Definition at line 274 of file tiffio.h.

◆ TIFFSizeProc

typedef toff_t(* TIFFSizeProc) (thandle_t)

Definition at line 276 of file tiffio.h.

◆ TIFFUnmapFileProc

typedef void(* TIFFUnmapFileProc) (thandle_t, void *base, toff_t size)

Definition at line 278 of file tiffio.h.

◆ TIFFVGetMethod

typedef int(* TIFFVGetMethod) (TIFF *, uint32, va_list)

Definition at line 329 of file tiffio.h.

◆ TIFFVSetMethod

typedef int(* TIFFVSetMethod) (TIFF *, uint32, va_list)

Definition at line 328 of file tiffio.h.

◆ tileContigRoutine

typedef void(* tileContigRoutine) (TIFFRGBAImage *, uint32 *, uint32, uint32, uint32, uint32, int32, int32, unsigned char *)

Definition at line 188 of file tiffio.h.

◆ tileSeparateRoutine

typedef void(* tileSeparateRoutine) (TIFFRGBAImage *, uint32 *, uint32, uint32, uint32, uint32, int32, int32, unsigned char *, unsigned char *, unsigned char *, unsigned char *)

Definition at line 191 of file tiffio.h.

◆ tmsize_t

Definition at line 65 of file tiffio.h.

◆ toff_t

typedef uint64 toff_t

Definition at line 66 of file tiffio.h.

◆ tsample_t

typedef uint16 tsample_t

Definition at line 71 of file tiffio.h.

◆ tsize_t

typedef tmsize_t tsize_t

Definition at line 75 of file tiffio.h.

◆ tstrile_t

typedef uint32 tstrile_t

Definition at line 72 of file tiffio.h.

◆ tstrip_t

Definition at line 73 of file tiffio.h.

◆ ttag_t

typedef uint32 ttag_t

Definition at line 69 of file tiffio.h.

◆ ttile_t

typedef tstrile_t ttile_t

Definition at line 74 of file tiffio.h.

Function Documentation

◆ _TIFFcalloc()

void * _TIFFcalloc ( tmsize_t  nmemb,
tmsize_t  siz 
)

Definition at line 317 of file tif_unix.c.

318{
319 if( nmemb == 0 || siz == 0 )
320 return ((void *) NULL);
321
322 return calloc((size_t) nmemb, (size_t)siz);
323}
#define NULL
Definition: types.h:112
#define calloc
Definition: rosglue.h:14

Referenced by TIFFReadBufferSetup(), and TIFFReadDirectory().

◆ _TIFFfree()

void _TIFFfree ( void p)

Definition at line 326 of file tif_unix.c.

327{
328 free(p);
329}
#define free
Definition: debug_ros.c:5
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by _TIFFCreateAnonField(), _TIFFFetchStrileValue(), _TIFFFillStrilesInternal(), _TIFFRewriteField(), _TIFFSetupFields(), _TIFFVSetField(), allocChoppedUpStripArrays(), EstimateStripByteCounts(), fpAcc(), fpDiff(), gtStripContig(), gtStripSeparate(), gtTileContig(), gtTileSeparate(), initCIELabConversion(), PredictorEncodeTile(), setByteArray(), setDoubleArrayOneValue(), setExtraSamples(), setupMap(), TIFFCleanup(), TIFFClientOpen(), TIFFDefaultDirectory(), TIFFDefaultTransferFunction(), TIFFFetchDirectory(), TIFFFetchNormalTag(), TIFFFetchStripThing(), TIFFFillStrip(), TIFFFillTile(), TIFFFreeDirectory(), TIFFGetConfiguredCODECs(), TIFFGrowStrips(), TIFFOpenW(), TIFFPrintDirectory(), TIFFReadAndRealloc(), TIFFReadBufferSetup(), TIFFReadCustomDirectory(), TIFFReadDirectory(), TIFFReadDirEntryArrayWithLimit(), TIFFReadDirEntryByteArray(), TIFFReadDirEntryDoubleArray(), TIFFReadDirEntryFloatArray(), TIFFReadDirEntryIfd8Array(), TIFFReadDirEntryLong8ArrayWithLimit(), TIFFReadDirEntryLongArray(), TIFFReadDirEntryPersampleShort(), TIFFReadDirEntrySbyteArray(), TIFFReadDirEntryShortArray(), TIFFReadDirEntrySlong8Array(), TIFFReadDirEntrySlongArray(), TIFFReadDirEntrySshortArray(), TIFFRGBAImageEnd(), TIFFUnlinkDirectory(), TIFFUnRegisterCODEC(), TIFFUnsetField(), TIFFWriteBufferSetup(), TIFFWriteDirectorySec(), TIFFWriteDirectoryTagCheckedRationalArray(), TIFFWriteDirectoryTagCheckedSrationalArray(), TIFFWriteDirectoryTagColormap(), TIFFWriteDirectoryTagIfdIfd8Array(), TIFFWriteDirectoryTagLongLong8Array(), TIFFWriteDirectoryTagSampleformatArray(), TIFFWriteDirectoryTagShortPerSample(), TIFFWriteDirectoryTagSubifd(), and TIFFWriteDirectoryTagTransferfunction().

◆ _TIFFmalloc()

void * _TIFFmalloc ( tmsize_t  s)

◆ _TIFFmemcmp()

int _TIFFmemcmp ( const void p1,
const void p2,
tmsize_t  c 
)

Definition at line 350 of file tif_unix.c.

351{
352 return (memcmp(p1, p2, (size_t) c));
353}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
const GLubyte * c
Definition: glext.h:8905

Referenced by TIFFWriteDirectoryTagTransferfunction().

◆ _TIFFmemcpy()

◆ _TIFFmemset()

◆ _TIFFrealloc()

void * _TIFFrealloc ( void p,
tmsize_t  s 
)

Definition at line 332 of file tif_unix.c.

333{
334 return (realloc(p, (size_t) s));
335}
#define realloc
Definition: debug_ros.c:6

Referenced by _TIFFCheckRealloc(), _TIFFFetchStrileValue(), _TIFFVSetField(), TIFFGetConfiguredCODECs(), TIFFGrowStrips(), TIFFReadAndRealloc(), and TIFFReadDirEntryDataAndRealloc().

◆ LogL10fromY()

int LogL10fromY ( double  ,
int   
)

◆ LogL10toY()

double LogL10toY ( int  )

◆ LogL16fromY()

int LogL16fromY ( double  ,
int   
)

◆ LogL16toY()

double LogL16toY ( int  )

◆ LogLuv24fromXYZ()

uint32 LogLuv24fromXYZ ( float ,
int   
)

◆ LogLuv24toXYZ()

void LogLuv24toXYZ ( uint32  ,
float  
)

◆ LogLuv32fromXYZ()

uint32 LogLuv32fromXYZ ( float ,
int   
)

◆ LogLuv32toXYZ()

void LogLuv32toXYZ ( uint32  ,
float  
)

◆ TIFFAccessTagMethods()

TIFFTagMethods * TIFFAccessTagMethods ( TIFF tif)

Definition at line 58 of file tif_extension.c.

60{
61 return &(tif->tif_tagmethods);
62}
TIFFTagMethods tif_tagmethods
Definition: tiffiop.h:219

◆ TIFFCheckpointDirectory()

int TIFFCheckpointDirectory ( TIFF tif)

Definition at line 237 of file tif_dirwrite.c.

238{
239 int rc;
240 /* Setup the strips arrays, if they haven't already been. */
241 if (tif->tif_dir.td_stripoffset_p == NULL)
242 (void) TIFFSetupStrips(tif);
245 return rc;
246}
#define SEEK_END
Definition: cabinet.c:27
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
uint64 * td_stripoffset_p
Definition: tif_dir.h:101
TIFFDirectory tif_dir
Definition: tiffiop.h:151
static int TIFFWriteDirectorySec(TIFF *tif, int isimage, int imagedone, uint64 *pdiroff)
Definition: tif_dirwrite.c:407
void TIFFSetWriteOffset(TIFF *tif, toff_t off)
Definition: tif_write.c:834
int TIFFSetupStrips(TIFF *tif)
Definition: tif_write.c:523
#define TIFFSeekFile(tif, off, whence)
Definition: tiffiop.h:237

◆ TIFFCheckTile()

int TIFFCheckTile ( TIFF tif,
uint32  x,
uint32  y,
uint32  z,
uint16  s 
)

Definition at line 73 of file tif_tile.c.

74{
75 TIFFDirectory *td = &tif->tif_dir;
76
77 if (x >= td->td_imagewidth) {
79 "%lu: Col out of range, max %lu",
80 (unsigned long) x,
81 (unsigned long) (td->td_imagewidth - 1));
82 return (0);
83 }
84 if (y >= td->td_imagelength) {
86 "%lu: Row out of range, max %lu",
87 (unsigned long) y,
88 (unsigned long) (td->td_imagelength - 1));
89 return (0);
90 }
91 if (z >= td->td_imagedepth) {
93 "%lu: Depth out of range, max %lu",
94 (unsigned long) z,
95 (unsigned long) (td->td_imagedepth - 1));
96 return (0);
97 }
99 s >= td->td_samplesperpixel) {
101 "%lu: Sample out of range, max %lu",
102 (unsigned long) s,
103 (unsigned long) (td->td_samplesperpixel - 1));
104 return (0);
105 }
106 return (1);
107}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble z
Definition: glext.h:5874
uint16 td_samplesperpixel
Definition: tif_dir.h:82
uint32 td_imagedepth
Definition: tif_dir.h:72
uint32 td_imagewidth
Definition: tif_dir.h:72
uint16 td_planarconfig
Definition: tif_dir.h:89
uint32 td_imagelength
Definition: tif_dir.h:72
thandle_t tif_clientdata
Definition: tiffiop.h:207
char * tif_name
Definition: tiffiop.h:116
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
#define PLANARCONFIG_SEPARATE
Definition: tiff.h:240

Referenced by _TIFFReadTileAndAllocBuffer(), TIFFReadTile(), and TIFFWriteTile().

◆ TIFFCIELabToRGBInit()

int TIFFCIELabToRGBInit ( TIFFCIELabToRGB cielab,
const TIFFDisplay display,
float refWhite 
)

Definition at line 123 of file tif_color.c.

125{
126 int i;
127 double dfGamma;
128
130
131 _TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay));
132
133 /* Red */
134 dfGamma = 1.0 / cielab->display.d_gammaR ;
135 cielab->rstep =
136 (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
137 for(i = 0; i <= cielab->range; i++) {
138 cielab->Yr2r[i] = cielab->display.d_Vrwr
139 * ((float)pow((double)i / cielab->range, dfGamma));
140 }
141
142 /* Green */
143 dfGamma = 1.0 / cielab->display.d_gammaG ;
144 cielab->gstep =
145 (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
146 for(i = 0; i <= cielab->range; i++) {
147 cielab->Yg2g[i] = cielab->display.d_Vrwg
148 * ((float)pow((double)i / cielab->range, dfGamma));
149 }
150
151 /* Blue */
152 dfGamma = 1.0 / cielab->display.d_gammaB ;
153 cielab->bstep =
154 (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
155 for(i = 0; i <= cielab->range; i++) {
156 cielab->Yb2b[i] = cielab->display.d_Vrwb
157 * ((float)pow((double)i / cielab->range, dfGamma));
158 }
159
160 /* Init reference white point */
161 cielab->X0 = refWhite[0];
162 cielab->Y0 = refWhite[1];
163 cielab->Z0 = refWhite[2];
164
165 return 0;
166}
double pow(double x, double y)
Definition: freeldr.c:110
GLenum GLint * range
Definition: glext.h:7539
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static float(__cdecl *square_half_float)(float x
float Yb2b[CIELABTORGB_TABLE_RANGE+1]
Definition: tiffio.h:171
float bstep
Definition: tiffio.h:166
TIFFDisplay display
Definition: tiffio.h:168
float rstep
Definition: tiffio.h:166
float gstep
Definition: tiffio.h:166
float Yr2r[CIELABTORGB_TABLE_RANGE+1]
Definition: tiffio.h:169
float Yg2g[CIELABTORGB_TABLE_RANGE+1]
Definition: tiffio.h:170
uint32 d_Vrwr
Definition: tiffio.h:143
float d_gammaG
Definition: tiffio.h:150
uint32 d_Vrwb
Definition: tiffio.h:145
float d_Y0R
Definition: tiffio.h:146
float d_gammaR
Definition: tiffio.h:149
float d_YCR
Definition: tiffio.h:140
float d_gammaB
Definition: tiffio.h:151
uint32 d_Vrwg
Definition: tiffio.h:144
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
Definition: tif_unix.c:344
#define CIELABTORGB_TABLE_RANGE
Definition: tiffio.h:165
int * display
Definition: x11stubs.c:12

Referenced by initCIELabConversion().

◆ TIFFCIELabToXYZ()

void TIFFCIELabToXYZ ( TIFFCIELabToRGB cielab,
uint32  l,
int32  a,
int32  b,
float X,
float Y,
float Z 
)

Definition at line 44 of file tif_color.c.

46{
47 float L = (float)l * 100.0F / 255.0F;
48 float cby, tmp;
49
50 if( L < 8.856F ) {
51 *Y = (L * cielab->Y0) / 903.292F;
52 cby = 7.787F * (*Y / cielab->Y0) + 16.0F / 116.0F;
53 } else {
54 cby = (L + 16.0F) / 116.0F;
55 *Y = cielab->Y0 * cby * cby * cby;
56 }
57
58 tmp = (float)a / 500.0F + cby;
59 if( tmp < 0.2069F )
60 *X = cielab->X0 * (tmp - 0.13793F) / 7.787F;
61 else
62 *X = cielab->X0 * tmp * tmp * tmp;
63
64 tmp = cby - (float)b / 200.0F;
65 if( tmp < 0.2069F )
66 *Z = cielab->Z0 * (tmp - 0.13793F) / 7.787F;
67 else
68 *Z = cielab->Z0 * tmp * tmp * tmp;
69}
r l[0]
Definition: byte_order.h:167
#define Z(I)
#define Y(I)
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define L(x)
Definition: ntvdm.h:50

Referenced by DECLAREContigPutFunc().

◆ TIFFCleanup()

void TIFFCleanup ( TIFF tif)

Auxiliary function to free the TIFF structure. Given structure will be completely freed, so you should save opened file handle and pointer to the close procedure in external variables before calling _TIFFCleanup(), if you will need these ones to close the file.

Parameters
tifA TIFF pointer.

Definition at line 46 of file tif_close.c.

47{
48 /*
49 * Flush buffered data and directory (if dirty).
50 */
51 if (tif->tif_mode != O_RDONLY)
52 TIFFFlush(tif);
53 (*tif->tif_cleanup)(tif);
55
56 if (tif->tif_dirlist)
58
59 /*
60 * Clean up client info links.
61 */
62 while( tif->tif_clientinfo )
63 {
65
66 tif->tif_clientinfo = psLink->next;
67 _TIFFfree( psLink->name );
68 _TIFFfree( psLink );
69 }
70
71 if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER))
73 if (isMapped(tif))
75
76 /*
77 * Clean up custom fields.
78 */
79 if (tif->tif_fields && tif->tif_nfields > 0) {
80 uint32 i;
81
82 for (i = 0; i < tif->tif_nfields; i++) {
83 TIFFField *fld = tif->tif_fields[i];
84 if (fld->field_bit == FIELD_CUSTOM &&
85 strncmp("Tag ", fld->field_name, 4) == 0) {
87 _TIFFfree(fld);
88 }
89 }
90
92 }
93
94 if (tif->tif_nfieldscompat > 0) {
95 uint32 i;
96
97 for (i = 0; i < tif->tif_nfieldscompat; i++) {
100 }
102 }
103
104 _TIFFfree(tif);
105}
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define O_RDONLY
Definition: acwin.h:108
unsigned int uint32
Definition: types.h:32
TIFFField * fields
Definition: tif_dir.h:279
uint32 allocated_size
Definition: tif_dir.h:277
char * field_name
Definition: tif_dir.h:293
unsigned short field_bit
Definition: tif_dir.h:290
struct client_info * next
Definition: tiffiop.h:94
char * name
Definition: tiffiop.h:96
uint64 * tif_dirlist
Definition: tiffiop.h:148
size_t tif_nfields
Definition: tiffiop.h:217
TIFFClientInfoLink * tif_clientinfo
Definition: tiffiop.h:220
TIFFField ** tif_fields
Definition: tiffiop.h:216
uint8 * tif_base
Definition: tiffiop.h:202
uint32 tif_flags
Definition: tiffiop.h:119
tmsize_t tif_size
Definition: tiffiop.h:203
TIFFVoidMethod tif_cleanup
Definition: tiffiop.h:188
size_t tif_nfieldscompat
Definition: tiffiop.h:224
int tif_mode
Definition: tiffiop.h:118
TIFFFieldArray * tif_fieldscompat
Definition: tiffiop.h:223
uint8 * tif_rawdata
Definition: tiffiop.h:195
void TIFFFreeDirectory(TIFF *tif)
Definition: tif_dir.c:1268
int TIFFFlush(TIFF *tif)
Definition: tif_flush.c:32
void _TIFFfree(void *p)
Definition: tif_unix.c:326
uint64 toff_t
Definition: tiffio.h:66
#define FIELD_CUSTOM
Definition: tiffio.h:312
#define TIFF_MYBUFFER
Definition: tiffiop.h:128
#define TIFFUnmapFileContents(tif, addr, size)
Definition: tiffiop.h:245
#define isMapped(tif)
Definition: tiffiop.h:230

Referenced by TIFFClientOpen(), and TIFFClose().

◆ TIFFClientdata()

thandle_t TIFFClientdata ( TIFF tif)

Definition at line 553 of file tif_open.c.

554{
555 return (tif->tif_clientdata);
556}

◆ TIFFClientOpen()

TIFF * TIFFClientOpen ( const char name,
const char mode,
thandle_t  clientdata,
TIFFReadWriteProc  readproc,
TIFFReadWriteProc  writeproc,
TIFFSeekProc  seekproc,
TIFFCloseProc  closeproc,
TIFFSizeProc  sizeproc,
TIFFMapFileProc  mapproc,
TIFFUnmapFileProc  unmapproc 
)

Definition at line 71 of file tif_open.c.

82{
83 static const char module[] = "TIFFClientOpen";
84 TIFF *tif;
85 int m;
86 const char* cp;
87
88 /* The following are configuration checks. They should be redundant, but should not
89 * compile to any actual code in an optimised release build anyway. If any of them
90 * fail, (makefile-based or other) configuration is not correct */
91 assert(sizeof(uint8)==1);
92 assert(sizeof(int8)==1);
93 assert(sizeof(uint16)==2);
94 assert(sizeof(int16)==2);
95 assert(sizeof(uint32)==4);
96 assert(sizeof(int32)==4);
97 assert(sizeof(uint64)==8);
98 assert(sizeof(int64)==8);
99 assert(sizeof(tmsize_t)==sizeof(void*));
100 {
101 union{
102 uint8 a8[2];
103 uint16 a16;
104 } n;
105 n.a8[0]=1;
106 n.a8[1]=0;
107 #ifdef WORDS_BIGENDIAN
108 assert(n.a16==256);
109 #else
110 assert(n.a16==1);
111 #endif
112 }
113
115 if (m == -1)
116 goto bad2;
117 tif = (TIFF *)_TIFFmalloc((tmsize_t)(sizeof (TIFF) + strlen(name) + 1));
118 if (tif == NULL) {
119 TIFFErrorExt(clientdata, module, "%s: Out of memory (TIFF structure)", name);
120 goto bad2;
121 }
122 _TIFFmemset(tif, 0, sizeof (*tif));
123 tif->tif_name = (char *)tif + sizeof (TIFF);
124 strcpy(tif->tif_name, name);
125 tif->tif_mode = m &~ (O_CREAT|O_TRUNC);
126 tif->tif_curdir = (uint16) -1; /* non-existent directory */
127 tif->tif_curoff = 0;
128 tif->tif_curstrip = (uint32) -1; /* invalid strip */
129 tif->tif_row = (uint32) -1; /* read/write pre-increment */
130 tif->tif_clientdata = clientdata;
131 if (!readproc || !writeproc || !seekproc || !closeproc || !sizeproc) {
132 TIFFErrorExt(clientdata, module,
133 "One of the client procedures is NULL pointer.");
134 _TIFFfree(tif);
135 goto bad2;
136 }
137 tif->tif_readproc = readproc;
138 tif->tif_writeproc = writeproc;
139 tif->tif_seekproc = seekproc;
140 tif->tif_closeproc = closeproc;
141 tif->tif_sizeproc = sizeproc;
142 if (mapproc)
143 tif->tif_mapproc = mapproc;
144 else
146 if (unmapproc)
147 tif->tif_unmapproc = unmapproc;
148 else
150 _TIFFSetDefaultCompressionState(tif); /* setup default state */
151 /*
152 * Default is to return data MSB2LSB and enable the
153 * use of memory-mapped files and strip chopping when
154 * a file is opened read-only.
155 */
157 if (m == O_RDONLY )
158 tif->tif_flags |= TIFF_MAPPED;
159
160 #ifdef STRIPCHOP_DEFAULT
161 if (m == O_RDONLY || m == O_RDWR)
163 #endif
164
165 /*
166 * Process library-specific flags in the open mode string.
167 * The following flags may be used to control intrinsic library
168 * behaviour that may or may not be desirable (usually for
169 * compatibility with some application that claims to support
170 * TIFF but only supports some brain dead idea of what the
171 * vendor thinks TIFF is):
172 *
173 * 'l' use little-endian byte order for creating a file
174 * 'b' use big-endian byte order for creating a file
175 * 'L' read/write information using LSB2MSB bit order
176 * 'B' read/write information using MSB2LSB bit order
177 * 'H' read/write information using host bit order
178 * 'M' enable use of memory-mapped files when supported
179 * 'm' disable use of memory-mapped files
180 * 'C' enable strip chopping support when reading
181 * 'c' disable strip chopping support
182 * 'h' read TIFF header only, do not load the first IFD
183 * '4' ClassicTIFF for creating a file (default)
184 * '8' BigTIFF for creating a file
185 * 'D' enable use of deferred strip/tile offset/bytecount array loading.
186 * 'O' on-demand loading of values instead of whole array loading (implies D)
187 *
188 * The use of the 'l' and 'b' flags is strongly discouraged.
189 * These flags are provided solely because numerous vendors,
190 * typically on the PC, do not correctly support TIFF; they
191 * only support the Intel little-endian byte order. This
192 * support is not configured by default because it supports
193 * the violation of the TIFF spec that says that readers *MUST*
194 * support both byte orders. It is strongly recommended that
195 * you not use this feature except to deal with busted apps
196 * that write invalid TIFF. And even in those cases you should
197 * bang on the vendors to fix their software.
198 *
199 * The 'L', 'B', and 'H' flags are intended for applications
200 * that can optimize operations on data by using a particular
201 * bit order. By default the library returns data in MSB2LSB
202 * bit order for compatibility with older versions of this
203 * library. Returning data in the bit order of the native CPU
204 * makes the most sense but also requires applications to check
205 * the value of the FillOrder tag; something they probably do
206 * not do right now.
207 *
208 * The 'M' and 'm' flags are provided because some virtual memory
209 * systems exhibit poor behaviour when large images are mapped.
210 * These options permit clients to control the use of memory-mapped
211 * files on a per-file basis.
212 *
213 * The 'C' and 'c' flags are provided because the library support
214 * for chopping up large strips into multiple smaller strips is not
215 * application-transparent and as such can cause problems. The 'c'
216 * option permits applications that only want to look at the tags,
217 * for example, to get the unadulterated TIFF tag information.
218 */
219 for (cp = mode; *cp; cp++)
220 switch (*cp) {
221 case 'b':
222 #ifndef WORDS_BIGENDIAN
223 if (m&O_CREAT)
224 tif->tif_flags |= TIFF_SWAB;
225 #endif
226 break;
227 case 'l':
228 #ifdef WORDS_BIGENDIAN
229 if ((m&O_CREAT))
230 tif->tif_flags |= TIFF_SWAB;
231 #endif
232 break;
233 case 'B':
234 tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
236 break;
237 case 'L':
238 tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
240 break;
241 case 'H':
242 tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
244 break;
245 case 'M':
246 if (m == O_RDONLY)
247 tif->tif_flags |= TIFF_MAPPED;
248 break;
249 case 'm':
250 if (m == O_RDONLY)
251 tif->tif_flags &= ~TIFF_MAPPED;
252 break;
253 case 'C':
254 if (m == O_RDONLY)
256 break;
257 case 'c':
258 if (m == O_RDONLY)
259 tif->tif_flags &= ~TIFF_STRIPCHOP;
260 break;
261 case 'h':
263 break;
264 case '8':
265 if (m&O_CREAT)
266 tif->tif_flags |= TIFF_BIGTIFF;
267 break;
268 case 'D':
270 break;
271 case 'O':
272 if( m == O_RDONLY )
274 break;
275 }
276
277#ifdef DEFER_STRILE_LOAD
278 /* Compatibility with old DEFER_STRILE_LOAD compilation flag */
279 /* Probably unneeded, since to the best of my knowledge (E. Rouault) */
280 /* GDAL was the only user of this, and will now use the new 'D' flag */
282#endif
283
284 /*
285 * Read in TIFF header.
286 */
287 if ((m & O_TRUNC) ||
288 !ReadOK(tif, &tif->tif_header, sizeof (TIFFHeaderClassic))) {
289 if (tif->tif_mode == O_RDONLY) {
291 "Cannot read TIFF header");
292 goto bad;
293 }
294 /*
295 * Setup header and write.
296 */
297 #ifdef WORDS_BIGENDIAN
300 #else
303 #endif
304 if (!(tif->tif_flags&TIFF_BIGTIFF))
305 {
308 if (tif->tif_flags & TIFF_SWAB)
310 tif->tif_header_size = sizeof(TIFFHeaderClassic);
311 }
312 else
313 {
316 tif->tif_header.big.tiff_unused = 0;
317 tif->tif_header.big.tiff_diroff = 0;
318 if (tif->tif_flags & TIFF_SWAB)
319 {
322 }
323 tif->tif_header_size = sizeof (TIFFHeaderBig);
324 }
325 /*
326 * The doc for "fopen" for some STD_C_LIBs says that if you
327 * open a file for modify ("+"), then you must fseek (or
328 * fflush?) between any freads and fwrites. This is not
329 * necessary on most systems, but has been shown to be needed
330 * on Solaris.
331 */
332 TIFFSeekFile( tif, 0, SEEK_SET );
333 if (!WriteOK(tif, &tif->tif_header, (tmsize_t)(tif->tif_header_size))) {
335 "Error writing TIFF header");
336 goto bad;
337 }
338 /*
339 * Setup the byte order handling.
340 */
342 #ifndef WORDS_BIGENDIAN
343 tif->tif_flags |= TIFF_SWAB;
344 #endif
345 } else {
346 #ifdef WORDS_BIGENDIAN
347 tif->tif_flags |= TIFF_SWAB;
348 #endif
349 }
350 /*
351 * Setup default directory.
352 */
353 if (!TIFFDefaultDirectory(tif))
354 goto bad;
355 tif->tif_diroff = 0;
356 tif->tif_dirlist = NULL;
357 tif->tif_dirlistsize = 0;
358 tif->tif_dirnumber = 0;
359 return (tif);
360 }
361 /*
362 * Setup the byte order handling.
363 */
366 #if MDI_SUPPORT
367 &&
370 #else
372 #endif
373 ) {
375 "Not a TIFF or MDI file, bad magic number %d (0x%x)",
376 #else
377 ) {
379 "Not a TIFF file, bad magic number %d (0x%x)",
380 #endif
383 goto bad;
384 }
386 #ifndef WORDS_BIGENDIAN
387 tif->tif_flags |= TIFF_SWAB;
388 #endif
389 } else {
390 #ifdef WORDS_BIGENDIAN
391 tif->tif_flags |= TIFF_SWAB;
392 #endif
393 }
394 if (tif->tif_flags & TIFF_SWAB)
399 "Not a TIFF file, bad version number %d (0x%x)",
402 goto bad;
403 }
405 {
406 if (tif->tif_flags & TIFF_SWAB)
408 tif->tif_header_size = sizeof(TIFFHeaderClassic);
409 }
410 else
411 {
412 if (!ReadOK(tif, ((uint8*)(&tif->tif_header) + sizeof(TIFFHeaderClassic)), (sizeof(TIFFHeaderBig)-sizeof(TIFFHeaderClassic))))
413 {
415 "Cannot read TIFF header");
416 goto bad;
417 }
418 if (tif->tif_flags & TIFF_SWAB)
419 {
422 }
423 if (tif->tif_header.big.tiff_offsetsize != 8)
424 {
426 "Not a TIFF file, bad BigTIFF offsetsize %d (0x%x)",
429 goto bad;
430 }
431 if (tif->tif_header.big.tiff_unused != 0)
432 {
434 "Not a TIFF file, bad BigTIFF unused %d (0x%x)",
437 goto bad;
438 }
439 tif->tif_header_size = sizeof(TIFFHeaderBig);
440 tif->tif_flags |= TIFF_BIGTIFF;
441 }
442 tif->tif_flags |= TIFF_MYBUFFER;
443 tif->tif_rawcp = tif->tif_rawdata = 0;
444 tif->tif_rawdatasize = 0;
445 tif->tif_rawdataoff = 0;
446 tif->tif_rawdataloaded = 0;
447
448 switch (mode[0]) {
449 case 'r':
450 if (!(tif->tif_flags&TIFF_BIGTIFF))
452 else
454 /*
455 * Try to use a memory-mapped file if the client
456 * has not explicitly suppressed usage with the
457 * 'm' flag in the open mode (see above).
458 */
459 if (tif->tif_flags & TIFF_MAPPED)
460 {
461 toff_t n;
462 if (TIFFMapFileContents(tif,(void**)(&tif->tif_base),&n))
463 {
464 tif->tif_size=(tmsize_t)n;
465 assert((toff_t)tif->tif_size==n);
466 }
467 else
468 tif->tif_flags &= ~TIFF_MAPPED;
469 }
470 /*
471 * Sometimes we do not want to read the first directory (for example,
472 * it may be broken) and want to proceed to other directories. I this
473 * case we use the TIFF_HEADERONLY flag to open file and return
474 * immediately after reading TIFF header.
475 */
476 if (tif->tif_flags & TIFF_HEADERONLY)
477 return (tif);
478
479 /*
480 * Setup initial directory.
481 */
482 if (TIFFReadDirectory(tif)) {
483 tif->tif_rawcc = (tmsize_t)-1;
485 return (tif);
486 }
487 break;
488 case 'a':
489 /*
490 * New directories are automatically append
491 * to the end of the directory chain when they
492 * are written out (see TIFFWriteDirectory).
493 */
494 if (!TIFFDefaultDirectory(tif))
495 goto bad;
496 return (tif);
497 }
498bad:
499 tif->tif_mode = O_RDONLY; /* XXX avoid flush */
500 TIFFCleanup(tif);
501bad2:
502 return ((TIFF*)0);
503}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define O_CREAT
Definition: acwin.h:110
#define O_TRUNC
Definition: acwin.h:112
unsigned short uint16
Definition: types.h:30
unsigned char uint8
Definition: types.h:28
#define assert(x)
Definition: debug.h:53
unsigned long long uint64
Definition: platform.h:18
short int16
Definition: platform.h:11
long int32
Definition: platform.h:12
char int8
Definition: platform.h:10
long long int64
Definition: platform.h:13
GLdouble n
Definition: glext.h:7729
GLenum mode
Definition: glext.h:6217
const GLfloat * m
Definition: glext.h:10848
#define O_RDWR
Definition: fcntl.h:36
#define SEEK_SET
Definition: jmemansi.c:26
if(dx< 0)
Definition: linetemp.h:194
POINT cp
Definition: magnifier.c:59
static BOOL readproc(HANDLE proc, LPVOID address, PVOID target, DWORD size)
Definition: env.c:191
uint64 tiff_diroff
Definition: tiff.h:105
uint16 tiff_offsetsize
Definition: tiff.h:103
uint16 tiff_unused
Definition: tiff.h:104
uint32 tiff_diroff
Definition: tiff.h:98
uint16 tiff_version
Definition: tiff.h:93
uint16 tiff_magic
Definition: tiff.h:92
Definition: name.c:39
Definition: tiffiop.h:115
TIFFReadWriteProc tif_readproc
Definition: tiffiop.h:208
TIFFReadWriteProc tif_writeproc
Definition: tiffiop.h:209
uint16 tif_dirnumber
Definition: tiffiop.h:150
TIFFUnmapFileProc tif_unmapproc
Definition: tiffiop.h:205
TIFFHeaderClassic classic
Definition: tiffiop.h:155
TIFFSeekProc tif_seekproc
Definition: tiffiop.h:210
union tiff::@3436 tif_header
TIFFHeaderBig big
Definition: tiffiop.h:156
tmsize_t tif_rawdataloaded
Definition: tiffiop.h:198
tmsize_t tif_rawcc
Definition: tiffiop.h:200
TIFFCloseProc tif_closeproc
Definition: tiffiop.h:211
uint16 tif_curdir
Definition: tiffiop.h:160
uint64 tif_nextdiroff
Definition: tiffiop.h:147
uint32 tif_curstrip
Definition: tiffiop.h:161
uint32 tif_row
Definition: tiffiop.h:159
TIFFMapFileProc tif_mapproc
Definition: tiffiop.h:204
uint64 tif_diroff
Definition: tiffiop.h:146
tmsize_t tif_rawdatasize
Definition: tiffiop.h:196
tmsize_t tif_rawdataoff
Definition: tiffiop.h:197
uint8 * tif_rawcp
Definition: tiffiop.h:199
uint16 tif_header_size
Definition: tiffiop.h:158
uint64 tif_curoff
Definition: tiffiop.h:162
TIFFSizeProc tif_sizeproc
Definition: tiffiop.h:212
uint16 tif_dirlistsize
Definition: tiffiop.h:149
TIFFHeaderCommon common
Definition: tiffiop.h:154
void TIFFCleanup(TIFF *tif)
Definition: tif_close.c:46
void _TIFFSetDefaultCompressionState(TIFF *tif)
Definition: tif_compress.c:135
#define HOST_FILLORDER
Definition: tif_config.h:113
int TIFFDefaultDirectory(TIFF *tif)
Definition: tif_dir.c:1372
int TIFFReadDirectory(TIFF *tif)
Definition: tif_dirread.c:3574
static void _tiffDummyUnmapProc(thandle_t fd, void *base, toff_t size)
Definition: tif_open.c:41
int _TIFFgetMode(const char *mode, const char *module)
Definition: tif_open.c:47
static int _tiffDummyMapProc(thandle_t fd, void **pbase, toff_t *psize)
Definition: tif_open.c:34
void TIFFSwabLong(uint32 *lp)
Definition: tif_swab.c:45
void TIFFSwabShort(uint16 *wp)
Definition: tif_swab.c:34
void TIFFSwabLong8(uint64 *lp)
Definition: tif_swab.c:57
void _TIFFmemset(void *p, int v, tmsize_t c)
Definition: tif_unix.c:338
void * _TIFFmalloc(tmsize_t s)
Definition: tif_unix.c:309
#define FILLORDER_LSB2MSB
Definition: tiff.h:216
#define TIFF_LITTLEENDIAN
Definition: tiff.h:52
#define MDI_LITTLEENDIAN
Definition: tiff.h:53
#define FILLORDER_MSB2LSB
Definition: tiff.h:215
#define MDI_BIGENDIAN
Definition: tiff.h:54
#define TIFF_VERSION_BIG
Definition: tiff.h:49
#define TIFF_VERSION_CLASSIC
Definition: tiff.h:48
#define TIFF_BIGENDIAN
Definition: tiff.h:51
#define HOST_BIGENDIAN
Definition: tiffconf.h:86
#define STRIPCHOP_DEFAULT
Definition: tiffconf.h:124
#define MDI_SUPPORT
Definition: tiffconf.h:139
struct tiff TIFF
Definition: tiffio.h:38
TIFF_SSIZE_T tmsize_t
Definition: tiffio.h:65
#define TIFF_LAZYSTRILELOAD
Definition: tiffiop.h:144
#define WriteOK(tif, buf, size)
Definition: tiffiop.h:259
#define TIFF_BUFFERSETUP
Definition: tiffiop.h:123
#define ReadOK(tif, buf, size)
Definition: tiffiop.h:252
#define TIFF_HEADERONLY
Definition: tiffiop.h:135
#define TIFFMapFileContents(tif, paddr, psize)
Definition: tiffiop.h:243
#define TIFF_STRIPCHOP
Definition: tiffiop.h:134
#define TIFF_DEFERSTRILELOAD
Definition: tiffiop.h:143
#define TIFF_MAPPED
Definition: tiffiop.h:130
#define TIFF_BIGTIFF
Definition: tiffiop.h:138
#define TIFF_SWAB
Definition: tiffiop.h:126
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by _tiffStreamOpen(), and TIFFFdOpen().

◆ TIFFClose()

void TIFFClose ( TIFF tif)

Close a previously opened TIFF file.

TIFFClose closes a file that was previously opened with TIFFOpen(). Any buffered data are flushed to the file, including the contents of the current directory (if modified); and all resources are reclaimed.

Parameters
tifA TIFF pointer.

Definition at line 122 of file tif_close.c.

123{
124 TIFFCloseProc closeproc = tif->tif_closeproc;
126
127 TIFFCleanup(tif);
128 (void) (*closeproc)(fd);
129}
static int fd
Definition: io.c:51
int(* TIFFCloseProc)(thandle_t)
Definition: tiffio.h:275

◆ TIFFComputeStrip()

uint32 TIFFComputeStrip ( TIFF tif,
uint32  row,
uint16  sample 
)

Definition at line 36 of file tif_strip.c.

37{
38 static const char module[] = "TIFFComputeStrip";
39 TIFFDirectory *td = &tif->tif_dir;
40 uint32 strip;
41
42 strip = row / td->td_rowsperstrip;
44 if (sample >= td->td_samplesperpixel) {
46 "%lu: Sample out of range, max %lu",
47 (unsigned long) sample, (unsigned long) td->td_samplesperpixel);
48 return (0);
49 }
50 strip += (uint32)sample*td->td_stripsperimage;
51 }
52 return (strip);
53}
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
uint32 td_rowsperstrip
Definition: tif_dir.h:83
uint32 td_stripsperimage
Definition: tif_dir.h:99

Referenced by gtStripContig(), and gtStripSeparate().

◆ TIFFComputeTile()

uint32 TIFFComputeTile ( TIFF tif,
uint32  x,
uint32  y,
uint32  z,
uint16  s 
)

Definition at line 36 of file tif_tile.c.

37{
38 TIFFDirectory *td = &tif->tif_dir;
41 uint32 dz = td->td_tiledepth;
42 uint32 tile = 1;
43
44 if (td->td_imagedepth == 1)
45 z = 0;
46 if (dx == (uint32) -1)
47 dx = td->td_imagewidth;
48 if (dy == (uint32) -1)
49 dy = td->td_imagelength;
50 if (dz == (uint32) -1)
51 dz = td->td_imagedepth;
52 if (dx != 0 && dy != 0 && dz != 0) {
55 uint32 zpt = TIFFhowmany_32(td->td_imagedepth, dz);
56
58 tile = (xpt*ypt*zpt)*s +
59 (xpt*ypt)*(z/dz) +
60 xpt*(y/dy) +
61 x/dx;
62 else
63 tile = (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx;
64 }
65 return (tile);
66}
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
uint32 td_tiledepth
Definition: tif_dir.h:73
uint32 td_tilelength
Definition: tif_dir.h:73
uint32 td_tilewidth
Definition: tif_dir.h:73
#define TIFFhowmany_32(x, y)
Definition: tiffiop.h:264

Referenced by _TIFFReadTileAndAllocBuffer(), TIFFReadTile(), and TIFFWriteTile().

◆ TIFFCreateCustomDirectory()

int TIFFCreateCustomDirectory ( TIFF tif,
const TIFFFieldArray infoarray 
)

Definition at line 1340 of file tif_dir.c.

1341{
1343
1344 /*
1345 * Reset the field definitions to match the application provided list.
1346 * Hopefully TIFFDefaultDirectory() won't have done anything irreversable
1347 * based on it's assumption this is an image directory.
1348 */
1349 _TIFFSetupFields(tif, infoarray);
1350
1351 tif->tif_diroff = 0;
1352 tif->tif_nextdiroff = 0;
1353 tif->tif_curoff = 0;
1354 tif->tif_row = (uint32) -1;
1355 tif->tif_curstrip = (uint32) -1;
1356
1357 return 0;
1358}
void _TIFFSetupFields(TIFF *tif, const TIFFFieldArray *fieldarray)
Definition: tif_dirinfo.c:317

Referenced by TIFFCreateEXIFDirectory().

◆ TIFFCreateDirectory()

int TIFFCreateDirectory ( TIFF tif)

Definition at line 1327 of file tif_dir.c.

1328{
1330 tif->tif_diroff = 0;
1331 tif->tif_nextdiroff = 0;
1332 tif->tif_curoff = 0;
1333 tif->tif_row = (uint32) -1;
1334 tif->tif_curstrip = (uint32) -1;
1335
1336 return 0;
1337}

Referenced by TIFFWriteDirectorySec().

◆ TIFFCreateEXIFDirectory()

int TIFFCreateEXIFDirectory ( TIFF tif)

Definition at line 1361 of file tif_dir.c.

1362{
1366}
int TIFFCreateCustomDirectory(TIFF *tif, const TIFFFieldArray *infoarray)
Definition: tif_dir.c:1340
static const TIFFFieldArray exifFieldArray
Definition: tif_dirinfo.c:49
const TIFFFieldArray * _TIFFGetExifFields(void)
Definition: tif_dirinfo.c:311

◆ TIFFCurrentDirectory()

uint16 TIFFCurrentDirectory ( TIFF tif)

Definition at line 612 of file tif_open.c.

613{
614 return (tif->tif_curdir);
615}

◆ TIFFCurrentDirOffset()

uint64 TIFFCurrentDirOffset ( TIFF tif)

Definition at line 1666 of file tif_dir.c.

1667{
1668 return (tif->tif_diroff);
1669}

◆ TIFFCurrentRow()

uint32 TIFFCurrentRow ( TIFF tif)

Definition at line 603 of file tif_open.c.

604{
605 return (tif->tif_row);
606}

◆ TIFFCurrentStrip()

uint32 TIFFCurrentStrip ( TIFF tif)

Definition at line 621 of file tif_open.c.

622{
623 return (tif->tif_curstrip);
624}

◆ TIFFCurrentTile()

uint32 TIFFCurrentTile ( TIFF tif)

Definition at line 630 of file tif_open.c.

631{
632 return (tif->tif_curtile);
633}
uint32 tif_curtile
Definition: tiffiop.h:169

◆ TIFFDataWidth()

int TIFFDataWidth ( TIFFDataType  type)

Definition at line 438 of file tif_dirinfo.c.

439{
440 switch(type)
441 {
442 case 0: /* nothing */
443 case TIFF_BYTE:
444 case TIFF_ASCII:
445 case TIFF_SBYTE:
446 case TIFF_UNDEFINED:
447 return 1;
448 case TIFF_SHORT:
449 case TIFF_SSHORT:
450 return 2;
451 case TIFF_LONG:
452 case TIFF_SLONG:
453 case TIFF_FLOAT:
454 case TIFF_IFD:
455 return 4;
456 case TIFF_RATIONAL:
457 case TIFF_SRATIONAL:
458 case TIFF_DOUBLE:
459 case TIFF_LONG8:
460 case TIFF_SLONG8:
461 case TIFF_IFD8:
462 return 8;
463 default:
464 return 0; /* will return 0 for unknown types */
465 }
466}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
@ TIFF_SSHORT
Definition: tiff.h:132
@ TIFF_SLONG
Definition: tiff.h:133
@ TIFF_BYTE
Definition: tiff.h:125
@ TIFF_SBYTE
Definition: tiff.h:130
@ TIFF_IFD
Definition: tiff.h:137
@ TIFF_SHORT
Definition: tiff.h:127
@ TIFF_UNDEFINED
Definition: tiff.h:131
@ TIFF_LONG
Definition: tiff.h:128
@ TIFF_SLONG8
Definition: tiff.h:139
@ TIFF_LONG8
Definition: tiff.h:138
@ TIFF_ASCII
Definition: tiff.h:126
@ TIFF_FLOAT
Definition: tiff.h:135
@ TIFF_DOUBLE
Definition: tiff.h:136
@ TIFF_IFD8
Definition: tiff.h:140
@ TIFF_SRATIONAL
Definition: tiff.h:134
@ TIFF_RATIONAL
Definition: tiff.h:129

Referenced by _TIFFRewriteField(), EstimateStripByteCounts(), and TIFFReadDirEntryArrayWithLimit().

◆ TIFFDefaultStripSize()

uint32 TIFFDefaultStripSize ( TIFF tif,
uint32  request 
)

Definition at line 217 of file tif_strip.c.

218{
219 return (*tif->tif_defstripsize)(tif, request);
220}
Definition: tftpd.h:86
TIFFStripMethod tif_defstripsize
Definition: tiffiop.h:189

◆ TIFFDefaultTileSize()

void TIFFDefaultTileSize ( TIFF tif,
uint32 tw,
uint32 th 
)

Definition at line 272 of file tif_tile.c.

273{
274 (*tif->tif_deftilesize)(tif, tw, th);
275}
TIFFTileMethod tif_deftilesize
Definition: tiffiop.h:190

◆ TIFFDeferStrileArrayWriting()

int TIFFDeferStrileArrayWriting ( TIFF tif)

Definition at line 210 of file tif_dirwrite.c.

211{
212 static const char module[] = "TIFFDeferStrileArrayWriting";
213 if (tif->tif_mode == O_RDONLY)
214 {
216 "File opened in read-only mode");
217 return 0;
218 }
219 if( tif->tif_diroff != 0 )
220 {
222 "Directory has already been written");
223 return 0;
224 }
225
227 return 1;
228}
unsigned char td_deferstrilearraywriting
Definition: tif_dir.h:124

◆ TIFFError()

void TIFFError ( const char ,
const char ,
  ... 
)

◆ TIFFErrorExt()

void void TIFFErrorExt ( thandle_t  ,
const char ,
const char ,
  ... 
)

◆ TIFFFdOpen()

TIFF * TIFFFdOpen ( int  fd,
const char name,
const char mode 
)

Definition at line 203 of file tif_unix.c.

204{
205 TIFF* tif;
206
208 fdh.fd = fd;
209 tif = TIFFClientOpen(name, mode,
210 fdh.h,
214 if (tif)
215 tif->tif_fd = fd;
216 return (tif);
217}
int tif_fd
Definition: tiffiop.h:117
TIFF * TIFFClientOpen(const char *name, const char *mode, thandle_t clientdata, TIFFReadWriteProc readproc, TIFFReadWriteProc writeproc, TIFFSeekProc seekproc, TIFFCloseProc closeproc, TIFFSizeProc sizeproc, TIFFMapFileProc mapproc, TIFFUnmapFileProc unmapproc)
Definition: tif_open.c:71
static tmsize_t _tiffReadProc(thandle_t fd, void *buf, tmsize_t size)
Definition: tif_unix.c:67
static void _tiffUnmapProc(thandle_t fd, void *base, toff_t size)
Definition: tif_unix.c:193
static tmsize_t _tiffWriteProc(thandle_t fd, void *buf, tmsize_t size)
Definition: tif_unix.c:95
static uint64 _tiffSeekProc(thandle_t fd, uint64 off, int whence)
Definition: tif_unix.c:124
static int _tiffCloseProc(thandle_t fd)
Definition: tif_unix.c:138
static int _tiffMapProc(thandle_t fd, void **pbase, toff_t *psize)
Definition: tif_unix.c:186
static uint64 _tiffSizeProc(thandle_t fd)
Definition: tif_unix.c:146
thandle_t h
Definition: tif_unix.c:63

Referenced by TIFFOpen(), and TIFFOpenW().

◆ TIFFFieldDataType()

TIFFDataType TIFFFieldDataType ( const TIFFField fip)

Definition at line 594 of file tif_dirinfo.c.

595{
596 return fip->field_type;
597}
TIFFDataType field_type
Definition: tif_dir.h:286

◆ TIFFFieldName()

const char * TIFFFieldName ( const TIFFField fip)

Definition at line 588 of file tif_dirinfo.c.

589{
590 return fip->field_name;
591}

◆ TIFFFieldPassCount()

int TIFFFieldPassCount ( const TIFFField fip)

Definition at line 600 of file tif_dirinfo.c.

601{
602 return fip->field_passcount;
603}
unsigned char field_passcount
Definition: tif_dir.h:292

◆ TIFFFieldReadCount()

int TIFFFieldReadCount ( const TIFFField fip)

Definition at line 606 of file tif_dirinfo.c.

607{
608 return fip->field_readcount;
609}
short field_readcount
Definition: tif_dir.h:284

◆ TIFFFieldTag()

uint32 TIFFFieldTag ( const TIFFField fip)

Definition at line 582 of file tif_dirinfo.c.

583{
584 return fip->field_tag;
585}
uint32 field_tag
Definition: tif_dir.h:283

Referenced by TIFFWriteDirectorySec().

◆ TIFFFieldWithName()

const TIFFField * TIFFFieldWithName ( TIFF tif,
const char field_name 
)

Definition at line 570 of file tif_dirinfo.c.

571{
572 const TIFFField* fip =
573 _TIFFFindFieldByName(tif, field_name, TIFF_ANY);
574 if (!fip) {
575 TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithName",
576 "Internal error, unknown tag %s", field_name);
577 }
578 return (fip);
579}
static const TIFFField * _TIFFFindFieldByName(TIFF *tif, const char *field_name, TIFFDataType dt)
Definition: tif_dirinfo.c:531
#define TIFF_ANY
Definition: tiffio.h:307

◆ TIFFFieldWithTag()

const TIFFField * TIFFFieldWithTag ( TIFF tif,
uint32  tag 
)

Definition at line 558 of file tif_dirinfo.c.

559{
560 const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
561 if (!fip) {
562 TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithTag",
563 "Internal error, unknown tag 0x%x",
564 (unsigned int) tag);
565 }
566 return (fip);
567}
Definition: ecma_167.h:138
const TIFFField * TIFFFindField(TIFF *tif, uint32 tag, TIFFDataType dt)
Definition: tif_dirinfo.c:506

Referenced by _TIFFVSetField(), CheckDirCount(), TIFFFetchStripThing(), TIFFPrintDirectory(), TIFFReadDirectory(), and TIFFUnsetField().

◆ TIFFFieldWriteCount()

int TIFFFieldWriteCount ( const TIFFField fip)

Definition at line 612 of file tif_dirinfo.c.

613{
614 return fip->field_writecount;
615}
short field_writecount
Definition: tif_dir.h:285

◆ TIFFFileName()

◆ TIFFFileno()

int TIFFFileno ( TIFF tif)

Definition at line 533 of file tif_open.c.

534{
535 return (tif->tif_fd);
536}

◆ TIFFFindCODEC()

const TIFFCodec * TIFFFindCODEC ( uint16  scheme)

Definition at line 186 of file tif_compress.c.

187{
188 const TIFFCodec* c;
189 codec_t* cd;
190
191 for (cd = registeredCODECS; cd; cd = cd->next)
192 if (cd->info->scheme == scheme)
193 return ((const TIFFCodec*) cd->info);
194 for (c = _TIFFBuiltinCODECS; c->name; c++)
195 if (c->scheme == scheme)
196 return (c);
197 return ((const TIFFCodec*) 0);
198}
InitDirComponents & cd
#define c
Definition: ke_i.h:80
DWORD scheme
char * name
Definition: tiffio.h:251
TIFFCodec _TIFFBuiltinCODECS[]
Definition: tif_codec.c:87
static codec_t * registeredCODECS
Definition: tif_compress.c:183

Referenced by _notConfigured(), TIFFIsCODECConfigured(), TIFFNoDecode(), TIFFNoEncode(), TIFFPrintDirectory(), and TIFFSetCompressionScheme().

◆ TIFFFindField()

const TIFFField * TIFFFindField ( TIFF tif,
uint32  tag,
TIFFDataType  dt 
)

Definition at line 506 of file tif_dirinfo.c.

507{
508 TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL};
509 TIFFField* pkey = &key;
510 const TIFFField **ret;
511 if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag &&
512 (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
513 return tif->tif_foundfield;
514
515 /* If we are invoked with no field information, then just return. */
516 if (!tif->tif_fields)
517 return NULL;
518
519 /* NB: use sorted search (e.g. binary search) */
520
521 key.field_tag = tag;
522 key.field_type = dt;
523
524 ret = (const TIFFField **) bsearch(&pkey, tif->tif_fields,
525 tif->tif_nfields,
526 sizeof(TIFFField *), tagCompare);
527 return tif->tif_foundfield = (ret ? *ret : NULL);
528}
Definition: copy.c:22
const TIFFField * tif_foundfield
Definition: tiffiop.h:218
#define bsearch
static int tagCompare(const void *a, const void *b)
Definition: tif_dirinfo.c:342
@ TIFF_NOTYPE
Definition: tiff.h:124
int ret

Referenced by _TIFFFindOrRegisterField(), _TIFFMergeFields(), _TIFFRewriteField(), _TIFFVGetField(), _TIFFVSetField(), OkToChangeTag(), TIFFFieldWithTag(), and TIFFVGetField().

◆ TIFFFlush()

int TIFFFlush ( TIFF tif)

Definition at line 32 of file tif_flush.c.

33{
34 if( tif->tif_mode == O_RDONLY )
35 return 1;
36
37 if (!TIFFFlushData(tif))
38 return (0);
39
40 /* In update (r+) mode we try to detect the case where
41 only the strip/tile map has been altered, and we try to
42 rewrite only that portion of the directory without
43 making any other changes */
44
45 if( (tif->tif_flags & TIFF_DIRTYSTRIP)
46 && !(tif->tif_flags & TIFF_DIRTYDIRECT)
47 && tif->tif_mode == O_RDWR )
48 {
50 return 1;
51 }
52
54 && !TIFFRewriteDirectory(tif))
55 return (0);
56
57 return (1);
58}
int TIFFRewriteDirectory(TIFF *tif)
Definition: tif_dirwrite.c:261
int TIFFForceStrileArrayWriting(TIFF *tif)
Definition: tif_flush.c:79
int TIFFFlushData(TIFF *tif)
Definition: tif_flush.c:156
#define TIFF_DIRTYSTRIP
Definition: tiffiop.h:140
#define TIFF_DIRTYDIRECT
Definition: tiffiop.h:122

Referenced by TIFFCleanup().

◆ TIFFFlushData()

int TIFFFlushData ( TIFF tif)

Definition at line 156 of file tif_flush.c.

157{
158 if ((tif->tif_flags & TIFF_BEENWRITING) == 0)
159 return (1);
160 if (tif->tif_flags & TIFF_POSTENCODE) {
161 tif->tif_flags &= ~TIFF_POSTENCODE;
162 if (!(*tif->tif_postencode)(tif))
163 return (0);
164 }
165 return (TIFFFlushData1(tif));
166}
TIFFBoolMethod tif_postencode
Definition: tiffiop.h:179
int TIFFFlushData1(TIFF *tif)
Definition: tif_write.c:803
#define TIFF_POSTENCODE
Definition: tiffiop.h:131
#define TIFF_BEENWRITING
Definition: tiffiop.h:125

Referenced by TIFFFlush(), and TIFFWriteScanline().

◆ TIFFForceStrileArrayWriting()

int TIFFForceStrileArrayWriting ( TIFF tif)

Definition at line 79 of file tif_flush.c.

80{
81 static const char module[] = "TIFFForceStrileArrayWriting";
82 const int isTiled = TIFFIsTiled(tif);
83
84 if (tif->tif_mode == O_RDONLY)
85 {
87 "File opened in read-only mode");
88 return 0;
89 }
90 if( tif->tif_diroff == 0 )
91 {
93 "Directory has not yet been written");
94 return 0;
95 }
96 if( (tif->tif_flags & TIFF_DIRTYDIRECT) != 0 )
97 {
99 "Directory has changes other than the strile arrays. "
100 "TIFFRewriteDirectory() should be called instead");
101 return 0;
102 }
103
104 if( !(tif->tif_flags & TIFF_DIRTYSTRIP) )
105 {
106 if( !(tif->tif_dir.td_stripoffset_entry.tdir_tag != 0 &&
114 {
116 "Function not called together with "
117 "TIFFDeferStrileArrayWriting()");
118 return 0;
119 }
120
121 if (tif->tif_dir.td_stripoffset_p == NULL && !TIFFSetupStrips(tif))
122 return 0;
123 }
124
125 if( _TIFFRewriteField( tif,
129 tif->tif_dir.td_nstrips,
131 && _TIFFRewriteField( tif,
135 tif->tif_dir.td_nstrips,
137 {
138 tif->tif_flags &= ~TIFF_DIRTYSTRIP;
139 tif->tif_flags &= ~TIFF_BEENWRITING;
140 return 1;
141 }
142
143 return 0;
144}
uint64 toff_long8
Definition: tif_dir.h:59
uint64 tdir_count
Definition: tif_dir.h:55
uint16 tdir_tag
Definition: tif_dir.h:53
uint16 tdir_type
Definition: tif_dir.h:54
union TIFFDirEntry::@3434 tdir_offset
uint64 * td_stripbytecount_p
Definition: tif_dir.h:102
TIFFDirEntry td_stripoffset_entry
Definition: tif_dir.h:107
uint32 td_nstrips
Definition: tif_dir.h:100
TIFFDirEntry td_stripbytecount_entry
Definition: tif_dir.h:108
int _TIFFRewriteField(TIFF *tif, uint16 tag, TIFFDataType in_datatype, tmsize_t count, void *data)
int TIFFIsTiled(TIFF *tif)
Definition: tif_open.c:594
#define TIFFTAG_TILEBYTECOUNTS
Definition: tiff.h:288
#define TIFFTAG_STRIPBYTECOUNTS
Definition: tiff.h:233
#define TIFFTAG_TILEOFFSETS
Definition: tiff.h:287
#define TIFFTAG_STRIPOFFSETS
Definition: tiff.h:221
#define isTiled(tif)
Definition: tiffiop.h:229

Referenced by TIFFFlush(), and TIFFWriteCheck().

◆ TIFFFreeDirectory()

void TIFFFreeDirectory ( TIFF tif)

Definition at line 1268 of file tif_dir.c.

1269{
1270 TIFFDirectory *td = &tif->tif_dir;
1271 int i;
1272
1274 CleanupField(td_sminsamplevalue);
1275 CleanupField(td_smaxsamplevalue);
1276 CleanupField(td_colormap[0]);
1277 CleanupField(td_colormap[1]);
1278 CleanupField(td_colormap[2]);
1279 CleanupField(td_sampleinfo);
1280 CleanupField(td_subifd);
1281 CleanupField(td_inknames);
1282 CleanupField(td_refblackwhite);
1283 CleanupField(td_transferfunction[0]);
1284 CleanupField(td_transferfunction[1]);
1285 CleanupField(td_transferfunction[2]);
1286 CleanupField(td_stripoffset_p);
1287 CleanupField(td_stripbytecount_p);
1291
1292 /* Cleanup custom tag values */
1293 for( i = 0; i < td->td_customValueCount; i++ ) {
1294 if (td->td_customValues[i].value)
1296 }
1297
1298 td->td_customValueCount = 0;
1299 CleanupField(td_customValues);
1300
1301 _TIFFmemset( &(td->td_stripoffset_entry), 0, sizeof(TIFFDirEntry));
1303}
int td_customValueCount
Definition: tif_dir.h:121
uint32 td_stripoffsetbyteallocsize
Definition: tif_dir.h:103
TIFFTagValue * td_customValues
Definition: tif_dir.h:122
unsigned long td_fieldsset[FIELD_SETLONGS]
Definition: tif_dir.h:70
void * value
Definition: tif_dir.h:38
#define CleanupField(member)
Definition: tif_dir.c:1257
#define FIELD_SETLONGS
Definition: tif_dir.h:68
#define FIELD_YCBCRSUBSAMPLING
Definition: tif_dir.h:171
#define FIELD_YCBCRPOSITIONING
Definition: tif_dir.h:172
#define TIFFClrFieldBit(tif, field)
Definition: tif_dir.h:198

Referenced by TIFFCleanup(), TIFFReadCustomDirectory(), TIFFReadDirectory(), TIFFUnlinkDirectory(), and TIFFWriteDirectorySec().

◆ TIFFGetBitRevTable()

const unsigned char * TIFFGetBitRevTable ( int  reversed)

Definition at line 278 of file tif_swab.c.

279{
280 return (reversed ? TIFFBitRevTable : TIFFNoBitRevTable);
281}
static const unsigned char TIFFBitRevTable[256]
Definition: tif_swab.c:208
static const unsigned char TIFFNoBitRevTable[256]
Definition: tif_swab.c:242

◆ TIFFGetClientInfo()

void * TIFFGetClientInfo ( TIFF tif,
const char name 
)

Definition at line 64 of file tif_extension.c.

66{
68
69 while( psLink != NULL && strcmp(psLink->name,name) != 0 )
70 psLink = psLink->next;
71
72 if( psLink != NULL )
73 return psLink->data;
74 else
75 return NULL;
76}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
void * data
Definition: tiffiop.h:95

◆ TIFFGetCloseProc()

TIFFCloseProc TIFFGetCloseProc ( TIFF tif)

Definition at line 702 of file tif_open.c.

703{
704 return (tif->tif_closeproc);
705}

◆ TIFFGetConfiguredCODECs()

TIFFCodec * TIFFGetConfiguredCODECs ( void  )

Get list of configured codecs, both built-in and registered by user. Caller is responsible to free this structure.

Returns
returns array of TIFFCodec records (the last record should be NULL) or NULL if function failed.

Definition at line 252 of file tif_compress.c.

253{
254 int i = 1;
255 codec_t *cd;
256 const TIFFCodec* c;
258 TIFFCodec* new_codecs;
259
260 for (cd = registeredCODECS; cd; cd = cd->next) {
261 new_codecs = (TIFFCodec *)
262 _TIFFrealloc(codecs, i * sizeof(TIFFCodec));
263 if (!new_codecs) {
265 return NULL;
266 }
267 codecs = new_codecs;
268 _TIFFmemcpy(codecs + i - 1, cd, sizeof(TIFFCodec));
269 i++;
270 }
271 for (c = _TIFFBuiltinCODECS; c->name; c++) {
272 if (TIFFIsCODECConfigured(c->scheme)) {
273 new_codecs = (TIFFCodec *)
274 _TIFFrealloc(codecs, i * sizeof(TIFFCodec));
275 if (!new_codecs) {
277 return NULL;
278 }
279 codecs = new_codecs;
280 _TIFFmemcpy(codecs + i - 1, (const void*)c, sizeof(TIFFCodec));
281 i++;
282 }
283 }
284
285 new_codecs = (TIFFCodec *) _TIFFrealloc(codecs, i * sizeof(TIFFCodec));
286 if (!new_codecs) {
288 return NULL;
289 }
290 codecs = new_codecs;
291 _TIFFmemset(codecs + i - 1, 0, sizeof(TIFFCodec));
292
293 return codecs;
294}
static const struct image_codec codecs[NUM_CODECS]
Definition: image.c:4283
int TIFFIsCODECConfigured(uint16 scheme)
Definition: tif_codec.c:150
void * _TIFFrealloc(void *p, tmsize_t s)
Definition: tif_unix.c:332

◆ TIFFGetField()

int TIFFGetField ( TIFF tif,
uint32  tag,
  ... 
)

Definition at line 1232 of file tif_dir.c.

1233{
1234 int status;
1235 va_list ap;
1236
1237 va_start(ap, tag);
1238 status = TIFFVGetField(tif, tag, ap);
1239 va_end(ap);
1240 return (status);
1241}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
Definition: ps.c:97
int TIFFVGetField(TIFF *tif, uint32 tag, va_list ap)
Definition: tif_dir.c:1250
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

Referenced by gtTileContig(), gtTileSeparate(), isCCITTCompression(), TIFFPrintDirectory(), TIFFRGBAImageBegin(), TIFFRGBAImageOK(), and TIFFWriteDirectorySec().

◆ TIFFGetFieldDefaulted()

int TIFFGetFieldDefaulted ( TIFF tif,
uint32  tag,
  ... 
)

Definition at line 345 of file tif_aux.c.

346{
347 int ok;
348 va_list ap;
349
350 va_start(ap, tag);
352 va_end(ap);
353 return (ok);
354}
#define ok(value,...)
Definition: atltest.h:57
int TIFFVGetFieldDefaulted(TIFF *tif, uint32 tag, va_list ap)
Definition: tif_aux.c:209

Referenced by gtStripContig(), gtStripSeparate(), initCIELabConversion(), initYCbCrConversion(), PickContigCase(), PickSeparateCase(), TIFFReadRGBAStripExt(), TIFFReadRGBATileExt(), TIFFRGBAImageBegin(), TIFFRGBAImageOK(), TIFFScanlineSize64(), TIFFVStripSize64(), TIFFVTileSize64(), and TIFFWriteDirectorySec().

◆ TIFFGetMapFileProc()

TIFFMapFileProc TIFFGetMapFileProc ( TIFF tif)

Definition at line 720 of file tif_open.c.

721{
722 return (tif->tif_mapproc);
723}

◆ TIFFGetMode()

int TIFFGetMode ( TIFF tif)

Definition at line 573 of file tif_open.c.

574{
575 return (tif->tif_mode);
576}

◆ TIFFGetReadProc()

TIFFReadWriteProc TIFFGetReadProc ( TIFF tif)

Definition at line 675 of file tif_open.c.

676{
677 return (tif->tif_readproc);
678}

◆ TIFFGetSeekProc()

TIFFSeekProc TIFFGetSeekProc ( TIFF tif)

Definition at line 693 of file tif_open.c.

694{
695 return (tif->tif_seekproc);
696}

◆ TIFFGetSizeProc()

TIFFSizeProc TIFFGetSizeProc ( TIFF tif)

Definition at line 711 of file tif_open.c.

712{
713 return (tif->tif_sizeproc);
714}

◆ TIFFGetStrileByteCount()

◆ TIFFGetStrileByteCountWithErr()

uint64 TIFFGetStrileByteCountWithErr ( TIFF tif,
uint32  strile,
int pbErr 
)

Definition at line 6311 of file tif_dirread.c.

6312{
6313 TIFFDirectory *td = &tif->tif_dir;
6314 return _TIFFGetStrileOffsetOrByteCountValue(tif, strile,
6316 &(td->td_stripbytecount_p), pbErr);
6317}
static uint64 _TIFFGetStrileOffsetOrByteCountValue(TIFF *tif, uint32 strile, TIFFDirEntry *dirent, uint64 **parray, int *pbErr)
Definition: tif_dirread.c:6246

Referenced by TIFFGetStrileByteCount().

◆ TIFFGetStrileOffset()

uint64 TIFFGetStrileOffset ( TIFF tif,
uint32  strile 
)

◆ TIFFGetStrileOffsetWithErr()

uint64 TIFFGetStrileOffsetWithErr ( TIFF tif,
uint32  strile,
int pbErr 
)

Definition at line 6296 of file tif_dirread.c.

6297{
6298 TIFFDirectory *td = &tif->tif_dir;
6299 return _TIFFGetStrileOffsetOrByteCountValue(tif, strile,
6300 &(td->td_stripoffset_entry),
6301 &(td->td_stripoffset_p), pbErr);
6302}

Referenced by TIFFGetStrileOffset().

◆ TIFFGetTagListCount()

int TIFFGetTagListCount ( TIFF tif)

Definition at line 34 of file tif_extension.c.

36{
37 TIFFDirectory* td = &tif->tif_dir;
38
39 return td->td_customValueCount;
40}

Referenced by TIFFPrintDirectory().

◆ TIFFGetTagListEntry()

uint32 TIFFGetTagListEntry ( TIFF tif,
int  tag_index 
)

Definition at line 42 of file tif_extension.c.

44{
45 TIFFDirectory* td = &tif->tif_dir;
46
47 if( tag_index < 0 || tag_index >= td->td_customValueCount )
48 return (uint32)(-1);
49 else
50 return td->td_customValues[tag_index].info->field_tag;
51}
const TIFFField * info
Definition: tif_dir.h:36

Referenced by TIFFPrintDirectory().

◆ TIFFGetUnmapFileProc()

TIFFUnmapFileProc TIFFGetUnmapFileProc ( TIFF tif)

Definition at line 729 of file tif_open.c.

730{
731 return (tif->tif_unmapproc);
732}

◆ TIFFGetVersion()

const char * TIFFGetVersion ( void  )

Definition at line 29 of file tif_version.c.

30{
31 return (TIFFVersion);
32}
static const char TIFFVersion[]
Definition: tif_version.c:26

◆ TIFFGetWriteProc()

TIFFReadWriteProc TIFFGetWriteProc ( TIFF tif)

Definition at line 684 of file tif_open.c.

685{
686 return (tif->tif_writeproc);
687}

◆ TIFFIsBigEndian()

int TIFFIsBigEndian ( TIFF tif)

Definition at line 666 of file tif_open.c.

667{
669}

◆ TIFFIsByteSwapped()

int TIFFIsByteSwapped ( TIFF tif)

Definition at line 639 of file tif_open.c.

640{
641 return ((tif->tif_flags & TIFF_SWAB) != 0);
642}

◆ TIFFIsCODECConfigured()

int TIFFIsCODECConfigured ( uint16  scheme)

Check whether we have working codec for the specific coding scheme.

Returns
returns 1 if the codec is configured and working. Otherwise 0 will be returned.

Definition at line 150 of file tif_codec.c.

151{
152 const TIFFCodec* codec = TIFFFindCODEC(scheme);
153
154 if(codec == NULL) {
155 return 0;
156 }
157 if(codec->init == NULL) {
158 return 0;
159 }
160 if(codec->init != NotConfigured){
161 return 1;
162 }
163 return 0;
164}
TIFFInitMethod init
Definition: tiffio.h:253
static int NotConfigured(TIFF *, int)
Definition: tif_codec.c:126
const TIFFCodec * TIFFFindCODEC(uint16 scheme)
Definition: tif_compress.c:186

Referenced by TIFFGetConfiguredCODECs().

◆ TIFFIsMSB2LSB()

int TIFFIsMSB2LSB ( TIFF tif)

Definition at line 657 of file tif_open.c.

658{
659 return (isFillOrder(tif, FILLORDER_MSB2LSB));
660}
#define isFillOrder(tif, o)
Definition: tiffiop.h:231

◆ TIFFIsTiled()

int TIFFIsTiled ( TIFF tif)

◆ TIFFIsUpSampled()

int TIFFIsUpSampled ( TIFF tif)

Definition at line 648 of file tif_open.c.

649{
650 return (isUpSampled(tif));
651}
#define isUpSampled(tif)
Definition: tiffiop.h:232

◆ TIFFLastDirectory()

int TIFFLastDirectory ( TIFF tif)

Definition at line 1676 of file tif_dir.c.

1677{
1678 return (tif->tif_nextdiroff == 0);
1679}

◆ TIFFMergeFieldInfo()

int TIFFMergeFieldInfo ( TIFF tif,
const  TIFFFieldInfo[],
uint32  n 
)

Definition at line 888 of file tif_dirinfo.c.

889{
890 static const char module[] = "TIFFMergeFieldInfo";
891 static const char reason[] = "for fields array";
892 TIFFField *tp;
893 size_t nfields;
894 uint32 i;
895
896 if (tif->tif_nfieldscompat > 0) {
899 tif->tif_nfieldscompat + 1,
900 sizeof(TIFFFieldArray), reason);
901 } else {
903 _TIFFCheckMalloc(tif, 1, sizeof(TIFFFieldArray),
904 reason);
905 }
906 if (!tif->tif_fieldscompat) {
908 "Failed to allocate fields array");
909 return -1;
910 }
911 nfields = tif->tif_nfieldscompat++;
912
913 tif->tif_fieldscompat[nfields].type = tfiatOther;
914 tif->tif_fieldscompat[nfields].allocated_size = n;
915 tif->tif_fieldscompat[nfields].count = n;
916 tif->tif_fieldscompat[nfields].fields =
917 (TIFFField *)_TIFFCheckMalloc(tif, n, sizeof(TIFFField),
918 reason);
919 if (!tif->tif_fieldscompat[nfields].fields) {
921 "Failed to allocate fields array");
922 return -1;
923 }
924
925 tp = tif->tif_fieldscompat[nfields].fields;
926 for (i = 0; i < n; i++) {
927 tp->field_tag = info[i].field_tag;
928 tp->field_readcount = info[i].field_readcount;
929 tp->field_writecount = info[i].field_writecount;
930 tp->field_type = info[i].field_type;
931 tp->reserved = 0;
932 tp->set_field_type =
933 _TIFFSetGetType(info[i].field_type,
934 info[i].field_readcount,
935 info[i].field_passcount);
936 tp->get_field_type =
937 _TIFFSetGetType(info[i].field_type,
938 info[i].field_readcount,
939 info[i].field_passcount);
940 tp->field_bit = info[i].field_bit;
941 tp->field_oktochange = info[i].field_oktochange;
942 tp->field_passcount = info[i].field_passcount;
943 tp->field_name = info[i].field_name;
944 tp->field_subfields = NULL;
945 tp++;
946 }
947
948 if (!_TIFFMergeFields(tif, tif->tif_fieldscompat[nfields].fields, n)) {
950 "Setting up field info failed");
951 return -1;
952 }
953
954 return 0;
955}
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
TIFFFieldArrayType type
Definition: tif_dir.h:276
uint32 count
Definition: tif_dir.h:278
void * _TIFFCheckRealloc(TIFF *tif, void *buffer, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Definition: tif_aux.c:97
void * _TIFFCheckMalloc(TIFF *tif, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Definition: tif_aux.c:121
@ tfiatOther
Definition: tif_dir.h:272
int _TIFFMergeFields(TIFF *tif, const TIFFField info[], uint32 n)
Definition: tif_dirinfo.c:369
static TIFFSetGetFieldType _TIFFSetGetType(TIFFDataType type, short count, unsigned char passcount)
Definition: tif_dirinfo.c:735

◆ TIFFNumberOfDirectories()

uint16 TIFFNumberOfDirectories ( TIFF tif)

Definition at line 1586 of file tif_dir.c.

1587{
1588 static const char module[] = "TIFFNumberOfDirectories";
1589 uint64 nextdir;
1590 uint16 n;
1591 if (!(tif->tif_flags&TIFF_BIGTIFF))
1592 nextdir = tif->tif_header.classic.tiff_diroff;
1593 else
1594 nextdir = tif->tif_header.big.tiff_diroff;
1595 n = 0;
1596 while (nextdir != 0 && TIFFAdvanceDirectory(tif, &nextdir, NULL))
1597 {
1598 if (n != 65535) {
1599 ++n;
1600 }
1601 else
1602 {
1604 "Directory count exceeded 65535 limit,"
1605 " giving up on counting.");
1606 return (65535);
1607 }
1608 }
1609 return (n);
1610}
static int TIFFAdvanceDirectory(TIFF *tif, uint64 *nextdir, uint64 *off)
Definition: tif_dir.c:1444

◆ TIFFNumberOfStrips()

uint32 TIFFNumberOfStrips ( TIFF tif)

Definition at line 59 of file tif_strip.c.

60{
61 TIFFDirectory *td = &tif->tif_dir;
62 uint32 nstrips;
63
64 nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 :
67 nstrips = _TIFFMultiply32(tif, nstrips, (uint32)td->td_samplesperpixel,
68 "TIFFNumberOfStrips");
69 return (nstrips);
70}
uint32 _TIFFMultiply32(TIFF *tif, uint32 first, uint32 second, const char *where)
Definition: tif_aux.c:37

Referenced by TIFFReadDirectory(), and TIFFSetupStrips().

◆ TIFFNumberOfTiles()

uint32 TIFFNumberOfTiles ( TIFF tif)

Definition at line 113 of file tif_tile.c.

114{
115 TIFFDirectory *td = &tif->tif_dir;
116 uint32 dx = td->td_tilewidth;
117 uint32 dy = td->td_tilelength;
118 uint32 dz = td->td_tiledepth;
119 uint32 ntiles;
120
121 if (dx == (uint32) -1)
122 dx = td->td_imagewidth;
123 if (dy == (uint32) -1)
124 dy = td->td_imagelength;
125 if (dz == (uint32) -1)
126 dz = td->td_imagedepth;
127 ntiles = (dx == 0 || dy == 0 || dz == 0) ? 0 :
130 "TIFFNumberOfTiles"),
131 TIFFhowmany_32(td->td_imagedepth, dz), "TIFFNumberOfTiles");
133 ntiles = _TIFFMultiply32(tif, ntiles, td->td_samplesperpixel,
134 "TIFFNumberOfTiles");
135 return (ntiles);
136}

Referenced by TIFFReadDirectory(), and TIFFSetupStrips().

◆ TIFFOpen()

TIFF * TIFFOpen ( const char name,
const char mode 
)

Definition at line 223 of file tif_unix.c.

224{
225 static const char module[] = "TIFFOpen";
226 int m, fd;
227 TIFF* tif;
228
230 if (m == -1)
231 return ((TIFF*)0);
232
233/* for cygwin and mingw */
234#ifdef O_BINARY
235 m |= O_BINARY;
236#endif
237
238 fd = open(name, m, 0666);
239 if (fd < 0) {
240 if (errno > 0 && strerror(errno) != NULL ) {
241 TIFFErrorExt(0, module, "%s: %s", name, strerror(errno) );
242 } else {
243 TIFFErrorExt(0, module, "%s: Cannot open", name);
244 }
245 return ((TIFF *)0);
246 }
247
248 tif = TIFFFdOpen((int)fd, name, mode);
249 if(!tif)
250 close(fd);
251 return tif;
252}
#define O_BINARY
Definition: acwin.h:109
#define open
Definition: acwin.h:95
#define close
Definition: acwin.h:98
const char * strerror(int err)
Definition: compat_str.c:23
#define errno
Definition: errno.h:18
TIFF * TIFFFdOpen(int fd, const char *name, const char *mode)
Definition: tif_unix.c:203

◆ TIFFPrintDirectory()

void TIFFPrintDirectory ( TIFF tif,
FILE fd,
long  flags 
)

Definition at line 234 of file tif_print.c.

235{
236 TIFFDirectory *td = &tif->tif_dir;
237 char *sep;
238 long l, n;
239
240#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
241 fprintf(fd, "TIFF Directory at offset 0x%I64x (%I64u)\n",
242 (unsigned __int64) tif->tif_diroff,
243 (unsigned __int64) tif->tif_diroff);
244#else
245 fprintf(fd, "TIFF Directory at offset 0x%llx (%llu)\n",
246 (unsigned long long) tif->tif_diroff,
247 (unsigned long long) tif->tif_diroff);
248#endif
250 fprintf(fd, " Subfile Type:");
251 sep = " ";
253 fprintf(fd, "%sreduced-resolution image", sep);
254 sep = "/";
255 }
256 if (td->td_subfiletype & FILETYPE_PAGE) {
257 fprintf(fd, "%smulti-page document", sep);
258 sep = "/";
259 }
261 fprintf(fd, "%stransparency mask", sep);
262 fprintf(fd, " (%lu = 0x%lx)\n",
263 (unsigned long) td->td_subfiletype, (long) td->td_subfiletype);
264 }
266 fprintf(fd, " Image Width: %lu Image Length: %lu",
267 (unsigned long) td->td_imagewidth, (unsigned long) td->td_imagelength);
269 fprintf(fd, " Image Depth: %lu",
270 (unsigned long) td->td_imagedepth);
271 fprintf(fd, "\n");
272 }
274 fprintf(fd, " Tile Width: %lu Tile Length: %lu",
275 (unsigned long) td->td_tilewidth, (unsigned long) td->td_tilelength);
277 fprintf(fd, " Tile Depth: %lu",
278 (unsigned long) td->td_tiledepth);
279 fprintf(fd, "\n");
280 }
282 fprintf(fd, " Resolution: %g, %g",
285 switch (td->td_resolutionunit) {
286 case RESUNIT_NONE:
287 fprintf(fd, " (unitless)");
288 break;
289 case RESUNIT_INCH:
290 fprintf(fd, " pixels/inch");
291 break;
293 fprintf(fd, " pixels/cm");
294 break;
295 default:
296 fprintf(fd, " (unit %u = 0x%x)",
299 break;
300 }
301 }
302 fprintf(fd, "\n");
303 }
305 fprintf(fd, " Position: %g, %g\n",
306 td->td_xposition, td->td_yposition);
308 fprintf(fd, " Bits/Sample: %u\n", td->td_bitspersample);
310 fprintf(fd, " Sample Format: ");
311 switch (td->td_sampleformat) {
313 fprintf(fd, "void\n");
314 break;
315 case SAMPLEFORMAT_INT:
316 fprintf(fd, "signed integer\n");
317 break;
319 fprintf(fd, "unsigned integer\n");
320 break;
322 fprintf(fd, "IEEE floating point\n");
323 break;
325 fprintf(fd, "complex signed integer\n");
326 break;
328 fprintf(fd, "complex IEEE floating point\n");
329 break;
330 default:
331 fprintf(fd, "%u (0x%x)\n",
333 break;
334 }
335 }
338 fprintf(fd, " Compression Scheme: ");
339 if (c)
340 fprintf(fd, "%s\n", c->name);
341 else
342 fprintf(fd, "%u (0x%x)\n",
344 }
346 fprintf(fd, " Photometric Interpretation: ");
347 if (td->td_photometric < NPHOTONAMES)
348 fprintf(fd, "%s\n", photoNames[td->td_photometric]);
349 else {
350 switch (td->td_photometric) {
351 case PHOTOMETRIC_LOGL:
352 fprintf(fd, "CIE Log2(L)\n");
353 break;
355 fprintf(fd, "CIE Log2(L) (u',v')\n");
356 break;
357 default:
358 fprintf(fd, "%u (0x%x)\n",
360 break;
361 }
362 }
363 }
365 uint16 i;
366 fprintf(fd, " Extra Samples: %u<", td->td_extrasamples);
367 sep = "";
368 for (i = 0; i < td->td_extrasamples; i++) {
369 switch (td->td_sampleinfo[i]) {
371 fprintf(fd, "%sunspecified", sep);
372 break;
374 fprintf(fd, "%sassoc-alpha", sep);
375 break;
377 fprintf(fd, "%sunassoc-alpha", sep);
378 break;
379 default:
380 fprintf(fd, "%s%u (0x%x)", sep,
381 td->td_sampleinfo[i], td->td_sampleinfo[i]);
382 break;
383 }
384 sep = ", ";
385 }
386 fprintf(fd, ">\n");
387 }
388 if (TIFFFieldSet(tif,FIELD_INKNAMES)) {
389 char* cp;
390 uint16 i;
391 fprintf(fd, " Ink Names: ");
392 i = td->td_samplesperpixel;
393 sep = "";
394 for (cp = td->td_inknames;
395 i > 0 && cp < td->td_inknames + td->td_inknameslen;
396 cp = strchr(cp,'\0')+1, i--) {
397 size_t max_chars =
398 td->td_inknameslen - (cp - td->td_inknames);
399 fputs(sep, fd);
400 _TIFFprintAsciiBounded(fd, cp, max_chars);
401 sep = ", ";
402 }
403 fputs("\n", fd);
404 }
406 fprintf(fd, " Thresholding: ");
407 switch (td->td_threshholding) {
409 fprintf(fd, "bilevel art scan\n");
410 break;
412 fprintf(fd, "halftone or dithered scan\n");
413 break;
415 fprintf(fd, "error diffused\n");
416 break;
417 default:
418 fprintf(fd, "%u (0x%x)\n",
420 break;
421 }
422 }
423 if (TIFFFieldSet(tif,FIELD_FILLORDER)) {
424 fprintf(fd, " FillOrder: ");
425 switch (td->td_fillorder) {
427 fprintf(fd, "msb-to-lsb\n");
428 break;
430 fprintf(fd, "lsb-to-msb\n");
431 break;
432 default:
433 fprintf(fd, "%u (0x%x)\n",
434 td->td_fillorder, td->td_fillorder);
435 break;
436 }
437 }
439 {
440 fprintf(fd, " YCbCr Subsampling: %u, %u\n",
442 }
444 fprintf(fd, " YCbCr Positioning: ");
445 switch (td->td_ycbcrpositioning) {
447 fprintf(fd, "centered\n");
448 break;
450 fprintf(fd, "cosited\n");
451 break;
452 default:
453 fprintf(fd, "%u (0x%x)\n",
455 break;
456 }
457 }
459 fprintf(fd, " Halftone Hints: light %u dark %u\n",
460 td->td_halftonehints[0], td->td_halftonehints[1]);
462 fprintf(fd, " Orientation: ");
464 fprintf(fd, "%s\n", orientNames[td->td_orientation]);
465 else
466 fprintf(fd, "%u (0x%x)\n",
468 }
470 fprintf(fd, " Samples/Pixel: %u\n", td->td_samplesperpixel);
472 fprintf(fd, " Rows/Strip: ");
473 if (td->td_rowsperstrip == (uint32) -1)
474 fprintf(fd, "(infinite)\n");
475 else
476 fprintf(fd, "%lu\n", (unsigned long) td->td_rowsperstrip);
477 }
479 fprintf(fd, " Min Sample Value: %u\n", td->td_minsamplevalue);
481 fprintf(fd, " Max Sample Value: %u\n", td->td_maxsamplevalue);
483 int i;
484 int count = (tif->tif_flags & TIFF_PERSAMPLE) ? td->td_samplesperpixel : 1;
485 fprintf(fd, " SMin Sample Value:");
486 for (i = 0; i < count; ++i)
487 fprintf(fd, " %g", td->td_sminsamplevalue[i]);
488 fprintf(fd, "\n");
489 }
491 int i;
492 int count = (tif->tif_flags & TIFF_PERSAMPLE) ? td->td_samplesperpixel : 1;
493 fprintf(fd, " SMax Sample Value:");
494 for (i = 0; i < count; ++i)
495 fprintf(fd, " %g", td->td_smaxsamplevalue[i]);
496 fprintf(fd, "\n");
497 }
499 fprintf(fd, " Planar Configuration: ");
500 switch (td->td_planarconfig) {
502 fprintf(fd, "single image plane\n");
503 break;
505 fprintf(fd, "separate image planes\n");
506 break;
507 default:
508 fprintf(fd, "%u (0x%x)\n",
510 break;
511 }
512 }
514 fprintf(fd, " Page Number: %u-%u\n",
515 td->td_pagenumber[0], td->td_pagenumber[1]);
516 if (TIFFFieldSet(tif,FIELD_COLORMAP)) {
517 fprintf(fd, " Color Map: ");
519 fprintf(fd, "\n");
520 n = 1L<<td->td_bitspersample;
521 for (l = 0; l < n; l++)
522 fprintf(fd, " %5ld: %5u %5u %5u\n",
523 l,
524 td->td_colormap[0][l],
525 td->td_colormap[1][l],
526 td->td_colormap[2][l]);
527 } else
528 fprintf(fd, "(present)\n");
529 }
531 int i;
532 fprintf(fd, " Reference Black/White:\n");
533 for (i = 0; i < 3; i++)
534 fprintf(fd, " %2d: %5g %5g\n", i,
535 td->td_refblackwhite[2*i+0],
536 td->td_refblackwhite[2*i+1]);
537 }
539 fprintf(fd, " Transfer Function: ");
540 if (flags & TIFFPRINT_CURVES) {
541 fprintf(fd, "\n");
542 n = 1L<<td->td_bitspersample;
543 for (l = 0; l < n; l++) {
544 uint16 i;
545 fprintf(fd, " %2ld: %5u",
546 l, td->td_transferfunction[0][l]);
547 for (i = 1; i < td->td_samplesperpixel - td->td_extrasamples && i < 3; i++)
548 fprintf(fd, " %5u",
549 td->td_transferfunction[i][l]);
550 fputc('\n', fd);
551 }
552 } else
553 fprintf(fd, "(present)\n");
554 }
555 if (TIFFFieldSet(tif, FIELD_SUBIFD) && (td->td_subifd)) {
556 uint16 i;
557 fprintf(fd, " SubIFD Offsets:");
558 for (i = 0; i < td->td_nsubifd; i++)
559#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
560 fprintf(fd, " %5I64u",
561 (unsigned __int64) td->td_subifd[i]);
562#else
563 fprintf(fd, " %5llu",
564 (unsigned long long) td->td_subifd[i]);
565#endif
566 fputc('\n', fd);
567 }
568
569 /*
570 ** Custom tag support.
571 */
572 {
573 int i;
574 short count;
575
577 for(i = 0; i < count; i++) {
579 const TIFFField *fip;
580 uint32 value_count;
581 int mem_alloc = 0;
582 void *raw_data;
583
584 fip = TIFFFieldWithTag(tif, tag);
585 if(fip == NULL)
586 continue;
587
588 if(fip->field_passcount) {
589 if (fip->field_readcount == TIFF_VARIABLE2 ) {
590 if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1)
591 continue;
592 } else if (fip->field_readcount == TIFF_VARIABLE ) {
593 uint16 small_value_count;
594 if(TIFFGetField(tif, tag, &small_value_count, &raw_data) != 1)
595 continue;
596 value_count = small_value_count;
597 } else {
600 continue;
601 }
602 } else {
605 value_count = 1;
606 else if (fip->field_readcount == TIFF_SPP)
607 value_count = td->td_samplesperpixel;
608 else
609 value_count = fip->field_readcount;
610 if (fip->field_tag == TIFFTAG_DOTRANGE
611 && strcmp(fip->field_name,"DotRange") == 0) {
612 /* TODO: This is an evil exception and should not have been
613 handled this way ... likely best if we move it into
614 the directory structure with an explicit field in
615 libtiff 4.1 and assign it a FIELD_ value */
616 static uint16 dotrange[2];
617 raw_data = dotrange;
618 TIFFGetField(tif, tag, dotrange+0, dotrange+1);
619 } else if (fip->field_type == TIFF_ASCII
622 || fip->field_readcount == TIFF_SPP
623 || value_count > 1) {
624 if(TIFFGetField(tif, tag, &raw_data) != 1)
625 continue;
626 } else {
627 raw_data = _TIFFmalloc(
629 * value_count);
630 mem_alloc = 1;
631 if(TIFFGetField(tif, tag, raw_data) != 1) {
632 _TIFFfree(raw_data);
633 continue;
634 }
635 }
636 }
637
638 /*
639 * Catch the tags which needs to be specially handled
640 * and pretty print them. If tag not handled in
641 * _TIFFPrettyPrintField() fall down and print it as
642 * any other tag.
643 */
644 if (!_TIFFPrettyPrintField(tif, fip, fd, tag, value_count, raw_data))
645 _TIFFPrintField(fd, fip, value_count, raw_data);
646
647 if(mem_alloc)
648 _TIFFfree(raw_data);
649 }
650 }
651
652 if (tif->tif_tagmethods.printdir)
653 (*tif->tif_tagmethods.printdir)(tif, fd, flags);
654
655 if ((flags & TIFFPRINT_STRIPS) &&
657 uint32 s;
658
659 fprintf(fd, " %lu %s:\n",
660 (unsigned long) td->td_nstrips,
661 isTiled(tif) ? "Tiles" : "Strips");
662 for (s = 0; s < td->td_nstrips; s++)
663#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
664 fprintf(fd, " %3lu: [%8I64u, %8I64u]\n",
665 (unsigned long) s,
666 (unsigned __int64) TIFFGetStrileOffset(tif, s),
667 (unsigned __int64) TIFFGetStrileByteCount(tif, s));
668#else
669 fprintf(fd, " %3lu: [%8llu, %8llu]\n",
670 (unsigned long) s,
671 (unsigned long long) TIFFGetStrileOffset(tif, s),
672 (unsigned long long) TIFFGetStrileByteCount(tif, s));
673#endif
674 }
675}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define __int64
Definition: basetyps.h:16
#define mem_alloc(bsize)
Definition: types.h:123
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLbitfield flags
Definition: glext.h:7161
_Check_return_opt_ _CRTIMP int __cdecl fputs(_In_z_ const char *_Str, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl fputc(_In_ int _Ch, _Inout_ FILE *_File)
float td_xposition
Definition: tif_dir.h:90
uint16 td_resolutionunit
Definition: tif_dir.h:88
uint16 td_sampleformat
Definition: tif_dir.h:76
float td_xresolution
Definition: tif_dir.h:87
int td_inknameslen
Definition: tif_dir.h:118
uint16 td_pagenumber[2]
Definition: tif_dir.h:91
float * td_refblackwhite
Definition: tif_dir.h:116
uint16 td_bitspersample
Definition: tif_dir.h:75
uint16 td_maxsamplevalue
Definition: tif_dir.h:84
float td_yresolution
Definition: tif_dir.h:87
uint16 td_photometric
Definition: tif_dir.h:78
uint16 td_fillorder
Definition: tif_dir.h:80
uint32 td_subfiletype
Definition: tif_dir.h:74
double * td_sminsamplevalue
Definition: tif_dir.h:85
uint16 td_minsamplevalue
Definition: tif_dir.h:84
uint16 td_threshholding
Definition: tif_dir.h:79
char * td_inknames
Definition: tif_dir.h:119
uint16 td_nsubifd
Definition: tif_dir.h:109
uint16 * td_transferfunction[3]
Definition: tif_dir.h:115
uint16 td_ycbcrpositioning
Definition: tif_dir.h:113
uint16 * td_sampleinfo
Definition: tif_dir.h:95
double * td_smaxsamplevalue
Definition: tif_dir.h:86
uint16 td_compression
Definition: tif_dir.h:77
uint16 td_extrasamples
Definition: tif_dir.h:94
uint16 td_halftonehints[2]
Definition: tif_dir.h:93
uint16 td_orientation
Definition: tif_dir.h:81
uint16 * td_colormap[3]
Definition: tif_dir.h:92
uint16 td_ycbcrsubsampling[2]
Definition: tif_dir.h:112
uint64 * td_subifd
Definition: tif_dir.h:110
float td_yposition
Definition: tif_dir.h:90
TIFFPrintMethod printdir
Definition: tiffio.h:335
int TIFFGetField(TIFF *tif, uint32 tag,...)
Definition: tif_dir.c:1232
#define FIELD_RESOLUTION
Definition: tif_dir.h:143
#define FIELD_SUBFILETYPE
Definition: tif_dir.h:147
#define FIELD_STRIPOFFSETS
Definition: tif_dir.h:162
#define FIELD_TRANSFERFUNCTION
Definition: tif_dir.h:174
#define FIELD_HALFTONEHINTS
Definition: tif_dir.h:170
#define FIELD_ORIENTATION
Definition: tif_dir.h:153
#define FIELD_MINSAMPLEVALUE
Definition: tif_dir.h:156
#define FIELD_FILLORDER
Definition: tif_dir.h:152
#define FIELD_SMAXSAMPLEVALUE
Definition: tif_dir.h:167
#define FIELD_IMAGEDIMENSIONS
Definition: tif_dir.h:141
#define FIELD_COLORMAP
Definition: tif_dir.h:163
#define FIELD_SUBIFD
Definition: tif_dir.h:176
#define FIELD_EXTRASAMPLES
Definition: tif_dir.h:164
#define FIELD_IMAGEDEPTH
Definition: tif_dir.h:168
#define FIELD_SMINSAMPLEVALUE
Definition: tif_dir.h:166
#define TIFFFieldSet(tif, field)
Definition: tif_dir.h:196
#define FIELD_MAXSAMPLEVALUE
Definition: tif_dir.h:157
#define FIELD_TILEDEPTH
Definition: tif_dir.h:169
#define FIELD_TILEDIMENSIONS
Definition: tif_dir.h:142
#define FIELD_POSITION
Definition: tif_dir.h:144
#define FIELD_ROWSPERSTRIP
Definition: tif_dir.h:155
#define FIELD_COMPRESSION
Definition: tif_dir.h:149
#define FIELD_REFBLACKWHITE
Definition: tif_dir.h:173
#define FIELD_SAMPLEFORMAT
Definition: tif_dir.h:165
#define FIELD_PAGENUMBER
Definition: tif_dir.h:160
#define FIELD_BITSPERSAMPLE
Definition: tif_dir.h:148
#define FIELD_INKNAMES
Definition: tif_dir.h:175
#define FIELD_RESOLUTIONUNIT
Definition: tif_dir.h:159
#define FIELD_PLANARCONFIG
Definition: tif_dir.h:158
#define FIELD_SAMPLESPERPIXEL
Definition: tif_dir.h:154
#define FIELD_PHOTOMETRIC
Definition: tif_dir.h:150
#define FIELD_THRESHHOLDING
Definition: tif_dir.h:151
const TIFFField * TIFFFieldWithTag(TIFF *tif, uint32 tag)
Definition: tif_dirinfo.c:558
int _TIFFDataSize(TIFFDataType type)
Definition: tif_dirinfo.c:476
uint64 TIFFGetStrileOffset(TIFF *tif, uint32 strile)
Definition: tif_dirread.c:6290
uint64 TIFFGetStrileByteCount(TIFF *tif, uint32 strile)
Definition: tif_dirread.c:6305
int TIFFGetTagListCount(TIFF *tif)
Definition: tif_extension.c:34
uint32 TIFFGetTagListEntry(TIFF *tif, int tag_index)
Definition: tif_extension.c:42
static void _TIFFPrintField(FILE *fd, const TIFFField *fip, uint32 value_count, void *raw_data)
Definition: tif_print.c:67
#define NORIENTNAMES
Definition: tif_print.c:64
#define NPHOTONAMES
Definition: tif_print.c:51
static int _TIFFPrettyPrintField(TIFF *tif, const TIFFField *fip, FILE *fd, uint32 tag, uint32 value_count, void *raw_data)
Definition: tif_print.c:141
static void _TIFFprintAsciiBounded(FILE *fd, const char *cp, size_t max_chars)
Definition: tif_print.c:684
static const char *const photoNames[]
Definition: tif_print.c:38
static const char *const orientNames[]
Definition: tif_print.c:53
#define THRESHHOLD_HALFTONE
Definition: tiff.h:210
#define TIFFTAG_DOTRANGE
Definition: tiff.h:301
#define EXTRASAMPLE_UNASSALPHA
Definition: tiff.h:306
#define YCBCRPOSITION_CENTERED
Definition: tiff.h:364
#define YCBCRPOSITION_COSITED
Definition: tiff.h:365
#define RESUNIT_CENTIMETER
Definition: tiff.h:264
#define EXTRASAMPLE_ASSOCALPHA
Definition: tiff.h:305
#define FILETYPE_MASK
Definition: tiff.h:149
#define PHOTOMETRIC_LOGL
Definition: tiff.h:206
#define SAMPLEFORMAT_COMPLEXINT
Definition: tiff.h:312
#define SAMPLEFORMAT_UINT
Definition: tiff.h:308
#define EXTRASAMPLE_UNSPECIFIED
Definition: tiff.h:304
#define RESUNIT_NONE
Definition: tiff.h:262
#define FILETYPE_REDUCEDIMAGE
Definition: tiff.h:147
#define THRESHHOLD_ERRORDIFFUSE
Definition: tiff.h:211
#define PHOTOMETRIC_LOGLUV
Definition: tiff.h:207
#define FILETYPE_PAGE
Definition: tiff.h:148
#define SAMPLEFORMAT_IEEEFP
Definition: tiff.h:310
#define SAMPLEFORMAT_COMPLEXIEEEFP
Definition: tiff.h:313
#define RESUNIT_INCH
Definition: tiff.h:263
#define THRESHHOLD_BILEVEL
Definition: tiff.h:209
#define SAMPLEFORMAT_VOID
Definition: tiff.h:311
#define SAMPLEFORMAT_INT
Definition: tiff.h:309
#define PLANARCONFIG_CONTIG
Definition: tiff.h:239
#define TIFFPRINT_STRIPS
Definition: tiffio.h:114
#define TIFFPRINT_COLORMAP
Definition: tiffio.h:116
#define TIFF_SPP
Definition: tiffio.h:309
#define TIFF_VARIABLE
Definition: tiffio.h:308
#define TIFFPRINT_CURVES
Definition: tiffio.h:115
#define TIFF_VARIABLE2
Definition: tiffio.h:310
#define TIFF_PERSAMPLE
Definition: tiffiop.h:141

◆ TIFFRasterScanlineSize()

tmsize_t TIFFRasterScanlineSize ( TIFF tif)

Definition at line 344 of file tif_strip.c.

345{
346 static const char module[] = "TIFFRasterScanlineSize";
347 uint64 m;
349 return _TIFFCastUInt64ToSSize(tif, m, module);
350}
tmsize_t _TIFFCastUInt64ToSSize(TIFF *tif, uint64 val, const char *module)
Definition: tif_aux.c:83
uint64 TIFFRasterScanlineSize64(TIFF *tif)
Definition: tif_strip.c:329

◆ TIFFRasterScanlineSize64()

uint64 TIFFRasterScanlineSize64 ( TIFF tif)

Definition at line 329 of file tif_strip.c.

330{
331 static const char module[] = "TIFFRasterScanlineSize64";
332 TIFFDirectory *td = &tif->tif_dir;
333 uint64 scanline;
334
335 scanline = _TIFFMultiply64(tif, td->td_bitspersample, td->td_imagewidth, module);
337 scanline = _TIFFMultiply64(tif, scanline, td->td_samplesperpixel, module);
338 return (TIFFhowmany8_64(scanline));
339 } else
340 return (_TIFFMultiply64(tif, TIFFhowmany8_64(scanline),
342}
uint64 _TIFFMultiply64(TIFF *tif, uint64 first, uint64 second, const char *where)
Definition: tif_aux.c:48
#define TIFFhowmany8_64(x)
Definition: tiffiop.h:274

Referenced by TIFFRasterScanlineSize().

◆ TIFFRawStripSize()

tmsize_t TIFFRawStripSize ( TIFF tif,
uint32  strip 
)

Definition at line 164 of file tif_strip.c.

165{
166 static const char module[] = "TIFFRawStripSize";
167 uint64 m;
168 tmsize_t n;
169 m=TIFFRawStripSize64(tif,strip);
170 if (m==(uint64)(-1))
171 n=(tmsize_t)(-1);
172 else
173 {
174 n=(tmsize_t)m;
175 if ((uint64)n!=m)
176 {
177 TIFFErrorExt(tif->tif_clientdata,module,"Integer overflow");
178 n=0;
179 }
180 }
181 return(n);
182}
uint64 TIFFRawStripSize64(TIFF *tif, uint32 strip)
Definition: tif_strip.c:140

◆ TIFFRawStripSize64()

uint64 TIFFRawStripSize64 ( TIFF tif,
uint32  strip 
)

Definition at line 140 of file tif_strip.c.

141{
142 static const char module[] = "TIFFRawStripSize64";
143 uint64 bytecount = TIFFGetStrileByteCount(tif, strip);
144
145 if (bytecount == 0)
146 {
147#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
149 "%I64u: Invalid strip byte count, strip %lu",
150 (unsigned __int64) bytecount,
151 (unsigned long) strip);
152#else
154 "%llu: Invalid strip byte count, strip %lu",
155 (unsigned long long) bytecount,
156 (unsigned long) strip);
157#endif
158 bytecount = (uint64) -1;
159 }
160
161 return bytecount;
162}

Referenced by TIFFRawStripSize().

◆ TIFFReadBufferSetup()

int TIFFReadBufferSetup ( TIFF tif,
void bp,
tmsize_t  size 
)

Definition at line 1378 of file tif_read.c.

1379{
1380 static const char module[] = "TIFFReadBufferSetup";
1381
1382 assert((tif->tif_flags&TIFF_NOREADRAW)==0);
1383 tif->tif_flags &= ~TIFF_BUFFERMMAP;
1384
1385 if (tif->tif_rawdata) {
1386 if (tif->tif_flags & TIFF_MYBUFFER)
1387 _TIFFfree(tif->tif_rawdata);
1388 tif->tif_rawdata = NULL;
1389 tif->tif_rawdatasize = 0;
1390 }
1391 if (bp) {
1392 tif->tif_rawdatasize = size;
1393 tif->tif_rawdata = (uint8*) bp;
1394 tif->tif_flags &= ~TIFF_MYBUFFER;
1395 } else {
1397 if (tif->tif_rawdatasize==0) {
1399 "Invalid buffer size");
1400 return (0);
1401 }
1402 /* Initialize to zero to avoid uninitialized buffers in case of */
1403 /* short reads (http://bugzilla.maptools.org/show_bug.cgi?id=2651) */
1404 tif->tif_rawdata = (uint8*) _TIFFcalloc(1, tif->tif_rawdatasize);
1405 tif->tif_flags |= TIFF_MYBUFFER;
1406 }
1407 if (tif->tif_rawdata == NULL) {
1409 "No space for data buffer at scanline %lu",
1410 (unsigned long) tif->tif_row);
1411 tif->tif_rawdatasize = 0;
1412 return (0);
1413 }
1414 return (1);
1415}
GLsizeiptr size
Definition: glext.h:5919
void * _TIFFcalloc(tmsize_t nmemb, tmsize_t siz)
Definition: tif_unix.c:317
#define TIFFroundup_64(x, y)
Definition: tiffiop.h:275
#define TIFF_NOREADRAW
Definition: tiffiop.h:136

Referenced by TIFFFillStrip(), and TIFFFillTile().

◆ TIFFReadCustomDirectory()

int TIFFReadCustomDirectory ( TIFF tif,
toff_t  diroff,
const TIFFFieldArray infoarray 
)

Definition at line 4394 of file tif_dirread.c.

4396{
4397 static const char module[] = "TIFFReadCustomDirectory";
4399 uint16 dircount;
4400 TIFFDirEntry* dp;
4401 uint16 di;
4402 const TIFFField* fip;
4403 uint32 fii;
4404 _TIFFSetupFields(tif, infoarray);
4405 dircount=TIFFFetchDirectory(tif,diroff,&dir,NULL);
4406 if (!dircount)
4407 {
4409 "Failed to read custom directory at offset " TIFF_UINT64_FORMAT,diroff);
4410 return 0;
4411 }
4412 TIFFFreeDirectory(tif);
4413 _TIFFmemset(&tif->tif_dir, 0, sizeof(TIFFDirectory));
4414 TIFFReadDirectoryCheckOrder(tif,dir,dircount);
4415 for (di=0, dp=dir; di<dircount; di++, dp++)
4416 {
4418 if (fii == FAILED_FII)
4419 {
4421 "Unknown field with tag %d (0x%x) encountered",
4422 dp->tdir_tag, dp->tdir_tag);
4424 dp->tdir_tag,
4425 (TIFFDataType) dp->tdir_type),
4426 1)) {
4428 "Registering anonymous field with tag %d (0x%x) failed",
4429 dp->tdir_tag, dp->tdir_tag);
4430 dp->tdir_ignore = TRUE;
4431 } else {
4433 assert( fii != FAILED_FII );
4434 }
4435 }
4436 if (!dp->tdir_ignore)
4437 {
4438 fip=tif->tif_fields[fii];
4439 if (fip->field_bit==FIELD_IGNORE)
4440 dp->tdir_ignore = TRUE;
4441 else
4442 {
4443 /* check data type */
4444 while ((fip->field_type!=TIFF_ANY)&&(fip->field_type!=dp->tdir_type))
4445 {
4446 fii++;
4447 if ((fii==tif->tif_nfields)||
4448 (tif->tif_fields[fii]->field_tag!=(uint32)dp->tdir_tag))
4449 {
4450 fii=0xFFFF;
4451 break;
4452 }
4453 fip=tif->tif_fields[fii];
4454 }
4455 if (fii==0xFFFF)
4456 {
4458 "Wrong data type %d for \"%s\"; tag ignored",
4459 dp->tdir_type,fip->field_name);
4460 dp->tdir_ignore = TRUE;
4461 }
4462 else
4463 {
4464 /* check count if known in advance */
4465 if ((fip->field_readcount!=TIFF_VARIABLE)&&
4467 {
4469 if (fip->field_readcount==TIFF_SPP)
4471 else
4473 if (!CheckDirCount(tif,dp,expected))
4474 dp->tdir_ignore = TRUE;
4475 }
4476 }
4477 }
4478 if (!dp->tdir_ignore) {
4479 switch (dp->tdir_tag)
4480 {
4483 break;
4484 default:
4485 (void)TIFFFetchNormalTag(tif, dp, TRUE);
4486 break;
4487 }
4488 } /*-- if (!dp->tdir_ignore) */
4489 }
4490 }
4491 if (dir)
4492 _TIFFfree(dir);
4493 return 1;
4494}
unsigned int dir
Definition: maze.c:112
BOOL expected
Definition: store.c:2063
uint8 tdir_ignore
Definition: tif_dir.h:61
#define TIFF_UINT64_FORMAT
Definition: tif_config.h:52
#define FIELD_IGNORE
Definition: tif_dir.h:138
TIFFField * _TIFFCreateAnonField(TIFF *tif, uint32 tag, TIFFDataType field_type)
Definition: tif_dirinfo.c:634
#define FAILED_FII
Definition: tif_dirread.c:41
static void TIFFReadDirectoryCheckOrder(TIFF *tif, TIFFDirEntry *dir, uint16 dircount)
Definition: tif_dirread.c:4324
static void TIFFReadDirectoryFindFieldInfo(TIFF *tif, uint16 tagid, uint32 *fii)
Definition: tif_dirread.c:4358
static int CheckDirCount(TIFF *, TIFFDirEntry *, uint32)
Definition: tif_dirread.c:4679
static uint16 TIFFFetchDirectory(TIFF *tif, uint64 diroff, TIFFDirEntry **pdir, uint64 *nextdiroff)
Definition: tif_dirread.c:4706
static int TIFFFetchSubjectDistance(TIFF *, TIFFDirEntry *)
Definition: tif_dirread.c:5698
static int TIFFFetchNormalTag(TIFF *, TIFFDirEntry *, int recover)
Definition: tif_dirread.c:4964
void TIFFWarningExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_warning.c:65
TIFFDataType
Definition: tiff.h:123
#define EXIFTAG_SUBJECTDISTANCE
Definition: tiff.h:599

Referenced by TIFFReadEXIFDirectory().

◆ TIFFReadDirectory()

int TIFFReadDirectory ( TIFF tif)

Definition at line 3574 of file tif_dirread.c.

3575{
3576 static const char module[] = "TIFFReadDirectory";
3578 uint16 dircount;
3579 TIFFDirEntry* dp;
3580 uint16 di;
3581 const TIFFField* fip;
3582 uint32 fii=FAILED_FII;
3583 toff_t nextdiroff;
3584 int bitspersample_read = FALSE;
3585 int color_channels;
3586
3587 tif->tif_diroff=tif->tif_nextdiroff;
3588 if (!TIFFCheckDirOffset(tif,tif->tif_nextdiroff))
3589 return 0; /* last offset or bad offset (IFD looping) */
3590 (*tif->tif_cleanup)(tif); /* cleanup any previous compression state */
3591 tif->tif_curdir++;
3592 nextdiroff = tif->tif_nextdiroff;
3593 dircount=TIFFFetchDirectory(tif,nextdiroff,&dir,&tif->tif_nextdiroff);
3594 if (!dircount)
3595 {
3597 "Failed to read directory at offset " TIFF_UINT64_FORMAT,nextdiroff);
3598 return 0;
3599 }
3600 TIFFReadDirectoryCheckOrder(tif,dir,dircount);
3601
3602 /*
3603 * Mark duplicates of any tag to be ignored (bugzilla 1994)
3604 * to avoid certain pathological problems.
3605 */
3606 {
3607 TIFFDirEntry* ma;
3608 uint16 mb;
3609 for (ma=dir, mb=0; mb<dircount; ma++, mb++)
3610 {
3611 TIFFDirEntry* na;
3612 uint16 nb;
3613 for (na=ma+1, nb=mb+1; nb<dircount; na++, nb++)
3614 {
3615 if (ma->tdir_tag == na->tdir_tag) {
3616 na->tdir_ignore = TRUE;
3617 }
3618 }
3619 }
3620 }
3621
3622 tif->tif_flags &= ~TIFF_BEENWRITING; /* reset before new dir */
3623 tif->tif_flags &= ~TIFF_BUF4WRITE; /* reset before new dir */
3624 tif->tif_flags &= ~TIFF_CHOPPEDUPARRAYS;
3625
3626 /* free any old stuff and reinit */
3627 TIFFFreeDirectory(tif);
3629 /*
3630 * Electronic Arts writes gray-scale TIFF files
3631 * without a PlanarConfiguration directory entry.
3632 * Thus we setup a default value here, even though
3633 * the TIFF spec says there is no default value.
3634 */
3636 /*
3637 * Setup default value and then make a pass over
3638 * the fields to check type and tag information,
3639 * and to extract info required to size data
3640 * structures. A second pass is made afterwards
3641 * to read in everything not taken in the first pass.
3642 * But we must process the Compression tag first
3643 * in order to merge in codec-private tag definitions (otherwise
3644 * we may get complaints about unknown tags). However, the
3645 * Compression tag may be dependent on the SamplesPerPixel
3646 * tag value because older TIFF specs permitted Compression
3647 * to be written as a SamplesPerPixel-count tag entry.
3648 * Thus if we don't first figure out the correct SamplesPerPixel
3649 * tag value then we may end up ignoring the Compression tag
3650 * value because it has an incorrect count value (if the
3651 * true value of SamplesPerPixel is not 1).
3652 */
3654 if (dp)
3655 {
3656 if (!TIFFFetchNormalTag(tif,dp,0))
3657 goto bad;
3658 dp->tdir_ignore = TRUE;
3659 }
3661 if (dp)
3662 {
3663 /*
3664 * The 5.0 spec says the Compression tag has one value, while
3665 * earlier specs say it has one value per sample. Because of
3666 * this, we accept the tag if one value is supplied with either
3667 * count.
3668 */
3669 uint16 value;
3670