GDAL
gdalexif.h
00001 /******************************************************************************
00002  * $Id: gdalexif.h 35883 2016-10-24 05:49:15Z goatbar $
00003  *
00004  * Project:  JPEG JFIF Driver
00005  * Purpose:  Implement GDAL JPEG Support based on IJG libjpeg.
00006  * Author:   Frank Warmerdam, warmerdam@pobox.com
00007  *
00008  ******************************************************************************
00009  * Copyright (c) 2000, Frank Warmerdam
00010  *
00011  * Permission is hereby granted, free of charge, to any person obtaining a
00012  * copy of this software and associated documentation files (the "Software"),
00013  * to deal in the Software without restriction, including without limitation
00014  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00015  * and/or sell copies of the Software, and to permit persons to whom the
00016  * Software is furnished to do so, subject to the following conditions:
00017  *
00018  * The above copyright notice and this permission notice shall be included
00019  * in all copies or substantial portions of the Software.
00020  *
00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00022  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00024  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00026  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00027  * DEALINGS IN THE SOFTWARE.
00028  ****************************************************************************/
00029 
00031 
00032 #ifdef RENAME_INTERNAL_LIBTIFF_SYMBOLS
00033 #include "../frmts/gtiff/libtiff/gdal_libtiff_symbol_rename.h"
00034 #endif
00035 
00036 static const struct gpsname {
00037     GUInt16     tag;
00038     const char* name;
00039 } gpstags [] = {
00040     { 0x00, "EXIF_GPSVersionID" },
00041     { 0x01, "EXIF_GPSLatitudeRef" },
00042     { 0x02, "EXIF_GPSLatitude" },
00043     { 0x03, "EXIF_GPSLongitudeRef" },
00044     { 0x04, "EXIF_GPSLongitude" },
00045     { 0x05, "EXIF_GPSAltitudeRef" },
00046     { 0x06, "EXIF_GPSAltitude" },
00047     { 0x07, "EXIF_GPSTimeStamp" },
00048     { 0x08, "EXIF_GPSSatellites" },
00049     { 0x09, "EXIF_GPSStatus" },
00050     { 0x0a, "EXIF_GPSMeasureMode" },
00051     { 0x0b, "EXIF_GPSDOP" },
00052     { 0x0c, "EXIF_GPSSpeedRef"},
00053     { 0x0d, "EXIF_GPSSpeed"},
00054     { 0x0e, "EXIF_GPSTrackRef"},
00055     { 0x0f, "EXIF_GPSTrack"},
00056     { 0x10, "EXIF_GPSImgDirectionRef"},
00057     { 0x11, "EXIF_GPSImgDirection"},
00058     { 0x12, "EXIF_GPSMapDatum"},
00059     { 0x13, "EXIF_GPSDestLatitudeRef"},
00060     { 0x14, "EXIF_GPSDestLatitude"},
00061     { 0x15, "EXIF_GPSDestLongitudeRef"},
00062     { 0x16, "EXIF_GPSDestLongitude"},
00063     { 0x17, "EXIF_GPSDestBearingRef"},
00064     { 0x18, "EXIF_GPSDestBearing"},
00065     { 0x19, "EXIF_GPSDestDistanceRef"},
00066     { 0x1a, "EXIF_GPSDestDistance"},
00067     { 0x1b, "EXIF_GPSProcessingMethod"},
00068     { 0x1c, "EXIF_GPSAreaInformation"},
00069     { 0x1d, "EXIF_GPSDateStamp"},
00070     { 0x1e, "EXIF_GPSDifferential"},
00071     { 0xffff, ""}
00072 };
00073 
00074 static const struct tagname {
00075   GUInt16       tag;
00076   const char*   name;
00077 } tagnames [] = {
00078     //{ 0x100, "EXIF_Image_Width"},
00079     //  { 0x101, "EXIF_Image_Length"},
00080     { 0x102, "EXIF_BitsPerSample"},
00081     { 0x103, "EXIF_Compression"},
00082     { 0x106, "EXIF_PhotometricInterpretation"},
00083     { 0x10A, "EXIF_Fill_Order"},
00084     { 0x10D, "EXIF_Document_Name"},
00085     { 0x10E, "EXIF_ImageDescription"},
00086     { 0x10F, "EXIF_Make"},
00087     { 0x110, "EXIF_Model"},
00088     { 0x111, "EXIF_StripOffsets"},
00089     { 0x112, "EXIF_Orientation"},
00090     { 0x115, "EXIF_SamplesPerPixel"},
00091     { 0x116, "EXIF_RowsPerStrip"},
00092     { 0x117, "EXIF_StripByteCounts"},
00093     { 0x11A, "EXIF_XResolution"},
00094     { 0x11B, "EXIF_YResolution"},
00095     { 0x11C, "EXIF_PlanarConfiguration"},
00096     { 0x128, "EXIF_ResolutionUnit"},
00097     { 0x12D, "EXIF_TransferFunction"},
00098     { 0x131, "EXIF_Software"},
00099     { 0x132, "EXIF_DateTime"},
00100     { 0x13B, "EXIF_Artist"},
00101     { 0x13E, "EXIF_WhitePoint"},
00102     { 0x13F, "EXIF_PrimaryChromaticities"},
00103     { 0x156, "EXIF_Transfer_Range"},
00104     { 0x200, "EXIF_JPEG_Proc"},
00105     { 0x201, "EXIF_JPEGInterchangeFormat"},
00106     { 0x202, "EXIF_JPEGInterchangeFormatLength"},
00107     { 0x211, "EXIF_YCbCrCoefficients"},
00108     { 0x212, "EXIF_YCbCrSubSampling"},
00109     { 0x213, "EXIF_YCbCrPositioning"},
00110     { 0x214, "EXIF_ReferenceBlackWhite"},
00111     { 0x828D, "EXIF_CFA_Repeat_Pattern_Dim"},
00112     { 0x828E, "EXIF_CFA_Pattern"},
00113     { 0x828F, "EXIF_Battery_Level"},
00114     { 0x8298, "EXIF_Copyright"},
00115     { 0x829A, "EXIF_ExposureTime"},
00116     { 0x829D, "EXIF_FNumber"},
00117     { 0x83BB, "EXIF_IPTC/NAA"},
00118     // { 0x8769, "EXIF_Offset"},
00119     { 0x8773, "EXIF_Inter_Color_Profile"},
00120     { 0x8822, "EXIF_ExposureProgram"},
00121     { 0x8824, "EXIF_SpectralSensitivity"},
00122     // { 0x8825, "EXIF_GPSOffset"},
00123     { 0x8827, "EXIF_ISOSpeedRatings"},
00124     { 0x8828, "EXIF_OECF"},
00125     { 0x9000, "EXIF_ExifVersion"},
00126     { 0x9003, "EXIF_DateTimeOriginal"},
00127     { 0x9004, "EXIF_DateTimeDigitized"},
00128     { 0x9101, "EXIF_ComponentsConfiguration"},
00129     { 0x9102, "EXIF_CompressedBitsPerPixel"},
00130     { 0x9201, "EXIF_ShutterSpeedValue"},
00131     { 0x9202, "EXIF_ApertureValue"},
00132     { 0x9203, "EXIF_BrightnessValue"},
00133     { 0x9204, "EXIF_ExposureBiasValue"},
00134     { 0x9205, "EXIF_MaxApertureValue"},
00135     { 0x9206, "EXIF_SubjectDistance"},
00136     { 0x9207, "EXIF_MeteringMode"},
00137     { 0x9208, "EXIF_LightSource"},
00138     { 0x9209, "EXIF_Flash"},
00139     { 0x920A, "EXIF_FocalLength"},
00140     { 0x9214, "EXIF_SubjectArea"},
00141     { 0x927C, "EXIF_MakerNote"},
00142     { 0x9286, "EXIF_UserComment"},
00143     { 0x9290, "EXIF_SubSecTime"},
00144     { 0x9291, "EXIF_SubSecTime_Original"},
00145     { 0x9292, "EXIF_SubSecTime_Digitized"},
00146     { 0xA000, "EXIF_FlashpixVersion"},
00147     { 0xA001, "EXIF_ColorSpace"},
00148     { 0xA002, "EXIF_PixelXDimension"},
00149     { 0xA003, "EXIF_PixelYDimension"},
00150     { 0xA004, "EXIF_RelatedSoundFile"},
00151     // { 0xA005, "EXIF_InteroperabilityOffset"},
00152     { 0xA20B, "EXIF_FlashEnergy"},   // 0x920B in TIFF/EP
00153     { 0xA20C, "EXIF_SpatialFrequencyResponse"},   // 0x920C    -  -
00154     { 0xA20E, "EXIF_FocalPlaneXResolution"},     // 0x920E    -  -
00155     { 0xA20F, "EXIF_FocalPlaneYResolution"},     // 0x920F    -  -
00156     { 0xA210, "EXIF_FocalPlaneResolutionUnit"},  // 0x9210    -  -
00157     { 0xA214, "EXIF_SubjectLocation"}, // 0x9214    -  -
00158     { 0xA215, "EXIF_ExposureIndex"},  // 0x9215    -  -
00159     { 0xA217, "EXIF_SensingMethod"},  // 0x9217    -  -
00160     { 0xA300, "EXIF_FileSource"},
00161     { 0xA301, "EXIF_SceneType"},
00162     { 0xA302, "EXIF_CFAPattern"},
00163     { 0xA401, "EXIF_CustomRendered"},
00164     { 0xA402, "EXIF_ExposureMode"},
00165     { 0XA403, "EXIF_WhiteBalance"},
00166     { 0xA404, "EXIF_DigitalZoomRatio"},
00167     { 0xA405, "EXIF_FocalLengthIn35mmFilm"},
00168     { 0xA406, "EXIF_SceneCaptureType"},
00169     { 0xA407, "EXIF_GainControl"},
00170     { 0xA408, "EXIF_Contrast"},
00171     { 0xA409, "EXIF_Saturation"},
00172     { 0xA40A, "EXIF_Sharpness"},
00173     { 0xA40B, "EXIF_DeviceSettingDescription"},
00174     { 0xA40C, "EXIF_SubjectDistanceRange"},
00175     { 0xA420, "EXIF_ImageUniqueID"},
00176     { 0x0000, ""}
00177 };
00178 
00179 static const struct intr_tag {
00180   GInt16        tag;
00181   const char*   name;
00182 } intr_tags [] = {
00183 
00184     { 0x1, "EXIF_Interoperability_Index"},
00185     { 0x2, "EXIF_Interoperability_Version"},
00186     { 0x1000, "EXIF_Related_Image_File_Format"},
00187     { 0x1001, "EXIF_Related_Image_Width"},
00188     { 0x1002, "EXIF_Related_Image_Length"},
00189     { 0x0000,       ""}
00190 };
00191 
00192 typedef enum {
00193         TIFF_NOTYPE     = 0,    /* placeholder */
00194         TIFF_BYTE       = 1,    /* 8-bit unsigned integer */
00195         TIFF_ASCII      = 2,    /* 8-bit bytes w/ last byte null */
00196         TIFF_SHORT      = 3,    /* 16-bit unsigned integer */
00197         TIFF_LONG       = 4,    /* 32-bit unsigned integer */
00198         TIFF_RATIONAL   = 5,    /* 64-bit unsigned fraction */
00199         TIFF_SBYTE      = 6,    /* !8-bit signed integer */
00200         TIFF_UNDEFINED  = 7,    /* !8-bit untyped data */
00201         TIFF_SSHORT     = 8,    /* !16-bit signed integer */
00202         TIFF_SLONG      = 9,    /* !32-bit signed integer */
00203         TIFF_SRATIONAL  = 10,   /* !64-bit signed fraction */
00204         TIFF_FLOAT      = 11,   /* !32-bit IEEE floating point */
00205         TIFF_DOUBLE     = 12,   /* !64-bit IEEE floating point */
00206         TIFF_IFD        = 13    /* %32-bit unsigned integer (offset) */
00207 } GDALEXIFTIFFDataType;
00208 
00209 /*
00210  * TIFF Image File Directories are comprised of a table of field
00211  * descriptors of the form shown below.  The table is sorted in
00212  * ascending order by tag.  The values associated with each entry are
00213  * disjoint and may appear anywhere in the file (so long as they are
00214  * placed on a word boundary).
00215  *
00216  * If the value is 4 bytes or less, then it is placed in the offset
00217  * field to save space.  If the value is less than 4 bytes, it is
00218  * left-justified in the offset field.
00219  */
00220 typedef struct {
00221         GUInt16          tdir_tag;       /* see below */
00222         GUInt16          tdir_type;      /* data type; see below */
00223         GUInt32          tdir_count;     /* number of items; length in spec */
00224         GUInt32          tdir_offset;    /* byte offset to field data */
00225 } GDALEXIFTIFFDirEntry;
00226 
00227 CPL_C_START
00228 /* Table of tag datatype widths. */
00229 extern int TIFFDataWidth(GDALEXIFTIFFDataType);
00230 extern void TIFFSwabShort(GUInt16*);
00231 extern void TIFFSwabLong(GUInt32*);
00232 extern void TIFFSwabDouble(double*);
00233 extern void TIFFSwabArrayOfShort(GUInt16*, unsigned long);
00234 extern void TIFFSwabArrayOfLong(GUInt32*, unsigned long);
00235 extern void TIFFSwabArrayOfDouble(double*, unsigned long);
00236 CPL_C_END
00237 

Generated for GDAL by doxygen 1.7.6.1.