Debian Codegraph @

converter/other/cameratopam/identify.c

raw
1 #define _DEFAULT_SOURCE /* New name for SVID & BSD source defines */
2 #define _BSD_SOURCE /* Make sure strcasecmp() is in string.h */
3 #include <string.h>
4
5 #include "pm.h"
6 #include "pm_c_util.h"
7 #include "nstring.h"
8
9 #include "global_variables.h"
10 #include "util.h"
11 #include "foveon.h"
12 #include "canon.h"
13 #include "dng.h"
14 #include "ljpeg.h"
15 #include "camera.h"
16 #include "stdio_nofail.h"
17
18 #include "identify.h"
19
20
21 #if HAVE_INT64
22 static bool const have64BitArithmetic = true;
23 #else
24 static bool const have64BitArithmetic = false;
25 #endif
26
27
28
29 /* This does the same as the function of the same name in the GNU C library */
30 static const char *memmem_internal (const char *haystack, size_t haystacklen,
31 const char *needle, size_t needlelen)
32 {
33 const char *c;
34 for (c = haystack; c <= haystack + haystacklen - needlelen; c++)
35 if (!memcmp (c, needle, needlelen))
36 return c;
37 return NULL;
38 }
39
40
41
42 static void
43 adobeCoeff(const char * const make,
44 const char * const model) {
45 /*
46 Thanks to Adobe for providing these excellent CAM -> XYZ matrices!
47 */
48 struct CoeffTableEntry {
49 const char * prefix;
50 short trans[12];
51 };
52
53 static struct CoeffTableEntry const table[] = {
54 { "Canon EOS D2000C",
55 { 24542,-10860,-3401,-1490,11370,-297,2858,-605,3225 } },
56 { "Canon EOS D30",
57 { 9805,-2689,-1312,-5803,13064,3068,-2438,3075,8775 } },
58 { "Canon EOS D60",
59 { 6188,-1341,-890,-7168,14489,2937,-2640,3228,8483 } },
60 { "Canon EOS 10D",
61 { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } },
62 { "Canon EOS 20D",
63 { 6599,-537,-891,-8071,15783,2424,-1983,2234,7462 } },
64 { "Canon EOS-1Ds Mark II",
65 { 6517,-602,-867,-8180,15926,2378,-1618,1771,7633 } },
66 { "Canon EOS-1D Mark II",
67 { 6264,-582,-724,-8312,15948,2504,-1744,1919,8664 } },
68 { "Canon EOS-1DS",
69 { 4374,3631,-1743,-7520,15212,2472,-2892,3632,8161 } },
70 { "Canon EOS-1D",
71 { 6906,-278,-1017,-6649,15074,1621,-2848,3897,7611 } },
72 { "Canon EOS",
73 { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } },
74 { "Canon PowerShot 600",
75 { -3822,10019,1311,4085,-157,3386,-5341,10829,4812,-1969,10969,
76 1126} },
77 { "Canon PowerShot A50",
78 { -5300,9846,1776,3436,684,3939,-5540,9879,6200,-1404,11175,217 } },
79 { "Canon PowerShot A5",
80 { -4801,9475,1952,2926,1611,4094,-5259,10164,5947,-1554,10883,547} },
81 { "Canon PowerShot G1",
82 { -4778,9467,2172,4743,-1141,4344,-5146,9908,6077,-1566,11051,557} },
83 { "Canon PowerShot G2",
84 { 9087,-2693,-1049,-6715,14382,2537,-2291,2819,7790 } },
85 { "Canon PowerShot G3",
86 { 9212,-2781,-1073,-6573,14189,2605,-2300,2844,7664 } },
87 { "Canon PowerShot G5",
88 { 9757,-2872,-933,-5972,13861,2301,-1622,2328,7212 } },
89 { "Canon PowerShot G6",
90 { 9877,-3775,-871,-7613,14807,3072,-1448,1305,7485 } },
91 { "Canon PowerShot Pro1",
92 { 10062,-3522,-999,-7643,15117,2730,-765,817,7323 } },
93 { "Canon PowerShot Pro70",
94 { -4155,9818,1529,3939,-25,4522,-5521,9870,6610,-2238,10873,1342 } },
95 { "Canon PowerShot Pro90",
96 { -4963,9896,2235,4642,-987,4294,-5162,10011,5859,-1770,11230,577} },
97 { "Canon PowerShot S30",
98 { 10566,-3652,-1129,-6552,14662,2006,-2197,2581,7670 } },
99 { "Canon PowerShot S40",
100 { 8510,-2487,-940,-6869,14231,2900,-2318,2829,9013 } },
101 { "Canon PowerShot S45",
102 { 8163,-2333,-955,-6682,14174,2751,-2077,2597,8041 } },
103 { "Canon PowerShot S50",
104 { 8882,-2571,-863,-6348,14234,2288,-1516,2172,6569 } },
105 { "Canon PowerShot S70",
106 { 9976,-3810,-832,-7115,14463,2906,-901,989,7889 } },
107 { "Contax N Digital",
108 { 7777,1285,-1053,-9280,16543,2916,-3677,5679,7060 } },
109 { "EPSON R-D1",
110 { 6827,-1878,-732,-8429,16012,2564,-704,592,7145 } },
111 { "FUJIFILM FinePix E550",
112 { 11044,-3888,-1120,-7248,15168,2208,-1531,2277,8069 } },
113 { "FUJIFILM FinePix F700",
114 { 10004,-3219,-1201,-7036,15047,2107,-1863,2565,7736 } },
115 { "FUJIFILM FinePix S20Pro",
116 { 10004,-3219,-1201,-7036,15047,2107,-1863,2565,7736 } },
117 { "FUJIFILM FinePix S2Pro",
118 { 12492,-4690,-1402,-7033,15423,1647,-1507,2111,7697 } },
119 { "FUJIFILM FinePix S3Pro",
120 { 11807,-4612,-1294,-8927,16968,1988,-2120,2741,8006 } },
121 { "FUJIFILM FinePix S5000",
122 { 8754,-2732,-1019,-7204,15069,2276,-1702,2334,6982 } },
123 { "FUJIFILM FinePix S5100",
124 { 11940,-4431,-1255,-6766,14428,2542,-993,1165,7421 } },
125 { "FUJIFILM FinePix S7000",
126 { 10190,-3506,-1312,-7153,15051,2238,-2003,2399,7505 } },
127 { "Kodak DCS315C",
128 { 17523,-4827,-2510,756,8546,-137,6113,1649,2250 } },
129 { "Kodak DCS330C",
130 { 20620,-7572,-2801,-103,10073,-396,3551,-233,2220 } },
131 { "KODAK DCS420",
132 { 10868,-1852,-644,-1537,11083,484,2343,628,2216 } },
133 { "KODAK DCS460",
134 { 10592,-2206,-967,-1944,11685,230,2206,670,1273 } },
135 { "KODAK EOSDCS1",
136 { 10592,-2206,-967,-1944,11685,230,2206,670,1273 } },
137 { "KODAK EOSDCS3B",
138 { 9898,-2700,-940,-2478,12219,206,1985,634,1031 } },
139 { "Kodak DCS520C",
140 { 24542,-10860,-3401,-1490,11370,-297,2858,-605,3225 } },
141 { "Kodak DCS560C",
142 { 20482,-7172,-3125,-1033,10410,-285,2542,226,3136 } },
143 { "Kodak DCS620C",
144 { 23617,-10175,-3149,-2054,11749,-272,2586,-489,3453 } },
145 { "Kodak DCS620X",
146 { 13095,-6231,154,12221,-21,-2137,895,4602,2258 } },
147 { "Kodak DCS660C",
148 { 18244,-6351,-2739,-791,11193,-521,3711,-129,2802 } },
149 { "Kodak DCS720X",
150 { 11775,-5884,950,9556,1846,-1286,-1019,6221,2728 } },
151 { "Kodak DCS760C",
152 { 16623,-6309,-1411,-4344,13923,323,2285,274,2926 } },
153 { "Kodak DCS Pro SLR",
154 { 5494,2393,-232,-6427,13850,2846,-1876,3997,5445 } },
155 { "Kodak DCS Pro 14nx",
156 { 5494,2393,-232,-6427,13850,2846,-1876,3997,5445 } },
157 { "Kodak DCS Pro 14",
158 { 7791,3128,-776,-8588,16458,2039,-2455,4006,6198 } },
159 { "Kodak ProBack645",
160 { 16414,-6060,-1470,-3555,13037,473,2545,122,4948 } },
161 { "Kodak ProBack",
162 { 21179,-8316,-2918,-915,11019,-165,3477,-180,4210 } },
163 { "LEICA DIGILUX 2",
164 { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } },
165 { "Leaf Valeo",
166 { 8236,1746,-1314,-8251,15953,2428,-3673,5786,5771 } },
167 { "Minolta DiMAGE 5",
168 { 8983,-2942,-963,-6556,14476,2237,-2426,2887,8014 } },
169 { "Minolta DiMAGE 7",
170 { 9144,-2777,-998,-6676,14556,2281,-2470,3019,7744 } },
171 { "Minolta DiMAGE A1",
172 { 9274,-2547,-1167,-8220,16323,1943,-2273,2720,8340 } },
173 { "MINOLTA DiMAGE A200",
174 { 8560,-2487,-986,-8112,15535,2771,-1209,1324,7743 } },
175 { "Minolta DiMAGE A2",
176 { 9097,-2726,-1053,-8073,15506,2762,-966,981,7763 } },
177 { "MINOLTA DYNAX 7D",
178 { 10239,-3104,-1099,-8037,15727,2451,-927,925,6871 } },
179 { "NIKON D100",
180 { 5915,-949,-778,-7516,15364,2282,-1228,1337,6404 } },
181 { "NIKON D1H",
182 { 7577,-2166,-926,-7454,15592,1934,-2377,2808,8606 } },
183 { "NIKON D1X",
184 { 7620,-2173,-966,-7604,15843,1805,-2356,2811,8439 } },
185 { "NIKON D1",
186 { 7559,-2130,-965,-7611,15713,1972,-2478,3042,8290 } },
187 { "NIKON D2H",
188 { 5710,-901,-615,-8594,16617,2024,-2975,4120,6830 } },
189 { "NIKON D70",
190 { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } },
191 { "NIKON E995", /* copied from E5000 */
192 { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } },
193 { "NIKON E2500",
194 { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } },
195 { "NIKON E4500",
196 { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } },
197 { "NIKON E5000",
198 { -5547,11762,2189,5814,-558,3342,-4924,9840,5949,688,9083,96 } },
199 { "NIKON E5400",
200 { 9349,-2987,-1001,-7919,15766,2266,-2098,2680,6839 } },
201 { "NIKON E5700",
202 { -5368,11478,2368,5537,-113,3148,-4969,10021,5782,778,9028,211 } },
203 { "NIKON E8400",
204 { 7842,-2320,-992,-8154,15718,2599,-1098,1342,7560 } },
205 { "NIKON E8700",
206 { 8489,-2583,-1036,-8051,15583,2643,-1307,1407,7354 } },
207 { "NIKON E8800",
208 { 7971,-2314,-913,-8451,15762,2894,-1442,1520,7610 } },
209 { "OLYMPUS C5050",
210 { 10508,-3124,-1273,-6079,14294,1901,-1653,2306,6237 } },
211 { "OLYMPUS C5060",
212 { 10445,-3362,-1307,-7662,15690,2058,-1135,1176,7602 } },
213 { "OLYMPUS C70",
214 { 10793,-3791,-1146,-7498,15177,2488,-1390,1577,7321 } },
215 { "OLYMPUS C80",
216 { 8606,-2509,-1014,-8238,15714,2703,-942,979,7760 } },
217 { "OLYMPUS E-10",
218 { 12745,-4500,-1416,-6062,14542,1580,-1934,2256,6603 } },
219 { "OLYMPUS E-1",
220 { 11846,-4767,-945,-7027,15878,1089,-2699,4122,8311 } },
221 { "OLYMPUS E-20",
222 { 13173,-4732,-1499,-5807,14036,1895,-2045,2452,7142 } },
223 { "OLYMPUS E-300",
224 { 7828,-1761,-348,-5788,14071,1830,-2853,4518,6557 } },
225 { "PENTAX *ist D",
226 { 9651,-2059,-1189,-8881,16512,2487,-1460,1345,10687 } },
227 { "Panasonic DMC-LC1",
228 { 11340,-4069,-1275,-7555,15266,2448,-2960,3426,7685 } },
229 { "SONY DSC-F828",
230 { 7924,-1910,-777,-8226,15459,2998,-1517,2199,6818,-7242,11401,
231 3481} },
232 { "SONY DSC-V3",
233 { 9877,-3775,-871,-7613,14807,3072,-1448,1305,7485 } }
234 };
235 double cc[4][4];
236 double cm[4][3];
237 double xyz[] = { 1,1,1 };
238 const char * name;
239 unsigned int i;
240
241 /* Make an identity matrix (1's on the diagonal) */
242 for (i = 0; i < 4; ++i) {
243 unsigned int j;
244 for (j = 0; j < 4; ++j)
245 cc[i][j] = (i == j);
246 }
247 pm_asprintf(&name, "%s %s", make, model);
248
249 for (i = 0; i < ARRAY_SIZE(table); ++i) {
250 const struct CoeffTableEntry * const entryP = &table[i];
251
252 if (strneq(name, entryP->prefix, strlen(entryP->prefix))) {
253 unsigned int j;
254 for (j = 0; j < 12; ++j)
255 cm[j/3][j%3] = entryP->trans[j];
256 dng_coeff(cc, cm, xyz);
257
258 break;
259 }
260 }
261 pm_strfree(name);
262 }
263
264
265
266 int
267 identify(FILE * const ifp,
268 bool const use_secondary,
269 bool const use_camera_rgb,
270 float const red_scale,
271 float const blue_scale,
272 unsigned int const four_color_rgb,
273 const char * const inputFileName,
274 LoadRawFn ** const loadRawFnP) {
275 /*----------------------------------------------------------------------------
276 Identify which camera created this file, and set global variables
277 accordingly. Return nonzero if the file cannot be decoded.
278 -----------------------------------------------------------------------------*/
279 char head[32];
280 char * c;
281 unsigned hlen, fsize, i;
282 static const struct {
283 int fsize;
284 char make[12], model[15], withjpeg;
285 } table[] = {
286 { 62464, "Kodak", "DC20" ,0 },
287 { 124928, "Kodak", "DC20" ,0 },
288 { 311696, "ST Micro", "STV680 VGA" ,0 }, /* SPYz */
289 { 787456, "Creative", "PC-CAM 600" ,0 },
290 { 2465792, "NIKON", "E950" ,1 }, /* or E800,E700 */
291 { 2940928, "NIKON", "E2100" ,1 }, /* or E2500 */
292 { 4771840, "NIKON", "E990" ,1 }, /* or E995 */
293 { 4775936, "NIKON", "E3700" ,1 }, /* or Optio 33WR */
294 { 5869568, "NIKON", "E4300" ,1 }, /* or DiMAGE Z2 */
295 { 5865472, "NIKON", "E4500" ,0 },
296 { 1976352, "CASIO", "QV-2000UX" ,0 },
297 { 3217760, "CASIO", "QV-3*00EX" ,0 },
298 { 6218368, "CASIO", "QV-5700" ,0 },
299 { 7530816, "CASIO", "QV-R51" ,1 },
300 { 7684000, "CASIO", "QV-4000" ,0 },
301 { 7753344, "CASIO", "EX-Z55" ,1 },
302 { 9313536, "CASIO", "EX-P600" ,1 },
303 { 10979200, "CASIO", "EX-P700" ,1 },
304 { 3178560, "PENTAX", "Optio S" ,1 }, /* 8-bit */
305 { 4841984, "PENTAX", "Optio S" ,1 }, /* 12-bit */
306 { 6114240, "PENTAX", "Optio S4" ,1 }, /* or S4i */
307 { 12582980, "Sinar", "" ,0 } };
308 static const char *corp[] =
309 { "Canon", "NIKON", "EPSON", "Kodak", "OLYMPUS", "PENTAX",
310 "MINOLTA", "Minolta", "Konica", "CASIO" };
311 float tmp;
312 LoadRawFn * load_raw;
313
314 /* What format is this file? Set make[] if we recognize it. */
315
316 raw_height = raw_width = fuji_width = flip = 0;
317 make[0] = model[0] = model2[0] = 0;
318 memset (white, 0, sizeof white);
319 timestamp = tiff_samples = 0;
320 data_offset = meta_length = tiff_data_compression = 0;
321 zero_after_ff = is_dng = fuji_secondary = filters = 0;
322 black = is_foveon = use_coeff = 0;
323 use_gamma = xmag = ymag = 1;
324 for (i=0; i < 4; i++) {
325 cam_mul[i] = 1 & i;
326 pre_mul[i] = 1;
327 }
328 colors = 3;
329 for (i=0; i < 0x1000; i++) curve[i] = i;
330 maximum = 0xfff;
331
332 order = get2(ifp);
333 hlen = get4(ifp);
334 fseek_nofail (ifp, 0, SEEK_SET);
335 fread_nofail (head, 1, 32, ifp);
336 fseek_nofail (ifp, 0, SEEK_END);
337 fsize = ftell_nofail(ifp);
338 if ((c = (char*)memmem_internal(head, 32, "MMMMRawT", 8))) {
339 strcpy (make, "Phase One");
340 data_offset = c - head;
341 fseek_nofail (ifp, data_offset + 8, SEEK_SET);
342 fseek_nofail (ifp, get4(ifp) + 136, SEEK_CUR);
343 raw_width = get4(ifp);
344 fseek_nofail (ifp, 12, SEEK_CUR);
345 raw_height = get4(ifp);
346 } else if (order == 0x4949 || order == 0x4d4d) {
347 if (!memcmp (head+6, "HEAPCCDR", 8)) {
348 data_offset = hlen;
349 parse_ciff(ifp, hlen, fsize - hlen);
350 } else {
351 parse_tiff(ifp, 0);
352 if (!strncmp(make,"NIKON",5) && filters == 0)
353 make[0] = 0;
354 }
355 } else if (!memcmp (head, "\0MRM", 4))
356 parse_minolta(ifp);
357 else if (!memcmp (head, "\xff\xd8\xff\xe1", 4) &&
358 !memcmp (head+6, "Exif", 4)) {
359 fseek_nofail (ifp, 4, SEEK_SET);
360 fseek_nofail (ifp, 4 + get2(ifp), SEEK_SET);
361 if (fgetc_nofail(ifp) != 0xff)
362 parse_tiff(ifp, 12);
363 } else if (!memcmp (head, "BM", 2)) {
364 data_offset = 0x1000;
365 order = 0x4949;
366 fseek_nofail (ifp, 38, SEEK_SET);
367 if (get4(ifp) == 2834 && get4(ifp) == 2834) {
368 strcpy (model, "BMQ");
369 flip = 3;
370 goto nucore;
371 }
372 } else if (!memcmp (head, "BR", 2)) {
373 strcpy (model, "RAW");
374 nucore:
375 strcpy (make, "Nucore");
376 order = 0x4949;
377 fseek_nofail (ifp, 10, SEEK_SET);
378 data_offset += get4(ifp);
379 get4(ifp);
380 raw_width = get4(ifp);
381 raw_height = get4(ifp);
382 if (model[0] == 'B' && raw_width == 2597) {
383 raw_width++;
384 data_offset -= 0x1000;
385 }
386 } else if (!memcmp (head+25, "ARECOYK", 7)) {
387 strcpy (make, "Contax");
388 strcpy (model,"N Digital");
389 fseek_nofail (ifp, 60, SEEK_SET);
390 camera_red = get4(ifp);
391 camera_red /= get4(ifp);
392 camera_blue = get4(ifp);
393 camera_blue = get4(ifp) / camera_blue;
394 } else if (!memcmp (head, "FUJIFILM", 8)) {
395 long data_offset_long;
396 fseek_nofail (ifp, 84, SEEK_SET);
397 parse_tiff(ifp, get4(ifp)+12);
398 fseek_nofail (ifp, 100, SEEK_SET);
399 pm_readbiglong(ifp, &data_offset_long);
400 data_offset = data_offset_long;
401 } else if (!memcmp (head, "DSC-Image", 9))
402 parse_rollei(ifp);
403 else if (!memcmp (head, "FOVb", 4))
404 parse_foveon(ifp);
405 else
406 for (i=0; i < sizeof table / sizeof *table; i++)
407 if (fsize == table[i].fsize) {
408 strcpy (make, table[i].make );
409 strcpy (model, table[i].model);
410 if (table[i].withjpeg)
411 parse_external_jpeg(inputFileName);
412 }
413 parse_mos(ifp, 8);
414 parse_mos(ifp, 3472);
415
416 for (i=0; i < sizeof corp / sizeof *corp; i++)
417 if (strstr (make, corp[i])) /* Simplify company names */
418 strcpy (make, corp[i]);
419 if (!strncmp (make, "KODAK", 5))
420 make[16] = model[16] = 0;
421 c = make + strlen(make); /* Remove trailing spaces */
422 while (*--c == ' ') *c = 0;
423 c = model + strlen(model);
424 while (*--c == ' ') *c = 0;
425 i = strlen(make); /* Remove make from model */
426 if (!strncmp (model, make, i++))
427 memmove (model, model+i, 64-i);
428 make[63] = model[63] = model2[63] = 0;
429
430 if (verbose)
431 fprintf(stderr, "Make = '%s', Model = '%s'\n", make, model);
432
433 if (make[0] == 0) {
434 pm_message ("unrecognized file format.");
435 return 1;
436 }
437
438 /* File format is OK. Do we know this camera? */
439 /* Start with some useful defaults: */
440
441 top_margin = left_margin = 0;
442 if ((raw_height | raw_width) < 0)
443 raw_height = raw_width = 0;
444 height = raw_height;
445 width = raw_width;
446 if (fuji_width) {
447 width = height + fuji_width;
448 height = width - 1;
449 ymag = 1;
450 }
451 load_raw = NULL;
452 if (is_dng) {
453 strcat (model, " DNG");
454 if (!filters)
455 colors = tiff_samples;
456 if (tiff_data_compression == 1)
457 load_raw = adobe_dng_load_raw_nc;
458 if (tiff_data_compression == 7)
459 load_raw = adobe_dng_load_raw_lj;
460 goto dng_skip;
461 }
462
463 /* We'll try to decode anything from Canon or Nikon. */
464
465 if (!filters) filters = 0x94949494;
466 if ((is_canon = !strcmp(make,"Canon")))
467 load_raw = memcmp (head+6,"HEAPCCDR",8) ?
468 lossless_jpeg_load_raw : canon_compressed_load_raw;
469 if (!strcmp(make,"NIKON"))
470 load_raw = nikon_is_compressed() ?
471 nikon_compressed_load_raw : nikon_load_raw;
472
473 /* Set parameters based on camera name (for non-DNG files). */
474
475 if (is_foveon) {
476 if (!have64BitArithmetic)
477 pm_error("This program was built without 64 bit arithmetic "
478 "capability and the Foveon format requires it.");
479 if (height*2 < width) ymag = 2;
480 if (width < height) xmag = 2;
481 filters = 0;
482 load_raw = foveon_load_raw;
483 foveon_coeff(&use_coeff, coeff);
484 } else if (!strcmp(model,"PowerShot 600")) {
485 height = 613;
486 width = 854;
487 colors = 4;
488 filters = 0xe1e4e1e4;
489 load_raw = canon_600_load_raw;
490 } else if (!strcmp(model,"PowerShot A5") ||
491 !strcmp(model,"PowerShot A5 Zoom")) {
492 height = 773;
493 width = 960;
494 raw_width = 992;
495 colors = 4;
496 filters = 0x1e4e1e4e;
497 load_raw = canon_a5_load_raw;
498 } else if (!strcmp(model,"PowerShot A50")) {
499 height = 968;
500 width = 1290;
501 raw_width = 1320;
502 colors = 4;
503 filters = 0x1b4e4b1e;
504 load_raw = canon_a5_load_raw;
505 } else if (!strcmp(model,"PowerShot Pro70")) {
506 height = 1024;
507 width = 1552;
508 colors = 4;
509 filters = 0x1e4b4e1b;
510 load_raw = canon_a5_load_raw;
511 black = 34;
512 } else if (!strcmp(model,"PowerShot Pro90 IS")) {
513 width = 1896;
514 colors = 4;
515 filters = 0xb4b4b4b4;
516 } else if (is_canon && raw_width == 2144) {
517 height = 1550;
518 width = 2088;
519 top_margin = 8;
520 left_margin = 4;
521 if (!strcmp(model,"PowerShot G1")) {
522 colors = 4;
523 filters = 0xb4b4b4b4;
524 }
525 } else if (is_canon && raw_width == 2224) {
526 height = 1448;
527 width = 2176;
528 top_margin = 6;
529 left_margin = 48;
530 } else if (is_canon && raw_width == 2376) {
531 height = 1720;
532 width = 2312;
533 top_margin = 6;
534 left_margin = 12;
535 } else if (is_canon && raw_width == 2672) {
536 height = 1960;
537 width = 2616;
538 top_margin = 6;
539 left_margin = 12;
540 } else if (is_canon && raw_width == 3152) {
541 height = 2056;
542 width = 3088;
543 top_margin = 12;
544 left_margin = 64;
545 maximum = 0xfa0;
546 } else if (is_canon && raw_width == 3160) {
547 height = 2328;
548 width = 3112;
549 top_margin = 12;
550 left_margin = 44;
551 } else if (is_canon && raw_width == 3344) {
552 height = 2472;
553 width = 3288;
554 top_margin = 6;
555 left_margin = 4;
556 } else if (!strcmp(model,"EOS D2000C")) {
557 filters = 0x61616161;
558 black = curve[200];
559 } else if (!strcmp(model,"EOS-1D")) {
560 raw_height = height = 1662;
561 raw_width = width = 2496;
562 data_offset = 288912;
563 filters = 0x61616161;
564 } else if (!strcmp(model,"EOS-1DS")) {
565 raw_height = height = 2718;
566 raw_width = width = 4082;
567 data_offset = 289168;
568 filters = 0x61616161;
569 } else if (is_canon && raw_width == 3516) {
570 top_margin = 14;
571 left_margin = 42;
572 goto canon_cr2;
573 } else if (is_canon && raw_width == 3596) {
574 top_margin = 12;
575 left_margin = 74;
576 goto canon_cr2;
577 } else if (is_canon && raw_width == 5108) {
578 top_margin = 13;
579 left_margin = 98;
580 maximum = 0xe80;
581 canon_cr2:
582 height = raw_height - top_margin;
583 width = raw_width - left_margin;
584 } else if (!strcmp(model,"D1")) {
585 camera_red *= 256/527.0;
586 camera_blue *= 256/317.0;
587 } else if (!strcmp(model,"D1X")) {
588 width = 4024;
589 ymag = 2;
590 } else if (!strcmp(model,"D100")) {
591 if (tiff_data_compression == 34713 && load_raw == nikon_load_raw)
592 raw_width = (width += 3) + 3;
593 } else if (!strcmp(model,"D2H")) {
594 width = 2482;
595 left_margin = 6;
596 } else if (!strcmp(model,"D2X")) {
597 width = 4312;
598 pre_mul[0] = 1.514;
599 pre_mul[2] = 1.727;
600 } else if (fsize == 2465792) {
601 height = 1203;
602 width = 1616;
603 filters = 0x4b4b4b4b;
604 colors = 4;
605 load_raw = nikon_e950_load_raw;
606 nikon_e950_coeff();
607 pre_mul[0] = 1.18193;
608 pre_mul[2] = 1.16452;
609 pre_mul[3] = 1.17250;
610 } else if (!strcmp(model,"E990")) {
611 if (!timestamp && !nikon_e990()) goto cp_e995;
612 height = 1540;
613 width = 2064;
614 colors = 4;
615 filters = 0xb4b4b4b4;
616 nikon_e950_coeff();
617 pre_mul[0] = 1.196;
618 pre_mul[1] = 1.246;
619 pre_mul[2] = 1.018;
620 } else if (!strcmp(model,"E995")) {
621 cp_e995:
622 strcpy (model, "E995");
623 height = 1540;
624 width = 2064;
625 colors = 4;
626 filters = 0xe1e1e1e1;
627 } else if (!strcmp(model,"E2100")) {
628 if (!timestamp && !nikon_e2100()) goto cp_e2500;
629 width = 1616;
630 height = 1206;
631 load_raw = nikon_e2100_load_raw;
632 pre_mul[0] = 1.945;
633 pre_mul[2] = 1.040;
634 } else if (!strcmp(model,"E2500")) {
635 cp_e2500:
636 strcpy (model, "E2500");
637 width = 1616;
638 height = 1204;
639 colors = 4;
640 filters = 0x4b4b4b4b;
641 } else if (!strcmp(model,"E3700")) {
642 if (!timestamp && pentax_optio33()) goto optio_33wr;
643 height = 1542;
644 width = 2064;
645 load_raw = nikon_e2100_load_raw;
646 pre_mul[0] = 1.818;
647 pre_mul[2] = 1.618;
648 } else if (!strcmp(model,"Optio 33WR")) {
649 optio_33wr:
650 strcpy (make, "PENTAX");
651 strcpy (model,"Optio 33WR");
652 height = 1542;
653 width = 2064;
654 load_raw = nikon_e2100_load_raw;
655 flip = 1;
656 filters = 0x16161616;
657 pre_mul[0] = 1.331;
658 pre_mul[2] = 1.820;
659 } else if (!strcmp(model,"E4300")) {
660 if (!timestamp && minolta_z2()) goto dimage_z2;
661 height = 1710;
662 width = 2288;
663 filters = 0x16161616;
664 pre_mul[0] = 508;
665 pre_mul[1] = 256;
666 pre_mul[2] = 322;
667 } else if (!strcmp(model,"DiMAGE Z2")) {
668 dimage_z2:
669 strcpy (make, "MINOLTA");
670 strcpy (model,"DiMAGE Z2");
671 height = 1710;
672 width = 2288;
673 filters = 0x16161616;
674 load_raw = nikon_e2100_load_raw;
675 pre_mul[0] = 508;
676 pre_mul[1] = 256;
677 pre_mul[2] = 450;
678 } else if (!strcmp(model,"E4500")) {
679 height = 1708;
680 width = 2288;
681 colors = 4;
682 filters = 0xb4b4b4b4;
683 } else if (!strcmp(model,"R-D1")) {
684 tiff_data_compression = 34713;
685 load_raw = nikon_load_raw;
686 } else if (!strcmp(model,"FinePixS2Pro")) {
687 height = 3584;
688 width = 3583;
689 fuji_width = 2144;
690 filters = 0x61616161;
691 load_raw = fuji_s2_load_raw;
692 black = 128;
693 strcpy (model+7, " S2Pro");
694 } else if (!strcmp(model,"FinePix S3Pro")) {
695 height = 3583;
696 width = 3584;
697 fuji_width = 2144;
698 if (fsize > 18000000 && use_secondary)
699 data_offset += 4352*2*1444;
700 filters = 0x49494949;
701 load_raw = fuji_s3_load_raw;
702 maximum = 0xffff;
703 } else if (!strcmp(model,"FinePix S5000")) {
704 height = 2499;
705 width = 2500;
706 fuji_width = 1423;
707 filters = 0x49494949;
708 load_raw = fuji_s5000_load_raw;
709 maximum = 0x3e00;
710 } else if (!strcmp(model,"FinePix S5100") ||
711 !strcmp(model,"FinePix S5500")) {
712 height = 1735;
713 width = 2304;
714 data_offset += width*10;
715 filters = 0x49494949;
716 load_raw = unpacked_load_raw;
717 maximum = 0xffff;
718 } else if (!strcmp(model,"FinePix E550") ||
719 !strcmp(model,"FinePix F810") ||
720 !strcmp(model,"FinePix S7000")) {
721 height = 3587;
722 width = 3588;
723 fuji_width = 2047;
724 filters = 0x49494949;
725 load_raw = fuji_s7000_load_raw;
726 maximum = 0x3e00;
727 } else if (!strcmp(model,"FinePix F700") ||
728 !strcmp(model,"FinePix S20Pro")) {
729 height = 2523;
730 width = 2524;
731 fuji_width = 1440;
732 filters = 0x49494949;
733 load_raw = fuji_f700_load_raw;
734 maximum = 0x3e00;
735 } else if (!strcmp(model,"Digital Camera KD-400Z")) {
736 height = 1712;
737 width = 2312;
738 raw_width = 2336;
739 data_offset = 4034;
740 fseek_nofail (ifp, 2032, SEEK_SET);
741 goto konica_400z;
742 } else if (!strcmp(model,"Digital Camera KD-510Z")) {
743 data_offset = 4032;
744 pre_mul[0] = 1.297;
745 pre_mul[2] = 1.438;
746 fseek_nofail (ifp, 2032, SEEK_SET);
747 goto konica_510z;
748 } else if (!strcasecmp(make,"MINOLTA")) {
749 load_raw = unpacked_load_raw;
750 maximum = 0xf7d;
751 if (!strncmp(model,"DiMAGE A",8)) {
752 if (!strcmp(model,"DiMAGE A200")) {
753 filters = 0x49494949;
754 tmp = camera_red;
755 camera_red = 1 / camera_blue;
756 camera_blue = 1 / tmp;
757 }
758 load_raw = packed_12_load_raw;
759 maximum = model[8] == '1' ? 0xf8b : 0xfff;
760 } else if (!strncmp(model,"ALPHA",5) ||
761 !strncmp(model,"DYNAX",5) ||
762 !strncmp(model,"MAXXUM",6)) {
763 load_raw = packed_12_load_raw;
764 maximum = 0xffb;
765 } else if (!strncmp(model,"DiMAGE G",8)) {
766 if (model[8] == '4') {
767 data_offset = 5056;
768 pre_mul[0] = 1.602;
769 pre_mul[2] = 1.441;
770 fseek_nofail (ifp, 2078, SEEK_SET);
771 height = 1716;
772 width = 2304;
773 } else if (model[8] == '5') {
774 data_offset = 4016;
775 fseek_nofail (ifp, 1936, SEEK_SET);
776 konica_510z:
777 height = 1956;
778 width = 2607;
779 raw_width = 2624;
780 } else if (model[8] == '6') {
781 data_offset = 4032;
782 fseek_nofail (ifp, 2030, SEEK_SET);
783 height = 2136;
784 width = 2848;
785 }
786 filters = 0x61616161;
787 konica_400z:
788 load_raw = unpacked_load_raw;
789 maximum = 0x3df;
790 order = 0x4d4d;
791 camera_red = get2(ifp);
792 camera_blue = get2(ifp);
793 camera_red /= get2(ifp);
794 camera_blue /= get2(ifp);
795 }
796 if (pre_mul[0] == 1 && pre_mul[2] == 1) {
797 pre_mul[0] = 1.42;
798 pre_mul[2] = 1.25;
799 }
800 } else if (!strcmp(model,"*ist D")) {
801 load_raw = unpacked_load_raw;
802 } else if (!strcmp(model,"*ist DS")) {
803 height--;
804 load_raw = packed_12_load_raw;
805 } else if (!strcmp(model,"Optio S")) {
806 if (fsize == 3178560) {
807 height = 1540;
808 width = 2064;
809 load_raw = eight_bit_load_raw;
810 camera_red *= 4;
811 camera_blue *= 4;
812 pre_mul[0] = 1.391;
813 pre_mul[2] = 1.188;
814 } else {
815 height = 1544;
816 width = 2068;
817 raw_width = 3136;
818 load_raw = packed_12_load_raw;
819 maximum = 0xf7c;
820 pre_mul[0] = 1.137;
821 pre_mul[2] = 1.453;
822 }
823 } else if (!strncmp(model,"Optio S4",8)) {
824 height = 1737;
825 width = 2324;
826 raw_width = 3520;
827 load_raw = packed_12_load_raw;
828 maximum = 0xf7a;
829 pre_mul[0] = 1.980;
830 pre_mul[2] = 1.570;
831 } else if (!strcmp(model,"STV680 VGA")) {
832 height = 484;
833 width = 644;
834 load_raw = eight_bit_load_raw;
835 flip = 2;
836 filters = 0x16161616;
837 black = 16;
838 pre_mul[0] = 1.097;
839 pre_mul[2] = 1.128;
840 } else if (!strcmp(make,"Phase One")) {
841 switch (raw_height) {
842 case 2060:
843 strcpy (model, "LightPhase");
844 height = 2048;
845 width = 3080;
846 top_margin = 5;
847 left_margin = 22;
848 pre_mul[0] = 1.331;
849 pre_mul[2] = 1.154;
850 break;
851 case 2682:
852 strcpy (model, "H10");
853 height = 2672;
854 width = 4012;
855 top_margin = 5;
856 left_margin = 26;
857 break;
858 case 4128:
859 strcpy (model, "H20");
860 height = 4098;
861 width = 4098;
862 top_margin = 20;
863 left_margin = 26;
864 pre_mul[0] = 1.963;
865 pre_mul[2] = 1.430;
866 break;
867 case 5488:
868 strcpy (model, "H25");
869 height = 5458;
870 width = 4098;
871 top_margin = 20;
872 left_margin = 26;
873 pre_mul[0] = 2.80;
874 pre_mul[2] = 1.20;
875 }
876 filters = top_margin & 1 ? 0x94949494 : 0x49494949;
877 load_raw = phase_one_load_raw;
878 maximum = 0xffff;
879 } else if (!strcmp(model,"Ixpress")) {
880 height = 4084;
881 width = 4080;
882 filters = 0x49494949;
883 load_raw = ixpress_load_raw;
884 maximum = 0xffff;
885 pre_mul[0] = 1.963;
886 pre_mul[2] = 1.430;
887 } else if (!strcmp(make,"Sinar") && !memcmp(head,"8BPS",4)) {
888 fseek_nofail (ifp, 14, SEEK_SET);
889 height = get4(ifp);
890 width = get4(ifp);
891 filters = 0x61616161;
892 data_offset = 68;
893 load_raw = unpacked_load_raw;
894 maximum = 0xffff;
895 } else if (!strcmp(make,"Leaf")) {
896 if (height > width)
897 filters = 0x16161616;
898 load_raw = unpacked_load_raw;
899 maximum = 0x3fff;
900 strcpy (model, "Valeo");
901 if (raw_width == 2060) {
902 filters = 0;
903 load_raw = leaf_load_raw;
904 maximum = 0xffff;
905 strcpy (model, "Volare");
906 }
907 } else if (!strcmp(model,"DIGILUX 2") || !strcmp(model,"DMC-LC1")) {
908 height = 1928;
909 width = 2568;
910 data_offset = 1024;
911 load_raw = unpacked_load_raw;
912 maximum = 0xfff0;
913 } else if (!strcmp(model,"E-1")) {
914 filters = 0x61616161;
915 load_raw = unpacked_load_raw;
916 maximum = 0xfff0;
917 black = 1024;
918 } else if (!strcmp(model,"E-10")) {
919 load_raw = unpacked_load_raw;
920 maximum = 0xfff0;
921 black = 2048;
922 } else if (!strncmp(model,"E-20",4)) {
923 load_raw = unpacked_load_raw;
924 maximum = 0xffc0;
925 black = 2560;
926 } else if (!strcmp(model,"E-300")) {
927 width -= 21;
928 load_raw = olympus_e300_load_raw;
929 if (fsize > 15728640) {
930 load_raw = unpacked_load_raw;
931 maximum = 0xfc30;
932 } else
933 black = 62;
934 } else if (!strcmp(make,"OLYMPUS")) {
935 load_raw = olympus_cseries_load_raw;
936 if (!strcmp(model,"C5050Z") ||
937 !strcmp(model,"C8080WZ"))
938 filters = 0x16161616;
939 } else if (!strcmp(model,"N Digital")) {
940 height = 2047;
941 width = 3072;
942 filters = 0x61616161;
943 data_offset = 0x1a00;
944 load_raw = packed_12_load_raw;
945 maximum = 0xf1e;
946 } else if (!strcmp(model,"DSC-F828")) {
947 width = 3288;
948 left_margin = 5;
949 load_raw = sony_load_raw;
950 filters = 0x9c9c9c9c;
951 colors = 4;
952 black = 491;
953 } else if (!strcmp(model,"DSC-V3")) {
954 width = 3109;
955 left_margin = 59;
956 load_raw = sony_load_raw;
957 } else if (!strcasecmp(make,"KODAK")) {
958 filters = 0x61616161;
959 if (!strcmp(model,"NC2000F")) {
960 width -= 4;
961 left_margin = 1;
962 for (i=176; i < 0x1000; i++)
963 curve[i] = curve[i-1];
964 pre_mul[0] = 1.509;
965 pre_mul[2] = 2.686;
966 } else if (!strcmp(model,"EOSDCS3B")) {
967 width -= 4;
968 left_margin = 2;
969 } else if (!strcmp(model,"EOSDCS1")) {
970 width -= 4;
971 left_margin = 2;
972 } else if (!strcmp(model,"DCS315C")) {
973 black = 8;
974 } else if (!strcmp(model,"DCS330C")) {
975 black = 8;
976 } else if (!strcmp(model,"DCS420")) {
977 width -= 4;
978 left_margin = 2;
979 } else if (!strcmp(model,"DCS460")) {
980 width -= 4;
981 left_margin = 2;
982 } else if (!strcmp(model,"DCS460A")) {
983 width -= 4;
984 left_margin = 2;
985 colors = 1;
986 filters = 0;
987 } else if (!strcmp(model,"DCS520C")) {
988 black = 180;
989 } else if (!strcmp(model,"DCS560C")) {
990 black = 188;
991 } else if (!strcmp(model,"DCS620C")) {
992 black = 180;
993 } else if (!strcmp(model,"DCS620X")) {
994 black = 185;
995 } else if (!strcmp(model,"DCS660C")) {
996 black = 214;
997 } else if (!strcmp(model,"DCS660M")) {
998 black = 214;
999 colors = 1;
1000 filters = 0;
1001 } else if (!strcmp(model,"DCS760M")) {
1002 colors = 1;
1003 filters = 0;
1004 }
1005 switch (tiff_data_compression) {
1006 case 0: /* No compression */
1007 case 1:
1008 load_raw = kodak_easy_load_raw;
1009 break;
1010 case 7: /* Lossless JPEG */
1011 load_raw = lossless_jpeg_load_raw;
1012 case 32867:
1013 break;
1014 case 65000: /* Kodak DCR compression */
1015 if (!have64BitArithmetic)
1016 pm_error("This program was built without 64 bit arithmetic "
1017 "capability, and Kodak DCR compression requires it.");
1018 if (kodak_data_compression == 32803)
1019 load_raw = kodak_compressed_load_raw;
1020 else {
1021 load_raw = kodak_yuv_load_raw;
1022 height = (height+1) & -2;
1023 width = (width +1) & -2;
1024 filters = 0;
1025 }
1026 break;
1027 default:
1028 pm_message ("%s %s uses unrecognized compression method %d.",
1029 make, model, tiff_data_compression);
1030 return 1;
1031 }
1032 if (!strcmp(model,"DC20")) {
1033 height = 242;
1034 if (fsize < 100000) {
1035 width = 249;
1036 raw_width = 256;
1037 } else {
1038 width = 501;
1039 raw_width = 512;
1040 }
1041 data_offset = raw_width + 1;
1042 colors = 4;
1043 filters = 0x8d8d8d8d;
1044 kodak_dc20_coeff (1.0);
1045 pre_mul[1] = 1.179;
1046 pre_mul[2] = 1.209;
1047 pre_mul[3] = 1.036;
1048 load_raw = kodak_easy_load_raw;
1049 } else if (strstr(model,"DC25")) {
1050 strcpy (model, "DC25");
1051 height = 242;
1052 if (fsize < 100000) {
1053 width = 249;
1054 raw_width = 256;
1055 data_offset = 15681;
1056 } else {
1057 width = 501;
1058 raw_width = 512;
1059 data_offset = 15937;
1060 }
1061 colors = 4;
1062 filters = 0xb4b4b4b4;
1063 load_raw = kodak_easy_load_raw;
1064 } else if (!strcmp(model,"Digital Camera 40")) {
1065 strcpy (model, "DC40");
1066 height = 512;
1067 width = 768;
1068 data_offset = 1152;
1069 load_raw = kodak_radc_load_raw;
1070 } else if (strstr(model,"DC50")) {
1071 strcpy (model, "DC50");
1072 height = 512;
1073 width = 768;
1074 data_offset = 19712;
1075 load_raw = kodak_radc_load_raw;
1076 } else if (strstr(model,"DC120")) {
1077 strcpy (model, "DC120");
1078 height = 976;
1079 width = 848;
1080 if (tiff_data_compression == 7)
1081 load_raw = kodak_jpeg_load_raw;
1082 else
1083 load_raw = kodak_dc120_load_raw;
1084 }
1085 } else if (!strcmp(make,"Rollei")) {
1086 switch (raw_width) {
1087 case 1316:
1088 height = 1030;
1089 width = 1300;
1090 top_margin = 1;
1091 left_margin = 6;
1092 break;
1093 case 2568:
1094 height = 1960;
1095 width = 2560;
1096 top_margin = 2;
1097 left_margin = 8;
1098 }
1099 filters = 0x16161616;
1100 load_raw = rollei_load_raw;
1101 pre_mul[0] = 1.8;
1102 pre_mul[2] = 1.3;
1103 } else if (!strcmp(model,"PC-CAM 600")) {
1104 height = 768;
1105 data_offset = width = 1024;
1106 filters = 0x49494949;
1107 load_raw = eight_bit_load_raw;
1108 pre_mul[0] = 1.14;
1109 pre_mul[2] = 2.73;
1110 } else if (!strcmp(model,"QV-2000UX")) {
1111 height = 1208;
1112 width = 1632;
1113 data_offset = width * 2;
1114 load_raw = eight_bit_load_raw;
1115 } else if (!strcmp(model,"QV-3*00EX")) {
1116 height = 1546;
1117 width = 2070;
1118 raw_width = 2080;
1119 load_raw = eight_bit_load_raw;
1120 } else if (!strcmp(model,"QV-4000")) {
1121 height = 1700;
1122 width = 2260;
1123 load_raw = unpacked_load_raw;
1124 maximum = 0xffff;
1125 } else if (!strcmp(model,"QV-5700")) {
1126 height = 1924;
1127 width = 2576;
1128 load_raw = casio_qv5700_load_raw;
1129 } else if (!strcmp(model,"QV-R51")) {
1130 height = 1926;
1131 width = 2576;
1132 raw_width = 3904;
1133 load_raw = packed_12_load_raw;
1134 pre_mul[0] = 1.340;
1135 pre_mul[2] = 1.672;
1136 } else if (!strcmp(model,"EX-Z55")) {
1137 height = 1960;
1138 width = 2570;
1139 raw_width = 3904;
1140 load_raw = packed_12_load_raw;
1141 pre_mul[0] = 1.520;
1142 pre_mul[2] = 1.316;
1143 } else if (!strcmp(model,"EX-P600")) {
1144 height = 2142;
1145 width = 2844;
1146 raw_width = 4288;
1147 load_raw = packed_12_load_raw;
1148 pre_mul[0] = 1.797;
1149 pre_mul[2] = 1.219;
1150 } else if (!strcmp(model,"EX-P700")) {
1151 height = 2318;
1152 width = 3082;
1153 raw_width = 4672;
1154 load_raw = packed_12_load_raw;
1155 pre_mul[0] = 1.758;
1156 pre_mul[2] = 1.504;
1157 } else if (!strcmp(make,"Nucore")) {
1158 filters = 0x61616161;
1159 load_raw = unpacked_load_raw;
1160 if (width == 2598) {
1161 filters = 0x16161616;
1162 load_raw = nucore_load_raw;
1163 flip = 2;
1164 }
1165 }
1166 if (!use_coeff)
1167 adobeCoeff(make, model);
1168 dng_skip:
1169 if (!load_raw || !height) {
1170 pm_message ("This program cannot handle data from %s %s.",
1171 make, model);
1172 return 1;
1173 }
1174 #ifdef NO_JPEG
1175 if (load_raw == kodak_jpeg_load_raw) {
1176 pm_message ("decoder was not linked with libjpeg.");
1177 return 1;
1178 }
1179 #endif
1180 if (!raw_height) raw_height = height;
1181 if (!raw_width ) raw_width = width;
1182 if (use_camera_rgb && colors == 3)
1183 use_coeff = 0;
1184 if (use_coeff) /* Apply user-selected color balance */
1185 for (i=0; i < colors; i++) {
1186 coeff[0][i] *= red_scale;
1187 coeff[2][i] *= blue_scale;
1188 }
1189 if (four_color_rgb && filters && colors == 3) {
1190 for (i=0; i < 32; i+=4) {
1191 if ((filters >> i & 15) == 9)
1192 filters |= 2 << i;
1193 if ((filters >> i & 15) == 6)
1194 filters |= 8 << i;
1195 }
1196 colors++;
1197 pre_mul[3] = pre_mul[1];
1198 if (use_coeff)
1199 for (i=0; i < 3; i++)
1200 coeff[i][3] = coeff[i][1] /= 2;
1201 }
1202 fseek_nofail (ifp, data_offset, SEEK_SET);
1203
1204 *loadRawFnP = load_raw;
1205
1206 return 0;
1207 }
1208
1209
1210