1 /*****************************************************************************/
2 // Copyright 2006-2008 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_shared.h#1 $ */
10 /* $DateTime: 2012/05/30 13:28:51 $ */
11 /* $Change: 832332 $ */
12 /* $Author: tknoll $ */
13 
14 /*****************************************************************************/
15 
16 #ifndef __dng_shared__
17 #define __dng_shared__
18 
19 /*****************************************************************************/
20 
21 #include "dng_classes.h"
22 #include "dng_fingerprint.h"
23 #include "dng_matrix.h"
24 #include "dng_memory.h"
25 #include "dng_negative.h"
26 #include "dng_rational.h"
27 #include "dng_string.h"
28 #include "dng_stream.h"
29 #include "dng_sdk_limits.h"
30 #include "dng_types.h"
31 #include "dng_xy_coord.h"
32 
33 #include <vector>
34 
35 /*****************************************************************************/
36 
37 class dng_camera_profile_info
38 	{
39 
40 	public:
41 
42 		bool fBigEndian;
43 
44 		uint32 fColorPlanes;
45 
46 		uint32 fCalibrationIlluminant1;
47 		uint32 fCalibrationIlluminant2;
48 
49 		dng_matrix fColorMatrix1;
50 		dng_matrix fColorMatrix2;
51 
52 		dng_matrix fForwardMatrix1;
53 		dng_matrix fForwardMatrix2;
54 
55 		dng_matrix fReductionMatrix1;
56 		dng_matrix fReductionMatrix2;
57 
58 		dng_string fProfileCalibrationSignature;
59 
60 		dng_string fProfileName;
61 
62 		dng_string fProfileCopyright;
63 
64 		uint32 fEmbedPolicy;
65 
66 		uint32 fProfileHues;
67 		uint32 fProfileSats;
68 		uint32 fProfileVals;
69 
70 		uint64 fHueSatDeltas1Offset;
71 		uint32 fHueSatDeltas1Count;
72 
73 		uint64 fHueSatDeltas2Offset;
74 		uint32 fHueSatDeltas2Count;
75 
76 		uint32 fHueSatMapEncoding;
77 
78 		uint32 fLookTableHues;
79 		uint32 fLookTableSats;
80 		uint32 fLookTableVals;
81 
82 		uint64 fLookTableOffset;
83 		uint32 fLookTableCount;
84 
85 		uint32 fLookTableEncoding;
86 
87 		dng_srational fBaselineExposureOffset;
88 
89 		uint32 fDefaultBlackRender;
90 
91 		uint64 fToneCurveOffset;
92 		uint32 fToneCurveCount;
93 
94 		dng_string fUniqueCameraModel;
95 
96 	public:
97 
98 		dng_camera_profile_info ();
99 
100 		~dng_camera_profile_info ();
101 
102 		bool ParseTag (dng_stream &stream,
103 					   uint32 parentCode,
104 					   uint32 tagCode,
105 					   uint32 tagType,
106 					   uint32 tagCount,
107 					   uint64 tagOffset);
108 
109 		bool ParseExtended (dng_stream &stream);
110 
111 	};
112 
113 /*****************************************************************************/
114 
115 class dng_shared
116 	{
117 
118 	public:
119 
120 		uint64 fExifIFD;
121 		uint64 fGPSInfo;
122 		uint64 fInteroperabilityIFD;
123 		uint64 fKodakDCRPrivateIFD;
124 		uint64 fKodakKDCPrivateIFD;
125 
126 		uint32 fXMPCount;
127 		uint64 fXMPOffset;
128 
129 		uint32 fIPTC_NAA_Count;
130 		uint64 fIPTC_NAA_Offset;
131 
132 		uint32 fMakerNoteCount;
133 		uint64 fMakerNoteOffset;
134 		uint32 fMakerNoteSafety;
135 
136 		uint32 fDNGVersion;
137 		uint32 fDNGBackwardVersion;
138 
139 		dng_string fUniqueCameraModel;
140 		dng_string fLocalizedCameraModel;
141 
142 		dng_camera_profile_info fCameraProfile;
143 
144 		dng_std_vector<dng_camera_profile_info> fExtraCameraProfiles;
145 
146 		dng_matrix fCameraCalibration1;
147 		dng_matrix fCameraCalibration2;
148 
149 		dng_string fCameraCalibrationSignature;
150 
151 		dng_vector fAnalogBalance;
152 
153 		dng_vector fAsShotNeutral;
154 
155 		dng_xy_coord fAsShotWhiteXY;
156 
157 		dng_srational fBaselineExposure;
158 		dng_urational fBaselineNoise;
159 		dng_urational fNoiseReductionApplied;
160 		dng_urational fBaselineSharpness;
161 		dng_urational fLinearResponseLimit;
162 		dng_urational fShadowScale;
163 
164 		bool fHasBaselineExposure;
165 		bool fHasShadowScale;
166 
167 		uint32 fDNGPrivateDataCount;
168 		uint64 fDNGPrivateDataOffset;
169 
170 		dng_fingerprint fRawImageDigest;
171 		dng_fingerprint fNewRawImageDigest;
172 
173 		dng_fingerprint fRawDataUniqueID;
174 
175 		dng_string fOriginalRawFileName;
176 
177 		uint32 fOriginalRawFileDataCount;
178 		uint64 fOriginalRawFileDataOffset;
179 
180 		dng_fingerprint fOriginalRawFileDigest;
181 
182 		uint32 fAsShotICCProfileCount;
183 		uint64 fAsShotICCProfileOffset;
184 
185 		dng_matrix fAsShotPreProfileMatrix;
186 
187 		uint32 fCurrentICCProfileCount;
188 		uint64 fCurrentICCProfileOffset;
189 
190 		dng_matrix fCurrentPreProfileMatrix;
191 
192 		uint32 fColorimetricReference;
193 
194 		dng_string fAsShotProfileName;
195 
196 		dng_noise_profile fNoiseProfile;
197 
198 		dng_point fOriginalDefaultFinalSize;
199 		dng_point fOriginalBestQualityFinalSize;
200 
201 		dng_urational fOriginalDefaultCropSizeH;
202 		dng_urational fOriginalDefaultCropSizeV;
203 
204 	public:
205 
206 		dng_shared ();
207 
208 		virtual ~dng_shared ();
209 
210 		virtual bool ParseTag (dng_stream &stream,
211 							   dng_exif &exif,
212 							   uint32 parentCode,
213 							   bool isMainIFD,
214 							   uint32 tagCode,
215 							   uint32 tagType,
216 							   uint32 tagCount,
217 							   uint64 tagOffset,
218 							   int64 offsetDelta);
219 
220 		virtual void PostParse (dng_host &host,
221 								dng_exif &exif);
222 
223 		virtual bool IsValidDNG ();
224 
225 	protected:
226 
227 		virtual bool Parse_ifd0 (dng_stream &stream,
228 							     dng_exif &exif,
229 							 	 uint32 parentCode,
230 							 	 uint32 tagCode,
231 							 	 uint32 tagType,
232 							 	 uint32 tagCount,
233 							 	 uint64 tagOffset);
234 
235 		virtual bool Parse_ifd0_exif (dng_stream &stream,
236 							          dng_exif &exif,
237 						 		 	  uint32 parentCode,
238 						 		 	  uint32 tagCode,
239 						 		 	  uint32 tagType,
240 						 		 	  uint32 tagCount,
241 						 		 	  uint64 tagOffset);
242 
243 	};
244 
245 /*****************************************************************************/
246 
247 #endif
248 
249 /*****************************************************************************/
250