Home | History | Annotate | Download | only in source
      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 
     34 const char * LookupParentCode (uint32 parentCode);
     35 
     36 /*****************************************************************************/
     37 
     38 const char * LookupTagCode (uint32 parentCode,
     39 							uint32 tagCode);
     40 
     41 /*****************************************************************************/
     42 
     43 const char * LookupTagType (uint32 tagType);
     44 
     45 /*****************************************************************************/
     46 
     47 const char * LookupNewSubFileType (uint32 key);
     48 
     49 const char * LookupCompression (uint32 key);
     50 
     51 const char * LookupPredictor (uint32 key);
     52 
     53 const char * LookupSampleFormat (uint32 key);
     54 
     55 const char * LookupPhotometricInterpretation (uint32 key);
     56 
     57 const char * LookupOrientation (uint32 key);
     58 
     59 const char * LookupResolutionUnit (uint32 key);
     60 
     61 const char * LookupCFAColor (uint32 key);
     62 
     63 const char * LookupSensingMethod (uint32 key);
     64 
     65 const char * LookupExposureProgram (uint32 key);
     66 
     67 const char * LookupMeteringMode (uint32 key);
     68 
     69 const char * LookupLightSource (uint32 key);
     70 
     71 const char * LookupColorSpace (uint32 key);
     72 
     73 const char * LookupFileSource (uint32 key);
     74 
     75 const char * LookupSceneType (uint32 key);
     76 
     77 const char * LookupCustomRendered (uint32 key);
     78 
     79 const char * LookupExposureMode (uint32 key);
     80 
     81 const char * LookupWhiteBalance (uint32 key);
     82 
     83 const char * LookupSceneCaptureType (uint32 key);
     84 
     85 const char * LookupGainControl (uint32 key);
     86 
     87 const char * LookupContrast (uint32 key);
     88 
     89 const char * LookupSaturation (uint32 key);
     90 
     91 const char * LookupSharpness (uint32 key);
     92 
     93 const char * LookupSubjectDistanceRange (uint32 key);
     94 
     95 const char * LookupComponent (uint32 key);
     96 
     97 const char * LookupCFALayout (uint32 key);
     98 
     99 const char * LookupMakerNoteSafety (uint32 key);
    100 
    101 const char * LookupColorimetricReference (uint32 key);
    102 
    103 const char * LookupPreviewColorSpace (uint32 key);
    104 
    105 const char * LookupJPEGMarker (uint32 key);
    106 
    107 const char * LookupSensitivityType (uint32 key);
    108 
    109 /*****************************************************************************/
    110 
    111 void DumpHexAscii (dng_stream &stream,
    112 				   uint32 count);
    113 
    114 void DumpHexAscii (const uint8 *buf,
    115 				   uint32 count);
    116 
    117 void DumpXMP (dng_stream &stream,
    118 			  uint32 count);
    119 
    120 void DumpString (const dng_string &s);
    121 
    122 void 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 
    130 void DumpMatrix (const dng_matrix &m);
    131 
    132 void DumpVector (const dng_vector &v);
    133 
    134 void DumpDateTime (const dng_date_time &dt);
    135 
    136 void DumpExposureTime (real64 x);
    137 
    138 void DumpFingerprint (const dng_fingerprint &p);
    139 
    140 void DumpHueSatMap (dng_stream &stream,
    141 				    uint32 hues,
    142 					uint32 sats,
    143 					uint32 vals,
    144 					bool skipSat0);
    145 
    146 /*****************************************************************************/
    147 
    148 #endif
    149 
    150 /*****************************************************************************/
    151 
    152 bool 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 
    160 bool CheckTagCount (uint32 parentCode,
    161 					uint32 tagCode,
    162 				    uint32 tagCount,
    163 				    uint32 minCount,
    164 				    uint32 maxCount = 0);
    165 
    166 bool CheckColorImage (uint32 parentCode,
    167 					  uint32 tagCode,
    168 				      uint32 colorPlanes);
    169 
    170 bool CheckMainIFD (uint32 parentCode,
    171 				   uint32 tagCode,
    172 				   uint32 newSubFileType);
    173 
    174 bool CheckRawIFD (uint32 parentCode,
    175 				  uint32 tagCode,
    176 				  uint32 photometricInterpretation);
    177 
    178 bool CheckCFA (uint32 parentCode,
    179 			   uint32 tagCode,
    180 		       uint32 photometricInterpretation);
    181 
    182 /*****************************************************************************/
    183 
    184 void ParseStringTag (dng_stream &stream,
    185 					 uint32 parentCode,
    186 					 uint32 tagCode,
    187 				     uint32 tagCount,
    188 				     dng_string &s,
    189 				     bool trimBlanks = true);
    190 
    191 void ParseDualStringTag (dng_stream &stream,
    192 					 	 uint32 parentCode,
    193 					 	 uint32 tagCode,
    194 				     	 uint32 tagCount,
    195 				     	 dng_string &s1,
    196 				     	 dng_string &s2);
    197 
    198 void ParseEncodedStringTag (dng_stream &stream,
    199 							uint32 parentCode,
    200 							uint32 tagCode,
    201 				    		uint32 tagCount,
    202 				    		dng_string &s);
    203 
    204 bool 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 
    213 bool ParseVectorTag (dng_stream &stream,
    214 					 uint32 parentCode,
    215 					 uint32 tagCode,
    216 					 uint32 tagType,
    217 					 uint32 tagCount,
    218 					 uint32 count,
    219 					 dng_vector &v);
    220 
    221 bool 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