ReactOS  0.4.14-dev-384-g5b37caa
tif_aux.c File Reference
#include <precomp.h>
#include "tif_predict.h"
#include <math.h>
Include dependency graph for tif_aux.c:

Go to the source code of this file.

Classes

struct  _Int64Parts
 
union  _Int64
 

Functions

uint32 _TIFFMultiply32 (TIFF *tif, uint32 first, uint32 second, const char *where)
 
uint64 _TIFFMultiply64 (TIFF *tif, uint64 first, uint64 second, const char *where)
 
void_TIFFCheckRealloc (TIFF *tif, void *buffer, tmsize_t nmemb, tmsize_t elem_size, const char *what)
 
void_TIFFCheckMalloc (TIFF *tif, tmsize_t nmemb, tmsize_t elem_size, const char *what)
 
static int TIFFDefaultTransferFunction (TIFFDirectory *td)
 
static int TIFFDefaultRefBlackWhite (TIFFDirectory *td)
 
int TIFFVGetFieldDefaulted (TIFF *tif, uint32 tag, va_list ap)
 
int TIFFGetFieldDefaulted (TIFF *tif, uint32 tag,...)
 
float _TIFFUInt64ToFloat (uint64 ui64)
 
double _TIFFUInt64ToDouble (uint64 ui64)
 
int _TIFFSeekOK (TIFF *tif, toff_t off)
 

Function Documentation

◆ _TIFFCheckMalloc()

void* _TIFFCheckMalloc ( TIFF tif,
tmsize_t  nmemb,
tmsize_t  elem_size,
const char what 
)

Definition at line 85 of file tif_aux.c.

86 {
87  return _TIFFCheckRealloc(tif, NULL, nmemb, elem_size, what);
88 }
void * _TIFFCheckRealloc(TIFF *tif, void *buffer, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Definition: tif_aux.c:62
smooth NULL
Definition: ftsmooth.c:416

Referenced by _TIFFMergeFields(), _TIFFRewriteField(), _TIFFVSetField(), ChopUpSingleUncompressedStrip(), EstimateStripByteCounts(), TIFFFetchDirectory(), TIFFFetchStripThing(), TIFFMergeFieldInfo(), TIFFReadDirEntryArrayWithLimit(), and TIFFSetupStrips().

◆ _TIFFCheckRealloc()

void* _TIFFCheckRealloc ( TIFF tif,
void buffer,
tmsize_t  nmemb,
tmsize_t  elem_size,
const char what 
)

Definition at line 62 of file tif_aux.c.

64 {
65  void* cp = NULL;
66  tmsize_t bytes = nmemb * elem_size;
67 
68  /*
69  * XXX: Check for integer overflow.
70  */
71  if (nmemb && elem_size && bytes / elem_size == nmemb)
73 
74  if (cp == NULL) {
76  "Failed to allocate memory for %s "
77  "(%ld elements of %ld bytes each)",
78  what,(long) nmemb, (long) elem_size);
79  }
80 
81  return cp;
82 }
GLuint buffer
Definition: glext.h:5915
thandle_t tif_clientdata
Definition: tiffiop.h:191
char * tif_name
Definition: tiffiop.h:103
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
TIFF_SSIZE_T tmsize_t
Definition: tiffio.h:65
smooth NULL
Definition: ftsmooth.c:416
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
void * _TIFFrealloc(void *p, tmsize_t s)
Definition: tif_unix.c:332
POINT cp
Definition: magnifier.c:59

Referenced by _TIFFCheckMalloc(), _TIFFMergeFields(), TIFFCheckDirOffset(), and TIFFMergeFieldInfo().

◆ _TIFFMultiply32()

uint32 _TIFFMultiply32 ( TIFF tif,
uint32  first,
uint32  second,
const char where 
)

Definition at line 36 of file tif_aux.c.

37 {
38  uint32 bytes = first * second;
39 
40  if (second && bytes / second != first) {
41  TIFFErrorExt(tif->tif_clientdata, where, "Integer overflow in %s", where);
42  bytes = 0;
43  }
44 
45  return bytes;
46 }
unsigned int uint32
Definition: types.h:32
const GLint * first
Definition: glext.h:5794
thandle_t tif_clientdata
Definition: tiffiop.h:191
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65

Referenced by TIFFNumberOfStrips(), and TIFFNumberOfTiles().

