| 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 |
#ifndef __dng_parse_utils__ |
| 10 |
#define __dng_parse_utils__ |
| 11 |
|
| 12 |
/*****************************************************************************/ |
| 13 |
|
| 14 |
#include "dng_classes.h" |
| 15 |
#include "dng_flags.h" |
| 16 |
#include "dng_types.h" |
| 17 |
#include "dng_stream.h" |
| 18 |
#include "dng_string.h" |
| 19 |
#include "dng_matrix.h" |
| 20 |
|
| 21 |
/*****************************************************************************/ |
| 22 |
|
| 23 |
#if qDNGValidate || qDNGDebug |
| 24 |
|
| 25 |
/*****************************************************************************/ |
| 26 |
|
| 27 |
const char * LookupParentCode (uint32 parentCode); |
| 28 |
|
| 29 |
/*****************************************************************************/ |
| 30 |
|
| 31 |
const char * LookupTagCode (uint32 parentCode, |
| 32 |
uint32 tagCode); |
| 33 |
|
| 34 |
/*****************************************************************************/ |
| 35 |
|
| 36 |
const char * LookupTagType (uint32 tagType); |
| 37 |
|
| 38 |
/*****************************************************************************/ |
| 39 |
|
| 40 |
const char * LookupNewSubFileType (uint32 key); |
| 41 |
|
| 42 |
const char * LookupCompression (uint32 key); |
| 43 |
|
| 44 |
const char * LookupPredictor (uint32 key); |
| 45 |
|
| 46 |
const char * LookupSampleFormat (uint32 key); |
| 47 |
|
| 48 |
const char * LookupPhotometricInterpretation (uint32 key); |
| 49 |
|
| 50 |
const char * LookupOrientation (uint32 key); |
| 51 |
|
| 52 |
const char * LookupResolutionUnit (uint32 key); |
| 53 |
|
| 54 |
const char * LookupCFAColor (uint32 key); |
| 55 |
|
| 56 |
const char * LookupSensingMethod (uint32 key); |
| 57 |
|
| 58 |
const char * LookupExposureProgram (uint32 key); |
| 59 |
|
| 60 |
const char * LookupMeteringMode (uint32 key); |
| 61 |
|
| 62 |
const char * LookupLightSource (uint32 key); |
| 63 |
|
| 64 |
const char * LookupColorSpace (uint32 key); |
| 65 |
|
| 66 |
const char * LookupFileSource (uint32 key); |
| 67 |
|
| 68 |
const char * LookupSceneType (uint32 key); |
| 69 |
|
| 70 |
const char * LookupCustomRendered (uint32 key); |
| 71 |
|
| 72 |
const char * LookupExposureMode (uint32 key); |
| 73 |
|
| 74 |
const char * LookupWhiteBalance (uint32 key); |
| 75 |
|
| 76 |
const char * LookupSceneCaptureType (uint32 key); |
| 77 |
|
| 78 |
const char * LookupGainControl (uint32 key); |
| 79 |
|
| 80 |
const char * LookupContrast (uint32 key); |
| 81 |
|
| 82 |
const char * LookupSaturation (uint32 key); |
| 83 |
|
| 84 |
const char * LookupSharpness (uint32 key); |
| 85 |
|
| 86 |
const char * LookupSubjectDistanceRange (uint32 key); |
| 87 |
|
| 88 |
const char * LookupComponent (uint32 key); |
| 89 |
|
| 90 |
const char * LookupCFALayout (uint32 key); |
| 91 |
|
| 92 |
const char * LookupMakerNoteSafety (uint32 key); |
| 93 |
|
| 94 |
const char * LookupColorimetricReference (uint32 key); |
| 95 |
|
| 96 |
const char * LookupPreviewColorSpace (uint32 key); |
| 97 |
|
| 98 |
const char * LookupJPEGMarker (uint32 key); |
| 99 |
|
| 100 |
const char * LookupSensitivityType (uint32 key); |
| 101 |
|
| 102 |
const char * LookupDepthFormat (uint32 key); |
| 103 |
|
| 104 |
const char * LookupDepthUnits (uint32 key); |
| 105 |
|
| 106 |
const char * LookupDepthMeasureType (uint32 key); |
| 107 |
|
| 108 |
/*****************************************************************************/ |
| 109 |
|
| 110 |
void DumpHexAscii (dng_stream &stream, |
| 111 |
uint32 count); |
| 112 |
|
| 113 |
void DumpHexAscii (const uint8 *buf, |
| 114 |
uint32 count); |
| 115 |
|
| 116 |
void DumpXMP (dng_stream &stream, |
| 117 |
uint32 count); |
| 118 |
|
| 119 |
void DumpString (const dng_string &s); |
| 120 |
|
| 121 |
void DumpTagValues (dng_stream &stream, |
| 122 |
const char *entry_name, |
| 123 |
uint32 parentCode, |
| 124 |
uint32 tagCode, |
| 125 |
uint32 tagType, |
| 126 |
uint32 tagCount, |
| 127 |
const char *tag_name = NULL); |
| 128 |
|
| 129 |
void DumpMatrix (const dng_matrix &m); |
| 130 |
|
| 131 |
void DumpVector (const dng_vector &v); |
| 132 |
|
| 133 |
void DumpDateTime (const dng_date_time &dt); |
| 134 |
|
| 135 |
void DumpExposureTime (real64 x); |
| 136 |
|
| 137 |
void DumpFingerprint (const dng_fingerprint &p); |
| 138 |
|
| 139 |
void DumpHueSatMap (dng_stream &stream, |
| 140 |
uint32 hues, |
| 141 |
uint32 sats, |
| 142 |
uint32 vals, |
| 143 |
bool skipSat0); |
| 144 |
|
| 145 |
/*****************************************************************************/ |
| 146 |
|
| 147 |
#endif |
| 148 |
|
| 149 |
/*****************************************************************************/ |
| 150 |
|
| 151 |
bool CheckTagType (uint32 parentCode, |
| 152 |
uint32 tagCode, |
| 153 |
uint32 tagType, |
| 154 |
uint16 validType0, |
| 155 |
uint16 validType1 = 0, |
| 156 |
uint16 validType2 = 0, |
| 157 |
uint16 validType3 = 0); |
| 158 |
|
| 159 |
bool CheckTagCount (uint32 parentCode, |
| 160 |
uint32 tagCode, |
| 161 |
uint32 tagCount, |
| 162 |
uint32 minCount, |
| 163 |
uint32 maxCount = 0); |
| 164 |
|
| 165 |
bool CheckColorImage (uint32 parentCode, |
| 166 |
uint32 tagCode, |
| 167 |
uint32 colorPlanes); |
| 168 |
|
| 169 |
bool CheckMainIFD (uint32 parentCode, |
| 170 |
uint32 tagCode, |
| 171 |
uint32 newSubFileType); |
| 172 |
|
| 173 |
bool CheckMainOrEnhancedIFD (uint32 parentCode, |
| 174 |
uint32 tagCode, |
| 175 |
uint32 newSubFileType); |
| 176 |
|
| 177 |
bool CheckRawIFD (uint32 parentCode, |
| 178 |
uint32 tagCode, |
| 179 |
uint32 photometricInterpretation); |
| 180 |
|
| 181 |
bool CheckCFA (uint32 parentCode, |
| 182 |
uint32 tagCode, |
| 183 |
uint32 photometricInterpretation); |
| 184 |
|
| 185 |
/*****************************************************************************/ |
| 186 |
|
| 187 |
void ParseStringTag (dng_stream &stream, |
| 188 |
uint32 parentCode, |
| 189 |
uint32 tagCode, |
| 190 |
uint32 tagCount, |
| 191 |
dng_string &s, |
| 192 |
bool trimBlanks = true); |
| 193 |
|
| 194 |
void ParseDualStringTag (dng_stream &stream, |
| 195 |
uint32 parentCode, |
| 196 |
uint32 tagCode, |
| 197 |
uint32 tagCount, |
| 198 |
dng_string &s1, |
| 199 |
dng_string &s2); |
| 200 |
|
| 201 |
void ParseEncodedStringTag (dng_stream &stream, |
| 202 |
uint32 parentCode, |
| 203 |
uint32 tagCode, |
| 204 |
uint32 tagCount, |
| 205 |
dng_string &s); |
| 206 |
|
| 207 |
bool ParseMatrixTag (dng_stream &stream, |
| 208 |
uint32 parentCode, |
| 209 |
uint32 tagCode, |
| 210 |
uint32 tagType, |
| 211 |
uint32 tagCount, |
| 212 |
uint32 rows, |
| 213 |
uint32 cols, |
| 214 |
dng_matrix &m); |
| 215 |
|
| 216 |
bool ParseVectorTag (dng_stream &stream, |
| 217 |
uint32 parentCode, |
| 218 |
uint32 tagCode, |
| 219 |
uint32 tagType, |
| 220 |
uint32 tagCount, |
| 221 |
uint32 count, |
| 222 |
dng_vector &v); |
| 223 |
|
| 224 |
bool ParseDateTimeTag (dng_stream &stream, |
| 225 |
uint32 parentCode, |
| 226 |
uint32 tagCode, |
| 227 |
uint32 tagType, |
| 228 |
uint32 tagCount, |
| 229 |
dng_date_time &dt); |
| 230 |
|
| 231 |
/*****************************************************************************/ |
| 232 |
|
| 233 |
#endif |
| 234 |
|
| 235 |
/*****************************************************************************/ |