Merge branch 'EXIF231_GPS_upgrade' into 'master'
EXIF 2.32 and GPS TIFF-tags and functionality upgraded. See merge request libtiff/libtiff!91
This commit is contained in:
commit
d83f5ce943
@ -12,6 +12,7 @@ EXPORTS TIFFAccessTagMethods
|
||||
TIFFCreateCustomDirectory
|
||||
TIFFCreateDirectory
|
||||
TIFFCreateEXIFDirectory
|
||||
TIFFCreateGPSDirectory
|
||||
TIFFCurrentDirOffset
|
||||
TIFFCurrentDirectory
|
||||
TIFFCurrentRow
|
||||
@ -86,6 +87,7 @@ EXPORTS TIFFAccessTagMethods
|
||||
TIFFReadCustomDirectory
|
||||
TIFFReadDirectory
|
||||
TIFFReadEXIFDirectory
|
||||
TIFFReadGPSDirectory
|
||||
TIFFReadEncodedStrip
|
||||
TIFFReadEncodedTile
|
||||
TIFFReadFromUserBuffer
|
||||
@ -171,5 +173,7 @@ EXPORTS TIFFAccessTagMethods
|
||||
_TIFFmemcpy
|
||||
_TIFFmemset
|
||||
_TIFFrealloc
|
||||
_TIFFMultiply32
|
||||
_TIFFMultiply64
|
||||
_TIFFMultiply32
|
||||
_TIFFMultiply64
|
||||
_TIFFGetExifFields
|
||||
_TIFFGetGpsFields
|
||||
|
@ -1403,6 +1403,17 @@ TIFFCreateEXIFDirectory(TIFF* tif)
|
||||
return TIFFCreateCustomDirectory(tif, exifFieldArray);
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates the EXIF GPS custom directory
|
||||
*/
|
||||
int
|
||||
TIFFCreateGPSDirectory(TIFF* tif)
|
||||
{
|
||||
const TIFFFieldArray* gpsFieldArray;
|
||||
gpsFieldArray = _TIFFGetGpsFields();
|
||||
return TIFFCreateCustomDirectory(tif, gpsFieldArray);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup a default directory structure.
|
||||
*/
|
||||
|
@ -261,6 +261,7 @@ extern "C" {
|
||||
|
||||
extern const TIFFFieldArray* _TIFFGetFields(void);
|
||||
extern const TIFFFieldArray* _TIFFGetExifFields(void);
|
||||
extern const TIFFFieldArray* _TIFFGetGpsFields(void);
|
||||
extern void _TIFFSetupFields(TIFF* tif, const TIFFFieldArray* infoarray);
|
||||
extern void _TIFFPrintFieldInfo(TIFF*, FILE*);
|
||||
|
||||
@ -269,6 +270,7 @@ extern int _TIFFFillStriles(TIFF*);
|
||||
typedef enum {
|
||||
tfiatImage,
|
||||
tfiatExif,
|
||||
tfiatGps, /* EXIF-GPS fields array type */
|
||||
tfiatOther
|
||||
} TIFFFieldArrayType;
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
#endif
|
||||
static const TIFFFieldArray tiffFieldArray;
|
||||
static const TIFFFieldArray exifFieldArray;
|
||||
static const TIFFFieldArray gpsFieldArray;
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
@ -149,9 +150,13 @@ tiffFields[] = {
|
||||
/* end Pixar tags */
|
||||
{ TIFFTAG_RICHTIFFIPTC, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "RichTIFFIPTC", NULL },
|
||||
{ TIFFTAG_PHOTOSHOP, -3, -3, TIFF_BYTE, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "Photoshop", NULL },
|
||||
{ TIFFTAG_EXIFIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "EXIFIFDOffset", (TIFFFieldArray*) &exifFieldArray },
|
||||
/*--: EXIFIFD and GPSIFD specified as TIFF_LONG by Aware-Systems and not TIFF_IFD8 as in original LibTiff.
|
||||
* However, for IFD-like tags, libtiff uses the data type TIFF_IFD8 in tiffFields[]-tag definition combined with
|
||||
* a special handling procedure in order to write either a 32-bit value and the TIFF_IFD type-id into ClassicTIFF files
|
||||
* or a 64-bit value and the TIFF_IFD8 type-id into BigTIFF files. */
|
||||
{ TIFFTAG_EXIFIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "EXIFIFDOffset", (TIFFFieldArray*) &exifFieldArray },
|
||||
{ TIFFTAG_ICCPROFILE, -3, -3, TIFF_UNDEFINED, 0, TIFF_SETGET_C32_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ICC Profile", NULL },
|
||||
{ TIFFTAG_GPSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "GPSIFDOffset", NULL },
|
||||
{ TIFFTAG_GPSIFD, 1, 1, TIFF_IFD8, 0, TIFF_SETGET_IFD8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "GPSIFDOffset", (TIFFFieldArray*) &gpsFieldArray },
|
||||
{ TIFFTAG_FAXRECVPARAMS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_CUSTOM, TRUE, FALSE, "FaxRecvParams", NULL },
|
||||
{ TIFFTAG_FAXSUBADDRESS, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_ASCII, FIELD_CUSTOM, TRUE, FALSE, "FaxSubAddress", NULL },
|
||||
{ TIFFTAG_FAXRECVTIME, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UINT32, FIELD_CUSTOM, TRUE, FALSE, "FaxRecvTime", NULL },
|
||||
@ -226,6 +231,9 @@ tiffFields[] = {
|
||||
/* begin pseudo tags */
|
||||
};
|
||||
|
||||
/*
|
||||
* EXIF tags (Version 2.31, July 2016 plus version 2.32 May 2019)
|
||||
*/
|
||||
static const TIFFField
|
||||
exifFields[] = {
|
||||
{ EXIFTAG_EXPOSURETIME, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureTime", NULL },
|
||||
@ -234,9 +242,18 @@ exifFields[] = {
|
||||
{ EXIFTAG_SPECTRALSENSITIVITY, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SpectralSensitivity", NULL },
|
||||
{ EXIFTAG_ISOSPEEDRATINGS, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "ISOSpeedRatings", NULL },
|
||||
{ EXIFTAG_OECF, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "OptoelectricConversionFactor", NULL },
|
||||
{ EXIFTAG_SENSITIVITYTYPE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SensitivityType", NULL },
|
||||
{ EXIFTAG_STANDARDOUTPUTSENSITIVITY, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "StandardOutputSensitivity", NULL },
|
||||
{ EXIFTAG_RECOMMENDEDEXPOSUREINDEX, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "RecommendedExposureIndex", NULL },
|
||||
{ EXIFTAG_ISOSPEED, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ISOSpeed", NULL },
|
||||
{ EXIFTAG_ISOSPEEDLATITUDEYYY, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ISOSpeedLatitudeyyy", NULL },
|
||||
{ EXIFTAG_ISOSPEEDLATITUDEZZZ, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ISOSpeedLatitudezzz", NULL },
|
||||
{ EXIFTAG_EXIFVERSION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExifVersion", NULL },
|
||||
{ EXIFTAG_DATETIMEORIGINAL, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateTimeOriginal", NULL },
|
||||
{ EXIFTAG_DATETIMEDIGITIZED, 20, 20, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "DateTimeDigitized", NULL },
|
||||
{ EXIFTAG_OFFSETTIME, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OffsetTime", NULL },
|
||||
{ EXIFTAG_OFFSETTIMEORIGINAL, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OffsetTimeOriginal", NULL },
|
||||
{ EXIFTAG_OFFSETTIMEDIGITIZED, 7, 7, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "OffsetTimeDigitized", NULL },
|
||||
{ EXIFTAG_COMPONENTSCONFIGURATION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ComponentsConfiguration", NULL },
|
||||
{ EXIFTAG_COMPRESSEDBITSPERPIXEL, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CompressedBitsPerPixel", NULL },
|
||||
{ EXIFTAG_SHUTTERSPEEDVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ShutterSpeedValue", NULL },
|
||||
@ -244,6 +261,9 @@ exifFields[] = {
|
||||
{ EXIFTAG_BRIGHTNESSVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BrightnessValue", NULL },
|
||||
{ EXIFTAG_EXPOSUREBIASVALUE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ExposureBiasValue", NULL },
|
||||
{ EXIFTAG_MAXAPERTUREVALUE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MaxApertureValue", NULL },
|
||||
/*--: EXIFTAG_SUBJECTDISTANCE: LibTiff returns value of "-1" if numerator equals 4294967295 (0xFFFFFFFF) to indicate infinite distance!
|
||||
* However, there are two other EXIF tags where numerator indicates a special value and six other cases where the denominator indicates special values,
|
||||
* which are not treated within LibTiff!! */
|
||||
{ EXIFTAG_SUBJECTDISTANCE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubjectDistance", NULL },
|
||||
{ EXIFTAG_METERINGMODE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "MeteringMode", NULL },
|
||||
{ EXIFTAG_LIGHTSOURCE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LightSource", NULL },
|
||||
@ -255,6 +275,12 @@ exifFields[] = {
|
||||
{ EXIFTAG_SUBSECTIME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTime", NULL },
|
||||
{ EXIFTAG_SUBSECTIMEORIGINAL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTimeOriginal", NULL },
|
||||
{ EXIFTAG_SUBSECTIMEDIGITIZED, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubSecTimeDigitized", NULL },
|
||||
{ EXIFTAG_TEMPERATURE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Temperature", NULL },
|
||||
{ EXIFTAG_HUMIDITY, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Humidity", NULL },
|
||||
{ EXIFTAG_PRESSURE, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Pressure", NULL },
|
||||
{ EXIFTAG_WATERDEPTH, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "WaterDepth", NULL },
|
||||
{ EXIFTAG_ACCELERATION, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Acceleration", NULL },
|
||||
{ EXIFTAG_CAMERAELEVATIONANGLE, 1, 1, TIFF_SRATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CameraElevationAngle", NULL },
|
||||
{ EXIFTAG_FLASHPIXVERSION, 4, 4, TIFF_UNDEFINED, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "FlashpixVersion", NULL },
|
||||
{ EXIFTAG_COLORSPACE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ColorSpace", NULL },
|
||||
{ EXIFTAG_PIXELXDIMENSION, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "PixelXDimension", NULL },
|
||||
@ -283,13 +309,70 @@ exifFields[] = {
|
||||
{ EXIFTAG_SHARPNESS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Sharpness", NULL },
|
||||
{ EXIFTAG_DEVICESETTINGDESCRIPTION, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "DeviceSettingDescription", NULL },
|
||||
{ EXIFTAG_SUBJECTDISTANCERANGE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SubjectDistanceRange", NULL },
|
||||
{ EXIFTAG_IMAGEUNIQUEID, 33, 33, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageUniqueID", NULL }
|
||||
{ EXIFTAG_IMAGEUNIQUEID, 33, 33, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "ImageUniqueID", NULL },
|
||||
{ EXIFTAG_CAMERAOWNERNAME, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CameraOwnerName", NULL },
|
||||
{ EXIFTAG_BODYSERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "BodySerialNumber", NULL },
|
||||
{ EXIFTAG_LENSSPECIFICATION, 4, 4, TIFF_RATIONAL, 0, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensSpecification", NULL },
|
||||
{ EXIFTAG_LENSMAKE, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensMake", NULL },
|
||||
{ EXIFTAG_LENSMODEL, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensModel", NULL },
|
||||
{ EXIFTAG_LENSSERIALNUMBER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "LensSerialNumber", NULL },
|
||||
{ EXIFTAG_GAMMA, 1, 1, TIFF_RATIONAL, 0, TIFF_SETGET_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "Gamma", NULL },
|
||||
{ EXIFTAG_COMPOSITEIMAGE, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "CompositeImage", NULL },
|
||||
{ EXIFTAG_SOURCEIMAGENUMBEROFCOMPOSITEIMAGE, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_C0_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "SourceImageNumberOfCompositeImage", NULL },
|
||||
{ EXIFTAG_SOURCEEXPOSURETIMESOFCOMPOSITEIMAGE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 1, "SourceExposureTimesOfCompositeImage", NULL }
|
||||
};
|
||||
/*
|
||||
* EXIF-GPS tags (Version 2.31, July 2016; nothing changed for version 2.32 May 2019)
|
||||
*/
|
||||
|
||||
static TIFFField
|
||||
gpsFields[] = {
|
||||
/* For the GPS tag definitions in gpsFields[] the standard definition for Rationals is TIFF_SETGET_DOUBLE and TIFF_SETGET_C0_FLOAT.
|
||||
*-- ATTENTION: After the upgrade with Rational2Double, the GPSTAG values can now be written and also read in double precision!
|
||||
* In order to achieve double precision for GPS tags:
|
||||
* Standard definitions for GPSTAG is kept to TIFF_SETGET_DOUBLE
|
||||
* and TIFF_SETGET_C0_FLOAT is changed to TIFF_SETGET_C0_DOUBLE.
|
||||
*/
|
||||
{ GPSTAG_VERSIONID , 4, 4, TIFF_BYTE , 0, TIFF_SETGET_C0_UINT8 , TIFF_SETGET_UINT8 , FIELD_CUSTOM , 1, 0, "VersionID", NULL },
|
||||
{ GPSTAG_LATITUDEREF , 2, 2, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "LatitudeRef", NULL },
|
||||
{ GPSTAG_LATITUDE , 3, 3, TIFF_RATIONAL , 0, TIFF_SETGET_C0_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "Latitude", NULL },
|
||||
{ GPSTAG_LONGITUDEREF , 2, 2, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "LongitudeRef", NULL },
|
||||
{ GPSTAG_LONGITUDE , 3, 3, TIFF_RATIONAL , 0, TIFF_SETGET_C0_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "Longitude", NULL },
|
||||
{ GPSTAG_ALTITUDEREF , 1, 1, TIFF_BYTE , 0, TIFF_SETGET_UINT8 , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "AltitudeRef", NULL },
|
||||
{ GPSTAG_ALTITUDE , 1, 1, TIFF_RATIONAL , 0, TIFF_SETGET_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "Altitude", NULL },
|
||||
{ GPSTAG_TIMESTAMP , 3, 3, TIFF_RATIONAL , 0, TIFF_SETGET_C0_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "TimeStamp", NULL },
|
||||
{ GPSTAG_SATELLITES , -1, -1, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "Satellites", NULL },
|
||||
{ GPSTAG_STATUS , 2, 2, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "Status", NULL },
|
||||
{ GPSTAG_MEASUREMODE , 2, 2, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "MeasureMode", NULL },
|
||||
{ GPSTAG_DOP , 1, 1, TIFF_RATIONAL , 0, TIFF_SETGET_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "DOP", NULL },
|
||||
{ GPSTAG_SPEEDREF , 2, 2, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "SpeedRef", NULL },
|
||||
{ GPSTAG_SPEED , 1, 1, TIFF_RATIONAL , 0, TIFF_SETGET_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "Speed", NULL },
|
||||
{ GPSTAG_TRACKREF , 2, 2, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "TrackRef", NULL },
|
||||
{ GPSTAG_TRACK , 1, 1, TIFF_RATIONAL , 0, TIFF_SETGET_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "Track", NULL },
|
||||
{ GPSTAG_IMGDIRECTIONREF , 2, 2, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "ImgDirectionRef", NULL },
|
||||
{ GPSTAG_IMGDIRECTION , 1, 1, TIFF_RATIONAL , 0, TIFF_SETGET_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "ImgDirection", NULL },
|
||||
{ GPSTAG_MAPDATUM , -1, -1, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "MapDatum", NULL },
|
||||
{ GPSTAG_DESTLATITUDEREF , 2, 2, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "DestLatitudeRef", NULL },
|
||||
{ GPSTAG_DESTLATITUDE , 3, 3, TIFF_RATIONAL , 0, TIFF_SETGET_C0_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "DestLatitude", NULL },
|
||||
{ GPSTAG_DESTLONGITUDEREF , 2, 2, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "DestLongitudeRef", NULL },
|
||||
{ GPSTAG_DESTLONGITUDE , 3, 3, TIFF_RATIONAL , 0, TIFF_SETGET_C0_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "DestLongitude", NULL },
|
||||
{ GPSTAG_DESTBEARINGREF , 2, 2, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "DestBearingRef", NULL },
|
||||
{ GPSTAG_DESTBEARING , 1, 1, TIFF_RATIONAL , 0, TIFF_SETGET_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "DestBearing", NULL },
|
||||
{ GPSTAG_DESTDISTANCEREF , 2, 2, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "DestDistanceRef", NULL },
|
||||
{ GPSTAG_DESTDISTANCE , 1, 1, TIFF_RATIONAL , 0, TIFF_SETGET_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "DestDistance", NULL },
|
||||
{ GPSTAG_PROCESSINGMETHOD , -1, -1, TIFF_UNDEFINED , 0, TIFF_SETGET_C16_UINT8 , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 1, "ProcessingMethod", NULL },
|
||||
{ GPSTAG_AREAINFORMATION , -1, -1, TIFF_UNDEFINED , 0, TIFF_SETGET_C16_UINT8 , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 1, "AreaInformation", NULL },
|
||||
{ GPSTAG_DATESTAMP , 11, 11, TIFF_ASCII , 0, TIFF_SETGET_ASCII , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "DateStamp", NULL },
|
||||
{ GPSTAG_DIFFERENTIAL , 1, 1, TIFF_SHORT , 0, TIFF_SETGET_UINT16 , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "Differential", NULL },
|
||||
{ GPSTAG_GPSHPOSITIONINGERROR , 1, 1, TIFF_RATIONAL , 0, TIFF_SETGET_DOUBLE , TIFF_SETGET_UNDEFINED , FIELD_CUSTOM , 1, 0, "HorizontalPositioningError", NULL }
|
||||
};
|
||||
|
||||
static const TIFFFieldArray
|
||||
tiffFieldArray = { tfiatImage, 0, TIFFArrayCount(tiffFields), (TIFFField*) tiffFields };
|
||||
static const TIFFFieldArray
|
||||
exifFieldArray = { tfiatExif, 0, TIFFArrayCount(exifFields), (TIFFField*) exifFields };
|
||||
static const TIFFFieldArray
|
||||
gpsFieldArray = { tfiatGps, 0, TIFFArrayCount(gpsFields), (TIFFField*) gpsFields };
|
||||
|
||||
/*
|
||||
* We have our own local lfind() equivalent to avoid subtle differences
|
||||
@ -322,6 +405,12 @@ _TIFFGetExifFields(void)
|
||||
return(&exifFieldArray);
|
||||
}
|
||||
|
||||
const TIFFFieldArray*
|
||||
_TIFFGetGpsFields(void)
|
||||
{
|
||||
return(&gpsFieldArray);
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFSetupFields(TIFF* tif, const TIFFFieldArray* fieldarray)
|
||||
{
|
||||
|
@ -4546,6 +4546,17 @@ TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff)
|
||||
return TIFFReadCustomDirectory(tif, diroff, exifFieldArray);
|
||||
}
|
||||
|
||||
/*
|
||||
*--: EXIF-GPS custom directory reading as another special case of custom IFD.
|
||||
*/
|
||||
int
|
||||
TIFFReadGPSDirectory(TIFF* tif, toff_t diroff)
|
||||
{
|
||||
const TIFFFieldArray* gpsFieldArray;
|
||||
gpsFieldArray = _TIFFGetGpsFields();
|
||||
return TIFFReadCustomDirectory(tif, diroff, gpsFieldArray);
|
||||
}
|
||||
|
||||
static int
|
||||
EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
|
||||
{
|
||||
|
@ -119,6 +119,11 @@ typedef struct {
|
||||
* Tag data type information.
|
||||
*
|
||||
* Note: RATIONALs are the ratio of two 32-bit integer values.
|
||||
*--:
|
||||
* Note2: TIFF_IFD8 data type is used in tiffFields[]-tag definition in order to distinguish the write-handling
|
||||
of those tags between ClassicTIFF and BigTiff:
|
||||
For ClassicTIFF libtiff writes a 32-bit value and the TIFF_IFD type-id into the file
|
||||
For BigTIFF libtiff writes a 64-bit value and the TIFF_IFD8 type-id into the file
|
||||
*/
|
||||
typedef enum {
|
||||
TIFF_NOTYPE = 0, /* placeholder */
|
||||
@ -626,8 +631,8 @@ typedef enum {
|
||||
#define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */
|
||||
#define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */
|
||||
#define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */
|
||||
#define EXIFTAG_OECF 34856 /* Optoelectric conversion
|
||||
factor */
|
||||
#define EXIFTAG_PHOTOGRAPHICSENSITIVITY 34855 /* Photographic Sensitivity (new name for tag 34855) */
|
||||
#define EXIFTAG_OECF 34856 /* Optoelectric conversion factor */
|
||||
#define EXIFTAG_EXIFVERSION 36864 /* Exif version */
|
||||
#define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original
|
||||
data generation */
|
||||
@ -679,10 +684,71 @@ typedef enum {
|
||||
#define EXIFTAG_SHARPNESS 41994 /* Sharpness */
|
||||
#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */
|
||||
#define EXIFTAG_SUBJECTDISTANCERANGE 41996 /* Subject distance range */
|
||||
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
|
||||
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
|
||||
#define EXIFTAG_IMAGEUNIQUEID 42016 /* Unique image ID */
|
||||
|
||||
/*--: New for EXIF-Version 2.32, May 2019 ... */
|
||||
#define EXIFTAG_SENSITIVITYTYPE 34864 /* The SensitivityType tag indicates which one of the parameters of ISO12232 is the PhotographicSensitivity tag. */
|
||||
#define EXIFTAG_STANDARDOUTPUTSENSITIVITY 34865 /* This tag indicates the standard output sensitivity value of a camera or input device defined in ISO 12232. */
|
||||
#define EXIFTAG_RECOMMENDEDEXPOSUREINDEX 34866 /* recommended exposure index */
|
||||
#define EXIFTAG_ISOSPEED 34867 /* ISO speed value */
|
||||
#define EXIFTAG_ISOSPEEDLATITUDEYYY 34868 /* ISO speed latitude yyy */
|
||||
#define EXIFTAG_ISOSPEEDLATITUDEZZZ 34869 /* ISO speed latitude zzz */
|
||||
#define EXIFTAG_OFFSETTIME 36880 /* offset from UTC of the time of DateTime tag. */
|
||||
#define EXIFTAG_OFFSETTIMEORIGINAL 36881 /* offset from UTC of the time of DateTimeOriginal tag. */
|
||||
#define EXIFTAG_OFFSETTIMEDIGITIZED 36882 /* offset from UTC of the time of DateTimeDigitized tag. */
|
||||
#define EXIFTAG_TEMPERATURE 37888 /* Temperature as the ambient situation at the shot in dergee Celsius */
|
||||
#define EXIFTAG_HUMIDITY 37889 /* Humidity as the ambient situation at the shot in percent */
|
||||
#define EXIFTAG_PRESSURE 37890 /* Pressure as the ambient situation at the shot hecto-Pascal (hPa) */
|
||||
#define EXIFTAG_WATERDEPTH 37891 /* WaterDepth as the ambient situation at the shot in meter (m) */
|
||||
#define EXIFTAG_ACCELERATION 37892 /* Acceleration (a scalar regardless of direction) as the ambient situation at the shot in units of mGal (10-5 m/s^2) */
|
||||
#define EXIFTAG_CAMERAELEVATIONANGLE 37893 /* Elevation/depression. angle of the orientation of the camera(imaging optical axis) as the ambient situation at the shot in degree(°) from -180° to +180°. */
|
||||
#define EXIFTAG_CAMERAOWNERNAME 42032 /* owner of a camera */
|
||||
#define EXIFTAG_BODYSERIALNUMBER 42033 /* serial number of the body of the camera */
|
||||
#define EXIFTAG_LENSSPECIFICATION 42034 /* minimum focal length (in mm), maximum focal length (in mm), minimum F number in the minimum focal length, and minimum F number in the maximum focal length, */
|
||||
#define EXIFTAG_LENSMAKE 42035 /* the lens manufacturer */
|
||||
#define EXIFTAG_LENSMODEL 42036 /* the lens’s model name and model number */
|
||||
#define EXIFTAG_LENSSERIALNUMBER 42037 /* the serial number of the interchangeable lens */
|
||||
#define EXIFTAG_GAMMA 42240 /* value of coefficient gamma */
|
||||
#define EXIFTAG_COMPOSITEIMAGE 42080 /* composite image */
|
||||
#define EXIFTAG_SOURCEIMAGENUMBEROFCOMPOSITEIMAGE 42081 /* source image number of composite image */
|
||||
#define EXIFTAG_SOURCEEXPOSURETIMESOFCOMPOSITEIMAGE 42082 /* source exposure times of composite image */
|
||||
|
||||
/*
|
||||
* EXIF-GPS tags (Version 2.31, July 2016)
|
||||
*/
|
||||
#define GPSTAG_VERSIONID 0 /* Indicates the version of GPSInfoIFD. */
|
||||
#define GPSTAG_LATITUDEREF 1 /* Indicates whether the latitude is north or south latitude. */
|
||||
#define GPSTAG_LATITUDE 2 /* Indicates the latitude. */
|
||||
#define GPSTAG_LONGITUDEREF 3 /* Indicates whether the longitude is east or west longitude. */
|
||||
#define GPSTAG_LONGITUDE 4 /* Indicates the longitude. */
|
||||
#define GPSTAG_ALTITUDEREF 5 /* Indicates the altitude used as the reference altitude. */
|
||||
#define GPSTAG_ALTITUDE 6 /* Indicates the altitude based on the reference in GPSAltitudeRef. */
|
||||
#define GPSTAG_TIMESTAMP 7 /* Indicates the time as UTC (Coordinated Universal Time). */
|
||||
#define GPSTAG_SATELLITES 8 /* Indicates the GPS satellites used for measurements. */
|
||||
#define GPSTAG_STATUS 9 /* Indicates the status of the GPS receiver when the image is recorded. */
|
||||
#define GPSTAG_MEASUREMODE 10 /* Indicates the GPS measurement mode. */
|
||||
#define GPSTAG_DOP 11 /* Indicates the GPS DOP (data degree of precision). */
|
||||
#define GPSTAG_SPEEDREF 12 /* Indicates the unit used to express the GPS receiver speed of movement. */
|
||||
#define GPSTAG_SPEED 13 /* Indicates the speed of GPS receiver movement. */
|
||||
#define GPSTAG_TRACKREF 14 /* Indicates the reference for giving the direction of GPS receiver movement. */
|
||||
#define GPSTAG_TRACK 15 /* Indicates the direction of GPS receiver movement. */
|
||||
#define GPSTAG_IMGDIRECTIONREF 16 /* Indicates the reference for giving the direction of the image when it is captured. */
|
||||
#define GPSTAG_IMGDIRECTION 17 /* Indicates the direction of the image when it was captured. */
|
||||
#define GPSTAG_MAPDATUM 18 /* Indicates the geodetic survey data used by the GPS receiver. (e.g. WGS-84) */
|
||||
#define GPSTAG_DESTLATITUDEREF 19 /* Indicates whether the latitude of the destination point is north or south latitude. */
|
||||
#define GPSTAG_DESTLATITUDE 20 /* Indicates the latitude of the destination point. */
|
||||
#define GPSTAG_DESTLONGITUDEREF 21 /* Indicates whether the longitude of the destination point is east or west longitude. */
|
||||
#define GPSTAG_DESTLONGITUDE 22 /* Indicates the longitude of the destination point. */
|
||||
#define GPSTAG_DESTBEARINGREF 23 /* Indicates the reference used for giving the bearing to the destination point. */
|
||||
#define GPSTAG_DESTBEARING 24 /* Indicates the bearing to the destination point. */
|
||||
#define GPSTAG_DESTDISTANCEREF 25 /* Indicates the unit used to express the distance to the destination point. */
|
||||
#define GPSTAG_DESTDISTANCE 26 /* Indicates the distance to the destination point. */
|
||||
#define GPSTAG_PROCESSINGMETHOD 27 /* A character string recording the name of the method used for location finding. */
|
||||
#define GPSTAG_AREAINFORMATION 28 /* A character string recording the name of the GPS area. */
|
||||
#define GPSTAG_DATESTAMP 29 /* A character string recording date and time information relative to UTC (Coordinated Universal Time). */
|
||||
#define GPSTAG_DIFFERENTIAL 30 /* Indicates whether differential correction is applied to the GPS receiver. */
|
||||
#define GPSTAG_GPSHPOSITIONINGERROR 31 /* Indicates horizontal positioning errors in meters. */
|
||||
|
||||
#endif /* _TIFF_ */
|
||||
|
||||
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||
|
@ -350,6 +350,7 @@ extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap);
|
||||
extern int TIFFReadDirectory(TIFF* tif);
|
||||
extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray);
|
||||
extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff);
|
||||
extern int TIFFReadGPSDirectory(TIFF* tif, toff_t diroff);
|
||||
extern uint64 TIFFScanlineSize64(TIFF* tif);
|
||||
extern tmsize_t TIFFScanlineSize(TIFF* tif);
|
||||
extern uint64 TIFFRasterScanlineSize64(TIFF* tif);
|
||||
@ -400,6 +401,7 @@ extern void TIFFFreeDirectory(TIFF*);
|
||||
extern int TIFFCreateDirectory(TIFF*);
|
||||
extern int TIFFCreateCustomDirectory(TIFF*,const TIFFFieldArray*);
|
||||
extern int TIFFCreateEXIFDirectory(TIFF*);
|
||||
extern int TIFFCreateGPSDirectory(TIFF*);
|
||||
extern int TIFFLastDirectory(TIFF*);
|
||||
extern int TIFFSetDirectory(TIFF*, uint16);
|
||||
extern int TIFFSetSubDirectory(TIFF*, uint64);
|
||||
|
@ -204,6 +204,11 @@ add_test(NAME "rational_precision2double"
|
||||
COMMAND "rational_precision2double")
|
||||
endif()
|
||||
|
||||
add_executable(custom_dir_EXIF_231 custom_dir_EXIF_231.c)
|
||||
target_link_libraries(custom_dir_EXIF_231 tiff port)
|
||||
add_test(NAME "custom_dir_EXIF_231"
|
||||
COMMAND "custom_dir_EXIF_231")
|
||||
|
||||
add_executable(defer_strile_loading defer_strile_loading.c)
|
||||
target_link_libraries(defer_strile_loading tiff port)
|
||||
|
||||
|
@ -67,7 +67,7 @@ endif
|
||||
|
||||
# Executable programs which need to be built in order to support tests
|
||||
check_PROGRAMS = \
|
||||
ascii_tag long_tag short_tag strip_rw rewrite custom_dir \
|
||||
ascii_tag long_tag short_tag strip_rw rewrite custom_dir custom_dir_EXIF_231 \
|
||||
rational_precision2double defer_strile_loading defer_strile_writing testtypes \
|
||||
$(JPEG_DEPENDENT_CHECK_PROG)
|
||||
|
||||
@ -216,6 +216,8 @@ custom_dir_SOURCES = custom_dir.c
|
||||
custom_dir_LDADD = $(LIBTIFF)
|
||||
rational_precision2double_SOURCES = rational_precision2double.c
|
||||
rational_precision2double_LDADD = $(LIBTIFF)
|
||||
custom_dir_EXIF_231_SOURCES = custom_dir_EXIF_231.c
|
||||
custom_dir_EXIF_231_LDADD = $(LIBTIFF)
|
||||
defer_strile_loading_SOURCES = defer_strile_loading.c
|
||||
defer_strile_loading_LDADD = $(LIBTIFF)
|
||||
defer_strile_writing_SOURCES = defer_strile_writing.c
|
||||
|
1398
test/custom_dir_EXIF_231.c
Normal file
1398
test/custom_dir_EXIF_231.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user