◆ _TIFFMultiply64()

uint64 _TIFFMultiply64 ( TIFF tif,
uint64  first,
uint64  second,
const char where 
)

Definition at line 49 of file tif_aux.c.

50 {
51  uint64 bytes = first * second;
52 
53  if (second && bytes / second != first) {
54  TIFFErrorExt(tif->tif_clientdata, where, "Integer overflow in %s", where);
55  bytes = 0;
56  }
57 
58  return bytes;
59 }
unsigned long long uint64
Definition: platform.h:18
const GLint * first
Definition: glext.h:5794
thandle_t tif_clientdata
Definition: tiffiop.h:191
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65

Referenced by TIFFRasterScanlineSize64(), TIFFScanlineSize64(), TIFFTileRowSize64(), TIFFVStripSize64(), and TIFFVTileSize64().

◆ _TIFFSeekOK()

int _TIFFSeekOK ( TIFF tif,
toff_t  off 
)

Definition at line 361 of file tif_aux.c.

362 {
363  /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */
364  /* See http://bugzilla.maptools.org/show_bug.cgi?id=2726 */
365  return off <= (~(uint64)0)/2 && TIFFSeekFile(tif,off,SEEK_SET)==off;
366 }
unsigned long long uint64
Definition: platform.h:18
#define TIFFSeekFile(tif, off, whence)
Definition: tiffiop.h:221
#define SEEK_SET
Definition: jmemansi.c:26
off
Definition: i386-dis.c:3909

◆ _TIFFUInt64ToDouble()

double _TIFFUInt64ToDouble ( uint64  ui64)

Definition at line 346 of file tif_aux.c.

347 {
348  _Int64 i;
349 
350  i.value = ui64;
351  if (i.part.high >= 0) {
352  return (double)i.value;
353  } else {
354  long double df;
355  df = (long double)i.value;
356  df += 18446744073709551616.0; /* adding 2**64 */
357  return (double)df;
358  }
359 }
return
Definition: dirsup.c:529
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 const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80

Referenced by TIFFReadDirEntryDouble(), and TIFFReadDirEntryDoubleArray().

◆ _TIFFUInt64ToFloat()

float _TIFFUInt64ToFloat ( uint64  ui64)

Definition at line 330 of file tif_aux.c.

331 {
332  _Int64 i;
333 
334  i.value = ui64;
335  if (i.part.high >= 0) {
336  return (float)i.value;
337  } else {
338  long double df;
339  df = (long double)i.value;
340  df += 18446744073709551616.0; /* adding 2**64 */
341  return (float)df;
342  }
343 }
return
Definition: dirsup.c:529
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 const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80

Referenced by TIFFReadDirEntryFloat(), and TIFFReadDirEntryFloatArray().

◆ TIFFDefaultRefBlackWhite()

static int TIFFDefaultRefBlackWhite ( TIFFDirectory td)
static

Definition at line 135 of file tif_aux.c.

136 {
137  int i;
138 
139  td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float));
140  if (td->td_refblackwhite == NULL)
141  return 0;
142  if (td->td_photometric == PHOTOMETRIC_YCBCR) {
143  /*
144  * YCbCr (Class Y) images must have the ReferenceBlackWhite
145  * tag set. Fix the broken images, which lacks that tag.
146  */
147  td->td_refblackwhite[0] = 0.0F;
148  td->td_refblackwhite[1] = td->td_refblackwhite[3] =
149  td->td_refblackwhite[5] = 255.0F;
150  td->td_refblackwhite[2] = td->td_refblackwhite[4] = 128.0F;
151  } else {
152  /*
153  * Assume RGB (Class R)
154  */
155  for (i = 0; i < 3; i++) {
156  td->td_refblackwhite[2*i+0] = 0;
157  td->td_refblackwhite[2*i+1] =
158  (float)((1L<<td->td_bitspersample)-1L);
159  }
160  }
161  return 1;
162 }
uint16 td_bitspersample
Definition: tif_dir.h:74
#define PHOTOMETRIC_YCBCR
Definition: tiff.h:202
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
smooth NULL
Definition: ftsmooth.c:416
void * _TIFFmalloc(tmsize_t s)
Definition: tif_unix.c:309
uint16 td_photometric
Definition: tif_dir.h:77
static const WCHAR L[]
Definition: oid.c:1250
float * td_refblackwhite
Definition: tif_dir.h:114

