summaryrefslogtreecommitdiff
path: root/source/dng_parse_utils.h
blob: 89a082f12ed1260a76e0580ace98d22ba41c2c71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/*****************************************************************************/
// Copyright 2006-2007 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE:  Adobe permits you to use, modify, and distribute this file in
// accordance with the terms of the Adobe license agreement accompanying it.
/*****************************************************************************/

/* $Id: //mondo/dng_sdk_1_4/dng_sdk/source/dng_parse_utils.h#1 $ */ 
/* $DateTime: 2012/05/30 13:28:51 $ */
/* $Change: 832332 $ */
/* $Author: tknoll $ */

/*****************************************************************************/

#ifndef __dng_parse_utils__
#define __dng_parse_utils__

/*****************************************************************************/

#include "dng_classes.h"
#include "dng_flags.h"
#include "dng_types.h"
#include "dng_stream.h"
#include "dng_string.h"
#include "dng_matrix.h"

/*****************************************************************************/

#if qDNGValidate

/*****************************************************************************/

const char * LookupParentCode (uint32 parentCode);

/*****************************************************************************/

const char * LookupTagCode (uint32 parentCode,
							uint32 tagCode);

/*****************************************************************************/

const char * LookupTagType (uint32 tagType);

/*****************************************************************************/

const char * LookupNewSubFileType (uint32 key);

const char * LookupCompression (uint32 key);

const char * LookupPredictor (uint32 key);

const char * LookupSampleFormat (uint32 key);

const char * LookupPhotometricInterpretation (uint32 key);

const char * LookupOrientation (uint32 key);

const char * LookupResolutionUnit (uint32 key);

const char * LookupCFAColor (uint32 key);

const char * LookupSensingMethod (uint32 key);

const char * LookupExposureProgram (uint32 key);

const char * LookupMeteringMode (uint32 key);

const char * LookupLightSource (uint32 key);

const char * LookupColorSpace (uint32 key);

const char * LookupFileSource (uint32 key);

const char * LookupSceneType (uint32 key);

const char * LookupCustomRendered (uint32 key);

const char * LookupExposureMode (uint32 key);

const char * LookupWhiteBalance (uint32 key);

const char * LookupSceneCaptureType (uint32 key);

const char * LookupGainControl (uint32 key);

const char * LookupContrast (uint32 key);

const char * LookupSaturation (uint32 key);

const char * LookupSharpness (uint32 key);

const char * LookupSubjectDistanceRange (uint32 key);

const char * LookupComponent (uint32 key);

const char * LookupCFALayout (uint32 key);

const char * LookupMakerNoteSafety (uint32 key);

const char * LookupColorimetricReference (uint32 key);

const char * LookupPreviewColorSpace (uint32 key);

const char * LookupJPEGMarker (uint32 key);

const char * LookupSensitivityType (uint32 key);

/*****************************************************************************/

void DumpHexAscii (dng_stream &stream,
				   uint32 count);
				   
void DumpHexAscii (const uint8 *buf,
				   uint32 count);

void DumpXMP (dng_stream &stream,
			  uint32 count);

void DumpString (const dng_string &s);

void DumpTagValues (dng_stream &stream,
					const char *entry_name,
					uint32 parentCode,
					uint32 tagCode,
					uint32 tagType,
					uint32 tagCount,
					const char *tag_name = NULL);
					
void DumpMatrix (const dng_matrix &m);

void DumpVector (const dng_vector &v);

void DumpDateTime (const dng_date_time &dt);

void DumpExposureTime (real64 x);

void DumpFingerprint (const dng_fingerprint &p);

void DumpHueSatMap (dng_stream &stream,
				    uint32 hues,
					uint32 sats,
					uint32 vals,
					bool skipSat0);

/*****************************************************************************/

#endif

/*****************************************************************************/

bool CheckTagType (uint32 parentCode,
				   uint32 tagCode,
				   uint32 tagType,
				   uint16 validType0,
				   uint16 validType1 = 0,
				   uint16 validType2 = 0,
				   uint16 validType3 = 0);

bool CheckTagCount (uint32 parentCode,
					uint32 tagCode,
				    uint32 tagCount,
				    uint32 minCount,
				    uint32 maxCount = 0);
				    		
bool CheckColorImage (uint32 parentCode,
					  uint32 tagCode,
				      uint32 colorPlanes);
				      
bool CheckMainIFD (uint32 parentCode,
				   uint32 tagCode,
				   uint32 newSubFileType);

bool CheckRawIFD (uint32 parentCode,
				  uint32 tagCode,
				  uint32 photometricInterpretation);

bool CheckCFA (uint32 parentCode,
			   uint32 tagCode,
		       uint32 photometricInterpretation);

/*****************************************************************************/

void ParseStringTag (dng_stream &stream,
					 uint32 parentCode,
					 uint32 tagCode,
				     uint32 tagCount,
				     dng_string &s,
				     bool trimBlanks = true);
				    	  
void ParseDualStringTag (dng_stream &stream,
					 	 uint32 parentCode,
					 	 uint32 tagCode,
				     	 uint32 tagCount,
				     	 dng_string &s1,
				     	 dng_string &s2);

void ParseEncodedStringTag (dng_stream &stream,
							uint32 parentCode,
							uint32 tagCode,
				    		uint32 tagCount,
				    		dng_string &s);
				    		
bool ParseMatrixTag (dng_stream &stream,
					 uint32 parentCode,
					 uint32 tagCode,
					 uint32 tagType,
					 uint32 tagCount,
					 uint32 rows,
					 uint32 cols,
					 dng_matrix &m);
				    		
bool ParseVectorTag (dng_stream &stream,
					 uint32 parentCode,
					 uint32 tagCode,
					 uint32 tagType,
					 uint32 tagCount,
					 uint32 count,
					 dng_vector &v);
					 
bool ParseDateTimeTag (dng_stream &stream,
					   uint32 parentCode,
					   uint32 tagCode,
					   uint32 tagType,
					   uint32 tagCount,
					   dng_date_time &dt);
				    		
/*****************************************************************************/

#endif
	
/*****************************************************************************/