| 1 |
/*****************************************************************************/ |
| 2 |
// Copyright 2006-2019 Adobe Systems Incorporated |
| 3 |
// All Rights Reserved. |
| 4 |
// |
| 5 |
// NOTICE: Adobe permits you to use, modify, and distribute this file in |
| 6 |
// accordance with the terms of the Adobe license agreement accompanying it. |
| 7 |
/*****************************************************************************/ |
| 8 |
|
| 9 |
#include "dng_parse_utils.h" |
| 10 |
|
| 11 |
#include "dng_date_time.h" |
| 12 |
#include "dng_globals.h" |
| 13 |
#include "dng_ifd.h" |
| 14 |
#include "dng_tag_codes.h" |
| 15 |
#include "dng_tag_types.h" |
| 16 |
#include "dng_tag_values.h" |
| 17 |
#include "dng_types.h" |
| 18 |
#include "dng_stream.h" |
| 19 |
#include "dng_exceptions.h" |
| 20 |
#include "dng_utils.h" |
| 21 |
|
| 22 |
/*****************************************************************************/ |
| 23 |
|
| 24 |
#if qDNGValidate || qDNGDebug |
| 25 |
|
| 26 |
/*****************************************************************************/ |
| 27 |
|
| 28 |
struct dng_name_table |
| 29 |
{ |
| 30 |
uint32 key; |
| 31 |
const char *name; |
| 32 |
}; |
| 33 |
|
| 34 |
/*****************************************************************************/ |
| 35 |
|
| 36 |
static const char * LookupName (uint32 key, |
| 37 |
const dng_name_table *table, |
| 38 |
uint32 table_entries) |
| 39 |
{ |
| 40 |
|
| 41 |
for (uint32 index = 0; index < table_entries; index++) |
| 42 |
{ |
| 43 |
|
| 44 |
if (key == table [index] . key) |
| 45 |
{ |
| 46 |
|
| 47 |
return table [index] . name; |
| 48 |
|
| 49 |
} |
| 50 |
|
| 51 |
} |
| 52 |
|
| 53 |
return NULL; |
| 54 |
|
| 55 |
} |
| 56 |
|
| 57 |
/*****************************************************************************/ |
| 58 |
|
| 59 |
const char * LookupParentCode (uint32 parentCode) |
| 60 |
{ |
| 61 |
|
| 62 |
const dng_name_table kParentCodeNames [] = |
| 63 |
{ |
| 64 |
{ 0, "IFD 0" }, |
| 65 |
{ tcExifIFD, "Exif IFD" }, |
| 66 |
{ tcGPSInfo, "GPS IFD" }, |
| 67 |
{ tcInteroperabilityIFD, "Interoperability IFD" }, |
| 68 |
{ tcKodakDCRPrivateIFD, "Kodak DCR Private IFD" }, |
| 69 |
{ tcKodakKDCPrivateIFD, "Kodak KDC Private IFD" }, |
| 70 |
{ tcCanonMakerNote, "Canon MakerNote" }, |
| 71 |
{ tcEpsonMakerNote, "Epson MakerNote" }, |
| 72 |
{ tcFujiMakerNote, "Fuji MakerNote" }, |
| 73 |
{ tcHasselbladMakerNote, "Hasselblad MakerNote" }, |
| 74 |
{ tcKodakMakerNote, "Kodak MakerNote" }, |
| 75 |
{ tcKodakMakerNote65280, "Kodak MakerNote 65280" }, |
| 76 |
{ tcLeicaMakerNote, "Leica MakerNote" }, |
| 77 |
{ tcMamiyaMakerNote, "Mamiya MakerNote" }, |
| 78 |
{ tcMinoltaMakerNote, "Minolta MakerNote" }, |
| 79 |
{ tcNikonMakerNote, "Nikon MakerNote" }, |
| 80 |
{ tcOlympusMakerNote, "Olympus MakerNote" }, |
| 81 |
{ tcOlympusMakerNote8208, "Olympus MakerNote 8208" }, |
| 82 |
{ tcOlympusMakerNote8224, "Olympus MakerNote 8224" }, |
| 83 |
{ tcOlympusMakerNote8240, "Olympus MakerNote 8240" }, |
| 84 |
{ tcOlympusMakerNote8256, "Olympus MakerNote 8256" }, |
| 85 |
{ tcOlympusMakerNote8272, "Olympus MakerNote 8272" }, |
| 86 |
{ tcOlympusMakerNote12288, "Olympus MakerNote 12288" }, |
| 87 |
{ tcPanasonicMakerNote, "Panasonic MakerNote" }, |
| 88 |
{ tcPentaxMakerNote, "Pentax MakerNote" }, |
| 89 |
{ tcPhaseOneMakerNote, "Phase One MakerNote" }, |
| 90 |
{ tcRicohMakerNote, "Ricoh MakerNote" }, |
| 91 |
{ tcRicohMakerNoteCameraInfo, "Ricoh MakerNote Camera Info" }, |
| 92 |
{ tcSonyMakerNote, "Sony MakerNote" }, |
| 93 |
{ tcSonyMakerNoteSubInfo, "Sony MakerNote SubInfo" }, |
| 94 |
{ tcSonyPrivateIFD1, "Sony Private IFD 1" }, |
| 95 |
{ tcSonyPrivateIFD2, "Sony Private IFD 2" }, |
| 96 |
{ tcSonyPrivateIFD3A, "Sony Private IFD 3A" }, |
| 97 |
{ tcSonyPrivateIFD3B, "Sony Private IFD 3B" }, |
| 98 |
{ tcSonyPrivateIFD3C, "Sony Private IFD 3C" }, |
| 99 |
{ tcCanonCRW, "Canon CRW" }, |
| 100 |
{ tcContaxRAW, "Contax RAW" }, |
| 101 |
{ tcFujiRAF, "Fuji RAF" }, |
| 102 |
{ tcLeafMOS, "Leaf MOS" }, |
| 103 |
{ tcMinoltaMRW, "Minolta MRW" }, |
| 104 |
{ tcPanasonicRAW, "Panasonic RAW" }, |
| 105 |
{ tcFoveonX3F, "Foveon X3F" }, |
| 106 |
{ tcJPEG, "JPEG" }, |
| 107 |
{ tcAdobePSD, "Adobe PSD" }, |
| 108 |
{ tcPNG, "PNG" }, |
| 109 |
{ tcHEIC, "HEIC" }, |
| 110 |
{ tcJXL, "JXL" }, |
| 111 |
{ tcAVIF, "AVIF" }, |
| 112 |
{ tcAppleMakerNote, "Apple MakerNote" }, |
| 113 |
}; |
| 114 |
|
| 115 |
const char *name = LookupName (parentCode, |
| 116 |
kParentCodeNames, |
| 117 |
sizeof (kParentCodeNames ) / |
| 118 |
sizeof (kParentCodeNames [0])); |
| 119 |
|
| 120 |
if (name) |
| 121 |
{ |
| 122 |
return name; |
| 123 |
} |
| 124 |
|
| 125 |
static char s [32]; |
| 126 |
|
| 127 |
if (parentCode >= tcFirstSubIFD && |
| 128 |
parentCode <= tcLastSubIFD) |
| 129 |
{ |
| 130 |
|
| 131 |
snprintf (s, 32, "SubIFD %u", (unsigned) (parentCode - tcFirstSubIFD + 1)); |
| 132 |
|
| 133 |
} |
| 134 |
|
| 135 |
else if (parentCode >= tcFirstChainedIFD && |
| 136 |
parentCode <= tcLastChainedIFD) |
| 137 |
{ |
| 138 |
|
| 139 |
snprintf (s, 32, "Chained IFD %u", (unsigned) (parentCode - tcFirstChainedIFD + 1)); |
| 140 |
|
| 141 |
} |
| 142 |
|
| 143 |
else |
| 144 |
{ |
| 145 |
|
| 146 |
snprintf (s, 32, "ParentIFD %u", (unsigned) parentCode); |
| 147 |
|
| 148 |
} |
| 149 |
|
| 150 |
return s; |
| 151 |
|
| 152 |
} |
| 153 |
|
| 154 |
/*****************************************************************************/ |
| 155 |
|
| 156 |
const char * LookupTagCode (uint32 parentCode, |
| 157 |
uint32 tagCode) |
| 158 |
{ |
| 159 |
|
| 160 |
const dng_name_table kTagNames [] = |
| 161 |
{ |
| 162 |
{ tcNewSubFileType, "NewSubFileType" }, |
| 163 |
{ tcSubFileType, "SubFileType" }, |
| 164 |
{ tcImageWidth, "ImageWidth" }, |
| 165 |
{ tcImageLength, "ImageLength" }, |
| 166 |
{ tcBitsPerSample, "BitsPerSample" }, |
| 167 |
{ tcCompression, "Compression" }, |
| 168 |
{ tcPhotometricInterpretation, "PhotometricInterpretation" }, |
| 169 |
{ tcThresholding, "Thresholding" }, |
| 170 |
{ tcCellWidth, "CellWidth" }, |
| 171 |
{ tcCellLength, "CellLength" }, |
| 172 |
{ tcFillOrder, "FillOrder" }, |
| 173 |
{ tcImageDescription, "ImageDescription" }, |
| 174 |
{ tcMake, "Make" }, |
| 175 |
{ tcModel, "Model" }, |
| 176 |
{ tcStripOffsets, "StripOffsets" }, |
| 177 |
{ tcOrientation, "Orientation" }, |
| 178 |
{ tcSamplesPerPixel, "SamplesPerPixel" }, |
| 179 |
{ tcRowsPerStrip, "RowsPerStrip" }, |
| 180 |
{ tcStripByteCounts, "StripByteCounts" }, |
| 181 |
{ tcMinSampleValue, "MinSampleValue" }, |
| 182 |
{ tcMaxSampleValue, "MaxSampleValue" }, |
| 183 |
{ tcXResolution, "XResolution" }, |
| 184 |
{ tcYResolution, "YResolution" }, |
| 185 |
{ tcPlanarConfiguration, "PlanarConfiguration" }, |
| 186 |
{ tcFreeOffsets, "FreeOffsets" }, |
| 187 |
{ tcFreeByteCounts, "FreeByteCounts" }, |
| 188 |
{ tcGrayResponseUnit, "GrayResponseUnit" }, |
| 189 |
{ tcGrayResponseCurve, "GrayResponseCurve" }, |
| 190 |
{ tcResolutionUnit, "ResolutionUnit" }, |
| 191 |
{ tcTransferFunction, "TransferFunction" }, |
| 192 |
{ tcSoftware, "Software" }, |
| 193 |
{ tcDateTime, "DateTime" }, |
| 194 |
{ tcArtist, "Artist" }, |
| 195 |
{ tcHostComputer, "HostComputer" }, |
| 196 |
{ tcWhitePoint, "WhitePoint" }, |
| 197 |
{ tcPrimaryChromaticities, "PrimaryChromaticities" }, |
| 198 |
{ tcColorMap, "ColorMap" }, |
| 199 |
{ tcTileWidth, "TileWidth" }, |
| 200 |
{ tcTileLength, "TileLength" }, |
| 201 |
{ tcTileOffsets, "TileOffsets" }, |
| 202 |
{ tcTileByteCounts, "TileByteCounts" }, |
| 203 |
{ tcSubIFDs, "SubIFDs" }, |
| 204 |
{ tcExtraSamples, "ExtraSamples" }, |
| 205 |
{ tcSampleFormat, "SampleFormat" }, |
| 206 |
{ tcJPEGTables, "JPEGTables" }, |
| 207 |
{ tcJPEGProc, "JPEGProc" }, |
| 208 |
{ tcJPEGInterchangeFormat, "JPEGInterchangeFormat" }, |
| 209 |
{ tcJPEGInterchangeFormatLength, "JPEGInterchangeFormatLength" }, |
| 210 |
{ tcYCbCrCoefficients, "YCbCrCoefficients" }, |
| 211 |
{ tcYCbCrSubSampling, "YCbCrSubSampling" }, |
| 212 |
{ tcYCbCrPositioning, "YCbCrPositioning" }, |
| 213 |
{ tcReferenceBlackWhite, "ReferenceBlackWhite" }, |
| 214 |
{ tcXMP, "XMP" }, |
| 215 |
{ tcKodakCameraSerialNumber, "KodakCameraSerialNumber" }, |
| 216 |
{ tcCFARepeatPatternDim, "CFARepeatPatternDim" }, |
| 217 |
{ tcCFAPattern, "CFAPattern" }, |
| 218 |
{ tcBatteryLevel, "BatteryLevel" }, |
| 219 |
{ tcKodakDCRPrivateIFD, "KodakDCRPrivateIFD" }, |
| 220 |
{ tcCopyright, "Copyright" }, |
| 221 |
{ tcExposureTime, "ExposureTime" }, |
| 222 |
{ tcFNumber, "FNumber" }, |
| 223 |
{ tcIPTC_NAA, "IPTC/NAA" }, |
| 224 |
{ tcLeafPKTS, "LeafPKTS" }, |
| 225 |
{ tcAdobeData, "AdobeData" }, |
| 226 |
{ tcExifIFD, "ExifIFD" }, |
| 227 |
{ tcICCProfile, "ICCProfile" }, |
| 228 |
{ tcExposureProgram, "ExposureProgram" }, |
| 229 |
{ tcSpectralSensitivity, "SpectralSensitivity" }, |
| 230 |
{ tcGPSInfo, "GPSInfo" }, |
| 231 |
{ tcISOSpeedRatings, "ISOSpeedRatings" }, |
| 232 |
{ tcOECF, "OECF" }, |
| 233 |
{ tcInterlace, "Interlace" }, |
| 234 |
{ tcTimeZoneOffset, "TimeZoneOffset" }, |
| 235 |
{ tcSelfTimerMode, "SelfTimerMode" }, |
| 236 |
{ tcSensitivityType, "SensitivityType" }, |
| 237 |
{ tcStandardOutputSensitivity, "StandardOutputSensitivity" }, |
| 238 |
{ tcRecommendedExposureIndex, "RecommendedExposureIndex" }, |
| 239 |
{ tcISOSpeed, "ISOSpeed" }, |
| 240 |
{ tcISOSpeedLatitudeyyy, "ISOSpeedLatitudeyyy" }, |
| 241 |
{ tcISOSpeedLatitudezzz, "ISOSpeedLatitudezzz" }, |
| 242 |
{ tcExifVersion, "ExifVersion" }, |
| 243 |
{ tcDateTimeOriginal, "DateTimeOriginal" }, |
| 244 |
{ tcDateTimeDigitized, "DateTimeDigitized" }, |
| 245 |
{ tcOffsetTime, "OffsetTime" }, |
| 246 |
{ tcOffsetTimeOriginal, "OffsetTimeOriginal" }, |
| 247 |
{ tcOffsetTimeDigitized, "OffsetTimeDigitized" }, |
| 248 |
{ tcComponentsConfiguration, "ComponentsConfiguration" }, |
| 249 |
{ tcCompressedBitsPerPixel, "CompressedBitsPerPixel" }, |
| 250 |
{ tcShutterSpeedValue, "ShutterSpeedValue" }, |
| 251 |
{ tcApertureValue, "ApertureValue" }, |
| 252 |
{ tcBrightnessValue, "BrightnessValue" }, |
| 253 |
{ tcExposureBiasValue, "ExposureBiasValue" }, |
| 254 |
{ tcMaxApertureValue, "MaxApertureValue" }, |
| 255 |
{ tcSubjectDistance, "SubjectDistance" }, |
| 256 |
{ tcMeteringMode, "MeteringMode" }, |
| 257 |
{ tcLightSource, "LightSource" }, |
| 258 |
{ tcFlash, "Flash" }, |
| 259 |
{ tcFocalLength, "FocalLength" }, |
| 260 |
{ tcFlashEnergy, "FlashEnergy" }, |
| 261 |
{ tcSpatialFrequencyResponse, "SpatialFrequencyResponse" }, |
| 262 |
{ tcNoise, "Noise" }, |
| 263 |
{ tcFocalPlaneXResolution, "FocalPlaneXResolution" }, |
| 264 |
{ tcFocalPlaneYResolution, "FocalPlaneYResolution" }, |
| 265 |
{ tcFocalPlaneResolutionUnit, "FocalPlaneResolutionUnit" }, |
| 266 |
{ tcImageNumber, "ImageNumber" }, |
| 267 |
{ tcSecurityClassification, "SecurityClassification" }, |
| 268 |
{ tcImageHistory, "ImageHistory" }, |
| 269 |
{ tcSubjectArea, "SubjectArea" }, |
| 270 |
{ tcExposureIndex, "ExposureIndex" }, |
| 271 |
{ tcTIFF_EP_StandardID, "TIFF/EPStandardID" }, |
| 272 |
{ tcSensingMethod, "SensingMethod" }, |
| 273 |
{ tcMakerNote, "MakerNote" }, |
| 274 |
{ tcUserComment, "UserComment" }, |
| 275 |
{ tcSubsecTime, "SubsecTime" }, |
| 276 |
{ tcSubsecTimeOriginal, "SubsecTimeOriginal" }, |
| 277 |
{ tcSubsecTimeDigitized, "SubsecTimeDigitized" }, |
| 278 |
{ tcAdobeLayerData, "AdobeLayerData" }, |
| 279 |
{ tcTemperature, "Temperature" }, |
| 280 |
{ tcHumidity, "Humidity" }, |
| 281 |
{ tcPressure, "Pressure" }, |
| 282 |
{ tcWaterDepth, "WaterDepth" }, |
| 283 |
{ tcAcceleration, "Acceleration" }, |
| 284 |
{ tcCameraElevationAngle, "CameraElevationAngle" }, |
| 285 |
{ tcFlashPixVersion, "FlashPixVersion" }, |
| 286 |
{ tcColorSpace, "ColorSpace" }, |
| 287 |
{ tcPixelXDimension, "PixelXDimension" }, |
| 288 |
{ tcPixelYDimension, "PixelYDimension" }, |
| 289 |
{ tcRelatedSoundFile, "RelatedSoundFile" }, |
| 290 |
{ tcInteroperabilityIFD, "InteroperabilityIFD" }, |
| 291 |
{ tcFlashEnergyExif, "FlashEnergyExif" }, |
| 292 |
{ tcSpatialFrequencyResponseExif, "SpatialFrequencyResponseExif" }, |
| 293 |
{ tcFocalPlaneXResolutionExif, "FocalPlaneXResolutionExif" }, |
| 294 |
{ tcFocalPlaneYResolutionExif, "FocalPlaneYResolutionExif" }, |
| 295 |
{ tcFocalPlaneResolutionUnitExif, "FocalPlaneResolutionUnitExif" }, |
| 296 |
{ tcSubjectLocation, "SubjectLocation" }, |
| 297 |
{ tcExposureIndexExif, "ExposureIndexExif" }, |
| 298 |
{ tcSensingMethodExif, "SensingMethodExif" }, |
| 299 |
{ tcFileSource, "FileSource" }, |
| 300 |
{ tcSceneType, "SceneType" }, |
| 301 |
{ tcCFAPatternExif, "CFAPatternExif" }, |
| 302 |
{ tcCustomRendered, "CustomRendered" }, |
| 303 |
{ tcExposureMode, "ExposureMode" }, |
| 304 |
{ tcWhiteBalance, "WhiteBalance" }, |
| 305 |
{ tcDigitalZoomRatio, "DigitalZoomRatio" }, |
| 306 |
{ tcFocalLengthIn35mmFilm, "FocalLengthIn35mmFilm" }, |
| 307 |
{ tcSceneCaptureType, "SceneCaptureType" }, |
| 308 |
{ tcGainControl, "GainControl" }, |
| 309 |
{ tcContrast, "Contrast" }, |
| 310 |
{ tcSaturation, "Saturation" }, |
| 311 |
{ tcSharpness, "Sharpness" }, |
| 312 |
{ tcDeviceSettingDescription, "DeviceSettingDescription" }, |
| 313 |
{ tcSubjectDistanceRange, "SubjectDistanceRange" }, |
| 314 |
{ tcImageUniqueID, "ImageUniqueID" }, |
| 315 |
{ tcCameraOwnerNameExif, "CameraOwnerNameExif" }, |
| 316 |
{ tcCameraSerialNumberExif, "CameraSerialNumberExif" }, |
| 317 |
{ tcLensSpecificationExif, "LensSpecificationExif" }, |
| 318 |
{ tcLensMakeExif, "LensMakeExif" }, |
| 319 |
{ tcLensModelExif, "LensModelExif" }, |
| 320 |
{ tcLensSerialNumberExif, "LensSerialNumberExif" }, |
| 321 |
{ tcGamma, "Gamma" }, |
| 322 |
{ tcPrintImageMatchingInfo, "PrintImageMatchingInfo" }, |
| 323 |
{ tcDNGVersion, "DNGVersion" }, |
| 324 |
{ tcDNGBackwardVersion, "DNGBackwardVersion" }, |
| 325 |
{ tcUniqueCameraModel, "UniqueCameraModel" }, |
| 326 |
{ tcLocalizedCameraModel, "LocalizedCameraModel" }, |
| 327 |
{ tcCFAPlaneColor, "CFAPlaneColor" }, |
| 328 |
{ tcCFALayout, "CFALayout" }, |
| 329 |
{ tcLinearizationTable, "LinearizationTable" }, |
| 330 |
{ tcBlackLevelRepeatDim, "BlackLevelRepeatDim" }, |
| 331 |
{ tcBlackLevel, "BlackLevel" }, |
| 332 |
{ tcBlackLevelDeltaH, "BlackLevelDeltaH" }, |
| 333 |
{ tcBlackLevelDeltaV, "BlackLevelDeltaV" }, |
| 334 |
{ tcWhiteLevel, "WhiteLevel" }, |
| 335 |
{ tcDefaultScale, "DefaultScale" }, |
| 336 |
{ tcDefaultCropOrigin, "DefaultCropOrigin" }, |
| 337 |
{ tcDefaultCropSize, "DefaultCropSize" }, |
| 338 |
{ tcDefaultUserCrop, "DefaultUserCrop" }, |
| 339 |
{ tcColorMatrix1, "ColorMatrix1" }, |
| 340 |
{ tcColorMatrix2, "ColorMatrix2" }, |
| 341 |
{ tcColorMatrix3, "ColorMatrix3" }, |
| 342 |
{ tcCameraCalibration1, "CameraCalibration1" }, |
| 343 |
{ tcCameraCalibration2, "CameraCalibration2" }, |
| 344 |
{ tcCameraCalibration3, "CameraCalibration3" }, |
| 345 |
{ tcReductionMatrix1, "ReductionMatrix1" }, |
| 346 |
{ tcReductionMatrix2, "ReductionMatrix2" }, |
| 347 |
{ tcReductionMatrix3, "ReductionMatrix3" }, |
| 348 |
{ tcAnalogBalance, "AnalogBalance" }, |
| 349 |
{ tcAsShotNeutral, "AsShotNeutral" }, |
| 350 |
{ tcAsShotWhiteXY, "AsShotWhiteXY" }, |
| 351 |
{ tcBaselineExposure, "BaselineExposure" }, |
| 352 |
{ tcBaselineNoise, "BaselineNoise" }, |
| 353 |
{ tcBaselineSharpness, "BaselineSharpness" }, |
| 354 |
{ tcBayerGreenSplit, "BayerGreenSplit" }, |
| 355 |
{ tcLinearResponseLimit, "LinearResponseLimit" }, |
| 356 |
{ tcCameraSerialNumber, "CameraSerialNumber" }, |
| 357 |
{ tcLensInfo, "LensInfo" }, |
| 358 |
{ tcChromaBlurRadius, "ChromaBlurRadius" }, |
| 359 |
{ tcAntiAliasStrength, "AntiAliasStrength" }, |
| 360 |
{ tcShadowScale, "ShadowScale" }, |
| 361 |
{ tcDNGPrivateData, "DNGPrivateData" }, |
| 362 |
{ tcMakerNoteSafety, "MakerNoteSafety" }, |
| 363 |
{ tcCalibrationIlluminant1, "CalibrationIlluminant1" }, |
| 364 |
{ tcCalibrationIlluminant2, "CalibrationIlluminant2" }, |
| 365 |
{ tcCalibrationIlluminant3, "CalibrationIlluminant3" }, |
| 366 |
{ tcIlluminantData1, "IlluminantData1" }, |
| 367 |
{ tcIlluminantData2, "IlluminantData2" }, |
| 368 |
{ tcIlluminantData3, "IlluminantData3" }, |
| 369 |
{ tcBestQualityScale, "BestQualityScale" }, |
| 370 |
{ tcRawDataUniqueID, "RawDataUniqueID" }, |
| 371 |
{ tcOriginalRawFileName, "OriginalRawFileName" }, |
| 372 |
{ tcOriginalRawFileData, "OriginalRawFileData" }, |
| 373 |
{ tcActiveArea, "ActiveArea" }, |
| 374 |
{ tcMaskedAreas, "MaskedAreas" }, |
| 375 |
{ tcAsShotICCProfile, "AsShotICCProfile" }, |
| 376 |
{ tcAsShotPreProfileMatrix, "AsShotPreProfileMatrix" }, |
| 377 |
{ tcCurrentICCProfile, "CurrentICCProfile" }, |
| 378 |
{ tcCurrentPreProfileMatrix, "CurrentPreProfileMatrix" }, |
| 379 |
{ tcColorimetricReference, "ColorimetricReference" }, |
| 380 |
{ tcCameraCalibrationSignature, "CameraCalibrationSignature" }, |
| 381 |
{ tcProfileCalibrationSignature, "ProfileCalibrationSignature" }, |
| 382 |
{ tcExtraCameraProfiles, "ExtraCameraProfiles" }, |
| 383 |
{ tcAsShotProfileName, "AsShotProfileName" }, |
| 384 |
{ tcNoiseReductionApplied, "NoiseReductionApplied" }, |
| 385 |
{ tcProfileName, "ProfileName" }, |
| 386 |
{ tcProfileHueSatMapDims, "ProfileHueSatMapDims" }, |
| 387 |
{ tcProfileHueSatMapData1, "ProfileHueSatMapData1" }, |
| 388 |
{ tcProfileHueSatMapData2, "ProfileHueSatMapData2" }, |
| 389 |
{ tcProfileHueSatMapData3, "ProfileHueSatMapData3" }, |
| 390 |
{ tcProfileHueSatMapEncoding, "ProfileHueSatMapEncoding" }, |
| 391 |
{ tcProfileToneCurve, "ProfileToneCurve" }, |
| 392 |
{ tcProfileToneMethod, "ProfileToneMethod" }, |
| 393 |
{ tcProfileEmbedPolicy, "ProfileEmbedPolicy" }, |
| 394 |
{ tcProfileCopyright, "ProfileCopyright" }, |
| 395 |
{ tcForwardMatrix1, "ForwardMatrix1" }, |
| 396 |
{ tcForwardMatrix2, "ForwardMatrix2" }, |
| 397 |
{ tcForwardMatrix3, "ForwardMatrix3" }, |
| 398 |
{ tcPreviewApplicationName, "PreviewApplicationName" }, |
| 399 |
{ tcPreviewApplicationVersion, "PreviewApplicationVersion" }, |
| 400 |
{ tcPreviewSettingsName, "PreviewSettingsName" }, |
| 401 |
{ tcPreviewSettingsDigest, "PreviewSettingsDigest" }, |
| 402 |
{ tcPreviewColorSpace, "PreviewColorSpace" }, |
| 403 |
{ tcPreviewDateTime, "PreviewDateTime" }, |
| 404 |
{ tcRawImageDigest, "RawImageDigest" }, |
| 405 |
{ tcOriginalRawFileDigest, "OriginalRawFileDigest" }, |
| 406 |
{ tcSubTileBlockSize, "SubTileBlockSize" }, |
| 407 |
{ tcRowInterleaveFactor, "RowInterleaveFactor" }, |
| 408 |
{ tcColumnInterleaveFactor, "ColumnInterleaveFactor" }, |
| 409 |
{ tcProfileLookTableDims, "ProfileLookTableDims" }, |
| 410 |
{ tcProfileLookTableData, "ProfileLookTableData" }, |
| 411 |
{ tcProfileLookTableEncoding, "ProfileLookTableEncoding" }, |
| 412 |
{ tcBaselineExposureOffset, "BaselineExposureOffset" }, |
| 413 |
{ tcDefaultBlackRender, "DefaultBlackRender" }, |
| 414 |
{ tcOpcodeList1, "OpcodeList1" }, |
| 415 |
{ tcOpcodeList2, "OpcodeList2" }, |
| 416 |
{ tcOpcodeList3, "OpcodeList3" }, |
| 417 |
{ tcNoiseProfile, "NoiseProfile" }, |
| 418 |
{ tcOriginalDefaultFinalSize, "OriginalDefaultFinalSize" }, |
| 419 |
{ tcOriginalBestQualityFinalSize, "OriginalBestQualityFinalSize" }, |
| 420 |
{ tcOriginalDefaultCropSize, "OriginalDefaultCropSize" }, |
| 421 |
{ tcProfileHueSatMapEncoding, "ProfileHueSatMapEncoding" }, |
| 422 |
{ tcProfileLookTableEncoding, "ProfileLookTableEncoding" }, |
| 423 |
{ tcBaselineExposureOffset, "BaselineExposureOffset" }, |
| 424 |
{ tcDefaultBlackRender, "DefaultBlackRender" }, |
| 425 |
{ tcNewRawImageDigest, "NewRawImageDigest" }, |
| 426 |
{ tcRawToPreviewGain, "RawToPreviewGain" }, |
| 427 |
{ tcCacheBlob, "CacheBlob" }, |
| 428 |
{ tcCacheVersion, "CacheVersion" }, |
| 429 |
{ tcDefaultUserCrop, "DefaultUserCrop" }, |
| 430 |
{ tcDepthFormat, "DepthFormat" }, |
| 431 |
{ tcDepthNear, "DepthNear" }, |
| 432 |
{ tcDepthFar, "DepthFar" }, |
| 433 |
{ tcDepthUnits, "DepthUnits" }, |
| 434 |
{ tcDepthMeasureType, "DepthMeasureType" }, |
| 435 |
{ tcEnhanceParams, "EnhanceParams" }, |
| 436 |
{ tcProfileGainTableMap, "ProfileGainTableMap" }, |
| 437 |
{ tcProfileGainTableMap2, "ProfileGainTableMap2" }, |
| 438 |
{ tcRGBTablesDraft, "RGBTablesDraft" }, |
| 439 |
{ tcRGBTables, "RGBTables" }, |
| 440 |
{ tcBigTableDigests, "BigTableDigests" }, |
| 441 |
{ tcBigTableOffsets, "BigTableOffsets" }, |
| 442 |
{ tcBigTableByteCounts, "BigTableByteCounts" }, |
| 443 |
{ tcMaskSubArea, "MaskSubArea" }, |
| 444 |
{ tcImageSequenceInfo, "ImageSequenceInfo" }, |
| 445 |
{ tcImageStats, "ImageStats" }, |
| 446 |
{ tcProfileDynamicRange, "ProfileDynamiceRange" }, |
| 447 |
{ tcProfileGroupName, "ProfileGroupName" }, |
| 448 |
{ tcJXLDistance, "JXLDistance" }, |
| 449 |
{ tcJXLEffort, "JXLEffort" }, |
| 450 |
{ tcJXLDecodeSpeed, "JXLDecodeSpeed" }, |
| 451 |
{ tcBigTableGroupIndex, "BigTableGroupIndex" }, |
| 452 |
{ tcKodakKDCPrivateIFD, "KodakKDCPrivateIFD" } |
| 453 |
}; |
| 454 |
|
| 455 |
const dng_name_table kGPSTagNames [] = |
| 456 |
{ |
| 457 |
{ tcGPSVersionID, "GPSVersionID" }, |
| 458 |
{ tcGPSLatitudeRef, "GPSLatitudeRef" }, |
| 459 |
{ tcGPSLatitude, "GPSLatitude" }, |
| 460 |
{ tcGPSLongitudeRef, "GPSLongitudeRef" }, |
| 461 |
{ tcGPSLongitude, "GPSLongitude" }, |
| 462 |
{ tcGPSAltitudeRef, "GPSAltitudeRef" }, |
| 463 |
{ tcGPSAltitude, "GPSAltitude" }, |
| 464 |
{ tcGPSTimeStamp, "GPSTimeStamp" }, |
| 465 |
{ tcGPSSatellites, "GPSSatellites" }, |
| 466 |
{ tcGPSStatus, "GPSStatus" }, |
| 467 |
{ tcGPSMeasureMode, "GPSMeasureMode" }, |
| 468 |
{ tcGPSDOP, "GPSDOP" }, |
| 469 |
{ tcGPSSpeedRef, "GPSSpeedRef" }, |
| 470 |
{ tcGPSSpeed, "GPSSpeed" }, |
| 471 |
{ tcGPSTrackRef, "GPSTrackRef" }, |
| 472 |
{ tcGPSTrack, "GPSTrack" }, |
| 473 |
{ tcGPSImgDirectionRef, "GPSImgDirectionRef" }, |
| 474 |
{ tcGPSImgDirection, "GPSImgDirection" }, |
| 475 |
{ tcGPSMapDatum, "GPSMapDatum" }, |
| 476 |
{ tcGPSDestLatitudeRef, "GPSDestLatitudeRef" }, |
| 477 |
{ tcGPSDestLatitude, "GPSDestLatitude" }, |
| 478 |
{ tcGPSDestLongitudeRef, "GPSDestLongitudeRef" }, |
| 479 |
{ tcGPSDestLongitude, "GPSDestLongitude" }, |
| 480 |
{ tcGPSDestBearingRef, "GPSDestBearingRef" }, |
| 481 |
{ tcGPSDestBearing, "GPSDestBearing" }, |
| 482 |
{ tcGPSDestDistanceRef, "GPSDestDistanceRef" }, |
| 483 |
{ tcGPSDestDistance, "GPSDestDistance" }, |
| 484 |
{ tcGPSProcessingMethod, "GPSProcessingMethod" }, |
| 485 |
{ tcGPSAreaInformation, "GPSAreaInformation" }, |
| 486 |
{ tcGPSDateStamp, "GPSDateStamp" }, |
| 487 |
{ tcGPSDifferential, "GPSDifferential" }, |
| 488 |
{ tcGPSHPositioningError, "GPSHPositioningError" }, |
| 489 |
}; |
| 490 |
|
| 491 |
const dng_name_table kInteroperabilityTagNames [] = |
| 492 |
{ |
| 493 |
{ tcInteroperabilityIndex, "InteroperabilityIndex" }, |
| 494 |
{ tcInteroperabilityVersion, "InteroperabilityVersion" }, |
| 495 |
{ tcRelatedImageFileFormat, "RelatedImageFileFormat" }, |
| 496 |
{ tcRelatedImageWidth, "RelatedImageWidth" }, |
| 497 |
{ tcRelatedImageLength, "RelatedImageLength" } |
| 498 |
}; |
| 499 |
|
| 500 |
const dng_name_table kFujiTagNames [] = |
| 501 |
{ |
| 502 |
{ tcFujiHeader, "FujiHeader" }, |
| 503 |
{ tcFujiRawInfo1, "FujiRawInfo1" }, |
| 504 |
{ tcFujiRawInfo2, "FujiRawInfo2" } |
| 505 |
}; |
| 506 |
|
| 507 |
const dng_name_table kContaxTagNames [] = |
| 508 |
{ |
| 509 |
{ tcContaxHeader, "ContaxHeader" } |
| 510 |
}; |
| 511 |
|
| 512 |
const char *name = NULL; |
| 513 |
|
| 514 |
if (parentCode == 0 || |
| 515 |
parentCode == tcExifIFD || |
| 516 |
parentCode == tcLeafMOS || |
| 517 |
(parentCode >= tcFirstSubIFD && parentCode <= tcLastSubIFD) || |
| 518 |
(parentCode >= tcFirstChainedIFD && parentCode <= tcLastChainedIFD)) |
| 519 |
{ |
| 520 |
|
| 521 |
name = LookupName (tagCode, |
| 522 |
kTagNames, |
| 523 |
sizeof (kTagNames ) / |
| 524 |
sizeof (kTagNames [0])); |
| 525 |
|
| 526 |
} |
| 527 |
|
| 528 |
else if (parentCode == tcGPSInfo) |
| 529 |
{ |
| 530 |
|
| 531 |
name = LookupName (tagCode, |
| 532 |
kGPSTagNames, |
| 533 |
sizeof (kGPSTagNames ) / |
| 534 |
sizeof (kGPSTagNames [0])); |
| 535 |
|
| 536 |
} |
| 537 |
|
| 538 |
else if (parentCode == tcInteroperabilityIFD) |
| 539 |
{ |
| 540 |
|
| 541 |
name = LookupName (tagCode, |
| 542 |
kInteroperabilityTagNames, |
| 543 |
sizeof (kInteroperabilityTagNames ) / |
| 544 |
sizeof (kInteroperabilityTagNames [0])); |
| 545 |
|
| 546 |
} |
| 547 |
|
| 548 |
else if (parentCode == tcFujiRAF) |
| 549 |
{ |
| 550 |
|
| 551 |
name = LookupName (tagCode, |
| 552 |
kFujiTagNames, |
| 553 |
sizeof (kFujiTagNames ) / |
| 554 |
sizeof (kFujiTagNames [0])); |
| 555 |
|
| 556 |
} |
| 557 |
|
| 558 |
else if (parentCode == tcContaxRAW) |
| 559 |
{ |
| 560 |
|
| 561 |
name = LookupName (tagCode, |
| 562 |
kContaxTagNames, |
| 563 |
sizeof (kContaxTagNames ) / |
| 564 |
sizeof (kContaxTagNames [0])); |
| 565 |
|
| 566 |
} |
| 567 |
|
| 568 |
if (name) |
| 569 |
{ |
| 570 |
return name; |
| 571 |
} |
| 572 |
|
| 573 |
static char s [32]; |
| 574 |
|
| 575 |
if (parentCode == tcCanonCRW) |
| 576 |
{ |
| 577 |
snprintf (s, 32, "CRW_%04X", (unsigned) tagCode); |
| 578 |
} |
| 579 |
|
| 580 |
else if (parentCode == tcMinoltaMRW) |
| 581 |
{ |
| 582 |
|
| 583 |
char c1 = (char) ((tagCode >> 24) & 0xFF); |
| 584 |
char c2 = (char) ((tagCode >> 16) & 0xFF); |
| 585 |
char c3 = (char) ((tagCode >> 8) & 0xFF); |
| 586 |
char c4 = (char) ((tagCode ) & 0xFF); |
| 587 |
|
| 588 |
if (c1 < ' ') c1 = '_'; |
| 589 |
if (c2 < ' ') c2 = '_'; |
| 590 |
if (c3 < ' ') c3 = '_'; |
| 591 |
if (c4 < ' ') c4 = '_'; |
| 592 |
|
| 593 |
snprintf (s, 32, "MRW%c%c%c%c", c1, c2, c3, c4); |
| 594 |
|
| 595 |
} |
| 596 |
|
| 597 |
else if (parentCode == tcFujiRawInfo1) |
| 598 |
{ |
| 599 |
snprintf (s, 32, "RAF1_%04X", (unsigned) tagCode); |
| 600 |
} |
| 601 |
|
| 602 |
else if (parentCode == tcFujiRawInfo2) |
| 603 |
{ |
| 604 |
snprintf (s, 32, "RAF2_%04X", (unsigned) tagCode); |
| 605 |
} |
| 606 |
|
| 607 |
else |
| 608 |
{ |
| 609 |
snprintf (s, 32, "Tag%u", (unsigned) tagCode); |
| 610 |
} |
| 611 |
|
| 612 |
return s; |
| 613 |
|
| 614 |
} |
| 615 |
|
| 616 |
/*****************************************************************************/ |
| 617 |
|
| 618 |
const char * LookupTagType (uint32 tagType) |
| 619 |
{ |
| 620 |
|
| 621 |
const dng_name_table kTagTypeNames [] = |
| 622 |
{ |
| 623 |
{ ttByte, "Byte" }, |
| 624 |
{ ttAscii, "ASCII" }, |
| 625 |
{ ttShort, "Short" }, |
| 626 |
{ ttLong, "Long" }, |
| 627 |
{ ttRational, "Rational" }, |
| 628 |
{ ttSByte, "SByte" }, |
| 629 |
{ ttUndefined, "Undefined" }, |
| 630 |
{ ttSShort, "SShort" }, |
| 631 |
{ ttSLong, "SLong" }, |
| 632 |
{ ttSRational, "SRational" }, |
| 633 |
{ ttFloat, "Float" }, |
| 634 |
{ ttDouble, "Double" }, |
| 635 |
{ ttIFD, "IFD" }, |
| 636 |
{ ttUnicode, "Unicode" }, |
| 637 |
{ ttComplex, "Complex" }, |
| 638 |
{ ttLong8, "Long8" }, |
| 639 |
{ ttSLong8, "SLong8" }, |
| 640 |
{ ttIFD8, "IFD8" } |
| 641 |
}; |
| 642 |
|
| 643 |
const char *name = LookupName (tagType, |
| 644 |
kTagTypeNames, |
| 645 |
sizeof (kTagTypeNames ) / |
| 646 |
sizeof (kTagTypeNames [0])); |
| 647 |
|
| 648 |
if (name) |
| 649 |
{ |
| 650 |
return name; |
| 651 |
} |
| 652 |
|
| 653 |
static char s [32]; |
| 654 |
|
| 655 |
snprintf (s, 32, "Type%u", (unsigned) tagType); |
| 656 |
|
| 657 |
return s; |
| 658 |
|
| 659 |
} |
| 660 |
|
| 661 |
/*****************************************************************************/ |
| 662 |
|
| 663 |
const char * LookupNewSubFileType (uint32 key) |
| 664 |
{ |
| 665 |
|
| 666 |
const dng_name_table kNewSubFileTypeNames [] = |
| 667 |
{ |
| 668 |
{ sfMainImage , "Main Image" }, |
| 669 |
{ sfPreviewImage , "Preview Image" }, |
| 670 |
{ sfTransparencyMask , "Transparency Mask" }, |
| 671 |
{ sfPreviewMask , "Preview Mask" }, |
| 672 |
{ sfDepthMap , "Depth Map" }, |
| 673 |
{ sfPreviewDepthMap , "Preview Depth Map" }, |
| 674 |
{ sfEnhancedImage , "Enhanced Image" }, |
| 675 |
{ sfAltPreviewImage , "Alt Preview Image" }, |
| 676 |
{ sfSemanticMask , "Semantic Mask" }, |
| 677 |
{ sfGainMap , "Gain Map" } |
| 678 |
}; |
| 679 |
|
| 680 |
const char *name = LookupName (key, |
| 681 |
kNewSubFileTypeNames, |
| 682 |
sizeof (kNewSubFileTypeNames ) / |
| 683 |
sizeof (kNewSubFileTypeNames [0])); |
| 684 |
|
| 685 |
if (name) |
| 686 |
{ |
| 687 |
return name; |
| 688 |
} |
| 689 |
|
| 690 |
static char s [32]; |
| 691 |
|
| 692 |
snprintf (s, 32, "%u", (unsigned) key); |
| 693 |
|
| 694 |
return s; |
| 695 |
|
| 696 |
} |
| 697 |
|
| 698 |
/*****************************************************************************/ |
| 699 |
|
| 700 |
const char * LookupCompression (uint32 key) |
| 701 |
{ |
| 702 |
|
| 703 |
const dng_name_table kCompressionNames [] = |
| 704 |
{ |
| 705 |
{ ccUncompressed, "Uncompressed" }, |
| 706 |
{ ccLZW, "LZW" }, |
| 707 |
{ ccOldJPEG, "Old JPEG" }, |
| 708 |
{ ccJPEG, "JPEG" }, |
| 709 |
{ ccDeflate, "Deflate" }, |
| 710 |
{ ccPackBits, "PackBits" }, |
| 711 |
{ ccOldDeflate, "OldDeflate" }, |
| 712 |
{ ccLossyJPEG, "Lossy JPEG" }, |
| 713 |
{ ccJXL, "JXL" } |
| 714 |
}; |
| 715 |
|
| 716 |
const char *name = LookupName (key, |
| 717 |
kCompressionNames, |
| 718 |
sizeof (kCompressionNames ) / |
| 719 |
sizeof (kCompressionNames [0])); |
| 720 |
|
| 721 |
if (name) |
| 722 |
{ |
| 723 |
return name; |
| 724 |
} |
| 725 |
|
| 726 |
static char s [32]; |
| 727 |
|
| 728 |
snprintf (s, 32, "%u", (unsigned) key); |
| 729 |
|
| 730 |
return s; |
| 731 |
|
| 732 |
} |
| 733 |
|
| 734 |
/*****************************************************************************/ |
| 735 |
|
| 736 |
const char * LookupPredictor (uint32 key) |
| 737 |
{ |
| 738 |
|
| 739 |
const dng_name_table kPredictorNames [] = |
| 740 |
{ |
| 741 |
{ cpNullPredictor, "NullPredictor" }, |
| 742 |
{ cpHorizontalDifference, "HorizontalDifference" }, |
| 743 |
{ cpFloatingPoint, "FloatingPoint" }, |
| 744 |
{ cpHorizontalDifferenceX2, "HorizontalDifferenceX2" }, |
| 745 |
{ cpHorizontalDifferenceX4, "HorizontalDifferenceX4" }, |
| 746 |
{ cpFloatingPointX2, "FloatingPointX2" }, |
| 747 |
{ cpFloatingPointX4, "FloatingPointX4" } |
| 748 |
}; |
| 749 |
|
| 750 |
const char *name = LookupName (key, |
| 751 |
kPredictorNames, |
| 752 |
sizeof (kPredictorNames ) / |
| 753 |
sizeof (kPredictorNames [0])); |
| 754 |
|
| 755 |
if (name) |
| 756 |
{ |
| 757 |
return name; |
| 758 |
} |
| 759 |
|
| 760 |
static char s [32]; |
| 761 |
|
| 762 |
snprintf (s, 32, "%u", (unsigned) key); |
| 763 |
|
| 764 |
return s; |
| 765 |
|
| 766 |
} |
| 767 |
|
| 768 |
/*****************************************************************************/ |
| 769 |
|
| 770 |
const char * LookupSampleFormat (uint32 key) |
| 771 |
{ |
| 772 |
|
| 773 |
const dng_name_table kSampleFormatNames [] = |
| 774 |
{ |
| 775 |
{ sfUnsignedInteger, "UnsignedInteger" }, |
| 776 |
{ sfSignedInteger, "SignedInteger" }, |
| 777 |
{ sfFloatingPoint, "FloatingPoint" }, |
| 778 |
{ sfUndefined, "Undefined" } |
| 779 |
}; |
| 780 |
|
| 781 |
const char *name = LookupName (key, |
| 782 |
kSampleFormatNames, |
| 783 |
sizeof (kSampleFormatNames ) / |
| 784 |
sizeof (kSampleFormatNames [0])); |
| 785 |
|
| 786 |
if (name) |
| 787 |
{ |
| 788 |
return name; |
| 789 |
} |
| 790 |
|
| 791 |
static char s [32]; |
| 792 |
|
| 793 |
snprintf (s, 32, "%u", (unsigned) key); |
| 794 |
|
| 795 |
return s; |
| 796 |
|
| 797 |
} |
| 798 |
|
| 799 |
/*****************************************************************************/ |
| 800 |
|
| 801 |
const char * LookupPhotometricInterpretation (uint32 key) |
| 802 |
{ |
| 803 |
|
| 804 |
const dng_name_table kPhotometricInterpretationNames [] = |
| 805 |
{ |
| 806 |
{ piWhiteIsZero, "WhiteIsZero" }, |
| 807 |
{ piBlackIsZero, "BlackIsZero" }, |
| 808 |
{ piRGB, "RGB" }, |
| 809 |
{ piRGBPalette, "RGBPalette" }, |
| 810 |
{ piTransparencyMask, "TransparencyMask" }, |
| 811 |
{ piDepth, "Depth" }, |
| 812 |
{ piPhotometricMask, "PhotometricMask" }, |
| 813 |
{ piGainMap, "GainMap" }, |
| 814 |
{ piCMYK, "CMYK" }, |
| 815 |
{ piYCbCr, "YCbCr" }, |
| 816 |
{ piCIELab, "CIELab" }, |
| 817 |
{ piICCLab, "ICCLab" }, |
| 818 |
{ piCFA, "CFA" }, |
| 819 |
{ piLinearRaw, "LinearRaw" } |
| 820 |
}; |
| 821 |
|
| 822 |
const char *name = LookupName (key, |
| 823 |
kPhotometricInterpretationNames, |
| 824 |
sizeof (kPhotometricInterpretationNames ) / |
| 825 |
sizeof (kPhotometricInterpretationNames [0])); |
| 826 |
|
| 827 |
if (name) |
| 828 |
{ |
| 829 |
return name; |
| 830 |
} |
| 831 |
|
| 832 |
static char s [32]; |
| 833 |
|
| 834 |
snprintf (s, 32, "%u", (unsigned) key); |
| 835 |
|
| 836 |
return s; |
| 837 |
|
| 838 |
} |
| 839 |
|
| 840 |
/*****************************************************************************/ |
| 841 |
|
| 842 |
const char * LookupOrientation (uint32 key) |
| 843 |
{ |
| 844 |
|
| 845 |
const dng_name_table kOrientationNames [] = |
| 846 |
{ |
| 847 |
{ 1, "1 - 0th row is top, 0th column is left" }, |
| 848 |
{ 2, "2 - 0th row is top, 0th column is right" }, |
| 849 |
{ 3, "3 - 0th row is bottom, 0th column is right" }, |
| 850 |
{ 4, "4 - 0th row is bottom, 0th column is left" }, |
| 851 |
{ 5, "5 - 0th row is left, 0th column is top" }, |
| 852 |
{ 6, "6 - 0th row is right, 0th column is top" }, |
| 853 |
{ 7, "7 - 0th row is right, 0th column is bottom" }, |
| 854 |
{ 8, "8 - 0th row is left, 0th column is bottom" }, |
| 855 |
{ 9, "9 - unknown" } |
| 856 |
}; |
| 857 |
|
| 858 |
const char *name = LookupName (key, |
| 859 |
kOrientationNames, |
| 860 |
sizeof (kOrientationNames ) / |
| 861 |
sizeof (kOrientationNames [0])); |
| 862 |
|
| 863 |
if (name) |
| 864 |
{ |
| 865 |
return name; |
| 866 |
} |
| 867 |
|
| 868 |
static char s [32]; |
| 869 |
|
| 870 |
snprintf (s, 32, "%u", (unsigned) key); |
| 871 |
|
| 872 |
return s; |
| 873 |
|
| 874 |
} |
| 875 |
|
| 876 |
/*****************************************************************************/ |
| 877 |
|
| 878 |
const char * LookupResolutionUnit (uint32 key) |
| 879 |
{ |
| 880 |
|
| 881 |
const dng_name_table kResolutionUnitNames [] = |
| 882 |
{ |
| 883 |
{ ruNone, "None" }, |
| 884 |
{ ruInch, "Inch" }, |
| 885 |
{ ruCM, "cm" }, |
| 886 |
{ ruMM, "mm" }, |
| 887 |
{ ruMicroM, "Micrometer" } |
| 888 |
}; |
| 889 |
|
| 890 |
const char *name = LookupName (key, |
| 891 |
kResolutionUnitNames, |
| 892 |
sizeof (kResolutionUnitNames ) / |
| 893 |
sizeof (kResolutionUnitNames [0])); |
| 894 |
|
| 895 |
if (name) |
| 896 |
{ |
| 897 |
return name; |
| 898 |
} |
| 899 |
|
| 900 |
static char s [32]; |
| 901 |
|
| 902 |
snprintf (s, 32, "%u", (unsigned) key); |
| 903 |
|
| 904 |
return s; |
| 905 |
|
| 906 |
} |
| 907 |
|
| 908 |
/*****************************************************************************/ |
| 909 |
|
| 910 |
const char * LookupCFAColor (uint32 key) |
| 911 |
{ |
| 912 |
|
| 913 |
const dng_name_table kCFAColorNames [] = |
| 914 |
{ |
| 915 |
{ 0, "Red" }, |
| 916 |
{ 1, "Green" }, |
| 917 |
{ 2, "Blue" }, |
| 918 |
{ 3, "Cyan" }, |
| 919 |
{ 4, "Magenta" }, |
| 920 |
{ 5, "Yellow" }, |
| 921 |
{ 6, "White" } |
| 922 |
}; |
| 923 |
|
| 924 |
const char *name = LookupName (key, |
| 925 |
kCFAColorNames, |
| 926 |
sizeof (kCFAColorNames ) / |
| 927 |
sizeof (kCFAColorNames [0])); |
| 928 |
|
| 929 |
if (name) |
| 930 |
{ |
| 931 |
return name; |
| 932 |
} |
| 933 |
|
| 934 |
static char s [32]; |
| 935 |
|
| 936 |
snprintf (s, 32, "Color%u", (unsigned) key); |
| 937 |
|
| 938 |
return s; |
| 939 |
|
| 940 |
} |
| 941 |
|
| 942 |
/*****************************************************************************/ |
| 943 |
|
| 944 |
const char * LookupSensingMethod (uint32 key) |
| 945 |
{ |
| 946 |
|
| 947 |
const dng_name_table kSensingMethodNames [] = |
| 948 |
{ |
| 949 |
{ 0, "Undefined" }, |
| 950 |
{ 1, "MonochromeArea" }, |
| 951 |
{ 2, "OneChipColorArea" }, |
| 952 |
{ 3, "TwoChipColorArea" }, |
| 953 |
{ 4, "ThreeChipColorArea" }, |
| 954 |
{ 5, "ColorSequentialArea" }, |
| 955 |
{ 6, "MonochromeLinear" }, |
| 956 |
{ 7, "TriLinear" }, |
| 957 |
{ 8, "ColorSequentialLinear" } |
| 958 |
}; |
| 959 |
|
| 960 |
const char *name = LookupName (key, |
| 961 |
kSensingMethodNames, |
| 962 |
sizeof (kSensingMethodNames ) / |
| 963 |
sizeof (kSensingMethodNames [0])); |
| 964 |
|
| 965 |
if (name) |
| 966 |
{ |
| 967 |
return name; |
| 968 |
} |
| 969 |
|
| 970 |
static char s [32]; |
| 971 |
|
| 972 |
snprintf (s, 32, "%u", (unsigned) key); |
| 973 |
|
| 974 |
return s; |
| 975 |
|
| 976 |
} |
| 977 |
|
| 978 |
/*****************************************************************************/ |
| 979 |
|
| 980 |
const char * LookupExposureProgram (uint32 key) |
| 981 |
{ |
| 982 |
|
| 983 |
const dng_name_table kExposureProgramNames [] = |
| 984 |
{ |
| 985 |
{ epUnidentified, "Unidentified" }, |
| 986 |
{ epManual, "Manual" }, |
| 987 |
{ epProgramNormal, "Program Normal" }, |
| 988 |
{ epAperturePriority, "Aperture Priority" }, |
| 989 |
{ epShutterPriority, "Shutter Priority" }, |
| 990 |
{ epProgramCreative, "Program Creative" }, |
| 991 |
{ epProgramAction, "Program Action" }, |
| 992 |
{ epPortraitMode, "Portrait Mode" }, |
| 993 |
{ epLandscapeMode, "Landscape Mode" } |
| 994 |
}; |
| 995 |
|
| 996 |
const char *name = LookupName (key, |
| 997 |
kExposureProgramNames, |
| 998 |
sizeof (kExposureProgramNames ) / |
| 999 |
sizeof (kExposureProgramNames [0])); |
| 1000 |
|
| 1001 |
if (name) |
| 1002 |
{ |
| 1003 |
return name; |
| 1004 |
} |
| 1005 |
|
| 1006 |
static char s [32]; |
| 1007 |
|
| 1008 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1009 |
|
| 1010 |
return s; |
| 1011 |
|
| 1012 |
} |
| 1013 |
|
| 1014 |
/*****************************************************************************/ |
| 1015 |
|
| 1016 |
const char * LookupMeteringMode (uint32 key) |
| 1017 |
{ |
| 1018 |
|
| 1019 |
const dng_name_table kMeteringModeNames [] = |
| 1020 |
{ |
| 1021 |
{ mmUnidentified, "Unknown" }, |
| 1022 |
{ mmAverage, "Average" }, |
| 1023 |
{ mmCenterWeightedAverage, "CenterWeightedAverage" }, |
| 1024 |
{ mmSpot, "Spot" }, |
| 1025 |
{ mmMultiSpot, "MultiSpot" }, |
| 1026 |
{ mmPattern, "Pattern" }, |
| 1027 |
{ mmPartial, "Partial" }, |
| 1028 |
{ mmOther, "Other" } |
| 1029 |
}; |
| 1030 |
|
| 1031 |
const char *name = LookupName (key, |
| 1032 |
kMeteringModeNames, |
| 1033 |
sizeof (kMeteringModeNames ) / |
| 1034 |
sizeof (kMeteringModeNames [0])); |
| 1035 |
|
| 1036 |
if (name) |
| 1037 |
{ |
| 1038 |
return name; |
| 1039 |
} |
| 1040 |
|
| 1041 |
static char s [32]; |
| 1042 |
|
| 1043 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1044 |
|
| 1045 |
return s; |
| 1046 |
|
| 1047 |
} |
| 1048 |
|
| 1049 |
/*****************************************************************************/ |
| 1050 |
|
| 1051 |
const char * LookupLightSource (uint32 key) |
| 1052 |
{ |
| 1053 |
|
| 1054 |
const dng_name_table kLightSourceNames [] = |
| 1055 |
{ |
| 1056 |
{ lsUnknown, "Unknown" }, |
| 1057 |
{ lsDaylight, "Daylight" }, |
| 1058 |
{ lsFluorescent, "Fluorescent" }, |
| 1059 |
{ lsTungsten, "Tungsten (incandescent light)" }, |
| 1060 |
{ lsFlash, "Flash" }, |
| 1061 |
{ lsFineWeather, "Fine weather" }, |
| 1062 |
{ lsCloudyWeather, "Cloudy weather" }, |
| 1063 |
{ lsShade, "Shade" }, |
| 1064 |
{ lsDaylightFluorescent, "Daylight fluorescent (D 5700 - 7100K)" }, |
| 1065 |
{ lsDayWhiteFluorescent, "Day white fluorescent (N 4600 - 5500K)" }, |
| 1066 |
{ lsCoolWhiteFluorescent, "Cool white fluorescent (W 3800 - 4500K)" }, |
| 1067 |
{ lsWhiteFluorescent, "White fluorescent (WW 3250 - 3800K)" }, |
| 1068 |
{ lsWarmWhiteFluorescent, "Warm white fluorescent (L 2600 - 3250K)" }, |
| 1069 |
{ lsStandardLightA, "Standard light A" }, |
| 1070 |
{ lsStandardLightB, "Standard light B" }, |
| 1071 |
{ lsStandardLightC, "Standard light C" }, |
| 1072 |
{ lsD55, "D55" }, |
| 1073 |
{ lsD65, "D65" }, |
| 1074 |
{ lsD75, "D75" }, |
| 1075 |
{ lsD50, "D50" }, |
| 1076 |
{ lsISOStudioTungsten, "ISO studio tungsten" }, |
| 1077 |
{ lsOther, "Other" } |
| 1078 |
}; |
| 1079 |
|
| 1080 |
const char *name = LookupName (key, |
| 1081 |
kLightSourceNames, |
| 1082 |
sizeof (kLightSourceNames ) / |
| 1083 |
sizeof (kLightSourceNames [0])); |
| 1084 |
|
| 1085 |
if (name) |
| 1086 |
{ |
| 1087 |
return name; |
| 1088 |
} |
| 1089 |
|
| 1090 |
static char s [32]; |
| 1091 |
|
| 1092 |
if (key & 0x08000) |
| 1093 |
{ |
| 1094 |
|
| 1095 |
snprintf (s, 32, "%uK", (unsigned) (key & 0x7FFF)); |
| 1096 |
|
| 1097 |
} |
| 1098 |
|
| 1099 |
else |
| 1100 |
{ |
| 1101 |
|
| 1102 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1103 |
|
| 1104 |
} |
| 1105 |
|
| 1106 |
return s; |
| 1107 |
|
| 1108 |
} |
| 1109 |
|
| 1110 |
/*****************************************************************************/ |
| 1111 |
|
| 1112 |
const char * LookupColorSpace (uint32 key) |
| 1113 |
{ |
| 1114 |
|
| 1115 |
const dng_name_table kColorSpaceNames [] = |
| 1116 |
{ |
| 1117 |
{ 1, "sRGB" }, |
| 1118 |
{ 0xFFFF, "Uncalibrated" } |
| 1119 |
}; |
| 1120 |
|
| 1121 |
const char *name = LookupName (key, |
| 1122 |
kColorSpaceNames, |
| 1123 |
sizeof (kColorSpaceNames ) / |
| 1124 |
sizeof (kColorSpaceNames [0])); |
| 1125 |
|
| 1126 |
if (name) |
| 1127 |
{ |
| 1128 |
return name; |
| 1129 |
} |
| 1130 |
|
| 1131 |
static char s [32]; |
| 1132 |
|
| 1133 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1134 |
|
| 1135 |
return s; |
| 1136 |
|
| 1137 |
} |
| 1138 |
|
| 1139 |
/*****************************************************************************/ |
| 1140 |
|
| 1141 |
const char * LookupFileSource (uint32 key) |
| 1142 |
{ |
| 1143 |
|
| 1144 |
const dng_name_table kFileSourceNames [] = |
| 1145 |
{ |
| 1146 |
{ 3, "DSC" } |
| 1147 |
}; |
| 1148 |
|
| 1149 |
const char *name = LookupName (key, |
| 1150 |
kFileSourceNames, |
| 1151 |
sizeof (kFileSourceNames ) / |
| 1152 |
sizeof (kFileSourceNames [0])); |
| 1153 |
|
| 1154 |
if (name) |
| 1155 |
{ |
| 1156 |
return name; |
| 1157 |
} |
| 1158 |
|
| 1159 |
static char s [32]; |
| 1160 |
|
| 1161 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1162 |
|
| 1163 |
return s; |
| 1164 |
|
| 1165 |
} |
| 1166 |
|
| 1167 |
/*****************************************************************************/ |
| 1168 |
|
| 1169 |
const char * LookupSceneType (uint32 key) |
| 1170 |
{ |
| 1171 |
|
| 1172 |
const dng_name_table kSceneTypeNames [] = |
| 1173 |
{ |
| 1174 |
{ 1, "A directly photographed image" } |
| 1175 |
}; |
| 1176 |
|
| 1177 |
const char *name = LookupName (key, |
| 1178 |
kSceneTypeNames, |
| 1179 |
sizeof (kSceneTypeNames ) / |
| 1180 |
sizeof (kSceneTypeNames [0])); |
| 1181 |
|
| 1182 |
if (name) |
| 1183 |
{ |
| 1184 |
return name; |
| 1185 |
} |
| 1186 |
|
| 1187 |
static char s [32]; |
| 1188 |
|
| 1189 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1190 |
|
| 1191 |
return s; |
| 1192 |
|
| 1193 |
} |
| 1194 |
|
| 1195 |
/*****************************************************************************/ |
| 1196 |
|
| 1197 |
const char * LookupCustomRendered (uint32 key) |
| 1198 |
{ |
| 1199 |
|
| 1200 |
const dng_name_table kCustomRenderedNames [] = |
| 1201 |
{ |
| 1202 |
{ 0, "Normal process" }, |
| 1203 |
{ 1, "Custom process" } |
| 1204 |
}; |
| 1205 |
|
| 1206 |
const char *name = LookupName (key, |
| 1207 |
kCustomRenderedNames, |
| 1208 |
sizeof (kCustomRenderedNames ) / |
| 1209 |
sizeof (kCustomRenderedNames [0])); |
| 1210 |
|
| 1211 |
if (name) |
| 1212 |
{ |
| 1213 |
return name; |
| 1214 |
} |
| 1215 |
|
| 1216 |
static char s [32]; |
| 1217 |
|
| 1218 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1219 |
|
| 1220 |
return s; |
| 1221 |
|
| 1222 |
} |
| 1223 |
|
| 1224 |
/*****************************************************************************/ |
| 1225 |
|
| 1226 |
const char * LookupExposureMode (uint32 key) |
| 1227 |
{ |
| 1228 |
|
| 1229 |
const dng_name_table kExposureModeNames [] = |
| 1230 |
{ |
| 1231 |
{ 0, "Auto exposure" }, |
| 1232 |
{ 1, "Manual exposure" }, |
| 1233 |
{ 2, "Auto bracket" } |
| 1234 |
}; |
| 1235 |
|
| 1236 |
const char *name = LookupName (key, |
| 1237 |
kExposureModeNames, |
| 1238 |
sizeof (kExposureModeNames ) / |
| 1239 |
sizeof (kExposureModeNames [0])); |
| 1240 |
|
| 1241 |
if (name) |
| 1242 |
{ |
| 1243 |
return name; |
| 1244 |
} |
| 1245 |
|
| 1246 |
static char s [32]; |
| 1247 |
|
| 1248 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1249 |
|
| 1250 |
return s; |
| 1251 |
|
| 1252 |
} |
| 1253 |
|
| 1254 |
/*****************************************************************************/ |
| 1255 |
|
| 1256 |
const char * LookupWhiteBalance (uint32 key) |
| 1257 |
{ |
| 1258 |
|
| 1259 |
const dng_name_table kWhiteBalanceNames [] = |
| 1260 |
{ |
| 1261 |
{ 0, "Auto white balance" }, |
| 1262 |
{ 1, "Manual white balance" } |
| 1263 |
}; |
| 1264 |
|
| 1265 |
const char *name = LookupName (key, |
| 1266 |
kWhiteBalanceNames, |
| 1267 |
sizeof (kWhiteBalanceNames ) / |
| 1268 |
sizeof (kWhiteBalanceNames [0])); |
| 1269 |
|
| 1270 |
if (name) |
| 1271 |
{ |
| 1272 |
return name; |
| 1273 |
} |
| 1274 |
|
| 1275 |
static char s [32]; |
| 1276 |
|
| 1277 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1278 |
|
| 1279 |
return s; |
| 1280 |
|
| 1281 |
} |
| 1282 |
|
| 1283 |
/*****************************************************************************/ |
| 1284 |
|
| 1285 |
const char * LookupSceneCaptureType (uint32 key) |
| 1286 |
{ |
| 1287 |
|
| 1288 |
const dng_name_table kSceneCaptureTypeNames [] = |
| 1289 |
{ |
| 1290 |
{ 0, "Standard" }, |
| 1291 |
{ 1, "Landscape" }, |
| 1292 |
{ 2, "Portrait" }, |
| 1293 |
{ 3, "Night scene" } |
| 1294 |
}; |
| 1295 |
|
| 1296 |
const char *name = LookupName (key, |
| 1297 |
kSceneCaptureTypeNames, |
| 1298 |
sizeof (kSceneCaptureTypeNames ) / |
| 1299 |
sizeof (kSceneCaptureTypeNames [0])); |
| 1300 |
|
| 1301 |
if (name) |
| 1302 |
{ |
| 1303 |
return name; |
| 1304 |
} |
| 1305 |
|
| 1306 |
static char s [32]; |
| 1307 |
|
| 1308 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1309 |
|
| 1310 |
return s; |
| 1311 |
|
| 1312 |
} |
| 1313 |
|
| 1314 |
/*****************************************************************************/ |
| 1315 |
|
| 1316 |
const char * LookupGainControl (uint32 key) |
| 1317 |
{ |
| 1318 |
|
| 1319 |
const dng_name_table kGainControlNames [] = |
| 1320 |
{ |
| 1321 |
{ 0, "None" }, |
| 1322 |
{ 1, "Low gain up" }, |
| 1323 |
{ 2, "High gain up" }, |
| 1324 |
{ 3, "Low gain down" }, |
| 1325 |
{ 4, "High gain down" } |
| 1326 |
}; |
| 1327 |
|
| 1328 |
const char *name = LookupName (key, |
| 1329 |
kGainControlNames, |
| 1330 |
sizeof (kGainControlNames ) / |
| 1331 |
sizeof (kGainControlNames [0])); |
| 1332 |
|
| 1333 |
if (name) |
| 1334 |
{ |
| 1335 |
return name; |
| 1336 |
} |
| 1337 |
|
| 1338 |
static char s [32]; |
| 1339 |
|
| 1340 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1341 |
|
| 1342 |
return s; |
| 1343 |
|
| 1344 |
} |
| 1345 |
|
| 1346 |
/*****************************************************************************/ |
| 1347 |
|
| 1348 |
const char * LookupContrast (uint32 key) |
| 1349 |
{ |
| 1350 |
|
| 1351 |
const dng_name_table kContrastNames [] = |
| 1352 |
{ |
| 1353 |
{ 0, "Normal" }, |
| 1354 |
{ 1, "Soft" }, |
| 1355 |
{ 2, "Hard" } |
| 1356 |
}; |
| 1357 |
|
| 1358 |
const char *name = LookupName (key, |
| 1359 |
kContrastNames, |
| 1360 |
sizeof (kContrastNames ) / |
| 1361 |
sizeof (kContrastNames [0])); |
| 1362 |
|
| 1363 |
if (name) |
| 1364 |
{ |
| 1365 |
return name; |
| 1366 |
} |
| 1367 |
|
| 1368 |
static char s [32]; |
| 1369 |
|
| 1370 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1371 |
|
| 1372 |
return s; |
| 1373 |
|
| 1374 |
} |
| 1375 |
|
| 1376 |
/*****************************************************************************/ |
| 1377 |
|
| 1378 |
const char * LookupSaturation (uint32 key) |
| 1379 |
{ |
| 1380 |
|
| 1381 |
const dng_name_table kSaturationNames [] = |
| 1382 |
{ |
| 1383 |
{ 0, "Normal" }, |
| 1384 |
{ 1, "Low saturation" }, |
| 1385 |
{ 2, "High saturation" } |
| 1386 |
}; |
| 1387 |
|
| 1388 |
const char *name = LookupName (key, |
| 1389 |
kSaturationNames, |
| 1390 |
sizeof (kSaturationNames ) / |
| 1391 |
sizeof (kSaturationNames [0])); |
| 1392 |
|
| 1393 |
if (name) |
| 1394 |
{ |
| 1395 |
return name; |
| 1396 |
} |
| 1397 |
|
| 1398 |
static char s [32]; |
| 1399 |
|
| 1400 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1401 |
|
| 1402 |
return s; |
| 1403 |
|
| 1404 |
} |
| 1405 |
|
| 1406 |
/*****************************************************************************/ |
| 1407 |
|
| 1408 |
const char * LookupSharpness (uint32 key) |
| 1409 |
{ |
| 1410 |
|
| 1411 |
const dng_name_table kSharpnessNames [] = |
| 1412 |
{ |
| 1413 |
{ 0, "Normal" }, |
| 1414 |
{ 1, "Soft" }, |
| 1415 |
{ 2, "Hard" } |
| 1416 |
}; |
| 1417 |
|
| 1418 |
const char *name = LookupName (key, |
| 1419 |
kSharpnessNames, |
| 1420 |
sizeof (kSharpnessNames ) / |
| 1421 |
sizeof (kSharpnessNames [0])); |
| 1422 |
|
| 1423 |
if (name) |
| 1424 |
{ |
| 1425 |
return name; |
| 1426 |
} |
| 1427 |
|
| 1428 |
static char s [32]; |
| 1429 |
|
| 1430 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1431 |
|
| 1432 |
return s; |
| 1433 |
|
| 1434 |
} |
| 1435 |
|
| 1436 |
/*****************************************************************************/ |
| 1437 |
|
| 1438 |
const char * LookupSubjectDistanceRange (uint32 key) |
| 1439 |
{ |
| 1440 |
|
| 1441 |
const dng_name_table kSubjectDistanceRangeNames [] = |
| 1442 |
{ |
| 1443 |
{ 0, "Unknown" }, |
| 1444 |
{ 1, "Macro" }, |
| 1445 |
{ 2, "Close view" }, |
| 1446 |
{ 3, "Distant view" } |
| 1447 |
}; |
| 1448 |
|
| 1449 |
const char *name = LookupName (key, |
| 1450 |
kSubjectDistanceRangeNames, |
| 1451 |
sizeof (kSubjectDistanceRangeNames ) / |
| 1452 |
sizeof (kSubjectDistanceRangeNames [0])); |
| 1453 |
|
| 1454 |
if (name) |
| 1455 |
{ |
| 1456 |
return name; |
| 1457 |
} |
| 1458 |
|
| 1459 |
static char s [32]; |
| 1460 |
|
| 1461 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1462 |
|
| 1463 |
return s; |
| 1464 |
|
| 1465 |
} |
| 1466 |
|
| 1467 |
/*****************************************************************************/ |
| 1468 |
|
| 1469 |
const char * LookupComponent (uint32 key) |
| 1470 |
{ |
| 1471 |
|
| 1472 |
const dng_name_table kComponentNames [] = |
| 1473 |
{ |
| 1474 |
{ 0, "-" }, |
| 1475 |
{ 1, "Y" }, |
| 1476 |
{ 2, "Cb" }, |
| 1477 |
{ 3, "Cr" }, |
| 1478 |
{ 4, "R" }, |
| 1479 |
{ 5, "G" }, |
| 1480 |
{ 6, "B" } |
| 1481 |
}; |
| 1482 |
|
| 1483 |
const char *name = LookupName (key, |
| 1484 |
kComponentNames, |
| 1485 |
sizeof (kComponentNames ) / |
| 1486 |
sizeof (kComponentNames [0])); |
| 1487 |
|
| 1488 |
if (name) |
| 1489 |
{ |
| 1490 |
return name; |
| 1491 |
} |
| 1492 |
|
| 1493 |
static char s [32]; |
| 1494 |
|
| 1495 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1496 |
|
| 1497 |
return s; |
| 1498 |
|
| 1499 |
} |
| 1500 |
|
| 1501 |
/*****************************************************************************/ |
| 1502 |
|
| 1503 |
const char * LookupCFALayout (uint32 key) |
| 1504 |
{ |
| 1505 |
|
| 1506 |
const dng_name_table kCFALayoutNames [] = |
| 1507 |
{ |
| 1508 |
{ 1, "Rectangular (or square) layout" }, |
| 1509 |
{ 2, "Staggered layout A: even columns are offset down by 1/2 row" }, |
| 1510 |
{ 3, "Staggered layout B: even columns are offset up by 1/2 row" }, |
| 1511 |
{ 4, "Staggered layout C: even rows are offset right by 1/2 column" }, |
| 1512 |
{ 5, "Staggered layout D: even rows are offset left by 1/2 column" }, |
| 1513 |
{ 6, "Staggered layout E: even rows are offset up by 1/2 row, even columns are offset left by 1/2 column" }, |
| 1514 |
{ 7, "Staggered layout F: even rows are offset up by 1/2 row, even columns are offset right by 1/2 column" }, |
| 1515 |
{ 8, "Staggered layout G: even rows are offset down by 1/2 row, even columns are offset left by 1/2 column" }, |
| 1516 |
{ 9, "Staggered layout H: even rows are offset down by 1/2 row, even columns are offset right by 1/2 column" } |
| 1517 |
}; |
| 1518 |
|
| 1519 |
const char *name = LookupName (key, |
| 1520 |
kCFALayoutNames, |
| 1521 |
sizeof (kCFALayoutNames ) / |
| 1522 |
sizeof (kCFALayoutNames [0])); |
| 1523 |
|
| 1524 |
if (name) |
| 1525 |
{ |
| 1526 |
return name; |
| 1527 |
} |
| 1528 |
|
| 1529 |
static char s [32]; |
| 1530 |
|
| 1531 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1532 |
|
| 1533 |
return s; |
| 1534 |
|
| 1535 |
} |
| 1536 |
|
| 1537 |
/*****************************************************************************/ |
| 1538 |
|
| 1539 |
const char * LookupMakerNoteSafety (uint32 key) |
| 1540 |
{ |
| 1541 |
|
| 1542 |
const dng_name_table kMakerNoteSafetyNames [] = |
| 1543 |
{ |
| 1544 |
{ 0, "Unsafe" }, |
| 1545 |
{ 1, "Safe" } |
| 1546 |
}; |
| 1547 |
|
| 1548 |
const char *name = LookupName (key, |
| 1549 |
kMakerNoteSafetyNames, |
| 1550 |
sizeof (kMakerNoteSafetyNames ) / |
| 1551 |
sizeof (kMakerNoteSafetyNames [0])); |
| 1552 |
|
| 1553 |
if (name) |
| 1554 |
{ |
| 1555 |
return name; |
| 1556 |
} |
| 1557 |
|
| 1558 |
static char s [32]; |
| 1559 |
|
| 1560 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1561 |
|
| 1562 |
return s; |
| 1563 |
|
| 1564 |
} |
| 1565 |
|
| 1566 |
/*****************************************************************************/ |
| 1567 |
|
| 1568 |
const char * LookupColorimetricReference (uint32 key) |
| 1569 |
{ |
| 1570 |
|
| 1571 |
const dng_name_table kColorimetricReferenceNames [] = |
| 1572 |
{ |
| 1573 |
{ crSceneReferred, "Scene Referred" }, |
| 1574 |
{ crICCProfilePCS, "ICC Profile PCS" }, |
| 1575 |
{ crOutputReferredHDR, "Output Referred HDR" } |
| 1576 |
}; |
| 1577 |
|
| 1578 |
const char *name = LookupName (key, |
| 1579 |
kColorimetricReferenceNames, |
| 1580 |
sizeof (kColorimetricReferenceNames ) / |
| 1581 |
sizeof (kColorimetricReferenceNames [0])); |
| 1582 |
|
| 1583 |
if (name) |
| 1584 |
{ |
| 1585 |
return name; |
| 1586 |
} |
| 1587 |
|
| 1588 |
static char s [32]; |
| 1589 |
|
| 1590 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1591 |
|
| 1592 |
return s; |
| 1593 |
|
| 1594 |
} |
| 1595 |
|
| 1596 |
/*****************************************************************************/ |
| 1597 |
|
| 1598 |
const char * LookupPreviewColorSpace (uint32 key) |
| 1599 |
{ |
| 1600 |
|
| 1601 |
const dng_name_table kPreviewColorSpaceNames [] = |
| 1602 |
{ |
| 1603 |
{ previewColorSpace_Unknown , "Unknown" }, |
| 1604 |
{ previewColorSpace_GrayGamma22, "Gray Gamma 2.2" }, |
| 1605 |
{ previewColorSpace_sRGB , "sRGB" }, |
| 1606 |
{ previewColorSpace_AdobeRGB , "Adobe RGB (1998)" }, |
| 1607 |
{ previewColorSpace_ProPhotoRGB, "Pro Photo RGB" } |
| 1608 |
}; |
| 1609 |
|
| 1610 |
const char *name = LookupName (key, |
| 1611 |
kPreviewColorSpaceNames, |
| 1612 |
sizeof (kPreviewColorSpaceNames ) / |
| 1613 |
sizeof (kPreviewColorSpaceNames [0])); |
| 1614 |
|
| 1615 |
if (name) |
| 1616 |
{ |
| 1617 |
return name; |
| 1618 |
} |
| 1619 |
|
| 1620 |
static char s [32]; |
| 1621 |
|
| 1622 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1623 |
|
| 1624 |
return s; |
| 1625 |
|
| 1626 |
} |
| 1627 |
|
| 1628 |
/*****************************************************************************/ |
| 1629 |
|
| 1630 |
const char * LookupJPEGMarker (uint32 key) |
| 1631 |
{ |
| 1632 |
|
| 1633 |
const dng_name_table kJPEGMarkerNames [] = |
| 1634 |
{ |
| 1635 |
{ M_TEM, "TEM" }, |
| 1636 |
{ M_SOF0, "SOF0" }, |
| 1637 |
{ M_SOF1, "SOF1" }, |
| 1638 |
{ M_SOF2, "SOF2" }, |
| 1639 |
{ M_SOF3, "SOF3" }, |
| 1640 |
{ M_DHT, "DHT" }, |
| 1641 |
{ M_SOF5, "SOF5" }, |
| 1642 |
{ M_SOF6, "SOF6" }, |
| 1643 |
{ M_SOF7, "SOF7" }, |
| 1644 |
{ M_JPG, "JPG" }, |
| 1645 |
{ M_SOF9, "SOF9" }, |
| 1646 |
{ M_SOF10, "SOF10" }, |
| 1647 |
{ M_SOF11, "SOF11" }, |
| 1648 |
{ M_DAC, "DAC" }, |
| 1649 |
{ M_SOF13, "SOF13" }, |
| 1650 |
{ M_SOF14, "SOF14" }, |
| 1651 |
{ M_SOF15, "SOF15" }, |
| 1652 |
{ M_RST0, "RST0" }, |
| 1653 |
{ M_RST1, "RST1" }, |
| 1654 |
{ M_RST2, "RST2" }, |
| 1655 |
{ M_RST3, "RST3" }, |
| 1656 |
{ M_RST4, "RST4" }, |
| 1657 |
{ M_RST5, "RST5" }, |
| 1658 |
{ M_RST6, "RST6" }, |
| 1659 |
{ M_RST7, "RST7" }, |
| 1660 |
{ M_SOI, "SOI" }, |
| 1661 |
{ M_EOI, "EOI" }, |
| 1662 |
{ M_SOS, "SOS" }, |
| 1663 |
{ M_DQT, "DQT" }, |
| 1664 |
{ M_DNL, "DNL" }, |
| 1665 |
{ M_DRI, "DRI" }, |
| 1666 |
{ M_DHP, "DHP" }, |
| 1667 |
{ M_EXP, "EXP" }, |
| 1668 |
{ M_APP0, "APP0" }, |
| 1669 |
{ M_APP1, "APP1" }, |
| 1670 |
{ M_APP2, "APP2" }, |
| 1671 |
{ M_APP3, "APP3" }, |
| 1672 |
{ M_APP4, "APP4" }, |
| 1673 |
{ M_APP5, "APP5" }, |
| 1674 |
{ M_APP6, "APP6" }, |
| 1675 |
{ M_APP7, "APP7" }, |
| 1676 |
{ M_APP8, "APP8" }, |
| 1677 |
{ M_APP9, "APP9" }, |
| 1678 |
{ M_APP10, "APP10" }, |
| 1679 |
{ M_APP11, "APP11" }, |
| 1680 |
{ M_APP12, "APP12" }, |
| 1681 |
{ M_APP13, "APP13" }, |
| 1682 |
{ M_APP14, "APP14" }, |
| 1683 |
{ M_APP15, "APP15" }, |
| 1684 |
{ M_JPG0, "JPG0" }, |
| 1685 |
{ M_JPG1, "JPG1" }, |
| 1686 |
{ M_JPG2, "JPG2" }, |
| 1687 |
{ M_JPG3, "JPG3" }, |
| 1688 |
{ M_JPG4, "JPG4" }, |
| 1689 |
{ M_JPG5, "JPG5" }, |
| 1690 |
{ M_JPG6, "JPG6" }, |
| 1691 |
{ M_JPG7, "JPG7" }, |
| 1692 |
{ M_JPG8, "JPG8" }, |
| 1693 |
{ M_JPG9, "JPG9" }, |
| 1694 |
{ M_JPG10, "JPG10" }, |
| 1695 |
{ M_JPG11, "JPG11" }, |
| 1696 |
{ M_JPG12, "JPG12" }, |
| 1697 |
{ M_JPG13, "JPG13" }, |
| 1698 |
{ M_COM, "COM" }, |
| 1699 |
{ M_ERROR, "ERROR" } |
| 1700 |
}; |
| 1701 |
|
| 1702 |
const char *name = LookupName (key, |
| 1703 |
kJPEGMarkerNames, |
| 1704 |
sizeof (kJPEGMarkerNames ) / |
| 1705 |
sizeof (kJPEGMarkerNames [0])); |
| 1706 |
|
| 1707 |
if (name) |
| 1708 |
{ |
| 1709 |
return name; |
| 1710 |
} |
| 1711 |
|
| 1712 |
static char s [32]; |
| 1713 |
|
| 1714 |
snprintf (s, 32, "0x%02X", (unsigned) key); |
| 1715 |
|
| 1716 |
return s; |
| 1717 |
|
| 1718 |
} |
| 1719 |
|
| 1720 |
/*****************************************************************************/ |
| 1721 |
|
| 1722 |
const char * LookupSensitivityType (uint32 key) |
| 1723 |
{ |
| 1724 |
|
| 1725 |
const dng_name_table kSensitivityTypeNames [] = |
| 1726 |
{ |
| 1727 |
{ stUnknown, "Unknown" }, |
| 1728 |
{ stStandardOutputSensitivity, "Standard Output Sensitivity (SOS)" }, |
| 1729 |
{ stRecommendedExposureIndex, "Recommended Exposure Index (REI)" }, |
| 1730 |
{ stISOSpeed, "ISO Speed" }, |
| 1731 |
{ stSOSandREI, "Standard Output Sensitivity (SOS) and Recommended Exposure Index (REI)" }, |
| 1732 |
{ stSOSandISOSpeed, "Standard Output Sensitivity (SOS) and ISO Speed" }, |
| 1733 |
{ stREIandISOSpeed, "Recommended Exposure Index (REI) and ISO Speed" }, |
| 1734 |
{ stSOSandREIandISOSpeed, "Standard Output Sensitivity (SOS) and Recommended Exposure Index (REI) and ISO Speed" }, |
| 1735 |
}; |
| 1736 |
|
| 1737 |
const char *name = LookupName (key, |
| 1738 |
kSensitivityTypeNames, |
| 1739 |
sizeof (kSensitivityTypeNames ) / |
| 1740 |
sizeof (kSensitivityTypeNames [0])); |
| 1741 |
|
| 1742 |
if (name) |
| 1743 |
{ |
| 1744 |
return name; |
| 1745 |
} |
| 1746 |
|
| 1747 |
static char s [32]; |
| 1748 |
|
| 1749 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1750 |
|
| 1751 |
return s; |
| 1752 |
|
| 1753 |
} |
| 1754 |
|
| 1755 |
/*****************************************************************************/ |
| 1756 |
|
| 1757 |
const char * LookupDepthFormat (uint32 key) |
| 1758 |
{ |
| 1759 |
|
| 1760 |
const dng_name_table kDepthFormatNames [] = |
| 1761 |
{ |
| 1762 |
{ depthFormatUnknown, "Unknown" }, |
| 1763 |
{ depthFormatLinear, "Linear" }, |
| 1764 |
{ depthFormatInverse, "Inverse" }, |
| 1765 |
}; |
| 1766 |
|
| 1767 |
const char *name = LookupName (key, |
| 1768 |
kDepthFormatNames, |
| 1769 |
sizeof (kDepthFormatNames ) / |
| 1770 |
sizeof (kDepthFormatNames [0])); |
| 1771 |
|
| 1772 |
if (name) |
| 1773 |
{ |
| 1774 |
return name; |
| 1775 |
} |
| 1776 |
|
| 1777 |
static char s [32]; |
| 1778 |
|
| 1779 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1780 |
|
| 1781 |
return s; |
| 1782 |
|
| 1783 |
} |
| 1784 |
|
| 1785 |
/*****************************************************************************/ |
| 1786 |
|
| 1787 |
const char * LookupDepthUnits (uint32 key) |
| 1788 |
{ |
| 1789 |
|
| 1790 |
const dng_name_table kDepthUnitNames [] = |
| 1791 |
{ |
| 1792 |
{ depthUnitsUnknown, "Unknown" }, |
| 1793 |
{ depthUnitsMeters, "Meters" }, |
| 1794 |
}; |
| 1795 |
|
| 1796 |
const char *name = LookupName (key, |
| 1797 |
kDepthUnitNames, |
| 1798 |
sizeof (kDepthUnitNames ) / |
| 1799 |
sizeof (kDepthUnitNames [0])); |
| 1800 |
|
| 1801 |
if (name) |
| 1802 |
{ |
| 1803 |
return name; |
| 1804 |
} |
| 1805 |
|
| 1806 |
static char s [32]; |
| 1807 |
|
| 1808 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1809 |
|
| 1810 |
return s; |
| 1811 |
|
| 1812 |
} |
| 1813 |
|
| 1814 |
/*****************************************************************************/ |
| 1815 |
|
| 1816 |
const char * LookupDepthMeasureType (uint32 key) |
| 1817 |
{ |
| 1818 |
|
| 1819 |
const dng_name_table kDepthMeasureTypeNames [] = |
| 1820 |
{ |
| 1821 |
{ depthMeasureUnknown, "Unknown" }, |
| 1822 |
{ depthMeasureOpticalAxis, "Optical Axis" }, |
| 1823 |
{ depthMeasureOpticalRay, "Optical Ray" }, |
| 1824 |
}; |
| 1825 |
|
| 1826 |
const char *name = LookupName (key, |
| 1827 |
kDepthMeasureTypeNames, |
| 1828 |
sizeof (kDepthMeasureTypeNames ) / |
| 1829 |
sizeof (kDepthMeasureTypeNames [0])); |
| 1830 |
|
| 1831 |
if (name) |
| 1832 |
{ |
| 1833 |
return name; |
| 1834 |
} |
| 1835 |
|
| 1836 |
static char s [32]; |
| 1837 |
|
| 1838 |
snprintf (s, 32, "%u", (unsigned) key); |
| 1839 |
|
| 1840 |
return s; |
| 1841 |
|
| 1842 |
} |
| 1843 |
|
| 1844 |
/*****************************************************************************/ |
| 1845 |
|
| 1846 |
void DumpHexAscii (dng_stream &stream, |
| 1847 |
uint32 count) |
| 1848 |
{ |
| 1849 |
|
| 1850 |
uint32 rows = (count + 15) >> 4; |
| 1851 |
|
| 1852 |
if (rows > gDumpLineLimit) |
| 1853 |
rows = gDumpLineLimit; |
| 1854 |
|
| 1855 |
for (uint32 row = 0; row < rows; row++) |
| 1856 |
{ |
| 1857 |
|
| 1858 |
printf (" "); |
| 1859 |
|
| 1860 |
uint32 col; |
| 1861 |
|
| 1862 |
uint32 cols = count - (row << 4); |
| 1863 |
|
| 1864 |
if (cols > 16) |
| 1865 |
cols = 16; |
| 1866 |
|
| 1867 |
uint8 x [16]; |
| 1868 |
|
| 1869 |
for (col = 0; col < 16; col++) |
| 1870 |
{ |
| 1871 |
|
| 1872 |
x [col] = ' '; |
| 1873 |
|
| 1874 |
if (col < cols) |
| 1875 |
{ |
| 1876 |
|
| 1877 |
x [col] = stream.Get_uint8 (); |
| 1878 |
|
| 1879 |
printf ("%02x ", x [col]); |
| 1880 |
|
| 1881 |
} |
| 1882 |
|
| 1883 |
else |
| 1884 |
{ |
| 1885 |
printf (" "); |
| 1886 |
} |
| 1887 |
|
| 1888 |
} |
| 1889 |
|
| 1890 |
printf (" "); |
| 1891 |
|
| 1892 |
for (col = 0; col < 16; col++) |
| 1893 |
{ |
| 1894 |
|
| 1895 |
if (x [col] >= (uint8) ' ' && x [col] <= (uint8) '~') |
| 1896 |
{ |
| 1897 |
printf ("%c", x [col]); |
| 1898 |
} |
| 1899 |
|
| 1900 |
else |
| 1901 |
{ |
| 1902 |
printf ("."); |
| 1903 |
} |
| 1904 |
|
| 1905 |
} |
| 1906 |
|
| 1907 |
printf ("\n"); |
| 1908 |
|
| 1909 |
} |
| 1910 |
|
| 1911 |
if (count > rows * 16) |
| 1912 |
{ |
| 1913 |
printf (" ... %u more bytes\n", (unsigned) (count - rows * 16)); |
| 1914 |
} |
| 1915 |
|
| 1916 |
} |
| 1917 |
|
| 1918 |
/*****************************************************************************/ |
| 1919 |
|
| 1920 |
void DumpHexAscii (const uint8 *buf, |
| 1921 |
uint32 count) |
| 1922 |
{ |
| 1923 |
|
| 1924 |
uint32 rows = (count + 15) >> 4; |
| 1925 |
|
| 1926 |
if (rows > gDumpLineLimit) |
| 1927 |
rows = gDumpLineLimit; |
| 1928 |
|
| 1929 |
for (uint32 row = 0; row < rows; row++) |
| 1930 |
{ |
| 1931 |
|
| 1932 |
printf (" "); |
| 1933 |
|
| 1934 |
uint32 col; |
| 1935 |
|
| 1936 |
uint32 cols = count - (row << 4); |
| 1937 |
|
| 1938 |
if (cols > 16) |
| 1939 |
cols = 16; |
| 1940 |
|
| 1941 |
uint8 x [16]; |
| 1942 |
|
| 1943 |
for (col = 0; col < 16; col++) |
| 1944 |
{ |
| 1945 |
|
| 1946 |
x [col] = ' '; |
| 1947 |
|
| 1948 |
if (col < cols) |
| 1949 |
{ |
| 1950 |
|
| 1951 |
x [col] = *(buf++); |
| 1952 |
|
| 1953 |
printf ("%02x ", x [col]); |
| 1954 |
|
| 1955 |
} |
| 1956 |
|
| 1957 |
else |
| 1958 |
{ |
| 1959 |
printf (" "); |
| 1960 |
} |
| 1961 |
|
| 1962 |
} |
| 1963 |
|
| 1964 |
printf (" "); |
| 1965 |
|
| 1966 |
for (col = 0; col < 16; col++) |
| 1967 |
{ |
| 1968 |
|
| 1969 |
if (x [col] >= (uint8) ' ' && x [col] <= (uint8) '~') |
| 1970 |
{ |
| 1971 |
printf ("%c", x [col]); |
| 1972 |
} |
| 1973 |
|
| 1974 |
else |
| 1975 |
{ |
| 1976 |
printf ("."); |
| 1977 |
} |
| 1978 |
|
| 1979 |
} |
| 1980 |
|
| 1981 |
printf ("\n"); |
| 1982 |
|
| 1983 |
} |
| 1984 |
|
| 1985 |
if (count > rows * 16) |
| 1986 |
{ |
| 1987 |
printf (" ... %u more bytes\n", (unsigned) (count - rows * 16)); |
| 1988 |
} |
| 1989 |
|
| 1990 |
} |
| 1991 |
|
| 1992 |
/*****************************************************************************/ |
| 1993 |
|
| 1994 |
void DumpXMP (dng_stream &stream, |
| 1995 |
uint32 count) |
| 1996 |
{ |
| 1997 |
|
| 1998 |
uint32 lineLength = 0; |
| 1999 |
|
| 2000 |
while (count > 0) |
| 2001 |
{ |
| 2002 |
|
| 2003 |
uint32 x = stream.Get_uint8 (); |
| 2004 |
|
| 2005 |
if (x == 0) break; |
| 2006 |
|
| 2007 |
count--; |
| 2008 |
|
| 2009 |
if (lineLength == 0) |
| 2010 |
{ |
| 2011 |
|
| 2012 |
printf ("XMP: "); |
| 2013 |
|
| 2014 |
lineLength = 5; |
| 2015 |
|
| 2016 |
} |
| 2017 |
|
| 2018 |
if (x == '\n' || |
| 2019 |
x == '\r') |
| 2020 |
{ |
| 2021 |
|
| 2022 |
printf ("\n"); |
| 2023 |
|
| 2024 |
lineLength = 0; |
| 2025 |
|
| 2026 |
} |
| 2027 |
|
| 2028 |
else |
| 2029 |
{ |
| 2030 |
|
| 2031 |
if (lineLength >= 128) |
| 2032 |
{ |
| 2033 |
|
| 2034 |
printf ("\nXMP: "); |
| 2035 |
|
| 2036 |
lineLength = 5; |
| 2037 |
|
| 2038 |
} |
| 2039 |
|
| 2040 |
if (x >= ' ' && x <= '~') |
| 2041 |
{ |
| 2042 |
|
| 2043 |
printf ("%c", (char) x); |
| 2044 |
|
| 2045 |
lineLength += 1; |
| 2046 |
|
| 2047 |
} |
| 2048 |
|
| 2049 |
else |
| 2050 |
{ |
| 2051 |
|
| 2052 |
printf ("\\%03o", (unsigned) x); |
| 2053 |
|
| 2054 |
lineLength += 4; |
| 2055 |
|
| 2056 |
} |
| 2057 |
|
| 2058 |
} |
| 2059 |
|
| 2060 |
} |
| 2061 |
|
| 2062 |
if (lineLength != 0) |
| 2063 |
{ |
| 2064 |
|
| 2065 |
printf ("\n"); |
| 2066 |
|
| 2067 |
} |
| 2068 |
|
| 2069 |
} |
| 2070 |
|
| 2071 |
/*****************************************************************************/ |
| 2072 |
|
| 2073 |
void DumpString (const dng_string &s) |
| 2074 |
{ |
| 2075 |
|
| 2076 |
const uint32 kMaxDumpString = gDumpLineLimit * 64; |
| 2077 |
|
| 2078 |
printf ("\""); |
| 2079 |
|
| 2080 |
const char *ss = s.Get (); |
| 2081 |
|
| 2082 |
uint32 total = 0; |
| 2083 |
|
| 2084 |
while (*ss != 0 && total++ < kMaxDumpString) |
| 2085 |
{ |
| 2086 |
|
| 2087 |
uint32 c = dng_string::DecodeUTF8 (ss); |
| 2088 |
|
| 2089 |
if (c >= ' ' && c <= '~') |
| 2090 |
{ |
| 2091 |
printf ("%c", (char) c); |
| 2092 |
} |
| 2093 |
|
| 2094 |
else switch (c) |
| 2095 |
{ |
| 2096 |
|
| 2097 |
case '\t': |
| 2098 |
{ |
| 2099 |
printf ("\\t"); |
| 2100 |
break; |
| 2101 |
} |
| 2102 |
|
| 2103 |
case '\n': |
| 2104 |
{ |
| 2105 |
printf ("\\n"); |
| 2106 |
break; |
| 2107 |
} |
| 2108 |
|
| 2109 |
case '\r': |
| 2110 |
{ |
| 2111 |
printf ("\\r"); |
| 2112 |
break; |
| 2113 |
} |
| 2114 |
|
| 2115 |
default: |
| 2116 |
{ |
| 2117 |
printf ("[%X]", (unsigned) c); |
| 2118 |
} |
| 2119 |
|
| 2120 |
} |
| 2121 |
|
| 2122 |
} |
| 2123 |
|
| 2124 |
uint32 extra = (uint32) strlen (ss); |
| 2125 |
|
| 2126 |
if (extra > 0) |
| 2127 |
{ |
| 2128 |
printf ("...\" (%u more bytes)", (unsigned) extra); |
| 2129 |
} |
| 2130 |
|
| 2131 |
else |
| 2132 |
{ |
| 2133 |
printf ("\""); |
| 2134 |
} |
| 2135 |
|
| 2136 |
} |
| 2137 |
|
| 2138 |
/*****************************************************************************/ |
| 2139 |
|
| 2140 |
void DumpTagValues (dng_stream &stream, |
| 2141 |
const char *entry_name, |
| 2142 |
uint32 parentCode, |
| 2143 |
uint32 tagCode, |
| 2144 |
uint32 tagType, |
| 2145 |
uint32 tagCount, |
| 2146 |
const char *tag_name) |
| 2147 |
{ |
| 2148 |
|
| 2149 |
const uint32 kMaxDumpSingleLine = 4; |
| 2150 |
|
| 2151 |
const uint32 kMaxDumpArray = Max_uint32 (gDumpLineLimit, kMaxDumpSingleLine); |
| 2152 |
|
| 2153 |
printf ("%s:", tag_name ? tag_name |
| 2154 |
: LookupTagCode (parentCode, tagCode)); |
| 2155 |
|
| 2156 |
switch (tagType) |
| 2157 |
{ |
| 2158 |
|
| 2159 |
case ttShort: |
| 2160 |
case ttLong: |
| 2161 |
case ttIFD: |
| 2162 |
case ttSByte: |
| 2163 |
case ttSShort: |
| 2164 |
case ttSLong: |
| 2165 |
case ttRational: |
| 2166 |
case ttSRational: |
| 2167 |
case ttFloat: |
| 2168 |
case ttDouble: |
| 2169 |
case ttLong8: |
| 2170 |
case ttSLong8: |
| 2171 |
case ttIFD8: |
| 2172 |
{ |
| 2173 |
|
| 2174 |
if (tagCount > kMaxDumpSingleLine) |
| 2175 |
{ |
| 2176 |
|
| 2177 |
printf (" %u entries", (unsigned) tagCount); |
| 2178 |
|
| 2179 |
} |
| 2180 |
|
| 2181 |
for (uint32 j = 0; j < tagCount && j < kMaxDumpArray; j++) |
| 2182 |
{ |
| 2183 |
|
| 2184 |
if (tagCount <= kMaxDumpSingleLine) |
| 2185 |
{ |
| 2186 |
|
| 2187 |
if (j == 0) |
| 2188 |
{ |
| 2189 |
|
| 2190 |
printf (" %s =", entry_name); |
| 2191 |
|
| 2192 |
} |
| 2193 |
|
| 2194 |
printf (" "); |
| 2195 |
|
| 2196 |
} |
| 2197 |
|
| 2198 |
else |
| 2199 |
{ |
| 2200 |
|
| 2201 |
printf ("\n %s [%u] = ", entry_name, (unsigned) j); |
| 2202 |
|
| 2203 |
} |
| 2204 |
|
| 2205 |
switch (tagType) |
| 2206 |
{ |
| 2207 |
|
| 2208 |
case ttByte: |
| 2209 |
case ttShort: |
| 2210 |
case ttLong: |
| 2211 |
case ttIFD: |
| 2212 |
{ |
| 2213 |
|
| 2214 |
uint32 x = stream.TagValue_uint32 (tagType); |
| 2215 |
|
| 2216 |
printf ("%u", (unsigned) x); |
| 2217 |
|
| 2218 |
break; |
| 2219 |
|
| 2220 |
} |
| 2221 |
|
| 2222 |
case ttLong8: |
| 2223 |
case ttIFD8: |
| 2224 |
{ |
| 2225 |
|
| 2226 |
uint64 x = stream.TagValue_uint64 (tagType); |
| 2227 |
|
| 2228 |
printf ("%llu", (unsigned long long) x); |
| 2229 |
|
| 2230 |
break; |
| 2231 |
|
| 2232 |
} |
| 2233 |
|
| 2234 |
case ttSByte: |
| 2235 |
case ttSShort: |
| 2236 |
case ttSLong: |
| 2237 |
{ |
| 2238 |
|
| 2239 |
int32 x = stream.TagValue_int32 (tagType); |
| 2240 |
|
| 2241 |
printf ("%d", (int) x); |
| 2242 |
|
| 2243 |
break; |
| 2244 |
|
| 2245 |
} |
| 2246 |
|
| 2247 |
case ttSLong8: |
| 2248 |
{ |
| 2249 |
|
| 2250 |
int64 x = stream.TagValue_int64 (tagType); |
| 2251 |
|
| 2252 |
printf ("%lld", (long long) x); |
| 2253 |
|
| 2254 |
break; |
| 2255 |
|
| 2256 |
} |
| 2257 |
|
| 2258 |
case ttRational: |
| 2259 |
{ |
| 2260 |
|
| 2261 |
dng_urational x = stream.TagValue_urational (tagType); |
| 2262 |
|
| 2263 |
printf ("%u/%u", (unsigned) x.n, (unsigned) x.d); |
| 2264 |
|
| 2265 |
break; |
| 2266 |
|
| 2267 |
} |
| 2268 |
|
| 2269 |
case ttSRational: |
| 2270 |
{ |
| 2271 |
|
| 2272 |
dng_srational x = stream.TagValue_srational (tagType); |
| 2273 |
|
| 2274 |
printf ("%d/%d", (int) x.n, (int) x.d); |
| 2275 |
|
| 2276 |
break; |
| 2277 |
|
| 2278 |
} |
| 2279 |
|
| 2280 |
default: |
| 2281 |
{ |
| 2282 |
|
| 2283 |
real64 x = stream.TagValue_real64 (tagType); |
| 2284 |
|
| 2285 |
printf ("%f", x); |
| 2286 |
|
| 2287 |
} |
| 2288 |
|
| 2289 |
} |
| 2290 |
|
| 2291 |
} |
| 2292 |
|
| 2293 |
printf ("\n"); |
| 2294 |
|
| 2295 |
if (tagCount > kMaxDumpArray) |
| 2296 |
{ |
| 2297 |
|
| 2298 |
printf (" ... %u more entries\n", (unsigned) (tagCount - kMaxDumpArray)); |
| 2299 |
|
| 2300 |
} |
| 2301 |
|
| 2302 |
break; |
| 2303 |
|
| 2304 |
} |
| 2305 |
|
| 2306 |
case ttAscii: |
| 2307 |
{ |
| 2308 |
|
| 2309 |
dng_string s; |
| 2310 |
|
| 2311 |
ParseStringTag (stream, |
| 2312 |
parentCode, |
| 2313 |
tagCode, |
| 2314 |
tagCount, |
| 2315 |
s, |
| 2316 |
false); |
| 2317 |
|
| 2318 |
printf (" "); |
| 2319 |
|
| 2320 |
DumpString (s); |
| 2321 |
|
| 2322 |
printf ("\n"); |
| 2323 |
|
| 2324 |
break; |
| 2325 |
|
| 2326 |
} |
| 2327 |
|
| 2328 |
default: |
| 2329 |
{ |
| 2330 |
|
| 2331 |
uint32 tagSize = tagCount * TagTypeSize (tagType); |
| 2332 |
|
| 2333 |
if (tagCount == 1 && (tagType == ttByte || |
| 2334 |
tagType == ttUndefined)) |
| 2335 |
{ |
| 2336 |
|
| 2337 |
uint8 x = stream.Get_uint8 (); |
| 2338 |
|
| 2339 |
printf (" %s = %u\n", LookupTagType (tagType), x); |
| 2340 |
|
| 2341 |
} |
| 2342 |
|
| 2343 |
else |
| 2344 |
{ |
| 2345 |
|
| 2346 |
printf (" %s, size = %u\n", LookupTagType (tagType), (unsigned) tagSize); |
| 2347 |
|
| 2348 |
DumpHexAscii (stream, tagSize); |
| 2349 |
|
| 2350 |
} |
| 2351 |
|
| 2352 |
} |
| 2353 |
|
| 2354 |
} |
| 2355 |
|
| 2356 |
} |
| 2357 |
|
| 2358 |
/*****************************************************************************/ |
| 2359 |
|
| 2360 |
void DumpMatrix (const dng_matrix &m) |
| 2361 |
{ |
| 2362 |
|
| 2363 |
for (uint32 row = 0; row < m.Rows (); row++) |
| 2364 |
{ |
| 2365 |
|
| 2366 |
for (uint32 col = 0; col < m.Cols (); col++) |
| 2367 |
{ |
| 2368 |
|
| 2369 |
if (col == 0) |
| 2370 |
printf (" "); |
| 2371 |
else |
| 2372 |
printf (" "); |
| 2373 |
|
| 2374 |
printf ("%8.4f", m [row] [col]); |
| 2375 |
|
| 2376 |
} |
| 2377 |
|
| 2378 |
printf ("\n"); |
| 2379 |
|
| 2380 |
} |
| 2381 |
|
| 2382 |
} |
| 2383 |
|
| 2384 |
/*****************************************************************************/ |
| 2385 |
|
| 2386 |
void DumpVector (const dng_vector &v) |
| 2387 |
{ |
| 2388 |
|
| 2389 |
for (uint32 index = 0; index < v.Count (); index++) |
| 2390 |
{ |
| 2391 |
|
| 2392 |
printf (" %0.4f", v [index]); |
| 2393 |
|
| 2394 |
} |
| 2395 |
|
| 2396 |
printf ("\n"); |
| 2397 |
|
| 2398 |
} |
| 2399 |
|
| 2400 |
/*****************************************************************************/ |
| 2401 |
|
| 2402 |
void DumpDateTime (const dng_date_time &dt) |
| 2403 |
{ |
| 2404 |
|
| 2405 |
printf ("%04d:%02d:%02d %02d:%02d:%02d", |
| 2406 |
(int) dt.fYear, |
| 2407 |
(int) dt.fMonth, |
| 2408 |
(int) dt.fDay, |
| 2409 |
(int) dt.fHour, |
| 2410 |
(int) dt.fMinute, |
| 2411 |
(int) dt.fSecond); |
| 2412 |
|
| 2413 |
} |
| 2414 |
|
| 2415 |
/*****************************************************************************/ |
| 2416 |
|
| 2417 |
void DumpExposureTime (real64 x) |
| 2418 |
{ |
| 2419 |
|
| 2420 |
if (x > 0.0) |
| 2421 |
{ |
| 2422 |
|
| 2423 |
if (x >= 0.25) |
| 2424 |
{ |
| 2425 |
printf ("%0.2f sec", x); |
| 2426 |
} |
| 2427 |
|
| 2428 |
else if (x >= 0.01) |
| 2429 |
{ |
| 2430 |
printf ("1/%0.1f sec", 1.0 / x); |
| 2431 |
} |
| 2432 |
|
| 2433 |
else |
| 2434 |
{ |
| 2435 |
printf ("1/%0.0f sec", 1.0 / x); |
| 2436 |
} |
| 2437 |
|
| 2438 |
} |
| 2439 |
|
| 2440 |
else |
| 2441 |
{ |
| 2442 |
|
| 2443 |
printf ("<invalid>"); |
| 2444 |
|
| 2445 |
} |
| 2446 |
|
| 2447 |
} |
| 2448 |
|
| 2449 |
/*****************************************************************************/ |
| 2450 |
|
| 2451 |
void DumpFingerprint (const dng_fingerprint &p) |
| 2452 |
{ |
| 2453 |
|
| 2454 |
printf ("<"); |
| 2455 |
|
| 2456 |
for (uint32 j = 0; j < 16; j++) |
| 2457 |
{ |
| 2458 |
printf ("%02x", p.data [j]); |
| 2459 |
} |
| 2460 |
|
| 2461 |
printf (">"); |
| 2462 |
|
| 2463 |
} |
| 2464 |
|
| 2465 |
/*****************************************************************************/ |
| 2466 |
|
| 2467 |
void DumpHueSatMap (dng_stream &stream, |
| 2468 |
uint32 hues, |
| 2469 |
uint32 sats, |
| 2470 |
uint32 vals, |
| 2471 |
bool skipSat0) |
| 2472 |
{ |
| 2473 |
|
| 2474 |
uint32 doneLines = 0; |
| 2475 |
uint32 skipLines = 0; |
| 2476 |
|
| 2477 |
for (uint32 v = 0; v < vals; v++) |
| 2478 |
{ |
| 2479 |
|
| 2480 |
for (uint32 h = 0; h < hues; h++) |
| 2481 |
{ |
| 2482 |
|
| 2483 |
for (uint32 s = skipSat0 ? 1 : 0; s < sats; s++) |
| 2484 |
{ |
| 2485 |
|
| 2486 |
real32 dh = stream.Get_real32 (); |
| 2487 |
real32 ds = stream.Get_real32 (); |
| 2488 |
real32 dv = stream.Get_real32 (); |
| 2489 |
|
| 2490 |
if (gDumpLineLimit == 0 || |
| 2491 |
gDumpLineLimit > doneLines) |
| 2492 |
{ |
| 2493 |
|
| 2494 |
doneLines++; |
| 2495 |
|
| 2496 |
if (vals == 1) |
| 2497 |
{ |
| 2498 |
|
| 2499 |
printf (" h [%2u] s [%2u]: h=%8.4f s=%6.4f v=%6.4f\n", |
| 2500 |
(unsigned) h, |
| 2501 |
(unsigned) s, |
| 2502 |
(double) dh, |
| 2503 |
(double) ds, |
| 2504 |
(double) dv); |
| 2505 |
|
| 2506 |
} |
| 2507 |
|
| 2508 |
else |
| 2509 |
{ |
| 2510 |
|
| 2511 |
printf (" v [%2u] h [%2u] s [%2u]: h=%8.4f s=%6.4f v=%6.4f\n", |
| 2512 |
(unsigned) v, |
| 2513 |
(unsigned) h, |
| 2514 |
(unsigned) s, |
| 2515 |
(double) dh, |
| 2516 |
(double) ds, |
| 2517 |
(double) dv); |
| 2518 |
|
| 2519 |
} |
| 2520 |
|
| 2521 |
} |
| 2522 |
|
| 2523 |
else |
| 2524 |
{ |
| 2525 |
|
| 2526 |
skipLines++; |
| 2527 |
|
| 2528 |
} |
| 2529 |
|
| 2530 |
} |
| 2531 |
|
| 2532 |
} |
| 2533 |
|
| 2534 |
} |
| 2535 |
|
| 2536 |
if (skipLines > 0) |
| 2537 |
{ |
| 2538 |
|
| 2539 |
printf (" ... %u more entries\n", (unsigned) skipLines); |
| 2540 |
|
| 2541 |
} |
| 2542 |
|
| 2543 |
} |
| 2544 |
|
| 2545 |
/*****************************************************************************/ |
| 2546 |
|
| 2547 |
#endif |
| 2548 |
|
| 2549 |
/*****************************************************************************/ |
| 2550 |
|
| 2551 |
bool CheckTagType (uint32 parentCode, |
| 2552 |
uint32 tagCode, |
| 2553 |
uint32 tagType, |
| 2554 |
uint16 validType0, |
| 2555 |
uint16 validType1, |
| 2556 |
uint16 validType2, |
| 2557 |
uint16 validType3) |
| 2558 |
{ |
| 2559 |
|
| 2560 |
if (tagType != validType0 && |
| 2561 |
tagType != validType1 && |
| 2562 |
tagType != validType2 && |
| 2563 |
tagType != validType3) |
| 2564 |
{ |
| 2565 |
|
| 2566 |
#if qDNGValidate |
| 2567 |
|
| 2568 |
{ |
| 2569 |
|
| 2570 |
char message [256]; |
| 2571 |
|
| 2572 |
snprintf (message, |
| 2573 |
256, |
| 2574 |
"%s %s has unexpected type (%s)", |
| 2575 |
LookupParentCode (parentCode), |
| 2576 |
LookupTagCode (parentCode, tagCode), |
| 2577 |
LookupTagType (tagType)); |
| 2578 |
|
| 2579 |
ReportWarning (message); |
| 2580 |
|
| 2581 |
} |
| 2582 |
|
| 2583 |
#else |
| 2584 |
|
| 2585 |
(void) parentCode; // Unused |
| 2586 |
(void) tagCode; // Unused |
| 2587 |
|
| 2588 |
#endif |
| 2589 |
|
| 2590 |
return false; |
| 2591 |
|
| 2592 |
} |
| 2593 |
|
| 2594 |
return true; |
| 2595 |
|
| 2596 |
} |
| 2597 |
|
| 2598 |
/*****************************************************************************/ |
| 2599 |
|
| 2600 |
bool CheckTagCount (uint32 parentCode, |
| 2601 |
uint32 tagCode, |
| 2602 |
uint32 tagCount, |
| 2603 |
uint32 minCount, |
| 2604 |
uint32 maxCount) |
| 2605 |
{ |
| 2606 |
|
| 2607 |
if (maxCount < minCount) |
| 2608 |
maxCount = minCount; |
| 2609 |
|
| 2610 |
if (tagCount < minCount || |
| 2611 |
tagCount > maxCount) |
| 2612 |
{ |
| 2613 |
|
| 2614 |
#if qDNGValidate |
| 2615 |
|
| 2616 |
{ |
| 2617 |
|
| 2618 |
char message [256]; |
| 2619 |
|
| 2620 |
snprintf (message, |
| 2621 |
256, |
| 2622 |
"%s %s has unexpected count (%u)", |
| 2623 |
LookupParentCode (parentCode), |
| 2624 |
LookupTagCode (parentCode, tagCode), |
| 2625 |
(unsigned) tagCount); |
| 2626 |
|
| 2627 |
ReportWarning (message); |
| 2628 |
|
| 2629 |
} |
| 2630 |
|
| 2631 |
#else |
| 2632 |
|
| 2633 |
(void) parentCode; // Unused |
| 2634 |
(void) tagCode; // Unused |
| 2635 |
|
| 2636 |
#endif |
| 2637 |
|
| 2638 |
return false; |
| 2639 |
|
| 2640 |
} |
| 2641 |
|
| 2642 |
return true; |
| 2643 |
|
| 2644 |
} |
| 2645 |
|
| 2646 |
/*****************************************************************************/ |
| 2647 |
|
| 2648 |
bool CheckColorImage (uint32 parentCode, |
| 2649 |
uint32 tagCode, |
| 2650 |
uint32 colorPlanes) |
| 2651 |
{ |
| 2652 |
|
| 2653 |
if (colorPlanes == 0) |
| 2654 |
{ |
| 2655 |
|
| 2656 |
#if qDNGValidate |
| 2657 |
|
| 2658 |
{ |
| 2659 |
|
| 2660 |
char message [256]; |
| 2661 |
|
| 2662 |
snprintf (message, |
| 2663 |
256, |
| 2664 |
"%s %s is not allowed with unknown color plane count " |
| 2665 |
" (missing ColorMatrix1 tag?)", |
| 2666 |
LookupParentCode (parentCode), |
| 2667 |
LookupTagCode (parentCode, tagCode)); |
| 2668 |
|
| 2669 |
ReportWarning (message); |
| 2670 |
|
| 2671 |
} |
| 2672 |
|
| 2673 |
#else |
| 2674 |
|
| 2675 |
(void) parentCode; // Unused |
| 2676 |
(void) tagCode; // Unused |
| 2677 |
|
| 2678 |
#endif |
| 2679 |
|
| 2680 |
return false; |
| 2681 |
|
| 2682 |
} |
| 2683 |
|
| 2684 |
if (colorPlanes == 1) |
| 2685 |
{ |
| 2686 |
|
| 2687 |
#if qDNGValidate |
| 2688 |
|
| 2689 |
{ |
| 2690 |
|
| 2691 |
char message [256]; |
| 2692 |
|
| 2693 |
snprintf (message, |
| 2694 |
256, |
| 2695 |
"%s %s is not allowed with monochrome images", |
| 2696 |
LookupParentCode (parentCode), |
| 2697 |
LookupTagCode (parentCode, tagCode)); |
| 2698 |
|
| 2699 |
ReportWarning (message); |
| 2700 |
|
| 2701 |
} |
| 2702 |
|
| 2703 |
#endif |
| 2704 |
|
| 2705 |
return false; |
| 2706 |
|
| 2707 |
} |
| 2708 |
|
| 2709 |
return true; |
| 2710 |
|
| 2711 |
} |
| 2712 |
|
| 2713 |
/*****************************************************************************/ |
| 2714 |
|
| 2715 |
bool CheckMainIFD (uint32 parentCode, |
| 2716 |
uint32 tagCode, |
| 2717 |
uint32 newSubFileType) |
| 2718 |
{ |
| 2719 |
|
| 2720 |
if (newSubFileType != sfMainImage) |
| 2721 |
{ |
| 2722 |
|
| 2723 |
#if qDNGValidate |
| 2724 |
|
| 2725 |
{ |
| 2726 |
|
| 2727 |
char message [256]; |
| 2728 |
|
| 2729 |
snprintf (message, |
| 2730 |
256, |
| 2731 |
"%s %s is not allowed IFDs with NewSubFileType != 0", |
| 2732 |
LookupParentCode (parentCode), |
| 2733 |
LookupTagCode (parentCode, tagCode)); |
| 2734 |
|
| 2735 |
ReportWarning (message); |
| 2736 |
|
| 2737 |
} |
| 2738 |
|
| 2739 |
#else |
| 2740 |
|
| 2741 |
(void) parentCode; // Unused |
| 2742 |
(void) tagCode; // Unused |
| 2743 |
|
| 2744 |
#endif |
| 2745 |
|
| 2746 |
return false; |
| 2747 |
|
| 2748 |
} |
| 2749 |
|
| 2750 |
return true; |
| 2751 |
|
| 2752 |
} |
| 2753 |
|
| 2754 |
/*****************************************************************************/ |
| 2755 |
|
| 2756 |
bool CheckMainOrEnhancedIFD (uint32 parentCode, |
| 2757 |
uint32 tagCode, |
| 2758 |
uint32 newSubFileType) |
| 2759 |
{ |
| 2760 |
|
| 2761 |
if (newSubFileType != sfMainImage && |
| 2762 |
newSubFileType != sfEnhancedImage) |
| 2763 |
{ |
| 2764 |
|
| 2765 |
#if qDNGValidate |
| 2766 |
|
| 2767 |
{ |
| 2768 |
|
| 2769 |
char message [256]; |
| 2770 |
|
| 2771 |
snprintf (message, |
| 2772 |
256, |
| 2773 |
"%s %s is not allowed IFDs with NewSubFileType != 0", |
| 2774 |
LookupParentCode (parentCode), |
| 2775 |
LookupTagCode (parentCode, tagCode)); |
| 2776 |
|
| 2777 |
ReportWarning (message); |
| 2778 |
|
| 2779 |
} |
| 2780 |
|
| 2781 |
#else |
| 2782 |
|
| 2783 |
(void) parentCode; // Unused |
| 2784 |
(void) tagCode; // Unused |
| 2785 |
|
| 2786 |
#endif |
| 2787 |
|
| 2788 |
return false; |
| 2789 |
|
| 2790 |
} |
| 2791 |
|
| 2792 |
return true; |
| 2793 |
|
| 2794 |
} |
| 2795 |
|
| 2796 |
/*****************************************************************************/ |
| 2797 |
|
| 2798 |
bool CheckRawIFD (uint32 parentCode, |
| 2799 |
uint32 tagCode, |
| 2800 |
uint32 photometricInterpretation) |
| 2801 |
{ |
| 2802 |
|
| 2803 |
if (photometricInterpretation != piCFA && |
| 2804 |
photometricInterpretation != piLinearRaw) |
| 2805 |
{ |
| 2806 |
|
| 2807 |
#if qDNGValidate |
| 2808 |
|
| 2809 |
{ |
| 2810 |
|
| 2811 |
char message [256]; |
| 2812 |
|
| 2813 |
snprintf (message, |
| 2814 |
256, |
| 2815 |
"%s %s is not allowed in IFDs with a non-raw PhotometricInterpretation", |
| 2816 |
LookupParentCode (parentCode), |
| 2817 |
LookupTagCode (parentCode, tagCode)); |
| 2818 |
|
| 2819 |
ReportWarning (message); |
| 2820 |
|
| 2821 |
} |
| 2822 |
|
| 2823 |
#else |
| 2824 |
|
| 2825 |
(void) parentCode; // Unused |
| 2826 |
(void) tagCode; // Unused |
| 2827 |
|
| 2828 |
#endif |
| 2829 |
|
| 2830 |
return false; |
| 2831 |
|
| 2832 |
} |
| 2833 |
|
| 2834 |
return true; |
| 2835 |
|
| 2836 |
} |
| 2837 |
|
| 2838 |
/*****************************************************************************/ |
| 2839 |
|
| 2840 |
bool CheckCFA (uint32 parentCode, |
| 2841 |
uint32 tagCode, |
| 2842 |
uint32 photometricInterpretation) |
| 2843 |
{ |
| 2844 |
|
| 2845 |
if (photometricInterpretation != piCFA) |
| 2846 |
{ |
| 2847 |
|
| 2848 |
#if qDNGValidate |
| 2849 |
|
| 2850 |
{ |
| 2851 |
|
| 2852 |
char message [256]; |
| 2853 |
|
| 2854 |
snprintf (message, |
| 2855 |
256, |
| 2856 |
"%s %s is not allowed in IFDs with a non-CFA PhotometricInterpretation", |
| 2857 |
LookupParentCode (parentCode), |
| 2858 |
LookupTagCode (parentCode, tagCode)); |
| 2859 |
|
| 2860 |
ReportWarning (message); |
| 2861 |
|
| 2862 |
} |
| 2863 |
|
| 2864 |
#else |
| 2865 |
|
| 2866 |
(void) parentCode; // Unused |
| 2867 |
(void) tagCode; // Unused |
| 2868 |
|
| 2869 |
#endif |
| 2870 |
|
| 2871 |
return false; |
| 2872 |
|
| 2873 |
} |
| 2874 |
|
| 2875 |
return true; |
| 2876 |
|
| 2877 |
} |
| 2878 |
|
| 2879 |
/*****************************************************************************/ |
| 2880 |
|
| 2881 |
void ParseStringTag (dng_stream &stream, |
| 2882 |
uint32 parentCode, |
| 2883 |
uint32 tagCode, |
| 2884 |
uint32 tagCount, |
| 2885 |
dng_string &s, |
| 2886 |
bool trimBlanks) |
| 2887 |
{ |
| 2888 |
|
| 2889 |
if (tagCount == 0 || |
| 2890 |
tagCount == 0xFFFFFFFF) |
| 2891 |
{ |
| 2892 |
|
| 2893 |
s.Clear (); |
| 2894 |
|
| 2895 |
return; |
| 2896 |
|
| 2897 |
} |
| 2898 |
|
| 2899 |
dng_memory_data temp_buffer (tagCount + 1); |
| 2900 |
|
| 2901 |
char *buffer = temp_buffer.Buffer_char (); |
| 2902 |
|
| 2903 |
stream.Get (buffer, tagCount); |
| 2904 |
|
| 2905 |
// Make sure the string is null terminated. |
| 2906 |
|
| 2907 |
if (buffer [tagCount - 1] != 0) |
| 2908 |
{ |
| 2909 |
|
| 2910 |
buffer [tagCount] = 0; |
| 2911 |
|
| 2912 |
#if qDNGValidate |
| 2913 |
|
| 2914 |
{ |
| 2915 |
|
| 2916 |
bool hasNull = false; |
| 2917 |
|
| 2918 |
for (uint32 j = 0; j < tagCount; j++) |
| 2919 |
{ |
| 2920 |
|
| 2921 |
if (buffer [j] == 0) |
| 2922 |
{ |
| 2923 |
|
| 2924 |
hasNull = true; |
| 2925 |
|
| 2926 |
break; |
| 2927 |
|
| 2928 |
} |
| 2929 |
|
| 2930 |
} |
| 2931 |
|
| 2932 |
if (!hasNull && parentCode < tcFirstMakerNoteIFD) |
| 2933 |
{ |
| 2934 |
|
| 2935 |
char message [256]; |
| 2936 |
|
| 2937 |
snprintf (message, |
| 2938 |
256, |
| 2939 |
"%s %s is not NULL terminated", |
| 2940 |
LookupParentCode (parentCode), |
| 2941 |
LookupTagCode (parentCode, tagCode)); |
| 2942 |
|
| 2943 |
ReportWarning (message); |
| 2944 |
|
| 2945 |
} |
| 2946 |
|
| 2947 |
} |
| 2948 |
|
| 2949 |
#else |
| 2950 |
|
| 2951 |
(void) parentCode; // Unused |
| 2952 |
(void) tagCode; // Unused |
| 2953 |
|
| 2954 |
#endif |
| 2955 |
|
| 2956 |
} |
| 2957 |
|
| 2958 |
// Medata working group - Allow UTF-8 |
| 2959 |
|
| 2960 |
s.Set_UTF8_or_System (buffer); |
| 2961 |
|
| 2962 |
if (trimBlanks) |
| 2963 |
{ |
| 2964 |
|
| 2965 |
s.TrimTrailingBlanks (); |
| 2966 |
|
| 2967 |
} |
| 2968 |
|
| 2969 |
} |
| 2970 |
|
| 2971 |
/*****************************************************************************/ |
| 2972 |
|
| 2973 |
void ParseDualStringTag (dng_stream &stream, |
| 2974 |
uint32 parentCode, |
| 2975 |
uint32 tagCode, |
| 2976 |
uint32 tagCount, |
| 2977 |
dng_string &s1, |
| 2978 |
dng_string &s2) |
| 2979 |
{ |
| 2980 |
|
| 2981 |
if (tagCount == 0 || |
| 2982 |
tagCount == 0xFFFFFFFF) |
| 2983 |
{ |
| 2984 |
|
| 2985 |
s1.Clear (); |
| 2986 |
s2.Clear (); |
| 2987 |
|
| 2988 |
return; |
| 2989 |
|
| 2990 |
} |
| 2991 |
|
| 2992 |
dng_memory_data temp_buffer (tagCount + 1); |
| 2993 |
|
| 2994 |
char *buffer = temp_buffer.Buffer_char (); |
| 2995 |
|
| 2996 |
stream.Get (buffer, tagCount); |
| 2997 |
|
| 2998 |
// Make sure the string is null terminated. |
| 2999 |
|
| 3000 |
if (buffer [tagCount - 1] != 0) |
| 3001 |
{ |
| 3002 |
|
| 3003 |
buffer [tagCount] = 0; |
| 3004 |
|
| 3005 |
#if qDNGValidate |
| 3006 |
|
| 3007 |
{ |
| 3008 |
|
| 3009 |
uint32 nullCount = 0; |
| 3010 |
|
| 3011 |
for (uint32 j = 0; j < tagCount; j++) |
| 3012 |
{ |
| 3013 |
|
| 3014 |
if (buffer [j] == 0) |
| 3015 |
{ |
| 3016 |
|
| 3017 |
nullCount++; |
| 3018 |
|
| 3019 |
} |
| 3020 |
|
| 3021 |
} |
| 3022 |
|
| 3023 |
if (nullCount < 2 && parentCode < tcFirstMakerNoteIFD) |
| 3024 |
{ |
| 3025 |
|
| 3026 |
char message [256]; |
| 3027 |
|
| 3028 |
snprintf (message, |
| 3029 |
256, |
| 3030 |
"%s %s is not NULL terminated", |
| 3031 |
LookupParentCode (parentCode), |
| 3032 |
LookupTagCode (parentCode, tagCode)); |
| 3033 |
|
| 3034 |
ReportWarning (message); |
| 3035 |
|
| 3036 |
} |
| 3037 |
|
| 3038 |
} |
| 3039 |
|
| 3040 |
#else |
| 3041 |
|
| 3042 |
(void) parentCode; // Unused |
| 3043 |
(void) tagCode; // Unused |
| 3044 |
|
| 3045 |
#endif |
| 3046 |
|
| 3047 |
} |
| 3048 |
|
| 3049 |
// Medata working group - Allow UTF-8 |
| 3050 |
|
| 3051 |
s1.Set_UTF8_or_System (buffer); |
| 3052 |
|
| 3053 |
s2.Set_ASCII (NULL); |
| 3054 |
|
| 3055 |
for (uint32 j = 1; j < tagCount - 1; j++) |
| 3056 |
{ |
| 3057 |
|
| 3058 |
if (buffer [j - 1] != 0 && |
| 3059 |
buffer [j ] == 0) |
| 3060 |
{ |
| 3061 |
|
| 3062 |
// Medata working group - Allow UTF-8 |
| 3063 |
|
| 3064 |
s2.Set_UTF8_or_System (buffer + j + 1); |
| 3065 |
|
| 3066 |
break; |
| 3067 |
|
| 3068 |
} |
| 3069 |
|
| 3070 |
} |
| 3071 |
|
| 3072 |
s1.TrimTrailingBlanks (); |
| 3073 |
s2.TrimTrailingBlanks (); |
| 3074 |
|
| 3075 |
} |
| 3076 |
|
| 3077 |
/*****************************************************************************/ |
| 3078 |
|
| 3079 |
void ParseEncodedStringTag (dng_stream &stream, |
| 3080 |
uint32 parentCode, |
| 3081 |
uint32 tagCode, |
| 3082 |
uint32 tagCount, |
| 3083 |
dng_string &s) |
| 3084 |
{ |
| 3085 |
|
| 3086 |
if (tagCount < 8) |
| 3087 |
{ |
| 3088 |
|
| 3089 |
#if qDNGValidate |
| 3090 |
|
| 3091 |
{ |
| 3092 |
|
| 3093 |
char message [256]; |
| 3094 |
|
| 3095 |
snprintf (message, |
| 3096 |
256, |
| 3097 |
"%s %s has unexpected count (%u)", |
| 3098 |
LookupParentCode (parentCode), |
| 3099 |
LookupTagCode (parentCode, tagCode), |
| 3100 |
(unsigned) tagCount); |
| 3101 |
|
| 3102 |
ReportWarning (message); |
| 3103 |
|
| 3104 |
} |
| 3105 |
|
| 3106 |
#else |
| 3107 |
|
| 3108 |
(void) parentCode; // Unused |
| 3109 |
(void) tagCode; // Unused |
| 3110 |
|
| 3111 |
#endif |
| 3112 |
|
| 3113 |
s.Clear (); |
| 3114 |
|
| 3115 |
return; |
| 3116 |
|
| 3117 |
} |
| 3118 |
|
| 3119 |
char label [8]; |
| 3120 |
|
| 3121 |
stream.Get (label, 8); |
| 3122 |
|
| 3123 |
// Sometimes lowercase is used by mistake. Accept this, but issue |
| 3124 |
// warning. |
| 3125 |
|
| 3126 |
{ |
| 3127 |
|
| 3128 |
#if qDNGValidate |
| 3129 |
|
| 3130 |
bool hadLower = false; |
| 3131 |
|
| 3132 |
#endif |
| 3133 |
|
| 3134 |
for (uint32 j = 0; j < 8; j++) |
| 3135 |
{ |
| 3136 |
|
| 3137 |
if (label [j] >= 'a' && label [j] <= 'z') |
| 3138 |
{ |
| 3139 |
|
| 3140 |
label [j] = 'A' + (label [j] - 'a'); |
| 3141 |
|
| 3142 |
#if qDNGValidate |
| 3143 |
|
| 3144 |
hadLower = true; |
| 3145 |
|
| 3146 |
#endif |
| 3147 |
|
| 3148 |
} |
| 3149 |
|
| 3150 |
} |
| 3151 |
|
| 3152 |
#if qDNGValidate |
| 3153 |
|
| 3154 |
if (hadLower) |
| 3155 |
{ |
| 3156 |
|
| 3157 |
char message [256]; |
| 3158 |
|
| 3159 |
snprintf (message, |
| 3160 |
256, |
| 3161 |
"%s %s text encoding label not all uppercase", |
| 3162 |
LookupParentCode (parentCode), |
| 3163 |
LookupTagCode (parentCode, tagCode)); |
| 3164 |
|
| 3165 |
ReportWarning (message); |
| 3166 |
|
| 3167 |
} |
| 3168 |
|
| 3169 |
#endif |
| 3170 |
|
| 3171 |
} |
| 3172 |
|
| 3173 |
if (memcmp (label, "UNICODE\000", 8) == 0) |
| 3174 |
{ |
| 3175 |
|
| 3176 |
uint32 uChars = (tagCount - 8) >> 1; |
| 3177 |
|
| 3178 |
dng_memory_data temp_buffer ((uChars + 1) * 2); |
| 3179 |
|
| 3180 |
uint16 *buffer = temp_buffer.Buffer_uint16 (); |
| 3181 |
|
| 3182 |
for (uint32 j = 0; j < uChars; j++) |
| 3183 |
{ |
| 3184 |
|
| 3185 |
buffer [j] = stream.Get_uint16 (); |
| 3186 |
|
| 3187 |
} |
| 3188 |
|
| 3189 |
buffer [uChars] = 0; |
| 3190 |
|
| 3191 |
#if qDNGValidate |
| 3192 |
|
| 3193 |
{ |
| 3194 |
|
| 3195 |
// If the writer used UTF-8 rather than UTF-16, and padded |
| 3196 |
// the string with blanks, then there will be lots of 0x2020 |
| 3197 |
// (unicode dagger symbol) characters in the string. |
| 3198 |
|
| 3199 |
uint32 count2020 = 0; |
| 3200 |
|
| 3201 |
for (uint32 k = 0; buffer [k] != 0; k++) |
| 3202 |
{ |
| 3203 |
|
| 3204 |
if (buffer [k] == 0x2020) |
| 3205 |
{ |
| 3206 |
|
| 3207 |
count2020++; |
| 3208 |
|
| 3209 |
} |
| 3210 |
|
| 3211 |
} |
| 3212 |
|
| 3213 |
if (count2020 > 1) |
| 3214 |
{ |
| 3215 |
|
| 3216 |
char message [256]; |
| 3217 |
|
| 3218 |
snprintf (message, |
| 3219 |
256, |
| 3220 |
"%s %s text appears to be UTF-8 rather than UTF-16", |
| 3221 |
LookupParentCode (parentCode), |
| 3222 |
LookupTagCode (parentCode, tagCode)); |
| 3223 |
|
| 3224 |
ReportWarning (message); |
| 3225 |
|
| 3226 |
} |
| 3227 |
|
| 3228 |
} |
| 3229 |
|
| 3230 |
#endif |
| 3231 |
|
| 3232 |
s.Set_UTF16 (buffer); |
| 3233 |
|
| 3234 |
} |
| 3235 |
|
| 3236 |
else |
| 3237 |
{ |
| 3238 |
|
| 3239 |
uint32 aChars = tagCount - 8; |
| 3240 |
|
| 3241 |
dng_memory_data temp_buffer (aChars + 1); |
| 3242 |
|
| 3243 |
char *buffer = temp_buffer.Buffer_char (); |
| 3244 |
|
| 3245 |
stream.Get (buffer, aChars); |
| 3246 |
|
| 3247 |
buffer [aChars] = 0; |
| 3248 |
|
| 3249 |
enum dng_encoding |
| 3250 |
{ |
| 3251 |
dng_encoding_ascii, |
| 3252 |
dng_encoding_jis_x208_1990, |
| 3253 |
dng_encoding_unknown |
| 3254 |
}; |
| 3255 |
|
| 3256 |
dng_encoding encoding = dng_encoding_unknown; |
| 3257 |
|
| 3258 |
if (memcmp (label, "ASCII\000\000\000", 8) == 0) |
| 3259 |
{ |
| 3260 |
|
| 3261 |
encoding = dng_encoding_ascii; |
| 3262 |
|
| 3263 |
} |
| 3264 |
|
| 3265 |
else if (memcmp (label, "JIS\000\000\000\000\000\000", 8) == 0) |
| 3266 |
{ |
| 3267 |
|
| 3268 |
encoding = dng_encoding_jis_x208_1990; |
| 3269 |
|
| 3270 |
} |
| 3271 |
|
| 3272 |
else |
| 3273 |
{ |
| 3274 |
|
| 3275 |
// Some Nikon D1 files have UserComment tags with zero encoding bits and |
| 3276 |
// garbage text values. So don't try to parse tags with unknown text |
| 3277 |
// encoding unless all the characters are printing ASCII. |
| 3278 |
|
| 3279 |
#if qDNGValidate |
| 3280 |
|
| 3281 |
if (memcmp (label, "\000\000\000\000\000\000\000\000\000", 8) == 0) |
| 3282 |
{ |
| 3283 |
|
| 3284 |
// Many camera makes store null tags with all zero encoding, so |
| 3285 |
// don't report a warning message for null strings. |
| 3286 |
|
| 3287 |
if (buffer [0] != 0) |
| 3288 |
{ |
| 3289 |
|
| 3290 |
char message [256]; |
| 3291 |
|
| 3292 |
snprintf (message, |
| 3293 |
256, |
| 3294 |
"%s %s has unknown encoding", |
| 3295 |
LookupParentCode (parentCode), |
| 3296 |
LookupTagCode (parentCode, tagCode)); |
| 3297 |
|
| 3298 |
ReportWarning (message); |
| 3299 |
|
| 3300 |
} |
| 3301 |
|
| 3302 |
} |
| 3303 |
|
| 3304 |
else |
| 3305 |
{ |
| 3306 |
|
| 3307 |
char message [256]; |
| 3308 |
|
| 3309 |
snprintf (message, |
| 3310 |
256, |
| 3311 |
"%s %s has unexpected text encoding", |
| 3312 |
LookupParentCode (parentCode), |
| 3313 |
LookupTagCode (parentCode, tagCode)); |
| 3314 |
|
| 3315 |
ReportWarning (message); |
| 3316 |
|
| 3317 |
} |
| 3318 |
|
| 3319 |
#endif |
| 3320 |
|
| 3321 |
} |
| 3322 |
|
| 3323 |
// If text encoding was unknown, and the text is anything |
| 3324 |
// other than pure ASCII, then ignore it. |
| 3325 |
|
| 3326 |
if (encoding == dng_encoding_unknown) |
| 3327 |
{ |
| 3328 |
|
| 3329 |
encoding = dng_encoding_ascii; |
| 3330 |
|
| 3331 |
for (uint32 i = 0; i < aChars && buffer [i] != 0; i++) |
| 3332 |
{ |
| 3333 |
|
| 3334 |
if (buffer [i] < ' ' || |
| 3335 |
buffer [i] > '~') |
| 3336 |
{ |
| 3337 |
|
| 3338 |
buffer [0] = 0; |
| 3339 |
|
| 3340 |
break; |
| 3341 |
|
| 3342 |
} |
| 3343 |
|
| 3344 |
} |
| 3345 |
|
| 3346 |
} |
| 3347 |
|
| 3348 |
switch (encoding) |
| 3349 |
{ |
| 3350 |
|
| 3351 |
case dng_encoding_ascii: |
| 3352 |
{ |
| 3353 |
|
| 3354 |
// Medata working group - allow UTF-8 for ASCII tags. |
| 3355 |
|
| 3356 |
s.Set_UTF8_or_System (buffer); |
| 3357 |
|
| 3358 |
break; |
| 3359 |
|
| 3360 |
} |
| 3361 |
|
| 3362 |
case dng_encoding_jis_x208_1990: |
| 3363 |
{ |
| 3364 |
s.Set_JIS_X208_1990 (buffer); |
| 3365 |
break; |
| 3366 |
} |
| 3367 |
|
| 3368 |
case dng_encoding_unknown: |
| 3369 |
{ |
| 3370 |
s.Set_SystemEncoding (buffer); |
| 3371 |
break; |
| 3372 |
} |
| 3373 |
|
| 3374 |
default: |
| 3375 |
break; |
| 3376 |
|
| 3377 |
} |
| 3378 |
|
| 3379 |
#if qDNGValidate |
| 3380 |
|
| 3381 |
{ |
| 3382 |
|
| 3383 |
if (encoding == dng_encoding_ascii && !s.IsASCII ()) |
| 3384 |
{ |
| 3385 |
|
| 3386 |
char message [256]; |
| 3387 |
|
| 3388 |
snprintf (message, |
| 3389 |
256, |
| 3390 |
"%s %s has non-ASCII characters", |
| 3391 |
LookupParentCode (parentCode), |
| 3392 |
LookupTagCode (parentCode, tagCode)); |
| 3393 |
|
| 3394 |
ReportWarning (message); |
| 3395 |
|
| 3396 |
} |
| 3397 |
|
| 3398 |
} |
| 3399 |
|
| 3400 |
#endif |
| 3401 |
|
| 3402 |
} |
| 3403 |
|
| 3404 |
s.TrimTrailingBlanks (); |
| 3405 |
|
| 3406 |
} |
| 3407 |
|
| 3408 |
/*****************************************************************************/ |
| 3409 |
|
| 3410 |
bool ParseMatrixTag (dng_stream &stream, |
| 3411 |
uint32 parentCode, |
| 3412 |
uint32 tagCode, |
| 3413 |
uint32 tagType, |
| 3414 |
uint32 tagCount, |
| 3415 |
uint32 rows, |
| 3416 |
uint32 cols, |
| 3417 |
dng_matrix &m) |
| 3418 |
{ |
| 3419 |
|
| 3420 |
if (CheckTagCount (parentCode, tagCode, tagCount, rows * cols)) |
| 3421 |
{ |
| 3422 |
|
| 3423 |
dng_matrix temp (rows, cols); |
| 3424 |
|
| 3425 |
for (uint32 row = 0; row < rows; row++) |
| 3426 |
for (uint32 col = 0; col < cols; col++) |
| 3427 |
{ |
| 3428 |
|
| 3429 |
temp [row] [col] = stream.TagValue_real64 (tagType); |
| 3430 |
|
| 3431 |
} |
| 3432 |
|
| 3433 |
m = temp; |
| 3434 |
|
| 3435 |
return true; |
| 3436 |
|
| 3437 |
} |
| 3438 |
|
| 3439 |
return false; |
| 3440 |
|
| 3441 |
} |
| 3442 |
|
| 3443 |
/*****************************************************************************/ |
| 3444 |
|
| 3445 |
bool ParseVectorTag (dng_stream &stream, |
| 3446 |
uint32 parentCode, |
| 3447 |
uint32 tagCode, |
| 3448 |
uint32 tagType, |
| 3449 |
uint32 tagCount, |
| 3450 |
uint32 count, |
| 3451 |
dng_vector &v) |
| 3452 |
{ |
| 3453 |
|
| 3454 |
if (CheckTagCount (parentCode, tagCode, tagCount, count)) |
| 3455 |
{ |
| 3456 |
|
| 3457 |
dng_vector temp (count); |
| 3458 |
|
| 3459 |
for (uint32 index = 0; index < count; index++) |
| 3460 |
{ |
| 3461 |
|
| 3462 |
temp [index] = stream.TagValue_real64 (tagType); |
| 3463 |
|
| 3464 |
} |
| 3465 |
|
| 3466 |
v = temp; |
| 3467 |
|
| 3468 |
return true; |
| 3469 |
|
| 3470 |
} |
| 3471 |
|
| 3472 |
return false; |
| 3473 |
|
| 3474 |
} |
| 3475 |
|
| 3476 |
/*****************************************************************************/ |
| 3477 |
|
| 3478 |
bool ParseDateTimeTag (dng_stream &stream, |
| 3479 |
uint32 parentCode, |
| 3480 |
uint32 tagCode, |
| 3481 |
uint32 tagType, |
| 3482 |
uint32 tagCount, |
| 3483 |
dng_date_time &dt) |
| 3484 |
{ |
| 3485 |
|
| 3486 |
if (!CheckTagType (parentCode, tagCode, tagType, ttAscii)) |
| 3487 |
{ |
| 3488 |
return false; |
| 3489 |
} |
| 3490 |
|
| 3491 |
// Kludge: Some versions of PaintShop Pro write these fields |
| 3492 |
// with a length of 21 rather than 20. Otherwise they are |
| 3493 |
// correctly formatted. So relax this test and allow these |
| 3494 |
// these longer than standard tags to be parsed. |
| 3495 |
|
| 3496 |
(void) CheckTagCount (parentCode, tagCode, tagCount, 20); |
| 3497 |
|
| 3498 |
if (tagCount < 20) |
| 3499 |
{ |
| 3500 |
return false; |
| 3501 |
} |
| 3502 |
|
| 3503 |
char s [21]; |
| 3504 |
|
| 3505 |
stream.Get (s, 20); |
| 3506 |
|
| 3507 |
s [20] = 0; |
| 3508 |
|
| 3509 |
// See if this is a valid date/time string. |
| 3510 |
|
| 3511 |
if (dt.Parse (s)) |
| 3512 |
{ |
| 3513 |
return true; |
| 3514 |
} |
| 3515 |
|
| 3516 |
// Accept strings that contain only blanks, colons, and zeros as |
| 3517 |
// valid "null" dates. |
| 3518 |
|
| 3519 |
dt = dng_date_time (); |
| 3520 |
|
| 3521 |
for (uint32 index = 0; index < 21; index++) |
| 3522 |
{ |
| 3523 |
|
| 3524 |
char c = s [index]; |
| 3525 |
|
| 3526 |
if (c == 0) |
| 3527 |
{ |
| 3528 |
return true; |
| 3529 |
} |
| 3530 |
|
| 3531 |
if (c != ' ' && c != ':' && c != '0') |
| 3532 |
{ |
| 3533 |
|
| 3534 |
#if qDNGValidate |
| 3535 |
|
| 3536 |
{ |
| 3537 |
|
| 3538 |
char message [256]; |
| 3539 |
|
| 3540 |
snprintf (message, |
| 3541 |
256, |
| 3542 |
"%s %s is not a valid date/time", |
| 3543 |
LookupParentCode (parentCode), |
| 3544 |
LookupTagCode (parentCode, tagCode)); |
| 3545 |
|
| 3546 |
ReportWarning (message); |
| 3547 |
|
| 3548 |
} |
| 3549 |
|
| 3550 |
#endif |
| 3551 |
|
| 3552 |
return false; |
| 3553 |
|
| 3554 |
} |
| 3555 |
|
| 3556 |
} |
| 3557 |
|
| 3558 |
return false; |
| 3559 |
|
| 3560 |
} |
| 3561 |
|
| 3562 |
/*****************************************************************************/ |