Referenced by TIFFVGetFieldDefaulted().

◆ TIFFDefaultTransferFunction()

static int TIFFDefaultTransferFunction ( TIFFDirectory td)
static

Definition at line 91 of file tif_aux.c.

92 {
94  tmsize_t i, n, nbytes;
95 
96  tf[0] = tf[1] = tf[2] = 0;
97  if (td->td_bitspersample >= sizeof(tmsize_t) * 8 - 2)
98  return 0;
99 
100  n = ((tmsize_t)1)<<td->td_bitspersample;
101  nbytes = n * sizeof (uint16);
102  tf[0] = (uint16 *)_TIFFmalloc(nbytes);
103  if (tf[0] == NULL)
104  return 0;
105  tf[0][0] = 0;
106  for (i = 1; i < n; i++) {
107  double t = (double)i/((double) n-1.);
108  tf[0][i] = (uint16)floor(65535.*pow(t, 2.2) + .5);
109  }
110 
111  if (td->td_samplesperpixel - td->td_extrasamples > 1) {
112  tf[1] = (uint16 *)_TIFFmalloc(nbytes);
113  if(tf[1] == NULL)
114  goto bad;
115  _TIFFmemcpy(tf[1], tf[0], nbytes);
116  tf[2] = (uint16 *)_TIFFmalloc(nbytes);
117  if (tf[2] == NULL)
118  goto bad;
119  _TIFFmemcpy(tf[2], tf[0], nbytes);
120  }
121  return 1;
122 
123 bad:
124  if (tf[0])
125  _TIFFfree(tf[0]);
126  if (tf[1])
127  _TIFFfree(tf[1]);
128  if (tf[2])
129  _TIFFfree(tf[2]);
130  tf[0] = tf[1] = tf[2] = 0;
131  return 0;
132 }
uint16 td_bitspersample
Definition: tif_dir.h:74
GLdouble n
Definition: glext.h:7729
GLdouble GLdouble t
Definition: gl.h:2047
HFONT tf
Definition: icontest.c:17
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
float pow(float __x, int __y)
Definition: _cmath.h:458
TIFF_SSIZE_T tmsize_t
Definition: tiffio.h:65
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
smooth NULL
Definition: ftsmooth.c:416
void * _TIFFmalloc(tmsize_t s)
Definition: tif_unix.c:309
uint16 td_extrasamples
Definition: tif_dir.h:93
unsigned short uint16
Definition: types.h:30
uint16 * td_transferfunction[3]
Definition: tif_dir.h:113
uint16 td_samplesperpixel
Definition: tif_dir.h:81
void _TIFFfree(void *p)
Definition: tif_unix.c:326
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
Definition: tif_unix.c:344

Referenced by TIFFVGetFieldDefaulted().

◆ TIFFGetFieldDefaulted()

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

Definition at line 309 of file tif_aux.c.

310 {
311  int ok;
312  va_list ap;
313 
314  va_start(ap, tag);
315  ok = TIFFVGetFieldDefaulted(tif, tag, ap);
316  va_end(ap);
317  return (ok);
318 }
Definition: ecma_167.h:138
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
#define ok(value,...)
Definition: atltest.h:57
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
int TIFFVGetFieldDefaulted(TIFF *tif, uint32 tag, va_list ap)
Definition: tif_aux.c:173

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

◆ TIFFVGetFieldDefaulted()

int TIFFVGetFieldDefaulted ( TIFF tif,
uint32  tag,
va_list  ap 
)

Definition at line 173 of file tif_aux.c.

