PBRT
/home/felix/UBC/projects/AdaptiveLightfieldSampling/pbrt_v2/src/3rdparty/tiff-3.9.4/tiffio.h
00001 /* $Id: tiffio.h,v 1.56.2.4 2010-06-08 18:50:43 bfriesen Exp $ */
00002 
00003 /*
00004  * Copyright (c) 1988-1997 Sam Leffler
00005  * Copyright (c) 1991-1997 Silicon Graphics, Inc.
00006  *
00007  * Permission to use, copy, modify, distribute, and sell this software and 
00008  * its documentation for any purpose is hereby granted without fee, provided
00009  * that (i) the above copyright notices and this permission notice appear in
00010  * all copies of the software and related documentation, and (ii) the names of
00011  * Sam Leffler and Silicon Graphics may not be used in any advertising or
00012  * publicity relating to the software without the specific, prior written
00013  * permission of Sam Leffler and Silicon Graphics.
00014  * 
00015  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
00016  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
00017  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
00018  * 
00019  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
00020  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
00021  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
00022  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
00023  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
00024  * OF THIS SOFTWARE.
00025  */
00026 
00027 #ifndef _TIFFIO_
00028 #define _TIFFIO_
00029 
00030 /*
00031  * TIFF I/O Library Definitions.
00032  */
00033 #include "tiff.h"
00034 #include "tiffvers.h"
00035 
00036 /*
00037  * TIFF is defined as an incomplete type to hide the
00038  * library's internal data structures from clients.
00039  */
00040 typedef struct tiff TIFF;
00041 
00042 /*
00043  * The following typedefs define the intrinsic size of
00044  * data types used in the *exported* interfaces.  These
00045  * definitions depend on the proper definition of types
00046  * in tiff.h.  Note also that the varargs interface used
00047  * to pass tag types and values uses the types defined in
00048  * tiff.h directly.
00049  *
00050  * NB: ttag_t is unsigned int and not unsigned short because
00051  *     ANSI C requires that the type before the ellipsis be a
00052  *     promoted type (i.e. one of int, unsigned int, pointer,
00053  *     or double) and because we defined pseudo-tags that are
00054  *     outside the range of legal Aldus-assigned tags.
00055  * NB: tsize_t is int32 and not uint32 because some functions
00056  *     return -1.
00057  * NB: toff_t is not off_t for many reasons; TIFFs max out at
00058  *     32-bit file offsets being the most important, and to ensure
00059  *     that it is unsigned, rather than signed.
00060  */
00061 typedef uint32 ttag_t;          /* directory tag */
00062 typedef uint16 tdir_t;          /* directory index */
00063 typedef uint16 tsample_t;       /* sample number */
00064 typedef uint32 tstrile_t;       /* strip or tile number */
00065 typedef tstrile_t tstrip_t;     /* strip number */
00066 typedef tstrile_t ttile_t;      /* tile number */
00067 typedef int32 tsize_t;          /* i/o size in bytes */
00068 typedef void* tdata_t;          /* image data ref */
00069 typedef uint32 toff_t;          /* file offset */
00070 
00071 #if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
00072 #define __WIN32__
00073 #endif
00074 
00075 /*
00076  * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
00077  * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
00078  *
00079  * By default tif_unix.c is assumed.
00080  */
00081 
00082 #if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
00083 #  if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
00084 #    define AVOID_WIN32_FILEIO
00085 #  endif
00086 #endif
00087 
00088 #if defined(USE_WIN32_FILEIO)
00089 # define VC_EXTRALEAN
00090 # include <windows.h>
00091 # ifdef __WIN32__
00092 DECLARE_HANDLE(thandle_t);      /* Win32 file handle */
00093 # else
00094 typedef HFILE thandle_t;        /* client data handle */
00095 # endif /* __WIN32__ */
00096 #else
00097 typedef void* thandle_t;        /* client data handle */
00098 #endif /* USE_WIN32_FILEIO */
00099 
00100 /*
00101  * Flags to pass to TIFFPrintDirectory to control
00102  * printing of data structures that are potentially
00103  * very large.   Bit-or these flags to enable printing
00104  * multiple items.
00105  */
00106 #define TIFFPRINT_NONE          0x0             /* no extra info */
00107 #define TIFFPRINT_STRIPS        0x1             /* strips/tiles info */
00108 #define TIFFPRINT_CURVES        0x2             /* color/gray response curves */
00109 #define TIFFPRINT_COLORMAP      0x4             /* colormap */
00110 #define TIFFPRINT_JPEGQTABLES   0x100           /* JPEG Q matrices */
00111 #define TIFFPRINT_JPEGACTABLES  0x200           /* JPEG AC tables */
00112 #define TIFFPRINT_JPEGDCTABLES  0x200           /* JPEG DC tables */
00113 
00114 /* 
00115  * Colour conversion stuff
00116  */
00117 
00118 /* reference white */
00119 #define D65_X0 (95.0470F)
00120 #define D65_Y0 (100.0F)
00121 #define D65_Z0 (108.8827F)
00122 
00123 #define D50_X0 (96.4250F)
00124 #define D50_Y0 (100.0F)
00125 #define D50_Z0 (82.4680F)
00126 
00127 /* Structure for holding information about a display device. */
00128 
00129 typedef unsigned char TIFFRGBValue;             /* 8-bit samples */
00130 
00131 typedef struct {
00132         float d_mat[3][3];              /* XYZ -> luminance matrix */
00133         float d_YCR;                    /* Light o/p for reference white */
00134         float d_YCG;
00135         float d_YCB;
00136         uint32 d_Vrwr;                  /* Pixel values for ref. white */
00137         uint32 d_Vrwg;
00138         uint32 d_Vrwb;
00139         float d_Y0R;                    /* Residual light for black pixel */
00140         float d_Y0G;
00141         float d_Y0B;
00142         float d_gammaR;                 /* Gamma values for the three guns */
00143         float d_gammaG;
00144         float d_gammaB;
00145 } TIFFDisplay;
00146 
00147 typedef struct {                                /* YCbCr->RGB support */
00148         TIFFRGBValue* clamptab;                 /* range clamping table */
00149         int*    Cr_r_tab;
00150         int*    Cb_b_tab;
00151         int32*  Cr_g_tab;
00152         int32*  Cb_g_tab;
00153         int32*  Y_tab;
00154 } TIFFYCbCrToRGB;
00155 
00156 typedef struct {                                /* CIE Lab 1976->RGB support */
00157         int     range;                          /* Size of conversion table */
00158 #define CIELABTORGB_TABLE_RANGE 1500
00159         float   rstep, gstep, bstep;
00160         float   X0, Y0, Z0;                     /* Reference white point */
00161         TIFFDisplay display;
00162         float   Yr2r[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yr to r */
00163         float   Yg2g[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yg to g */
00164         float   Yb2b[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yb to b */
00165 } TIFFCIELabToRGB;
00166 
00167 /*
00168  * RGBA-style image support.
00169  */
00170 typedef struct _TIFFRGBAImage TIFFRGBAImage;
00171 /*
00172  * The image reading and conversion routines invoke
00173  * ``put routines'' to copy/image/whatever tiles of
00174  * raw image data.  A default set of routines are 
00175  * provided to convert/copy raw image data to 8-bit
00176  * packed ABGR format rasters.  Applications can supply
00177  * alternate routines that unpack the data into a
00178  * different format or, for example, unpack the data
00179  * and draw the unpacked raster on the display.
00180  */
00181 typedef void (*tileContigRoutine)
00182     (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
00183         unsigned char*);
00184 typedef void (*tileSeparateRoutine)
00185     (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
00186         unsigned char*, unsigned char*, unsigned char*, unsigned char*);
00187 /*
00188  * RGBA-reader state.
00189  */
00190 struct _TIFFRGBAImage {
00191         TIFF* tif;                              /* image handle */
00192         int stoponerr;                          /* stop on read error */
00193         int isContig;                           /* data is packed/separate */
00194         int alpha;                              /* type of alpha data present */
00195         uint32 width;                           /* image width */
00196         uint32 height;                          /* image height */
00197         uint16 bitspersample;                   /* image bits/sample */
00198         uint16 samplesperpixel;                 /* image samples/pixel */
00199         uint16 orientation;                     /* image orientation */
00200         uint16 req_orientation;                 /* requested orientation */
00201         uint16 photometric;                     /* image photometric interp */
00202         uint16* redcmap;                        /* colormap pallete */
00203         uint16* greencmap;
00204         uint16* bluecmap;
00205         /* get image data routine */
00206         int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
00207         /* put decoded strip/tile */
00208         union {
00209             void (*any)(TIFFRGBAImage*);
00210             tileContigRoutine contig;
00211             tileSeparateRoutine separate;
00212         } put;
00213         TIFFRGBValue* Map;                      /* sample mapping array */
00214         uint32** BWmap;                         /* black&white map */
00215         uint32** PALmap;                        /* palette image map */
00216         TIFFYCbCrToRGB* ycbcr;                  /* YCbCr conversion state */
00217         TIFFCIELabToRGB* cielab;                /* CIE L*a*b conversion state */
00218 
00219         int row_offset;
00220         int col_offset;
00221 };
00222 
00223 /*
00224  * Macros for extracting components from the
00225  * packed ABGR form returned by TIFFReadRGBAImage.
00226  */
00227 #define TIFFGetR(abgr)  ((abgr) & 0xff)
00228 #define TIFFGetG(abgr)  (((abgr) >> 8) & 0xff)
00229 #define TIFFGetB(abgr)  (((abgr) >> 16) & 0xff)
00230 #define TIFFGetA(abgr)  (((abgr) >> 24) & 0xff)
00231 
00232 /*
00233  * A CODEC is a software package that implements decoding,
00234  * encoding, or decoding+encoding of a compression algorithm.
00235  * The library provides a collection of builtin codecs.
00236  * More codecs may be registered through calls to the library
00237  * and/or the builtin implementations may be overridden.
00238  */
00239 typedef int (*TIFFInitMethod)(TIFF*, int);
00240 typedef struct {
00241         char*           name;
00242         uint16          scheme;
00243         TIFFInitMethod  init;
00244 } TIFFCodec;
00245 
00246 #include <stdio.h>
00247 #include <stdarg.h>
00248 
00249 /* share internal LogLuv conversion routines? */
00250 #ifndef LOGLUV_PUBLIC
00251 #define LOGLUV_PUBLIC           1
00252 #endif
00253 
00254 #if !defined(__GNUC__) && !defined(__attribute__)
00255 #  define __attribute__(x) /*nothing*/
00256 #endif
00257 
00258 #if defined(c_plusplus) || defined(__cplusplus)
00259 extern "C" {
00260 #endif
00261 typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
00262 typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
00263 typedef tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
00264 typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
00265 typedef int (*TIFFCloseProc)(thandle_t);
00266 typedef toff_t (*TIFFSizeProc)(thandle_t);
00267 typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);
00268 typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);
00269 typedef void (*TIFFExtendProc)(TIFF*); 
00270 
00271 extern  const char* TIFFGetVersion(void);
00272 
00273 extern  const TIFFCodec* TIFFFindCODEC(uint16);
00274 extern  TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
00275 extern  void TIFFUnRegisterCODEC(TIFFCodec*);
00276 extern  int TIFFIsCODECConfigured(uint16);
00277 extern  TIFFCodec* TIFFGetConfiguredCODECs(void);
00278 
00279 /*
00280  * Auxiliary functions.
00281  */
00282 
00283 extern  tdata_t _TIFFmalloc(tsize_t);
00284 extern  tdata_t _TIFFrealloc(tdata_t, tsize_t);
00285 extern  void _TIFFmemset(tdata_t, int, tsize_t);
00286 extern  void _TIFFmemcpy(tdata_t, const tdata_t, tsize_t);
00287 extern  int _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);
00288 extern  void _TIFFfree(tdata_t);
00289 
00290 /*
00291 ** Stuff, related to tag handling and creating custom tags.
00292 */
00293 extern  int  TIFFGetTagListCount( TIFF * );
00294 extern  ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );
00295     
00296 #define TIFF_ANY        TIFF_NOTYPE     /* for field descriptor searching */
00297 #define TIFF_VARIABLE   -1              /* marker for variable length tags */
00298 #define TIFF_SPP        -2              /* marker for SamplesPerPixel tags */
00299 #define TIFF_VARIABLE2  -3              /* marker for uint32 var-length tags */
00300 
00301 #define FIELD_CUSTOM    65    
00302 
00303 typedef struct {
00304         ttag_t  field_tag;              /* field's tag */
00305         short   field_readcount;        /* read count/TIFF_VARIABLE/TIFF_SPP */
00306         short   field_writecount;       /* write count/TIFF_VARIABLE */
00307         TIFFDataType field_type;        /* type of associated data */
00308         unsigned short field_bit;       /* bit in fieldsset bit vector */
00309         unsigned char field_oktochange; /* if true, can change while writing */
00310         unsigned char field_passcount;  /* if true, pass dir count on set */
00311         char    *field_name;            /* ASCII name */
00312 } TIFFFieldInfo;
00313 
00314 typedef struct _TIFFTagValue {
00315     const TIFFFieldInfo  *info;
00316     int             count;
00317     void           *value;
00318 } TIFFTagValue;
00319 
00320 extern  void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
00321 extern  const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
00322 extern  const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,
00323                                                      TIFFDataType);
00324 extern  const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);
00325 extern  const TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);
00326 
00327 typedef int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
00328 typedef int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
00329 typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
00330     
00331 typedef struct {
00332     TIFFVSetMethod      vsetfield;      /* tag set routine */
00333     TIFFVGetMethod      vgetfield;      /* tag get routine */
00334     TIFFPrintMethod     printdir;       /* directory print routine */
00335 } TIFFTagMethods;
00336         
00337 extern  TIFFTagMethods *TIFFAccessTagMethods( TIFF * );
00338 extern  void *TIFFGetClientInfo( TIFF *, const char * );
00339 extern  void TIFFSetClientInfo( TIFF *, void *, const char * );
00340 
00341 extern  void TIFFCleanup(TIFF*);
00342 extern  void TIFFClose(TIFF*);
00343 extern  int TIFFFlush(TIFF*);
00344 extern  int TIFFFlushData(TIFF*);
00345 extern  int TIFFGetField(TIFF*, ttag_t, ...);
00346 extern  int TIFFVGetField(TIFF*, ttag_t, va_list);
00347 extern  int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);
00348 extern  int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);
00349 extern  int TIFFReadDirectory(TIFF*);
00350 extern  int TIFFReadCustomDirectory(TIFF*, toff_t, const TIFFFieldInfo[],
00351                                     size_t);
00352 extern  int TIFFReadEXIFDirectory(TIFF*, toff_t);
00353 extern  tsize_t TIFFScanlineSize(TIFF*);
00354 extern  tsize_t TIFFOldScanlineSize(TIFF*);
00355 extern  tsize_t TIFFNewScanlineSize(TIFF*);
00356 extern  tsize_t TIFFRasterScanlineSize(TIFF*);
00357 extern  tsize_t TIFFStripSize(TIFF*);
00358 extern  tsize_t TIFFRawStripSize(TIFF*, tstrip_t);
00359 extern  tsize_t TIFFVStripSize(TIFF*, uint32);
00360 extern  tsize_t TIFFTileRowSize(TIFF*);
00361 extern  tsize_t TIFFTileSize(TIFF*);
00362 extern  tsize_t TIFFVTileSize(TIFF*, uint32);
00363 extern  uint32 TIFFDefaultStripSize(TIFF*, uint32);
00364 extern  void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
00365 extern  int TIFFFileno(TIFF*);
00366 extern  int TIFFSetFileno(TIFF*, int);
00367 extern  thandle_t TIFFClientdata(TIFF*);
00368 extern  thandle_t TIFFSetClientdata(TIFF*, thandle_t);
00369 extern  int TIFFGetMode(TIFF*);
00370 extern  int TIFFSetMode(TIFF*, int);
00371 extern  int TIFFIsTiled(TIFF*);
00372 extern  int TIFFIsByteSwapped(TIFF*);
00373 extern  int TIFFIsUpSampled(TIFF*);
00374 extern  int TIFFIsMSB2LSB(TIFF*);
00375 extern  int TIFFIsBigEndian(TIFF*);
00376 extern  TIFFReadWriteProc TIFFGetReadProc(TIFF*);
00377 extern  TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
00378 extern  TIFFSeekProc TIFFGetSeekProc(TIFF*);
00379 extern  TIFFCloseProc TIFFGetCloseProc(TIFF*);
00380 extern  TIFFSizeProc TIFFGetSizeProc(TIFF*);
00381 extern  TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
00382 extern  TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
00383 extern  uint32 TIFFCurrentRow(TIFF*);
00384 extern  tdir_t TIFFCurrentDirectory(TIFF*);
00385 extern  tdir_t TIFFNumberOfDirectories(TIFF*);
00386 extern  uint32 TIFFCurrentDirOffset(TIFF*);
00387 extern  tstrip_t TIFFCurrentStrip(TIFF*);
00388 extern  ttile_t TIFFCurrentTile(TIFF*);
00389 extern  int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);
00390 extern  int TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);
00391 extern  int TIFFSetupStrips(TIFF *);
00392 extern  int TIFFWriteCheck(TIFF*, int, const char *);
00393 extern  void TIFFFreeDirectory(TIFF*);
00394 extern  int TIFFCreateDirectory(TIFF*);
00395 extern  int TIFFLastDirectory(TIFF*);
00396 extern  int TIFFSetDirectory(TIFF*, tdir_t);
00397 extern  int TIFFSetSubDirectory(TIFF*, uint32);
00398 extern  int TIFFUnlinkDirectory(TIFF*, tdir_t);
00399 extern  int TIFFSetField(TIFF*, ttag_t, ...);
00400 extern  int TIFFVSetField(TIFF*, ttag_t, va_list);
00401 extern  int TIFFWriteDirectory(TIFF *);
00402 extern  int TIFFCheckpointDirectory(TIFF *);
00403 extern  int TIFFRewriteDirectory(TIFF *);
00404 extern  int TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);
00405 
00406 #if defined(c_plusplus) || defined(__cplusplus)
00407 extern  void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
00408 extern  int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
00409 extern  int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
00410 extern  int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
00411 extern  int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
00412                                       int = ORIENTATION_BOTLEFT, int = 0);
00413 #else
00414 extern  void TIFFPrintDirectory(TIFF*, FILE*, long);
00415 extern  int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
00416 extern  int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
00417 extern  int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
00418 extern  int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
00419 #endif
00420 
00421 extern  int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );
00422 extern  int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
00423 extern  int TIFFRGBAImageOK(TIFF*, char [1024]);
00424 extern  int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
00425 extern  int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
00426 extern  void TIFFRGBAImageEnd(TIFFRGBAImage*);
00427 extern  TIFF* TIFFOpen(const char*, const char*);
00428 # ifdef __WIN32__
00429 extern  TIFF* TIFFOpenW(const wchar_t*, const char*);
00430 # endif /* __WIN32__ */
00431 extern  TIFF* TIFFFdOpen(int, const char*, const char*);
00432 extern  TIFF* TIFFClientOpen(const char*, const char*,
00433             thandle_t,
00434             TIFFReadWriteProc, TIFFReadWriteProc,
00435             TIFFSeekProc, TIFFCloseProc,
00436             TIFFSizeProc,
00437             TIFFMapFileProc, TIFFUnmapFileProc);
00438 extern  const char* TIFFFileName(TIFF*);
00439 extern  const char* TIFFSetFileName(TIFF*, const char *);
00440 extern void TIFFError(const char*, const char*, ...) __attribute__((format (printf,2,3)));
00441 extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) __attribute__((format (printf,3,4)));
00442 extern void TIFFWarning(const char*, const char*, ...) __attribute__((format (printf,2,3)));
00443 extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) __attribute__((format (printf,3,4)));
00444 extern  TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
00445 extern  TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
00446 extern  TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
00447 extern  TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
00448 extern  TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
00449 extern  ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);
00450 extern  int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);
00451 extern  ttile_t TIFFNumberOfTiles(TIFF*);
00452 extern  tsize_t TIFFReadTile(TIFF*,
00453             tdata_t, uint32, uint32, uint32, tsample_t);
00454 extern  tsize_t TIFFWriteTile(TIFF*,
00455             tdata_t, uint32, uint32, uint32, tsample_t);
00456 extern  tstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t);
00457 extern  tstrip_t TIFFNumberOfStrips(TIFF*);
00458 extern  tsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
00459 extern  tsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
00460 extern  tsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
00461 extern  tsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
00462 extern  tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
00463 extern  tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
00464 extern  tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
00465 extern  tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
00466 extern  int TIFFDataWidth(TIFFDataType);    /* table of tag datatype widths */
00467 extern  void TIFFSetWriteOffset(TIFF*, toff_t);
00468 extern  void TIFFSwabShort(uint16*);
00469 extern  void TIFFSwabLong(uint32*);
00470 extern  void TIFFSwabDouble(double*);
00471 extern  void TIFFSwabArrayOfShort(uint16*, unsigned long);
00472 extern  void TIFFSwabArrayOfTriples(uint8*, unsigned long);
00473 extern  void TIFFSwabArrayOfLong(uint32*, unsigned long);
00474 extern  void TIFFSwabArrayOfDouble(double*, unsigned long);
00475 extern  void TIFFReverseBits(unsigned char *, unsigned long);
00476 extern  const unsigned char* TIFFGetBitRevTable(int);
00477 
00478 #ifdef LOGLUV_PUBLIC
00479 #define U_NEU           0.210526316
00480 #define V_NEU           0.473684211
00481 #define UVSCALE         410.
00482 extern  double LogL16toY(int);
00483 extern  double LogL10toY(int);
00484 extern  void XYZtoRGB24(float*, uint8*);
00485 extern  int uv_decode(double*, double*, int);
00486 extern  void LogLuv24toXYZ(uint32, float*);
00487 extern  void LogLuv32toXYZ(uint32, float*);
00488 #if defined(c_plusplus) || defined(__cplusplus)
00489 extern  int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
00490 extern  int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
00491 extern  int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
00492 extern  uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
00493 extern  uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
00494 #else
00495 extern  int LogL16fromY(double, int);
00496 extern  int LogL10fromY(double, int);
00497 extern  int uv_encode(double, double, int);
00498 extern  uint32 LogLuv24fromXYZ(float*, int);
00499 extern  uint32 LogLuv32fromXYZ(float*, int);
00500 #endif
00501 #endif /* LOGLUV_PUBLIC */
00502     
00503 extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
00504 extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
00505                             float *, float *, float *);
00506 extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
00507                          uint32 *, uint32 *, uint32 *);
00508 
00509 extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
00510 extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
00511                            uint32 *, uint32 *, uint32 *);
00512 
00513 #if defined(c_plusplus) || defined(__cplusplus)
00514 }
00515 #endif
00516 
00517 #endif /* _TIFFIO_ */
00518 
00519 /* vim: set ts=8 sts=8 sw=8 noet: */
00520 /*
00521  * Local Variables:
00522  * mode: c
00523  * c-basic-offset: 8
00524  * fill-column: 78
00525  * End:
00526  */