Changeset 1807
- Timestamp:
- 04/14/12 01:02:01 (14 months ago)
- File:
-
- 1 edited
-
trunk/core/dng.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/dng.c
r1805 r1807 85 85 BE(2), // BayerPhase = 2 (top left pixel is green in a green/blue row) 86 86 #endif 87 88 // BE(4), // FixBadPixelsConstant = 489 // BE(0x01030000), // DNG version = 1.3.0.090 // BE(1), // Flags = 191 // BE(8), // Opcode length = 8 bytes92 // BE(1), // Constant = 193 //#if cam_CFAPattern == 0x0201010094 // BE(0), // BayerPhase = 0 (top left pixel is red)95 //#elif cam_CFAPattern == 0x0102000196 // BE(1), // BayerPhase = 1 (top left pixel is green in a green/red row)97 //#elif cam_CFAPattern == 0x0100020198 // BE(2), // BayerPhase = 2 (top left pixel is green in a green/blue row)99 //#elif cam_CFAPattern == 0x00010102100 // BE(3), // BayerPhase = 3 (top left pixel is blue)101 //#endif102 //103 // BE(4), // FixBadPixelsConstant = 4104 // BE(0x01030000), // DNG version = 1.3.0.0105 // BE(1), // Flags = 1106 // BE(8), // Opcode length = 8 bytes107 // BE(2), // Constant = 2108 //#if cam_CFAPattern == 0x02010100109 // BE(0), // BayerPhase = 0 (top left pixel is red)110 //#elif cam_CFAPattern == 0x01020001111 // BE(1), // BayerPhase = 1 (top left pixel is green in a green/red row)112 //#elif cam_CFAPattern == 0x01000201113 // BE(2), // BayerPhase = 2 (top left pixel is green in a green/blue row)114 //#elif cam_CFAPattern == 0x00010102115 // BE(3), // BayerPhase = 3 (top left pixel is blue)116 //#endif117 //118 // BE(4), // FixBadPixelsConstant = 4119 // BE(0x01030000), // DNG version = 1.3.0.0120 // BE(1), // Flags = 1121 // BE(8), // Opcode length = 8 bytes122 // BE(3), // Constant = 3123 //#if cam_CFAPattern == 0x02010100124 // BE(0), // BayerPhase = 0 (top left pixel is red)125 //#elif cam_CFAPattern == 0x01020001126 // BE(1), // BayerPhase = 1 (top left pixel is green in a green/red row)127 //#elif cam_CFAPattern == 0x01000201128 // BE(2), // BayerPhase = 2 (top left pixel is green in a green/blue row)129 //#elif cam_CFAPattern == 0x00010102130 // BE(3), // BayerPhase = 3 (top left pixel is blue)131 //#endif132 87 }; 133 88 134 89 // warning: according to TIFF format specification, elements must be sorted by tag value in ascending order! 90 91 // Index of DNGVersion in IFD0 below. 92 // *** warning - if entries are added or removed this should be updated *** 93 #define DNG_VERSION_INDEX 22 135 94 136 95 struct dir_entry IFD0[]={ … … 171 130 }; 172 131 132 // Index of the badpixel opcode entry in IFD1 below 133 // *** warning - if entries are added or removed this should be updated *** 134 #define BADPIXEL_OPCODE_INDEX 21 173 135 174 136 struct dir_entry IFD1[]={ … … 194 156 {0xC620, T_LONG, 2, (int)&camera_sensor.crop.size}, 195 157 {0xC68D, T_LONG, 4, (int)&camera_sensor.dng_active_area}, 196 {0xC740, T_UNDEFINED|T_PTR, sizeof(badpixel_opcode), (int)&badpixel_opcode}, // Note: should be the last entry!158 {0xC740, T_UNDEFINED|T_PTR, sizeof(badpixel_opcode), (int)&badpixel_opcode}, 197 159 {0, T_END} 198 160 }; 199 200 161 201 162 static int cam_shutter[2] = { 0, 1000000 }; // Shutter speed … … 262 223 } 263 224 225 // Index of the GPS IFD in IFD_LIST below 226 // *** warning - if entries are added or removed this should be updated *** 227 #define GPS_IFD_INDEX 3 228 264 229 struct {struct dir_entry* entry; int count;} IFD_LIST[]={{IFD0,0}, {IFD1,0}, {EXIF_IFD,0}, {GPS_IFD, 0}}; 265 230 … … 285 250 int raw_offset; 286 251 287 // Find entries for DNG version and bad pixel opcodes288 for (i=0; IFD0[i].tag != 0xC612; i++);289 for (j=0; (IFD1[j].type != 0) && (IFD1[j].tag != 0xC740); j++);290 252 // Set version and opcodes 291 253 if (conf.dng_version) 292 254 { 293 255 // If CHDK is removing bad pixels then set DNG version to 1.1 and remove opcodes 294 IFD0[ i].offset = BE(0x01010000);295 IFD1[ j].tag = 0;296 IFD1[ j].type = T_END;256 IFD0[DNG_VERSION_INDEX].offset = BE(0x01010000); 257 IFD1[BADPIXEL_OPCODE_INDEX].tag = 0; 258 IFD1[BADPIXEL_OPCODE_INDEX].type = T_END; 297 259 } 298 260 else 299 261 { 300 262 // Set DNG version to 1.3 and add bad pixel opcodes 301 IFD0[ i].offset = BE(0x01030000);302 IFD1[ j].tag = 0xC740;303 IFD1[ j].type = T_UNDEFINED|T_PTR;263 IFD0[DNG_VERSION_INDEX].offset = BE(0x01030000); 264 IFD1[BADPIXEL_OPCODE_INDEX].tag = 0xC740; 265 IFD1[BADPIXEL_OPCODE_INDEX].type = T_UNDEFINED|T_PTR; 304 266 } 305 267 306 268 // filling EXIF fields 307 269 308 gps_getData(&gps_data); 270 if (camera_info.props.gps) 271 { 272 // If camera has GPS get the GPS data 273 gps_getData(&gps_data); 274 } 275 else 276 { 277 // If no GPS then remove the GPS data from the header 278 IFD_LIST[GPS_IFD_INDEX].entry = 0; 279 } 309 280 310 281 for (j=0;j<IFDs;j++) {
Note: See TracChangeset
for help on using the changeset viewer.