174 {
175  TIFFDirectory *td = &tif->tif_dir;
176 
177  if (TIFFVGetField(tif, tag, ap))
178  return (1);
179  switch (tag) {
180  case TIFFTAG_SUBFILETYPE:
181  *va_arg(ap, uint32 *) = td->td_subfiletype;
182  return (1);
184  *va_arg(ap, uint16 *) = td->td_bitspersample;
185  return (1);
187  *va_arg(ap, uint16 *) = td->td_threshholding;
188  return (1);
189  case TIFFTAG_FILLORDER:
190  *va_arg(ap, uint16 *) = td->td_fillorder;
191  return (1);
192  case TIFFTAG_ORIENTATION:
193  *va_arg(ap, uint16 *) = td->td_orientation;
194  return (1);
196  *va_arg(ap, uint16 *) = td->td_samplesperpixel;
197  return (1);
199  *va_arg(ap, uint32 *) = td->td_rowsperstrip;
200  return (1);
202  *va_arg(ap, uint16 *) = td->td_minsamplevalue;
203  return (1);
205  *va_arg(ap, uint16 *) = td->td_maxsamplevalue;
206  return (1);
208  *va_arg(ap, uint16 *) = td->td_planarconfig;
209  return (1);
211  *va_arg(ap, uint16 *) = td->td_resolutionunit;
212  return (1);
213  case TIFFTAG_PREDICTOR:
214  {
216  if( sp == NULL )
217  {
219  "Cannot get \"Predictor\" tag as plugin is not configured");
220  *va_arg(ap, uint16*) = 0;
221  return 0;
222  }
223  *va_arg(ap, uint16*) = (uint16) sp->predictor;
224  return 1;
225  }
226  case TIFFTAG_DOTRANGE:
227  *va_arg(ap, uint16 *) = 0;
228  *va_arg(ap, uint16 *) = (1<<td->td_bitspersample)-1;
229  return (1);
230  case TIFFTAG_INKSET:
231  *va_arg(ap, uint16 *) = INKSET_CMYK;
232  return 1;
234  *va_arg(ap, uint16 *) = 4;
235  return (1);
237  *va_arg(ap, uint16 *) = td->td_extrasamples;
238  *va_arg(ap, uint16 **) = td->td_sampleinfo;
239  return (1);
240  case TIFFTAG_MATTEING:
241  *va_arg(ap, uint16 *) =
242  (td->td_extrasamples == 1 &&
244  return (1);
245  case TIFFTAG_TILEDEPTH:
246  *va_arg(ap, uint32 *) = td->td_tiledepth;
247  return (1);
248  case TIFFTAG_DATATYPE:
249  *va_arg(ap, uint16 *) = td->td_sampleformat-1;
250  return (1);
252  *va_arg(ap, uint16 *) = td->td_sampleformat;
253  return(1);
254  case TIFFTAG_IMAGEDEPTH:
255  *va_arg(ap, uint32 *) = td->td_imagedepth;
256  return (1);
258  {
259  /* defaults are from CCIR Recommendation 601-1 */
260  static float ycbcrcoeffs[] = { 0.299f, 0.587f, 0.114f };
261  *va_arg(ap, float **) = ycbcrcoeffs;
262  return 1;
263  }
265  *va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[0];
266  *va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[1];
267  return (1);
269  *va_arg(ap, uint16 *) = td->td_ycbcrpositioning;
270  return (1);
271  case TIFFTAG_WHITEPOINT:
272  {
273  static float whitepoint[2];
274 
275  /* TIFF 6.0 specification tells that it is no default
276  value for the WhitePoint, but AdobePhotoshop TIFF
277  Technical Note tells that it should be CIE D50. */
278  whitepoint[0] = D50_X0 / (D50_X0 + D50_Y0 + D50_Z0);
279  whitepoint[1] = D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0);
280  *va_arg(ap, float **) = whitepoint;
281  return 1;
282  }
284  if (!td->td_transferfunction[0] &&
286  TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space for \"TransferFunction\" tag");
287  return (0);
288  }
289  *va_arg(ap, uint16 **) = td->td_transferfunction[0];
290  if (td->td_samplesperpixel - td->td_extrasamples > 1) {
291  *va_arg(ap, uint16 **) = td->td_transferfunction[1];
292  *va_arg(ap, uint16 **) = td->td_transferfunction[2];
293  }
294  return (1);
297  return (0);
298  *va_arg(ap, float **) = td->td_refblackwhite;
299  return (1);
300  }
301  return 0;
302 }
#define D50_Z0
Definition: tiffio.h:137
#define TIFFTAG_SUBFILETYPE
Definition: tiff.h:146
uint16 td_ycbcrpositioning
Definition: tif_dir.h:111
uint16 td_bitspersample
Definition: tif_dir.h:74
uint32 td_tiledepth
Definition: tif_dir.h:72
#define TIFFTAG_BITSPERSAMPLE
Definition: tiff.h:156
#define TIFFTAG_ROWSPERSTRIP
Definition: tiff.h:233
#define TIFFTAG_EXTRASAMPLES
Definition: tiff.h:304
#define TIFFTAG_ORIENTATION
Definition: tiff.h:223
unsigned int uint32
Definition: types.h:32
static int TIFFDefaultRefBlackWhite(TIFFDirectory *td)
Definition: tif_aux.c:135
#define TIFFTAG_DATATYPE
Definition: tiff.h:385
#define TIFFTAG_MINSAMPLEVALUE
Definition: tiff.h:235
#define TIFFTAG_FILLORDER
Definition: tiff.h:215
#define D50_X0
Definition: tiffio.h:135
Definition: ecma_167.h:138
#define TIFFTAG_DOTRANGE
Definition: tiff.h:302
uint32 td_imagedepth
Definition: tif_dir.h:71
#define TIFFTAG_THRESHHOLDING
Definition: tiff.h:209
#define TIFFTAG_YCBCRSUBSAMPLING
Definition: tiff.h:367
thandle_t tif_clientdata
Definition: tiffiop.h:191
#define TIFFTAG_REFERENCEBLACKWHITE
Definition: tiff.h:371
#define TIFFTAG_PLANARCONFIG
Definition: tiff.h:239
#define TIFFTAG_MATTEING
Definition: tiff.h:384
char * tif_name
Definition: tiffiop.h:103
#define TIFFTAG_YCBCRCOEFFICIENTS
Definition: tiff.h:366
#define INKSET_CMYK
Definition: tiff.h:298
#define TIFFTAG_YCBCRPOSITIONING
Definition: tiff.h:368
uint32 td_subfiletype
Definition: tif_dir.h:73
uint16 * td_sampleinfo
Definition: tif_dir.h:94
uint16 td_resolutionunit
Definition: tif_dir.h:87
smooth NULL
Definition: ftsmooth.c:416
#define TIFFTAG_SAMPLESPERPIXEL
Definition: tiff.h:232
uint16 td_planarconfig
Definition: tif_dir.h:88
uint16 td_orientation
Definition: tif_dir.h:80
int TIFFVGetField(TIFF *tif, uint32 tag, va_list ap)
Definition: tif_dir.c:1233
uint16 td_minsamplevalue
Definition: tif_dir.h:83
static int TIFFDefaultTransferFunction(TIFFDirectory *td)
Definition: tif_aux.c:91
uint16 td_extrasamples
Definition: tif_dir.h:93
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
uint16 td_fillorder
Definition: tif_dir.h:79
uint8 * tif_data
Definition: tiffiop.h:175
#define TIFFTAG_TRANSFERFUNCTION
Definition: tiff.h:273
#define TIFFTAG_WHITEPOINT
Definition: tiff.h:282
uint16 td_sampleformat
Definition: tif_dir.h:75
uint16 td_threshholding
Definition: tif_dir.h:78
#define TIFFTAG_INKSET
Definition: tiff.h:297
#define TIFFTAG_NUMBEROFINKS
Definition: tiff.h:301
uint16 td_maxsamplevalue
Definition: tif_dir.h:83
#define va_arg(ap, T)
Definition: acmsvcex.h:89
uint32 td_rowsperstrip
Definition: tif_dir.h:82
#define TIFFTAG_TILEDEPTH
Definition: tiff.h:387
#define TIFFTAG_IMAGEDEPTH
Definition: tiff.h:386
#define TIFFTAG_RESOLUTIONUNIT
Definition: tiff.h:262
uint16 td_ycbcrsubsampling[2]
Definition: tif_dir.h:110
unsigned short uint16
Definition: types.h:30
TIFFDirectory tif_dir
Definition: tiffiop.h:135
float * td_refblackwhite
Definition: tif_dir.h:114
uint16 * td_transferfunction[3]
Definition: tif_dir.h:113
#define TIFFTAG_PREDICTOR
Definition: tiff.h:278
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
uint16 td_samplesperpixel
Definition: tif_dir.h:81
static const WCHAR sp[]
Definition: suminfo.c:288
#define D50_Y0
Definition: tiffio.h:136
#define TIFFTAG_SAMPLEFORMAT
Definition: tiff.h:308
#define EXTRASAMPLE_ASSOCALPHA
Definition: tiff.h:306
#define TIFFTAG_MAXSAMPLEVALUE
Definition: tiff.h:236

Referenced by TIFFGetFieldDefaulted().