|
roentgen |
b75cab |
/* $Id: tif_dirinfo.c,v 1.117 2012-08-19 16:56:34 bfriesen Exp $ */
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/*
|
|
roentgen |
b75cab |
* Copyright (c) 1988-1997 Sam Leffler
|
|
roentgen |
b75cab |
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
|
roentgen |
b75cab |
*
|
|
roentgen |
b75cab |
* Permission to use, copy, modify, distribute, and sell this software and
|
|
roentgen |
b75cab |
* its documentation for any purpose is hereby granted without fee, provided
|
|
roentgen |
b75cab |
* that (i) the above copyright notices and this permission notice appear in
|
|
roentgen |
b75cab |
* all copies of the software and related documentation, and (ii) the names of
|
|
roentgen |
b75cab |
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
|
roentgen |
b75cab |
* publicity relating to the software without the specific, prior written
|
|
roentgen |
b75cab |
* permission of Sam Leffler and Silicon Graphics.
|
|
roentgen |
b75cab |
*
|
|
roentgen |
b75cab |
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
|
roentgen |
b75cab |
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
|
roentgen |
b75cab |
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
|
roentgen |
b75cab |
*
|
|
roentgen |
b75cab |
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
|
roentgen |
b75cab |
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
|
roentgen |
b75cab |
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
roentgen |
b75cab |
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
|
roentgen |
b75cab |
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
roentgen |
b75cab |
* OF THIS SOFTWARE.
|
|
roentgen |
b75cab |
*/
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/*
|
|
roentgen |
b75cab |
* TIFF Library.
|
|
roentgen |
b75cab |
*
|
|
roentgen |
b75cab |
* Core Directory Tag Support.
|
|
roentgen |
b75cab |
*/
|
|
roentgen |
b75cab |
#include "tiffiop.h"
|
|
roentgen |
b75cab |
#include <stdlib.h></stdlib.h>
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/*
|
|
roentgen |
b75cab |
* NOTE: THIS ARRAY IS ASSUMED TO BE SORTED BY TAG.
|
|
roentgen |
b75cab |
*
|
|
roentgen |
b75cab |
* NOTE: The second field (field_readcount) and third field (field_writecount)
|
|
roentgen |
b75cab |
* sometimes use the values TIFF_VARIABLE (-1), TIFF_VARIABLE2 (-3)
|
|
roentgen |
b75cab |
* and TIFF_SPP (-2). The macros should be used but would throw off
|
|
roentgen |
b75cab |
* the formatting of the code, so please interprete the -1, -2 and -3
|
|
roentgen |
b75cab |
* values accordingly.
|
|
roentgen |
b75cab |
*/
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
static TIFFFieldArray tiffFieldArray;
|
|
roentgen |
b75cab |
static TIFFFieldArray exifFieldArray;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
static TIFFField
|
|
roentgen |
b75cab |
tiffFields[] = {
|
|
roentgen |
b75cab |
{ TIFFTAG_SUBFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_SUBFILETYPE, 1, 0, "SubfileType", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_OSUBFILETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_SUBFILETYPE, 1, 0, "OldSubfileType", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_IMAGEDIMENSIONS, 0, 0, "ImageWidth", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_IMAGELENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_IMAGEDIMENSIONS, 1, 0, "ImageLength", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_BITSPERSAMPLE, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_BITSPERSAMPLE, 0, 0, "BitsPerSample", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_COMPRESSION, -1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_COMPRESSION, 0, 0, "Compression", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PHOTOMETRIC, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_PHOTOMETRIC, 0, 0, "PhotometricInterpretation", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_THRESHHOLDING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_THRESHHOLDING, 1, 0, "Threshholding", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CELLWIDTH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "CellWidth", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CELLLENGTH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "CellLength", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_FILLORDER, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_FILLORDER, 0, 0, "FillOrder", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_DOCUMENTNAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DocumentName", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_IMAGEDESCRIPTION, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageDescription", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_MAKE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Make", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_MODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Model", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_STRIPOFFSETS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPOFFSETS, 0, 0, "StripOffsets", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ORIENTATION, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_ORIENTATION, 0, 0, "Orientation", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_SAMPLESPERPIXEL, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_SAMPLESPERPIXEL, 0, 0, "SamplesPerPixel", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_ROWSPERSTRIP, 0, 0, "RowsPerStrip", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_STRIPBYTECOUNTS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPBYTECOUNTS, 0, 0, "StripByteCounts", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_MINSAMPLEVALUE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_MINSAMPLEVALUE, 1, 0, "MinSampleValue", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_MAXSAMPLEVALUE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_MAXSAMPLEVALUE, 1, 0, "MaxSampleValue", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_XRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_RESOLUTION, 1, 0, "XResolution", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_YRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_RESOLUTION, 1, 0, "YResolution", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PLANARCONFIG, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_PLANARCONFIG, 0, 0, "PlanarConfiguration", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PAGENAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PageName", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_XPOSITION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_POSITION, 1, 0, "XPosition", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_YPOSITION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_POSITION, 1, 0, "YPosition", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_FREEOFFSETS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 0, 0, "FreeOffsets", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_FREEBYTECOUNTS, -1, -1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 0, 0, "FreeByteCounts", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_GRAYRESPONSEUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "GrayResponseUnit", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_GRAYRESPONSECURVE, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "GrayResponseCurve", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_RESOLUTIONUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_RESOLUTIONUNIT, 1, 0, "ResolutionUnit", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PAGENUMBER, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_PAGENUMBER, 1, 0, "PageNumber", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_COLORRESPONSEUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_IGNORE, 1, 0, "ColorResponseUnit", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_TRANSFERFUNCTION, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_OTHER, TIFF_SETGET_UNDEFINED, FIELD_TRANSFERFUNCTION, 1, 0, "TransferFunction", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_SOFTWARE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Software", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_DATETIME, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateTime", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ARTIST, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Artist", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_HOSTCOMPUTER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "HostComputer", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_WHITEPOINT, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "WhitePoint", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PRIMARYCHROMATICITIES, 6, 6, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PrimaryChromaticities", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_COLORMAP, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_OTHER, TIFF_SETGET_UNDEFINED, FIELD_COLORMAP, 1, 0, "ColorMap", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_HALFTONEHINTS, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_HALFTONEHINTS, 1, 0, "HalftoneHints", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_TILEWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_TILEDIMENSIONS, 0, 0, "TileWidth", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_TILELENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_TILEDIMENSIONS, 0, 0, "TileLength", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_TILEOFFSETS, -1, 1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPOFFSETS, 0, 0, "TileOffsets", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_LONG8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_STRIPBYTECOUNTS, 0, 0, "TileByteCounts", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_SUBIFD, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, TIFF_SETGET_UNDEFINED, FIELD_SUBIFD, 1, 1, "SubIFD", &tiffFieldArray },
|
|
roentgen |
b75cab |
{ TIFFTAG_INKSET, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "InkSet", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_INKNAMES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_C16_ASCII, TIFF_SETGET_UNDEFINED, FIELD_INKNAMES, 1, 1, "InkNames", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "NumberOfInks", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_DOTRANGE, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "DotRange", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_TARGETPRINTER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TargetPrinter", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_EXTRASAMPLES, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_EXTRASAMPLES, 0, 1, "ExtraSamples", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_SAMPLEFORMAT, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_SAMPLEFORMAT, 0, 0, "SampleFormat", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_SMINSAMPLEVALUE, -2, -1, TIFF_ANY, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_SMINSAMPLEVALUE, 1, 0, "SMinSampleValue", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_SMAXSAMPLEVALUE, -2, -1, TIFF_ANY, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_SMAXSAMPLEVALUE, 1, 0, "SMaxSampleValue", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CLIPPATH, -1, -3, TIFF_BYTE, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ClipPath", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_XCLIPPATHUNITS, 1, 1, TIFF_SLONG, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "XClipPathUnits", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_XCLIPPATHUNITS, 1, 1, TIFF_SBYTE, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "XClipPathUnits", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_YCLIPPATHUNITS, 1, 1, TIFF_SLONG, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "YClipPathUnits", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_YCBCRCOEFFICIENTS, 3, 3, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "YCbCrCoefficients", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_YCBCRSUBSAMPLING, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_YCBCRSUBSAMPLING, 0, 0, "YCbCrSubsampling", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_YCBCRPOSITIONING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_YCBCRPOSITIONING, 0, 0, "YCbCrPositioning", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_REFBLACKWHITE, 1, 0, "ReferenceBlackWhite", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_XMLPACKET, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "XMLPacket", NULL },
|
|
roentgen |
b75cab |
/* begin SGI tags */
|
|
roentgen |
b75cab |
{ TIFFTAG_MATTEING, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_EXTRASAMPLES, 0, 0, "Matteing", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_DATATYPE, -2, -1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_SAMPLEFORMAT, 0, 0, "DataType", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_IMAGEDEPTH, 0, 0, "ImageDepth", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_TILEDEPTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_TILEDEPTH, 0, 0, "TileDepth", NULL },
|
|
roentgen |
b75cab |
/* end SGI tags */
|
|
roentgen |
b75cab |
/* begin Pixar tags */
|
|
roentgen |
b75cab |
{ TIFFTAG_PIXAR_IMAGEFULLWIDTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageFullWidth", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PIXAR_IMAGEFULLLENGTH, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageFullLength", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PIXAR_TEXTUREFORMAT, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TextureFormat", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PIXAR_WRAPMODES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TextureWrapModes", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PIXAR_FOVCOT, 1, 1, TIFF_FLOAT, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FieldOfViewCotangent", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN, 16, 16, TIFF_FLOAT, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MatrixWorldToScreen", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA, 16, 16, TIFF_FLOAT, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MatrixWorldToCamera", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_COPYRIGHT, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Copyright", NULL },
|
|
roentgen |
b75cab |
/* end Pixar tags */
|
|
roentgen |
b75cab |
{ TIFFTAG_RICHTIFFIPTC, -3, -3, TIFF_LONG, 0, TIFF_SETGET_C32_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "RichTIFFIPTC", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PHOTOSHOP, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "Photoshop", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_EXIFIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "EXIFIFDOffset", &exifFieldArray },
|
|
roentgen |
b75cab |
{ TIFFTAG_ICCPROFILE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ICC Profile", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_GPSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "GPSIFDOffset", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_FAXRECVPARAMS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_CUSTOM, TRUE, FALSE, "FaxRecvParams", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_FAXSUBADDRESS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_ASCII, FIELD_CUSTOM, TRUE, FALSE, "FaxSubAddress", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_FAXRECVTIME, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_CUSTOM, TRUE, FALSE, "FaxRecvTime", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_FAXDCS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_ASCII, FIELD_CUSTOM, TRUE, FALSE, "FaxDcs", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_STONITS, 1, 1, TIFF_DOUBLE, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "StoNits", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_INTEROPERABILITYIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "InteroperabilityIFDOffset", NULL },
|
|
roentgen |
b75cab |
/* begin DNG tags */
|
|
roentgen |
b75cab |
{ TIFFTAG_DNGVERSION, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "DNGVersion", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_DNGBACKWARDVERSION, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "DNGBackwardVersion", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_UNIQUECAMERAMODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "UniqueCameraModel", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "LocalizedCameraModel", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CFAPLANECOLOR, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "CFAPlaneColor", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CFALAYOUT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "CFALayout", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_LINEARIZATIONTABLE, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "LinearizationTable", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_BLACKLEVELREPEATDIM, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "BlackLevelRepeatDim", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_BLACKLEVEL, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "BlackLevel", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_BLACKLEVELDELTAH, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "BlackLevelDeltaH", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_BLACKLEVELDELTAV, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "BlackLevelDeltaV", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_WHITELEVEL, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "WhiteLevel", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_DEFAULTSCALE, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "DefaultScale", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_BESTQUALITYSCALE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "BestQualityScale", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_DEFAULTCROPORIGIN, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "DefaultCropOrigin", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_DEFAULTCROPSIZE, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "DefaultCropSize", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_COLORMATRIX1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ColorMatrix1", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_COLORMATRIX2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ColorMatrix2", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CAMERACALIBRATION1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "CameraCalibration1", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CAMERACALIBRATION2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "CameraCalibration2", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_REDUCTIONMATRIX1, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ReductionMatrix1", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_REDUCTIONMATRIX2, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ReductionMatrix2", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ANALOGBALANCE, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "AnalogBalance", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ASSHOTNEUTRAL, -1, -1, TIFF_RATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "AsShotNeutral", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ASSHOTWHITEXY, 2, 2, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "AsShotWhiteXY", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_BASELINEEXPOSURE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "BaselineExposure", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_BASELINENOISE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "BaselineNoise", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_BASELINESHARPNESS, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "BaselineSharpness", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_BAYERGREENSPLIT, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "BayerGreenSplit", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_LINEARRESPONSELIMIT, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "LinearResponseLimit", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CAMERASERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CameraSerialNumber", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_LENSINFO, 4, 4, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "LensInfo", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CHROMABLURRADIUS, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ChromaBlurRadius", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ANTIALIASSTRENGTH, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "AntiAliasStrength", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_SHADOWSCALE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ShadowScale", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_DNGPRIVATEDATA, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "DNGPrivateData", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_MAKERNOTESAFETY, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "MakerNoteSafety", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CALIBRATIONILLUMINANT1, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "CalibrationIlluminant1", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CALIBRATIONILLUMINANT2, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "CalibrationIlluminant2", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_RAWDATAUNIQUEID, 16, 16, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "RawDataUniqueID", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ORIGINALRAWFILENAME, -1, -1, TIFF_BYTE, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OriginalRawFileName", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ORIGINALRAWFILEDATA, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "OriginalRawFileData", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ACTIVEAREA, 4, 4, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ActiveArea", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_MASKEDAREAS, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "MaskedAreas", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ASSHOTICCPROFILE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "AsShotICCProfile", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_ASSHOTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "AsShotPreProfileMatrix", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CURRENTICCPROFILE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "CurrentICCProfile", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CURRENTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "CurrentPreProfileMatrix", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PERSAMPLE, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "PerSample", NULL},
|
|
roentgen |
b75cab |
/* end DNG tags */
|
|
roentgen |
b75cab |
/* begin TIFF/FX tags */
|
|
roentgen |
b75cab |
{ TIFFTAG_INDEXED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "Indexed" },
|
|
roentgen |
b75cab |
{ TIFFTAG_GLOBALPARAMETERSIFD, 1, 1, TIFF_IFD, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "GlobalParametersIFD", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_PROFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ProfileType", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_FAXPROFILE, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "FaxProfile", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_CODINGMETHODS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "CodingMethods", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_VERSIONYEAR, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "VersionYear", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_MODENUMBER, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ModeNumber", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_DECODE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "Decode", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_IMAGEBASECOLOR, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ImageBaseColor", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_T82OPTIONS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "T82Options", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_STRIPROWCOUNTS, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "StripRowCounts", NULL },
|
|
roentgen |
b75cab |
{ TIFFTAG_IMAGELAYER, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ImageLayer", NULL },
|
|
roentgen |
b75cab |
/* end DNG tags */
|
|
roentgen |
b75cab |
/* begin pseudo tags */
|
|
roentgen |
b75cab |
};
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
static TIFFField
|
|
roentgen |
b75cab |
exifFields[] = {
|
|
roentgen |
b75cab |
{ EXIFTAG_EXPOSURETIME, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureTime", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_FNUMBER, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FNumber", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_EXPOSUREPROGRAM, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureProgram", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SPECTRALSENSITIVITY, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SpectralSensitivity", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_ISOSPEEDRATINGS, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ISOSpeedRatings", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_OECF, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OptoelectricConversionFactor", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_EXIFVERSION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExifVersion", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_DATETIMEORIGINAL, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateTimeOriginal", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_DATETIMEDIGITIZED, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateTimeDigitized", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_COMPONENTSCONFIGURATION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ComponentsConfiguration", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_COMPRESSEDBITSPERPIXEL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CompressedBitsPerPixel", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SHUTTERSPEEDVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ShutterSpeedValue", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_APERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ApertureValue", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_BRIGHTNESSVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BrightnessValue", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_EXPOSUREBIASVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureBiasValue", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_MAXAPERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MaxApertureValue", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SUBJECTDISTANCE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubjectDistance", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_METERINGMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MeteringMode", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_LIGHTSOURCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LightSource", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_FLASH, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Flash", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_FOCALLENGTH, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalLength", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SUBJECTAREA, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "SubjectArea", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_MAKERNOTE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "MakerNote", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_USERCOMMENT, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "UserComment", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SUBSECTIME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTime", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SUBSECTIMEORIGINAL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTimeOriginal", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SUBSECTIMEDIGITIZED, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTimeDigitized", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_FLASHPIXVERSION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FlashpixVersion", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_COLORSPACE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ColorSpace", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_PIXELXDIMENSION, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PixelXDimension", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_PIXELYDIMENSION, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PixelYDimension", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_RELATEDSOUNDFILE, 13, 13, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RelatedSoundFile", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_FLASHENERGY, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FlashEnergy", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SPATIALFREQUENCYRESPONSE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "SpatialFrequencyResponse", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_FOCALPLANEXRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalPlaneXResolution", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_FOCALPLANEYRESOLUTION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalPlaneYResolution", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_FOCALPLANERESOLUTIONUNIT, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalPlaneResolutionUnit", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SUBJECTLOCATION, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubjectLocation", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_EXPOSUREINDEX, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureIndex", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SENSINGMETHOD, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SensingMethod", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_FILESOURCE, 1, 1, TIFF_UNDEFINED, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FileSource", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SCENETYPE, 1, 1, TIFF_UNDEFINED, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SceneType", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_CFAPATTERN, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "CFAPattern", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_CUSTOMRENDERED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CustomRendered", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_EXPOSUREMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureMode", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_WHITEBALANCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "WhiteBalance", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_DIGITALZOOMRATIO, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DigitalZoomRatio", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_FOCALLENGTHIN35MMFILM, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FocalLengthIn35mmFilm", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SCENECAPTURETYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SceneCaptureType", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_GAINCONTROL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_DOUBLE, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "GainControl", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_CONTRAST, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Contrast", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SATURATION, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Saturation", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SHARPNESS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Sharpness", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_DEVICESETTINGDESCRIPTION, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "DeviceSettingDescription", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_SUBJECTDISTANCERANGE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubjectDistanceRange", NULL },
|
|
roentgen |
b75cab |
{ EXIFTAG_IMAGEUNIQUEID, 33, 33, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageUniqueID", NULL }
|
|
roentgen |
b75cab |
};
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
static TIFFFieldArray
|
|
roentgen |
b75cab |
tiffFieldArray = { tfiatImage, 0, TIFFArrayCount(tiffFields), tiffFields };
|
|
roentgen |
b75cab |
static TIFFFieldArray
|
|
roentgen |
b75cab |
exifFieldArray = { tfiatExif, 0, TIFFArrayCount(exifFields), exifFields };
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/*
|
|
roentgen |
b75cab |
* We have our own local lfind() equivelent to avoid subtle differences
|
|
roentgen |
b75cab |
* in types passed to lfind() on different systems.
|
|
roentgen |
b75cab |
*/
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
static void *
|
|
roentgen |
b75cab |
td_lfind(const void *key, const void *base, size_t *nmemb, size_t size,
|
|
roentgen |
b75cab |
int(*compar)(const void *, const void *))
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
char *element, *end;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
end = (char *)base + *nmemb * size;
|
|
roentgen |
b75cab |
for (element = (char *)base; element < end; element += size)
|
|
roentgen |
b75cab |
if (!compar(key, element)) /* key found */
|
|
roentgen |
b75cab |
return element;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
return NULL;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
const TIFFFieldArray*
|
|
roentgen |
b75cab |
_TIFFGetFields(void)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
return(&tiffFieldArray);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
const TIFFFieldArray*
|
|
roentgen |
b75cab |
_TIFFGetExifFields(void)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
return(&exifFieldArray);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
void
|
|
roentgen |
b75cab |
_TIFFSetupFields(TIFF* tif, const TIFFFieldArray* fieldarray)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
if (tif->tif_fields && tif->tif_nfields > 0) {
|
|
roentgen |
b75cab |
uint32 i;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
for (i = 0; i < tif->tif_nfields; i++) {
|
|
roentgen |
b75cab |
TIFFField *fld = tif->tif_fields[i];
|
|
roentgen |
b75cab |
if (fld->field_bit == FIELD_CUSTOM &&
|
|
roentgen |
b75cab |
strncmp("Tag ", fld->field_name, 4) == 0) {
|
|
roentgen |
b75cab |
_TIFFfree(fld->field_name);
|
|
roentgen |
b75cab |
_TIFFfree(fld);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
_TIFFfree(tif->tif_fields);
|
|
roentgen |
b75cab |
tif->tif_fields = NULL;
|
|
roentgen |
b75cab |
tif->tif_nfields = 0;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
if (!_TIFFMergeFields(tif, fieldarray->fields, fieldarray->count)) {
|
|
roentgen |
b75cab |
TIFFErrorExt(tif->tif_clientdata, "_TIFFSetupFields",
|
|
roentgen |
b75cab |
"Setting up field info failed");
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
static int
|
|
roentgen |
b75cab |
tagCompare(const void* a, const void* b)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
const TIFFField* ta = *(const TIFFField**) a;
|
|
roentgen |
b75cab |
const TIFFField* tb = *(const TIFFField**) b;
|
|
roentgen |
b75cab |
/* NB: be careful of return values for 16-bit platforms */
|
|
roentgen |
b75cab |
if (ta->field_tag != tb->field_tag)
|
|
roentgen |
b75cab |
return (int)ta->field_tag - (int)tb->field_tag;
|
|
roentgen |
b75cab |
else
|
|
roentgen |
b75cab |
return (ta->field_type == TIFF_ANY) ?
|
|
roentgen |
b75cab |
0 : ((int)tb->field_type - (int)ta->field_type);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
static int
|
|
roentgen |
b75cab |
tagNameCompare(const void* a, const void* b)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
const TIFFField* ta = *(const TIFFField**) a;
|
|
roentgen |
b75cab |
const TIFFField* tb = *(const TIFFField**) b;
|
|
roentgen |
b75cab |
int ret = strcmp(ta->field_name, tb->field_name);
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
if (ret)
|
|
roentgen |
b75cab |
return ret;
|
|
roentgen |
b75cab |
else
|
|
roentgen |
b75cab |
return (ta->field_type == TIFF_ANY) ?
|
|
roentgen |
b75cab |
0 : ((int)tb->field_type - (int)ta->field_type);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
int
|
|
roentgen |
b75cab |
_TIFFMergeFields(TIFF* tif, const TIFFField info[], uint32 n)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
static const char module[] = "_TIFFMergeFields";
|
|
roentgen |
b75cab |
static const char reason[] = "for fields array";
|
|
roentgen |
b75cab |
/* TIFFField** tp; */
|
|
roentgen |
b75cab |
uint32 i;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
tif->tif_foundfield = NULL;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
if (tif->tif_fields && tif->tif_nfields > 0) {
|
|
roentgen |
b75cab |
tif->tif_fields = (TIFFField**)
|
|
roentgen |
b75cab |
_TIFFCheckRealloc(tif, tif->tif_fields,
|
|
roentgen |
b75cab |
(tif->tif_nfields + n),
|
|
roentgen |
b75cab |
sizeof(TIFFField *), reason);
|
|
roentgen |
b75cab |
} else {
|
|
roentgen |
b75cab |
tif->tif_fields = (TIFFField **)
|
|
roentgen |
b75cab |
_TIFFCheckMalloc(tif, n, sizeof(TIFFField *),
|
|
roentgen |
b75cab |
reason);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
if (!tif->tif_fields) {
|
|
roentgen |
b75cab |
TIFFErrorExt(tif->tif_clientdata, module,
|
|
roentgen |
b75cab |
"Failed to allocate fields array");
|
|
roentgen |
b75cab |
return 0;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/* tp = tif->tif_fields + tif->tif_nfields; */
|
|
roentgen |
b75cab |
for (i = 0; i < n; i++) {
|
|
roentgen |
b75cab |
const TIFFField *fip =
|
|
roentgen |
b75cab |
TIFFFindField(tif, info[i].field_tag, TIFF_ANY);
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/* only add definitions that aren't already present */
|
|
roentgen |
b75cab |
if (!fip) {
|
|
roentgen |
b75cab |
tif->tif_fields[tif->tif_nfields] = (TIFFField *) (info+i);
|
|
roentgen |
b75cab |
tif->tif_nfields++;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/* Sort the field info by tag number */
|
|
roentgen |
b75cab |
qsort(tif->tif_fields, tif->tif_nfields,
|
|
roentgen |
b75cab |
sizeof(TIFFField *), tagCompare);
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
return n;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
void
|
|
roentgen |
b75cab |
_TIFFPrintFieldInfo(TIFF* tif, FILE* fd)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
uint32 i;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
fprintf(fd, "%s: \n", tif->tif_name);
|
|
roentgen |
b75cab |
for (i = 0; i < tif->tif_nfields; i++) {
|
|
roentgen |
b75cab |
const TIFFField* fip = tif->tif_fields[i];
|
|
roentgen |
b75cab |
fprintf(fd, "field[%2d] %5lu, %2d, %2d, %d, %2d, %5s, %5s, %s\n"
|
|
roentgen |
b75cab |
, (int)i
|
|
roentgen |
b75cab |
, (unsigned long) fip->field_tag
|
|
roentgen |
b75cab |
, fip->field_readcount, fip->field_writecount
|
|
roentgen |
b75cab |
, fip->field_type
|
|
roentgen |
b75cab |
, fip->field_bit
|
|
roentgen |
b75cab |
, fip->field_oktochange ? "TRUE" : "FALSE"
|
|
roentgen |
b75cab |
, fip->field_passcount ? "TRUE" : "FALSE"
|
|
roentgen |
b75cab |
, fip->field_name
|
|
roentgen |
b75cab |
);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/*
|
|
roentgen |
b75cab |
* Return size of TIFFDataType in bytes
|
|
roentgen |
b75cab |
*/
|
|
roentgen |
b75cab |
int
|
|
roentgen |
b75cab |
TIFFDataWidth(TIFFDataType type)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
switch(type)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
case 0: /* nothing */
|
|
roentgen |
b75cab |
case TIFF_BYTE:
|
|
roentgen |
b75cab |
case TIFF_ASCII:
|
|
roentgen |
b75cab |
case TIFF_SBYTE:
|
|
roentgen |
b75cab |
case TIFF_UNDEFINED:
|
|
roentgen |
b75cab |
return 1;
|
|
roentgen |
b75cab |
case TIFF_SHORT:
|
|
roentgen |
b75cab |
case TIFF_SSHORT:
|
|
roentgen |
b75cab |
return 2;
|
|
roentgen |
b75cab |
case TIFF_LONG:
|
|
roentgen |
b75cab |
case TIFF_SLONG:
|
|
roentgen |
b75cab |
case TIFF_FLOAT:
|
|
roentgen |
b75cab |
case TIFF_IFD:
|
|
roentgen |
b75cab |
return 4;
|
|
roentgen |
b75cab |
case TIFF_RATIONAL:
|
|
roentgen |
b75cab |
case TIFF_SRATIONAL:
|
|
roentgen |
b75cab |
case TIFF_DOUBLE:
|
|
roentgen |
b75cab |
case TIFF_LONG8:
|
|
roentgen |
b75cab |
case TIFF_SLONG8:
|
|
roentgen |
b75cab |
case TIFF_IFD8:
|
|
roentgen |
b75cab |
return 8;
|
|
roentgen |
b75cab |
default:
|
|
roentgen |
b75cab |
return 0; /* will return 0 for unknown types */
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/*
|
|
roentgen |
b75cab |
* Return size of TIFFDataType in bytes.
|
|
roentgen |
b75cab |
*
|
|
roentgen |
b75cab |
* XXX: We need a separate function to determine the space needed
|
|
roentgen |
b75cab |
* to store the value. For TIFF_RATIONAL values TIFFDataWidth() returns 8,
|
|
roentgen |
b75cab |
* but we use 4-byte float to represent rationals.
|
|
roentgen |
b75cab |
*/
|
|
roentgen |
b75cab |
int
|
|
roentgen |
b75cab |
_TIFFDataSize(TIFFDataType type)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
switch (type)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
case TIFF_BYTE:
|
|
roentgen |
b75cab |
case TIFF_SBYTE:
|
|
roentgen |
b75cab |
case TIFF_ASCII:
|
|
roentgen |
b75cab |
case TIFF_UNDEFINED:
|
|
roentgen |
b75cab |
return 1;
|
|
roentgen |
b75cab |
case TIFF_SHORT:
|
|
roentgen |
b75cab |
case TIFF_SSHORT:
|
|
roentgen |
b75cab |
return 2;
|
|
roentgen |
b75cab |
case TIFF_LONG:
|
|
roentgen |
b75cab |
case TIFF_SLONG:
|
|
roentgen |
b75cab |
case TIFF_FLOAT:
|
|
roentgen |
b75cab |
case TIFF_IFD:
|
|
roentgen |
b75cab |
case TIFF_RATIONAL:
|
|
roentgen |
b75cab |
case TIFF_SRATIONAL:
|
|
roentgen |
b75cab |
return 4;
|
|
roentgen |
b75cab |
case TIFF_DOUBLE:
|
|
roentgen |
b75cab |
case TIFF_LONG8:
|
|
roentgen |
b75cab |
case TIFF_SLONG8:
|
|
roentgen |
b75cab |
case TIFF_IFD8:
|
|
roentgen |
b75cab |
return 8;
|
|
roentgen |
b75cab |
default:
|
|
roentgen |
b75cab |
return 0;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
const TIFFField*
|
|
roentgen |
b75cab |
TIFFFindField(TIFF* tif, uint32 tag, TIFFDataType dt)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL};
|
|
roentgen |
b75cab |
TIFFField* pkey = &key;
|
|
roentgen |
b75cab |
const TIFFField **ret;
|
|
roentgen |
b75cab |
if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag &&
|
|
roentgen |
b75cab |
(dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
|
|
roentgen |
b75cab |
return tif->tif_foundfield;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/* If we are invoked with no field information, then just return. */
|
|
roentgen |
b75cab |
if (!tif->tif_fields)
|
|
roentgen |
b75cab |
return NULL;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/* NB: use sorted search (e.g. binary search) */
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
key.field_tag = tag;
|
|
roentgen |
b75cab |
key.field_type = dt;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
ret = (const TIFFField **) bsearch(&pkey, tif->tif_fields,
|
|
roentgen |
b75cab |
tif->tif_nfields,
|
|
roentgen |
b75cab |
sizeof(TIFFField *), tagCompare);
|
|
roentgen |
b75cab |
return tif->tif_foundfield = (ret ? *ret : NULL);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
const TIFFField*
|
|
roentgen |
b75cab |
_TIFFFindFieldByName(TIFF* tif, const char *field_name, TIFFDataType dt)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL};
|
|
roentgen |
b75cab |
TIFFField* pkey = &key;
|
|
roentgen |
b75cab |
const TIFFField **ret;
|
|
roentgen |
b75cab |
if (tif->tif_foundfield
|
|
roentgen |
b75cab |
&& streq(tif->tif_foundfield->field_name, field_name)
|
|
roentgen |
b75cab |
&& (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
|
|
roentgen |
b75cab |
return (tif->tif_foundfield);
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/* If we are invoked with no field information, then just return. */
|
|
roentgen |
b75cab |
if (!tif->tif_fields)
|
|
roentgen |
b75cab |
return NULL;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/* NB: use linear search since list is sorted by key#, not name */
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
key.field_name = (char *)field_name;
|
|
roentgen |
b75cab |
key.field_type = dt;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
ret = (const TIFFField **)
|
|
roentgen |
b75cab |
td_lfind(&pkey, tif->tif_fields, &tif->tif_nfields,
|
|
roentgen |
b75cab |
sizeof(TIFFField *), tagNameCompare);
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
return tif->tif_foundfield = (ret ? *ret : NULL);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
const TIFFField*
|
|
roentgen |
b75cab |
TIFFFieldWithTag(TIFF* tif, uint32 tag)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
|
|
roentgen |
b75cab |
if (!fip) {
|
|
roentgen |
b75cab |
TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithTag",
|
|
roentgen |
b75cab |
"Internal error, unknown tag 0x%x",
|
|
roentgen |
b75cab |
(unsigned int) tag);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
return (fip);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
const TIFFField*
|
|
roentgen |
b75cab |
TIFFFieldWithName(TIFF* tif, const char *field_name)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
const TIFFField* fip =
|
|
roentgen |
b75cab |
_TIFFFindFieldByName(tif, field_name, TIFF_ANY);
|
|
roentgen |
b75cab |
if (!fip) {
|
|
roentgen |
b75cab |
TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithName",
|
|
roentgen |
b75cab |
"Internal error, unknown tag %s", field_name);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
return (fip);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
uint32
|
|
roentgen |
b75cab |
TIFFFieldTag(const TIFFField* fip)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
return fip->field_tag;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
const char *
|
|
roentgen |
b75cab |
TIFFFieldName(const TIFFField* fip)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
return fip->field_name;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
TIFFDataType
|
|
roentgen |
b75cab |
TIFFFieldDataType(const TIFFField* fip)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
return fip->field_type;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
int
|
|
roentgen |
b75cab |
TIFFFieldPassCount(const TIFFField* fip)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
return fip->field_passcount;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
int
|
|
roentgen |
b75cab |
TIFFFieldReadCount(const TIFFField* fip)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
return fip->field_readcount;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
int
|
|
roentgen |
b75cab |
TIFFFieldWriteCount(const TIFFField* fip)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
return fip->field_writecount;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
const TIFFField*
|
|
roentgen |
b75cab |
_TIFFFindOrRegisterField(TIFF *tif, uint32 tag, TIFFDataType dt)
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
const TIFFField *fld;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
fld = TIFFFindField(tif, tag, dt);
|
|
roentgen |
b75cab |
if (fld == NULL) {
|
|
roentgen |
b75cab |
fld = _TIFFCreateAnonField(tif, tag, dt);
|
|
roentgen |
b75cab |
if (!_TIFFMergeFields(tif, fld, 1))
|
|
roentgen |
b75cab |
return NULL;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
return fld;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
TIFFField*
|
|
roentgen |
b75cab |
_TIFFCreateAnonField(TIFF *tif, uint32 tag, TIFFDataType field_type)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
TIFFField *fld;
|
|
roentgen |
b75cab |
(void) tif;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
fld = (TIFFField *) _TIFFmalloc(sizeof (TIFFField));
|
|
roentgen |
b75cab |
if (fld == NULL)
|
|
roentgen |
b75cab |
return NULL;
|
|
roentgen |
b75cab |
_TIFFmemset(fld, 0, sizeof(TIFFField));
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
fld->field_tag = tag;
|
|
roentgen |
b75cab |
fld->field_readcount = TIFF_VARIABLE2;
|
|
roentgen |
b75cab |
fld->field_writecount = TIFF_VARIABLE2;
|
|
roentgen |
b75cab |
fld->field_type = field_type;
|
|
roentgen |
b75cab |
fld->reserved = 0;
|
|
roentgen |
b75cab |
switch (field_type)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
case TIFF_BYTE:
|
|
roentgen |
b75cab |
case TIFF_UNDEFINED:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_UINT8;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_UINT8;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
case TIFF_ASCII:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_ASCII;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_ASCII;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
case TIFF_SHORT:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_UINT16;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_UINT16;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
case TIFF_LONG:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_UINT32;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_UINT32;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
case TIFF_RATIONAL:
|
|
roentgen |
b75cab |
case TIFF_SRATIONAL:
|
|
roentgen |
b75cab |
case TIFF_FLOAT:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_FLOAT;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_FLOAT;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
case TIFF_SBYTE:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_SINT8;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_SINT8;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
case TIFF_SSHORT:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_SINT16;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_SINT16;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
case TIFF_SLONG:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_SINT32;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_SINT32;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
case TIFF_DOUBLE:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_DOUBLE;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_DOUBLE;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
case TIFF_IFD:
|
|
roentgen |
b75cab |
case TIFF_IFD8:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_IFD8;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_IFD8;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
case TIFF_LONG8:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_UINT64;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_UINT64;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
case TIFF_SLONG8:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_C32_SINT64;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_C32_SINT64;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
default:
|
|
roentgen |
b75cab |
fld->set_field_type = TIFF_SETGET_UNDEFINED;
|
|
roentgen |
b75cab |
fld->get_field_type = TIFF_SETGET_UNDEFINED;
|
|
roentgen |
b75cab |
break;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
fld->field_bit = FIELD_CUSTOM;
|
|
roentgen |
b75cab |
fld->field_oktochange = TRUE;
|
|
roentgen |
b75cab |
fld->field_passcount = TRUE;
|
|
roentgen |
b75cab |
fld->field_name = (char *) _TIFFmalloc(32);
|
|
roentgen |
b75cab |
if (fld->field_name == NULL) {
|
|
roentgen |
b75cab |
_TIFFfree(fld);
|
|
roentgen |
b75cab |
return NULL;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
fld->field_subfields = NULL;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/*
|
|
roentgen |
b75cab |
* note that this name is a special sign to TIFFClose() and
|
|
roentgen |
b75cab |
* _TIFFSetupFields() to free the field
|
|
roentgen |
b75cab |
*/
|
|
roentgen |
b75cab |
sprintf(fld->field_name, "Tag %d", (int) tag);
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
return fld;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/****************************************************************************
|
|
roentgen |
b75cab |
* O B S O L E T E D I N T E R F A C E S
|
|
roentgen |
b75cab |
*
|
|
roentgen |
b75cab |
* Don't use this stuff in your applications, it may be removed in the future
|
|
roentgen |
b75cab |
* libtiff versions.
|
|
roentgen |
b75cab |
****************************************************************************/
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
static TIFFSetGetFieldType
|
|
roentgen |
b75cab |
_TIFFSetGetType(TIFFDataType type, short count, unsigned char passcount)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
if (type == TIFF_ASCII && count == TIFF_VARIABLE && passcount == 0)
|
|
roentgen |
b75cab |
return TIFF_SETGET_ASCII;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
else if (count == 1 && passcount == 0) {
|
|
roentgen |
b75cab |
switch (type)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
case TIFF_BYTE:
|
|
roentgen |
b75cab |
case TIFF_UNDEFINED:
|
|
roentgen |
b75cab |
return TIFF_SETGET_UINT8;
|
|
roentgen |
b75cab |
case TIFF_ASCII:
|
|
roentgen |
b75cab |
return TIFF_SETGET_ASCII;
|
|
roentgen |
b75cab |
case TIFF_SHORT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_UINT16;
|
|
roentgen |
b75cab |
case TIFF_LONG:
|
|
roentgen |
b75cab |
return TIFF_SETGET_UINT32;
|
|
roentgen |
b75cab |
case TIFF_RATIONAL:
|
|
roentgen |
b75cab |
case TIFF_SRATIONAL:
|
|
roentgen |
b75cab |
case TIFF_FLOAT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_FLOAT;
|
|
roentgen |
b75cab |
case TIFF_SBYTE:
|
|
roentgen |
b75cab |
return TIFF_SETGET_SINT8;
|
|
roentgen |
b75cab |
case TIFF_SSHORT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_SINT16;
|
|
roentgen |
b75cab |
case TIFF_SLONG:
|
|
roentgen |
b75cab |
return TIFF_SETGET_SINT32;
|
|
roentgen |
b75cab |
case TIFF_DOUBLE:
|
|
roentgen |
b75cab |
return TIFF_SETGET_DOUBLE;
|
|
roentgen |
b75cab |
case TIFF_IFD:
|
|
roentgen |
b75cab |
case TIFF_IFD8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_IFD8;
|
|
roentgen |
b75cab |
case TIFF_LONG8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_UINT64;
|
|
roentgen |
b75cab |
case TIFF_SLONG8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_SINT64;
|
|
roentgen |
b75cab |
default:
|
|
roentgen |
b75cab |
return TIFF_SETGET_UNDEFINED;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
else if (count >= 1 && passcount == 0) {
|
|
roentgen |
b75cab |
switch (type)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
case TIFF_BYTE:
|
|
roentgen |
b75cab |
case TIFF_UNDEFINED:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_UINT8;
|
|
roentgen |
b75cab |
case TIFF_ASCII:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_ASCII;
|
|
roentgen |
b75cab |
case TIFF_SHORT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_UINT16;
|
|
roentgen |
b75cab |
case TIFF_LONG:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_UINT32;
|
|
roentgen |
b75cab |
case TIFF_RATIONAL:
|
|
roentgen |
b75cab |
case TIFF_SRATIONAL:
|
|
roentgen |
b75cab |
case TIFF_FLOAT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_FLOAT;
|
|
roentgen |
b75cab |
case TIFF_SBYTE:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_SINT8;
|
|
roentgen |
b75cab |
case TIFF_SSHORT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_SINT16;
|
|
roentgen |
b75cab |
case TIFF_SLONG:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_SINT32;
|
|
roentgen |
b75cab |
case TIFF_DOUBLE:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_DOUBLE;
|
|
roentgen |
b75cab |
case TIFF_IFD:
|
|
roentgen |
b75cab |
case TIFF_IFD8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_IFD8;
|
|
roentgen |
b75cab |
case TIFF_LONG8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_UINT64;
|
|
roentgen |
b75cab |
case TIFF_SLONG8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C0_SINT64;
|
|
roentgen |
b75cab |
default:
|
|
roentgen |
b75cab |
return TIFF_SETGET_UNDEFINED;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
else if (count == TIFF_VARIABLE && passcount == 1) {
|
|
roentgen |
b75cab |
switch (type)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
case TIFF_BYTE:
|
|
roentgen |
b75cab |
case TIFF_UNDEFINED:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_UINT8;
|
|
roentgen |
b75cab |
case TIFF_ASCII:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_ASCII;
|
|
roentgen |
b75cab |
case TIFF_SHORT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_UINT16;
|
|
roentgen |
b75cab |
case TIFF_LONG:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_UINT32;
|
|
roentgen |
b75cab |
case TIFF_RATIONAL:
|
|
roentgen |
b75cab |
case TIFF_SRATIONAL:
|
|
roentgen |
b75cab |
case TIFF_FLOAT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_FLOAT;
|
|
roentgen |
b75cab |
case TIFF_SBYTE:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_SINT8;
|
|
roentgen |
b75cab |
case TIFF_SSHORT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_SINT16;
|
|
roentgen |
b75cab |
case TIFF_SLONG:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_SINT32;
|
|
roentgen |
b75cab |
case TIFF_DOUBLE:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_DOUBLE;
|
|
roentgen |
b75cab |
case TIFF_IFD:
|
|
roentgen |
b75cab |
case TIFF_IFD8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_IFD8;
|
|
roentgen |
b75cab |
case TIFF_LONG8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_UINT64;
|
|
roentgen |
b75cab |
case TIFF_SLONG8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C16_SINT64;
|
|
roentgen |
b75cab |
default:
|
|
roentgen |
b75cab |
return TIFF_SETGET_UNDEFINED;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
else if (count == TIFF_VARIABLE2 && passcount == 1) {
|
|
roentgen |
b75cab |
switch (type)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
case TIFF_BYTE:
|
|
roentgen |
b75cab |
case TIFF_UNDEFINED:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_UINT8;
|
|
roentgen |
b75cab |
case TIFF_ASCII:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_ASCII;
|
|
roentgen |
b75cab |
case TIFF_SHORT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_UINT16;
|
|
roentgen |
b75cab |
case TIFF_LONG:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_UINT32;
|
|
roentgen |
b75cab |
case TIFF_RATIONAL:
|
|
roentgen |
b75cab |
case TIFF_SRATIONAL:
|
|
roentgen |
b75cab |
case TIFF_FLOAT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_FLOAT;
|
|
roentgen |
b75cab |
case TIFF_SBYTE:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_SINT8;
|
|
roentgen |
b75cab |
case TIFF_SSHORT:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_SINT16;
|
|
roentgen |
b75cab |
case TIFF_SLONG:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_SINT32;
|
|
roentgen |
b75cab |
case TIFF_DOUBLE:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_DOUBLE;
|
|
roentgen |
b75cab |
case TIFF_IFD:
|
|
roentgen |
b75cab |
case TIFF_IFD8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_IFD8;
|
|
roentgen |
b75cab |
case TIFF_LONG8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_UINT64;
|
|
roentgen |
b75cab |
case TIFF_SLONG8:
|
|
roentgen |
b75cab |
return TIFF_SETGET_C32_SINT64;
|
|
roentgen |
b75cab |
default:
|
|
roentgen |
b75cab |
return TIFF_SETGET_UNDEFINED;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
return TIFF_SETGET_UNDEFINED;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
int
|
|
roentgen |
b75cab |
TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], uint32 n)
|
|
roentgen |
b75cab |
{
|
|
roentgen |
b75cab |
static const char module[] = "TIFFMergeFieldInfo";
|
|
roentgen |
b75cab |
static const char reason[] = "for fields array";
|
|
roentgen |
b75cab |
TIFFField *tp;
|
|
roentgen |
b75cab |
size_t nfields;
|
|
roentgen |
b75cab |
uint32 i;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
if (tif->tif_nfieldscompat > 0) {
|
|
roentgen |
b75cab |
tif->tif_fieldscompat = (TIFFFieldArray *)
|
|
roentgen |
b75cab |
_TIFFCheckRealloc(tif, tif->tif_fieldscompat,
|
|
roentgen |
b75cab |
tif->tif_nfieldscompat + 1,
|
|
roentgen |
b75cab |
sizeof(TIFFFieldArray), reason);
|
|
roentgen |
b75cab |
} else {
|
|
roentgen |
b75cab |
tif->tif_fieldscompat = (TIFFFieldArray *)
|
|
roentgen |
b75cab |
_TIFFCheckMalloc(tif, 1, sizeof(TIFFFieldArray),
|
|
roentgen |
b75cab |
reason);
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
if (!tif->tif_fieldscompat) {
|
|
roentgen |
b75cab |
TIFFErrorExt(tif->tif_clientdata, module,
|
|
roentgen |
b75cab |
"Failed to allocate fields array");
|
|
roentgen |
b75cab |
return -1;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
nfields = tif->tif_nfieldscompat++;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
tif->tif_fieldscompat[nfields].type = tfiatOther;
|
|
roentgen |
b75cab |
tif->tif_fieldscompat[nfields].allocated_size = n;
|
|
roentgen |
b75cab |
tif->tif_fieldscompat[nfields].count = n;
|
|
roentgen |
b75cab |
tif->tif_fieldscompat[nfields].fields =
|
|
roentgen |
b75cab |
(TIFFField *)_TIFFCheckMalloc(tif, n, sizeof(TIFFField),
|
|
roentgen |
b75cab |
reason);
|
|
roentgen |
b75cab |
if (!tif->tif_fieldscompat[nfields].fields) {
|
|
roentgen |
b75cab |
TIFFErrorExt(tif->tif_clientdata, module,
|
|
roentgen |
b75cab |
"Failed to allocate fields array");
|
|
roentgen |
b75cab |
return -1;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
tp = tif->tif_fieldscompat[nfields].fields;
|
|
roentgen |
b75cab |
for (i = 0; i < n; i++) {
|
|
roentgen |
b75cab |
tp->field_tag = info[i].field_tag;
|
|
roentgen |
b75cab |
tp->field_readcount = info[i].field_readcount;
|
|
roentgen |
b75cab |
tp->field_writecount = info[i].field_writecount;
|
|
roentgen |
b75cab |
tp->field_type = info[i].field_type;
|
|
roentgen |
b75cab |
tp->reserved = 0;
|
|
roentgen |
b75cab |
tp->set_field_type =
|
|
roentgen |
b75cab |
_TIFFSetGetType(info[i].field_type,
|
|
roentgen |
b75cab |
info[i].field_readcount,
|
|
roentgen |
b75cab |
info[i].field_passcount);
|
|
roentgen |
b75cab |
tp->get_field_type =
|
|
roentgen |
b75cab |
_TIFFSetGetType(info[i].field_type,
|
|
roentgen |
b75cab |
info[i].field_readcount,
|
|
roentgen |
b75cab |
info[i].field_passcount);
|
|
roentgen |
b75cab |
tp->field_bit = info[i].field_bit;
|
|
roentgen |
b75cab |
tp->field_oktochange = info[i].field_oktochange;
|
|
roentgen |
b75cab |
tp->field_passcount = info[i].field_passcount;
|
|
roentgen |
b75cab |
tp->field_name = info[i].field_name;
|
|
roentgen |
b75cab |
tp->field_subfields = NULL;
|
|
roentgen |
b75cab |
tp++;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
if (!_TIFFMergeFields(tif, tif->tif_fieldscompat[nfields].fields, n)) {
|
|
roentgen |
b75cab |
TIFFErrorExt(tif->tif_clientdata, module,
|
|
roentgen |
b75cab |
"Setting up field info failed");
|
|
roentgen |
b75cab |
return -1;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
return 0;
|
|
roentgen |
b75cab |
}
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/* vim: set ts=8 sts=8 sw=8 noet: */
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
/*
|
|
roentgen |
b75cab |
* Local Variables:
|
|
roentgen |
b75cab |
* mode: c
|
|
roentgen |
b75cab |
* c-basic-offset: 8
|
|
roentgen |
b75cab |
* fill-column: 78
|
|
roentgen |
b75cab |
* End:
|
|
roentgen |
b75cab |
*/
|