ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/tiffio.h
(Generate patch)

Comparing ray/src/common/tiffio.h (file contents):
Revision 3.3 by schorsch, Sat Jun 7 12:50:21 2003 UTC vs.
Revision 3.14 by greg, Fri Sep 23 19:22:37 2005 UTC

# Line 1 | Line 1
1 < /* $Header$ */
1 > /* $Id$ */
2  
3   /*
4   * Copyright (c) 1988-1997 Sam Leffler
# Line 86 | Line 86 | typedef        uint32 toff_t;          /* file offset */
86   #endif
87  
88   #if defined(USE_WIN32_FILEIO)
89 < #include <windows.h>
90 < #ifdef __WIN32__
89 > # include <windows.h>
90 > # ifdef __WIN32__
91   DECLARE_HANDLE(thandle_t);      /* Win32 file handle */
92 < #else
92 > # else
93   typedef HFILE thandle_t;        /* client data handle */
94 < #endif
94 > # endif /* __WIN32__ */
95   #else
96   typedef void* thandle_t;        /* client data handle */
97 < #endif
97 > #endif /* USE_WIN32_FILEIO */
98  
99   #ifndef NULL
100 < #define NULL    0
100 > # define NULL   (void *)0
101   #endif
102  
103   /*
# Line 114 | Line 114 | typedef        void* thandle_t;        /* client data handle */
114   #define TIFFPRINT_JPEGACTABLES  0x200           /* JPEG AC tables */
115   #define TIFFPRINT_JPEGDCTABLES  0x200           /* JPEG DC tables */
116  
117 + /*
118 + * Colour conversion stuff
119 + */
120 +
121 + /* reference white */
122 + #define D65_X0 (95.0470F)
123 + #define D65_Y0 (100.0F)
124 + #define D65_Z0 (108.8827F)
125 +
126 + #define D50_X0 (96.4250F)
127 + #define D50_Y0 (100.0F)
128 + #define D50_Z0 (82.4680F)
129 +
130 + /* Structure for holding information about a display device. */
131 +
132 + typedef unsigned char TIFFRGBValue;             /* 8-bit samples */
133 +
134 + typedef struct {
135 +        float d_mat[3][3];              /* XYZ -> luminance matrix */
136 +        float d_YCR;                    /* Light o/p for reference white */
137 +        float d_YCG;
138 +        float d_YCB;
139 +        uint32 d_Vrwr;                  /* Pixel values for ref. white */
140 +        uint32 d_Vrwg;
141 +        uint32 d_Vrwb;
142 +        float d_Y0R;                    /* Residual light for black pixel */
143 +        float d_Y0G;
144 +        float d_Y0B;
145 +        float d_gammaR;                 /* Gamma values for the three guns */
146 +        float d_gammaG;
147 +        float d_gammaB;
148 + } TIFFDisplay;
149 +
150 + typedef struct {                                /* YCbCr->RGB support */
151 +        TIFFRGBValue* clamptab;                 /* range clamping table */
152 +        int*    Cr_r_tab;
153 +        int*    Cb_b_tab;
154 +        int32*  Cr_g_tab;
155 +        int32*  Cb_g_tab;
156 +        int32*  Y_tab;
157 + } TIFFYCbCrToRGB;
158 +
159 + typedef struct {                                /* CIE Lab 1976->RGB support */
160 +        int     range;                          /* Size of conversion table */
161 + #define CIELABTORGB_TABLE_RANGE 1500
162 +        float   rstep, gstep, bstep;
163 +        float   X0, Y0, Z0;                     /* Reference white point */
164 +        TIFFDisplay display;
165 +        float   Yr2r[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yr to r */
166 +        float   Yg2g[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yg to g */
167 +        float   Yb2b[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yb to b */
168 + } TIFFCIELabToRGB;
169 +
170   /*
171   * RGBA-style image support.
172   */
120 typedef unsigned char TIFFRGBValue;             /* 8-bit samples */
173   typedef struct _TIFFRGBAImage TIFFRGBAImage;
174   /*
175   * The image reading and conversion routines invoke
# Line 138 | Line 190 | typedef void (*tileSeparateRoutine)
190   /*
191   * RGBA-reader state.
192   */
141 typedef struct {                                /* YCbCr->RGB support */
142        TIFFRGBValue* clamptab;                 /* range clamping table */
143        int*    Cr_r_tab;
144        int*    Cb_b_tab;
145        int32*  Cr_g_tab;
146        int32*  Cb_g_tab;
147        float   coeffs[3];                      /* cached for repeated use */
148 } TIFFYCbCrToRGB;
149
193   struct _TIFFRGBAImage {
194          TIFF*   tif;                            /* image handle */
195          int     stoponerr;                      /* stop on read error */
# Line 157 | Line 200 | struct _TIFFRGBAImage {
200          uint16  bitspersample;                  /* image bits/sample */
201          uint16  samplesperpixel;                /* image samples/pixel */
202          uint16  orientation;                    /* image orientation */
203 +        uint16  req_orientation;                /* requested orientation */
204          uint16  photometric;                    /* image photometric interp */
205          uint16* redcmap;                        /* colormap pallete */
206          uint16* greencmap;
# Line 172 | Line 216 | struct _TIFFRGBAImage {
216          uint32** BWmap;                         /* black&white map */
217          uint32** PALmap;                        /* palette image map */
218          TIFFYCbCrToRGB* ycbcr;                  /* YCbCr conversion state */
219 +        TIFFCIELabToRGB* cielab;                /* CIE L*a*b conversion state */
220  
221          int     row_offset;
222          int     col_offset;
# Line 203 | Line 248 | typedef struct {
248   #include <stdio.h>
249   #include <stdarg.h>
250  
251 <                        /* share internal LogLuv conversion routines */
251 > /* share internal LogLuv conversion routines? */
252   #ifndef LOGLUV_PUBLIC
253 < #define LOGLUV_PUBLIC           1
253 > #define LOGLUV_PUBLIC           1      
254   #endif
255  
256 < #if defined(__cplusplus)
256 > #if defined(c_plusplus) || defined(__cplusplus)
257   extern "C" {
258   #endif
259   typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
# Line 225 | Line 270 | extern const char* TIFFGetVersion(void);
270   extern  const TIFFCodec* TIFFFindCODEC(uint16);
271   extern  TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
272   extern  void TIFFUnRegisterCODEC(TIFFCodec*);
273 + extern  int TIFFIsCODECConfigured(uint16);
274 + extern  TIFFCodec* TIFFGetConfiguredCODECs();
275  
276   extern  tdata_t _TIFFmalloc(tsize_t);
277   extern  tdata_t _TIFFrealloc(tdata_t, tsize_t);
# Line 233 | Line 280 | extern void _TIFFmemcpy(tdata_t, const tdata_t, tsize_
280   extern  int _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);
281   extern  void _TIFFfree(tdata_t);
282  
283 + extern  void TIFFCleanup(TIFF*);
284   extern  void TIFFClose(TIFF*);
285   extern  int TIFFFlush(TIFF*);
286   extern  int TIFFFlushData(TIFF*);
# Line 244 | Line 292 | extern int TIFFReadDirectory(TIFF*);
292   extern  tsize_t TIFFScanlineSize(TIFF*);
293   extern  tsize_t TIFFRasterScanlineSize(TIFF*);
294   extern  tsize_t TIFFStripSize(TIFF*);
295 + extern  tsize_t TIFFRawStripSize(TIFF*, tstrip_t);
296   extern  tsize_t TIFFVStripSize(TIFF*, uint32);
297   extern  tsize_t TIFFTileRowSize(TIFF*);
298   extern  tsize_t TIFFTileSize(TIFF*);
# Line 251 | Line 300 | extern tsize_t TIFFVTileSize(TIFF*, uint32);
300   extern  uint32 TIFFDefaultStripSize(TIFF*, uint32);
301   extern  void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
302   extern  int TIFFFileno(TIFF*);
303 + extern  int TIFFSetFileno(TIFF*, int);
304 + extern  thandle_t TIFFClientdata(TIFF*);
305 + extern  thandle_t TIFFSetClientdata(TIFF*, thandle_t);
306   extern  int TIFFGetMode(TIFF*);
307 + extern  int TIFFSetMode(TIFF*, int);
308   extern  int TIFFIsTiled(TIFF*);
309   extern  int TIFFIsByteSwapped(TIFF*);
310   extern  int TIFFIsUpSampled(TIFF*);
311   extern  int TIFFIsMSB2LSB(TIFF*);
312 + extern  int TIFFIsBigEndian(TIFF*);
313 + extern  TIFFReadWriteProc TIFFGetReadProc(TIFF*);
314 + extern  TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
315 + extern  TIFFSeekProc TIFFGetSeekProc(TIFF*);
316 + extern  TIFFCloseProc TIFFGetCloseProc(TIFF*);
317 + extern  TIFFSizeProc TIFFGetSizeProc(TIFF*);
318 + extern  TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
319 + extern  TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
320   extern  uint32 TIFFCurrentRow(TIFF*);
321   extern  tdir_t TIFFCurrentDirectory(TIFF*);
322   extern  tdir_t TIFFNumberOfDirectories(TIFF*);
# Line 264 | Line 325 | extern tstrip_t TIFFCurrentStrip(TIFF*);
325   extern  ttile_t TIFFCurrentTile(TIFF*);
326   extern  int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);
327   extern  int TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);
328 + extern  int TIFFSetupStrips(TIFF *);
329   extern  int TIFFWriteCheck(TIFF*, int, const char *);
330   extern  int TIFFCreateDirectory(TIFF*);
331   extern  int TIFFLastDirectory(TIFF*);
# Line 273 | Line 335 | extern int TIFFUnlinkDirectory(TIFF*, tdir_t);
335   extern  int TIFFSetField(TIFF*, ttag_t, ...);
336   extern  int TIFFVSetField(TIFF*, ttag_t, va_list);
337   extern  int TIFFWriteDirectory(TIFF *);
338 + extern  int TIFFCheckpointDirectory(TIFF *);
339 + extern  int TIFFRewriteDirectory(TIFF *);
340   extern  int TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);
341  
342   #if defined(c_plusplus) || defined(__cplusplus)
# Line 280 | Line 344 | extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0)
344   extern  int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
345   extern  int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
346   extern  int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
347 + extern  int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
348 +                                      int = ORIENTATION_BOTLEFT, int = 0);
349   #else
350   extern  void TIFFPrintDirectory(TIFF*, FILE*, long);
351   extern  int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
352   extern  int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
353   extern  int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
354 + extern  int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
355   #endif
356  
357   extern  int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );
# Line 294 | Line 361 | extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, i
361   extern  int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
362   extern  void TIFFRGBAImageEnd(TIFFRGBAImage*);
363   extern  TIFF* TIFFOpen(const char*, const char*);
364 + # ifdef __WIN32__
365 + extern  TIFF* TIFFOpenW(const wchar_t*, const char*);
366 + # endif /* __WIN32__ */
367   extern  TIFF* TIFFFdOpen(int, const char*, const char*);
368   extern  TIFF* TIFFClientOpen(const char*, const char*,
369              thandle_t,
# Line 302 | Line 372 | extern TIFF* TIFFClientOpen(const char*, const char*,
372              TIFFSizeProc,
373              TIFFMapFileProc, TIFFUnmapFileProc);
374   extern  const char* TIFFFileName(TIFF*);
375 + extern const char* TIFFSetFileName(TIFF*, const char *);
376   extern  void TIFFError(const char*, const char*, ...);
377   extern  void TIFFWarning(const char*, const char*, ...);
378   extern  TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
# Line 324 | Line 395 | extern tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t,
395   extern  tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
396   extern  tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
397   extern  tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
398 + extern  int TIFFDataWidth(TIFFDataType);    /* table of tag datatype widths */
399   extern  void TIFFSetWriteOffset(TIFF*, toff_t);
400   extern  void TIFFSwabShort(uint16*);
401   extern  void TIFFSwabLong(uint32*);
402   extern  void TIFFSwabDouble(double*);
403   extern  void TIFFSwabArrayOfShort(uint16*, unsigned long);
404 + extern  void TIFFSwabArrayOfTriples(uint8*, unsigned long);
405   extern  void TIFFSwabArrayOfLong(uint32*, unsigned long);
406   extern  void TIFFSwabArrayOfDouble(double*, unsigned long);
407   extern  void TIFFReverseBits(unsigned char *, unsigned long);
408   extern  const unsigned char* TIFFGetBitRevTable(int);
409  
410 < #if LOGLUV_PUBLIC
410 > #ifdef LOGLUV_PUBLIC
411   #define U_NEU           0.210526316
412   #define V_NEU           0.473684211
413   #define UVSCALE         410.
# Line 358 | Line 431 | extern uint32 LogLuv24fromXYZ(float*, int);
431   extern  uint32 LogLuv32fromXYZ(float*, int);
432   #endif
433   #endif /* LOGLUV_PUBLIC */
434 < #if defined(__cplusplus)
434 >
435 > /*
436 > ** Stuff, related to tag handling and creating custom tags.
437 > */
438 > extern  int  TIFFGetTagListCount( TIFF * );
439 > extern  ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );
440 >    
441 > #define TIFF_ANY        TIFF_NOTYPE     /* for field descriptor searching */
442 > #define TIFF_VARIABLE   -1              /* marker for variable length tags */
443 > #define TIFF_SPP        -2              /* marker for SamplesPerPixel tags */
444 > #define TIFF_VARIABLE2  -3              /* marker for uint32 var-length tags */
445 >
446 > #define FIELD_CUSTOM    65    
447 >
448 > typedef struct {
449 >        ttag_t  field_tag;              /* field's tag */
450 >        short   field_readcount;        /* read count/TIFF_VARIABLE/TIFF_SPP */
451 >        short   field_writecount;       /* write count/TIFF_VARIABLE */
452 >        TIFFDataType field_type;        /* type of associated data */
453 >        unsigned short field_bit;       /* bit in fieldsset bit vector */
454 >        unsigned char field_oktochange; /* if true, can change while writing */
455 >        unsigned char field_passcount;  /* if true, pass dir count on set */
456 >        char    *field_name;            /* ASCII name */
457 > } TIFFFieldInfo;
458 >
459 > typedef struct _TIFFTagValue {
460 >    const TIFFFieldInfo  *info;
461 >    int             count;
462 >    void           *value;
463 > } TIFFTagValue;
464 >
465 > extern  void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
466 > extern  const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
467 > extern  const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,
468 >                                                     TIFFDataType);
469 > extern  const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);
470 > extern  const TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);
471 >
472 > typedef int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
473 > typedef int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
474 > typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
475 >    
476 > typedef struct {
477 >    TIFFVSetMethod      vsetfield;      /* tag set routine */
478 >    TIFFVGetMethod      vgetfield;      /* tag get routine */
479 >    TIFFPrintMethod     printdir;       /* directory print routine */
480 > } TIFFTagMethods;
481 >        
482 > extern  TIFFTagMethods *TIFFAccessTagMethods( TIFF * );
483 > extern  void *TIFFGetClientInfo( TIFF *, const char * );
484 > extern  void TIFFSetClientInfo( TIFF *, void *, const char * );
485 >    
486 > extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
487 > extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
488 >                            float *, float *, float *);
489 > extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
490 >                         uint32 *, uint32 *, uint32 *);
491 >
492 > extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
493 > extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
494 >                           uint32 *, uint32 *, uint32 *);
495 >
496 > #if defined(c_plusplus) || defined(__cplusplus)
497   }
498   #endif
499 +
500   #endif /* _TIFFIO_ */
501 +
502 + /* vim: set ts=8 sts=8 sw=8 noet: */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines