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