Added initial support for IQ3 MP100 and 16 bit IIQ files (RawFormat 8)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
--- dcraw.c 2016-01-02 12:05:48 +0000
|
||||
+++ dcraw.cc 2016-01-02 13:21:21 +0000
|
||||
--- dcraw.c 2015-09-08 08:08:11.000000000 +0200
|
||||
+++ dcraw.cc 2016-01-08 15:37:02.884467080 +0100
|
||||
@@ -1,3 +1,15 @@
|
||||
+/*RT*/#include <glib.h>
|
||||
+/*RT*/#include <glib/gstdio.h>
|
||||
@@ -236,7 +236,17 @@
|
||||
unsigned c;
|
||||
|
||||
if (nbits == -1)
|
||||
@@ -1731,6 +1695,338 @@
|
||||
@@ -1721,7 +1685,8 @@
|
||||
pixel[col] = curve[pixel[col]];
|
||||
}
|
||||
for (col=0; col < raw_width; col++) {
|
||||
- i = (pixel[col] << 2) - ph1.black
|
||||
+ if (ph1.format != 8) pixel[col] <<= 2;
|
||||
+ i = pixel[col] - ph1.black
|
||||
+ cblack[row][col >= ph1.split_col]
|
||||
+ rblack[col][row >= ph1.split_row];
|
||||
if (i > 0) RAW(row,col) = i;
|
||||
@@ -1731,6 +1696,338 @@
|
||||
maximum = 0xfffc - ph1.black;
|
||||
}
|
||||
|
||||
@@ -575,7 +585,7 @@
|
||||
void CLASS hasselblad_load_raw()
|
||||
{
|
||||
struct jhead jh;
|
||||
@@ -1954,10 +2250,10 @@
|
||||
@@ -1954,10 +2251,10 @@
|
||||
maximum = curve[0x3ff];
|
||||
}
|
||||
|
||||
@@ -589,7 +599,7 @@
|
||||
int byte;
|
||||
|
||||
if (!nbits) return vbits=0;
|
||||
@@ -2140,7 +2436,7 @@
|
||||
@@ -2140,7 +2437,7 @@
|
||||
|
||||
void CLASS kodak_radc_load_raw()
|
||||
{
|
||||
@@ -598,7 +608,7 @@
|
||||
1,1, 2,3, 3,4, 4,2, 5,7, 6,5, 7,6, 7,8,
|
||||
1,0, 2,1, 3,3, 4,4, 5,2, 6,7, 7,6, 8,5, 8,8,
|
||||
2,1, 2,3, 3,0, 3,2, 3,4, 4,6, 5,5, 6,7, 6,8,
|
||||
@@ -2246,11 +2542,11 @@
|
||||
@@ -2246,11 +2543,11 @@
|
||||
METHODDEF(boolean)
|
||||
fill_input_buffer (j_decompress_ptr cinfo)
|
||||
{
|
||||
@@ -612,7 +622,7 @@
|
||||
cinfo->src->next_input_byte = jpeg_buffer;
|
||||
cinfo->src->bytes_in_buffer = nbytes;
|
||||
return TRUE;
|
||||
@@ -2600,10 +2896,9 @@
|
||||
@@ -2600,10 +2897,9 @@
|
||||
maximum = (1 << (thumb_misc & 31)) - 1;
|
||||
}
|
||||
|
||||
@@ -625,7 +635,7 @@
|
||||
if (start) {
|
||||
for (p=0; p < 4; p++)
|
||||
pad[p] = key = key * 48828125 + 1;
|
||||
@@ -2688,11 +2983,13 @@
|
||||
@@ -2688,11 +2984,13 @@
|
||||
bit += 7;
|
||||
}
|
||||
for (i=0; i < 16; i++, col+=2)
|
||||
@@ -640,7 +650,7 @@
|
||||
}
|
||||
|
||||
void CLASS samsung_load_raw()
|
||||
@@ -2988,7 +3285,7 @@
|
||||
@@ -2988,7 +3286,7 @@
|
||||
|
||||
void CLASS foveon_decoder (unsigned size, unsigned code)
|
||||
{
|
||||
@@ -649,7 +659,7 @@
|
||||
struct decode *cur;
|
||||
int i, len;
|
||||
|
||||
@@ -3085,7 +3382,7 @@
|
||||
@@ -3085,7 +3383,7 @@
|
||||
pred[c] += diff[dindex->leaf];
|
||||
if (pred[c] >> 16 && ~pred[c] >> 16) derror();
|
||||
}
|
||||
@@ -658,7 +668,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3696,6 +3993,8 @@
|
||||
@@ -3696,6 +3994,8 @@
|
||||
if (load_raw == &CLASS phase_one_load_raw ||
|
||||
load_raw == &CLASS phase_one_load_raw_c)
|
||||
phase_one_correct();
|
||||
@@ -667,7 +677,7 @@
|
||||
if (fuji_width) {
|
||||
for (row=0; row < raw_height-top_margin*2; row++) {
|
||||
for (col=0; col < fuji_width << !fuji_layout; col++) {
|
||||
@@ -3711,10 +4010,13 @@
|
||||
@@ -3711,10 +4011,13 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -683,7 +693,7 @@
|
||||
if (mask[0][3] > 0) goto mask_set;
|
||||
if (load_raw == &CLASS canon_load_raw ||
|
||||
load_raw == &CLASS lossless_jpeg_load_raw) {
|
||||
@@ -4316,239 +4618,8 @@
|
||||
@@ -4316,239 +4619,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -924,7 +934,7 @@
|
||||
|
||||
void CLASS cielab (ushort rgb[3], short lab[3])
|
||||
{
|
||||
@@ -4814,112 +4885,7 @@
|
||||
@@ -4814,112 +4886,7 @@
|
||||
}
|
||||
#undef fcol
|
||||
|
||||
@@ -1037,7 +1047,7 @@
|
||||
#undef TS
|
||||
|
||||
void CLASS median_filter()
|
||||
@@ -5089,7 +5055,7 @@
|
||||
@@ -5089,7 +5056,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1046,7 +1056,7 @@
|
||||
|
||||
void CLASS parse_makernote (int base, int uptag)
|
||||
{
|
||||
@@ -5194,6 +5160,11 @@
|
||||
@@ -5194,6 +5161,11 @@
|
||||
tag |= uptag << 16;
|
||||
if (tag == 2 && strstr(make,"NIKON") && !iso_speed)
|
||||
iso_speed = (get2(),get2());
|
||||
@@ -1058,7 +1068,7 @@
|
||||
if (tag == 4 && len > 26 && len < 35) {
|
||||
if ((i=(get4(),get2())) != 0x7fff && !iso_speed)
|
||||
iso_speed = 50 * pow (2, i/32.0 - 4);
|
||||
@@ -5246,12 +5217,16 @@
|
||||
@@ -5246,12 +5218,16 @@
|
||||
cam_mul[2] = get4() << 2;
|
||||
}
|
||||
}
|
||||
@@ -1076,7 +1086,7 @@
|
||||
if (tag == 0x1d)
|
||||
while ((c = fgetc(ifp)) && c != EOF)
|
||||
serial = serial*10 + (isdigit(c) ? c - '0' : c % 10);
|
||||
@@ -5442,6 +5417,7 @@
|
||||
@@ -5442,6 +5418,7 @@
|
||||
case 33434: shutter = getreal(type); break;
|
||||
case 33437: aperture = getreal(type); break;
|
||||
case 34855: iso_speed = get2(); break;
|
||||
@@ -1084,7 +1094,7 @@
|
||||
case 36867:
|
||||
case 36868: get_timestamp(0); break;
|
||||
case 37377: if ((expo = -getreal(type)) < 128)
|
||||
@@ -5613,28 +5589,33 @@
|
||||
@@ -5613,28 +5590,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1124,7 +1134,7 @@
|
||||
entries = get2();
|
||||
if (entries > 512) return 1;
|
||||
while (entries--) {
|
||||
@@ -5702,7 +5683,8 @@
|
||||
@@ -5702,7 +5684,8 @@
|
||||
fgets (make, 64, ifp);
|
||||
break;
|
||||
case 272: /* Model */
|
||||
@@ -1134,7 +1144,7 @@
|
||||
break;
|
||||
case 280: /* Panasonic RW2 offset */
|
||||
if (type != 4) break;
|
||||
@@ -5762,6 +5744,9 @@
|
||||
@@ -5762,6 +5745,9 @@
|
||||
case 315: /* Artist */
|
||||
fread (artist, 64, 1, ifp);
|
||||
break;
|
||||
@@ -1144,7 +1154,7 @@
|
||||
case 322: /* TileWidth */
|
||||
tiff_ifd[ifd].tile_width = getint(type);
|
||||
break;
|
||||
@@ -5777,6 +5762,9 @@
|
||||
@@ -5777,6 +5763,9 @@
|
||||
is_raw = 5;
|
||||
}
|
||||
break;
|
||||
@@ -1154,7 +1164,7 @@
|
||||
case 330: /* SubIFDs */
|
||||
if (!strcmp(model,"DSLR-A100") && tiff_ifd[ifd].width == 3872) {
|
||||
load_raw = &CLASS sony_arw_load_raw;
|
||||
@@ -5790,6 +5778,9 @@
|
||||
@@ -5790,6 +5779,9 @@
|
||||
fseek (ifp, i+4, SEEK_SET);
|
||||
}
|
||||
break;
|
||||
@@ -1164,7 +1174,7 @@
|
||||
case 400:
|
||||
strcpy (make, "Sarnoff");
|
||||
maximum = 0xfff;
|
||||
@@ -5971,6 +5962,9 @@
|
||||
@@ -5971,6 +5963,9 @@
|
||||
if (!make[0]) strcpy (make, "DNG");
|
||||
is_raw = 1;
|
||||
break;
|
||||
@@ -1174,7 +1184,7 @@
|
||||
case 50710: /* CFAPlaneColor */
|
||||
if (filters == 9) break;
|
||||
if (len > 4) len = 4;
|
||||
@@ -6002,12 +5996,21 @@
|
||||
@@ -6002,12 +5997,21 @@
|
||||
case 61450:
|
||||
cblack[4] = cblack[5] = MIN(sqrt(len),64);
|
||||
case 50714: /* BlackLevel */
|
||||
@@ -1202,7 +1212,7 @@
|
||||
case 50715: /* BlackLevelDeltaH */
|
||||
case 50716: /* BlackLevelDeltaV */
|
||||
for (num=i=0; i < len; i++)
|
||||
@@ -6024,13 +6027,13 @@
|
||||
@@ -6024,13 +6028,13 @@
|
||||
case 50721: /* ColorMatrix1 */
|
||||
case 50722: /* ColorMatrix2 */
|
||||
FORCC for (j=0; j < 3; j++)
|
||||
@@ -1218,7 +1228,7 @@
|
||||
break;
|
||||
case 50727: /* AnalogBalance */
|
||||
FORCC ab[c] = getreal(type);
|
||||
@@ -6053,6 +6056,11 @@
|
||||
@@ -6053,6 +6057,11 @@
|
||||
case 50752:
|
||||
read_shorts (cr2_slice, 3);
|
||||
break;
|
||||
@@ -1230,7 +1240,7 @@
|
||||
case 50829: /* ActiveArea */
|
||||
top_margin = getint(type);
|
||||
left_margin = getint(type);
|
||||
@@ -6085,21 +6093,27 @@
|
||||
@@ -6085,21 +6094,27 @@
|
||||
fread (buf, sony_length, 1, ifp);
|
||||
sony_decrypt (buf, sony_length/4, 1, sony_key);
|
||||
sfp = ifp;
|
||||
@@ -1266,7 +1276,7 @@
|
||||
cam_xyz_coeff (cmatrix, cam_xyz);
|
||||
}
|
||||
if (asn[0]) {
|
||||
@@ -6107,13 +6121,14 @@
|
||||
@@ -6107,13 +6122,14 @@
|
||||
FORCC cam_mul[c] = 1 / asn[c];
|
||||
}
|
||||
if (!use_cm)
|
||||
@@ -1282,7 +1292,7 @@
|
||||
|
||||
fseek (ifp, base, SEEK_SET);
|
||||
order = get2();
|
||||
@@ -6191,7 +6206,12 @@
|
||||
@@ -6191,7 +6207,12 @@
|
||||
case 8: load_raw = &CLASS eight_bit_load_raw; break;
|
||||
case 12: if (tiff_ifd[raw].phint == 2)
|
||||
load_flags = 6;
|
||||
@@ -1296,7 +1306,7 @@
|
||||
case 14: load_flags = 0;
|
||||
case 16: load_raw = &CLASS unpacked_load_raw;
|
||||
if (!strncmp(make,"OLYMPUS",7) &&
|
||||
@@ -6230,6 +6250,7 @@
|
||||
@@ -6230,6 +6251,7 @@
|
||||
case 32803: load_raw = &CLASS kodak_65000_load_raw;
|
||||
}
|
||||
case 32867: case 34892: break;
|
||||
@@ -1304,7 +1314,7 @@
|
||||
default: is_raw = 0;
|
||||
}
|
||||
if (!dng_version)
|
||||
@@ -6315,7 +6336,7 @@
|
||||
@@ -6315,7 +6337,7 @@
|
||||
{
|
||||
const char *file, *ext;
|
||||
char *jname, *jfile, *jext;
|
||||
@@ -1313,7 +1323,7 @@
|
||||
|
||||
ext = strrchr (ifname, '.');
|
||||
file = strrchr (ifname, '/');
|
||||
@@ -6337,13 +6358,14 @@
|
||||
@@ -6337,13 +6359,14 @@
|
||||
} else
|
||||
while (isdigit(*--jext)) {
|
||||
if (*jext != '9') {
|
||||
@@ -1330,7 +1340,7 @@
|
||||
if (verbose)
|
||||
fprintf (stderr,_("Reading metadata from %s ...\n"), jname);
|
||||
parse_tiff (12);
|
||||
@@ -6620,6 +6642,7 @@
|
||||
@@ -6620,6 +6643,7 @@
|
||||
load_raw = ph1.format < 3 ?
|
||||
&CLASS phase_one_load_raw : &CLASS phase_one_load_raw_c;
|
||||
maximum = 0xffff;
|
||||
@@ -1338,7 +1348,7 @@
|
||||
strcpy (make, "Phase One");
|
||||
if (model[0]) return;
|
||||
switch (raw_height) {
|
||||
@@ -6688,7 +6711,11 @@
|
||||
@@ -6688,7 +6712,11 @@
|
||||
order = get2();
|
||||
hlen = get4();
|
||||
if (get4() == 0x48454150) /* "HEAP" */
|
||||
@@ -1350,7 +1360,7 @@
|
||||
if (parse_tiff (save+6)) apply_tiff();
|
||||
fseek (ifp, save+len, SEEK_SET);
|
||||
}
|
||||
@@ -6960,7 +6987,8 @@
|
||||
@@ -6960,7 +6988,8 @@
|
||||
{
|
||||
static const struct {
|
||||
const char *prefix;
|
||||
@@ -1360,7 +1370,7 @@
|
||||
} table[] = {
|
||||
{ "AgfaPhoto DC-833m", 0, 0, /* DJC */
|
||||
{ 11438,-3762,-1115,-2409,9914,2497,-1227,2295,5300 } },
|
||||
@@ -7919,6 +7947,33 @@
|
||||
@@ -7919,6 +7948,33 @@
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1394,7 +1404,7 @@
|
||||
}
|
||||
|
||||
void CLASS simple_coeff (int index)
|
||||
@@ -8229,7 +8284,7 @@
|
||||
@@ -8229,7 +8285,7 @@
|
||||
tiff_flip = flip = filters = UINT_MAX; /* unknown */
|
||||
raw_height = raw_width = fuji_width = fuji_layout = cr2_slice[0] = 0;
|
||||
maximum = height = width = top_margin = left_margin = 0;
|
||||
@@ -1403,7 +1413,7 @@
|
||||
iso_speed = shutter = aperture = focal_len = unique_id = 0;
|
||||
tiff_nifds = 0;
|
||||
memset (tiff_ifd, 0, sizeof tiff_ifd);
|
||||
@@ -8261,13 +8316,20 @@
|
||||
@@ -8261,13 +8317,20 @@
|
||||
fread (head, 1, 32, ifp);
|
||||
fseek (ifp, 0, SEEK_END);
|
||||
flen = fsize = ftell(ifp);
|
||||
@@ -1426,7 +1436,7 @@
|
||||
parse_ciff (hlen, flen-hlen, 0);
|
||||
load_raw = &CLASS canon_load_raw;
|
||||
} else if (parse_tiff(0)) apply_tiff();
|
||||
@@ -8313,6 +8375,7 @@
|
||||
@@ -8313,6 +8376,7 @@
|
||||
fseek (ifp, 100+28*(shot_select > 0), SEEK_SET);
|
||||
parse_tiff (data_offset = get4());
|
||||
parse_tiff (thumb_offset+12);
|
||||
@@ -1434,7 +1444,7 @@
|
||||
apply_tiff();
|
||||
} else if (!memcmp (head,"RIFF",4)) {
|
||||
fseek (ifp, 0, SEEK_SET);
|
||||
@@ -8426,9 +8489,10 @@
|
||||
@@ -8426,9 +8490,10 @@
|
||||
if (make[0] == 0) parse_smal (0, flen);
|
||||
if (make[0] == 0) {
|
||||
parse_jpeg(0);
|
||||
@@ -1448,7 +1458,7 @@
|
||||
strcpy (make, "OmniVision");
|
||||
data_offset = ftell(ifp) + 0x8000-32;
|
||||
width = raw_width;
|
||||
@@ -8437,6 +8501,7 @@
|
||||
@@ -8437,6 +8502,7 @@
|
||||
filters = 0x16161616;
|
||||
} else is_raw = 0;
|
||||
}
|
||||
@@ -1456,7 +1466,7 @@
|
||||
|
||||
for (i=0; i < sizeof corp / sizeof *corp; i++)
|
||||
if (strcasestr (make, corp[i])) /* Simplify company names */
|
||||
@@ -8468,7 +8533,7 @@
|
||||
@@ -8468,7 +8534,7 @@
|
||||
if (height == 3136 && width == 4864) /* Pentax K20D and Samsung GX20 */
|
||||
{ height = 3124; width = 4688; filters = 0x16161616; }
|
||||
if (width == 4352 && (!strcmp(model,"K-r") || !strcmp(model,"K-x")))
|
||||
@@ -1465,7 +1475,7 @@
|
||||
if (width >= 4960 && !strncmp(model,"K-5",3))
|
||||
{ left_margin = 10; width = 4950; filters = 0x16161616; }
|
||||
if (width == 4736 && !strcmp(model,"K-7"))
|
||||
@@ -8487,6 +8552,7 @@
|
||||
@@ -8487,6 +8553,7 @@
|
||||
switch (tiff_compress) {
|
||||
case 1: load_raw = &CLASS packed_dng_load_raw; break;
|
||||
case 7: load_raw = &CLASS lossless_dng_load_raw; break;
|
||||
@@ -1473,7 +1483,7 @@
|
||||
case 34892: load_raw = &CLASS lossy_dng_load_raw; break;
|
||||
default: load_raw = 0;
|
||||
}
|
||||
@@ -8541,6 +8607,7 @@
|
||||
@@ -8541,6 +8608,7 @@
|
||||
if (height > width) pixel_aspect = 2;
|
||||
filters = 0;
|
||||
simple_coeff(0);
|
||||
@@ -1481,7 +1491,7 @@
|
||||
} else if (!strcmp(make,"Canon") && tiff_bps == 15) {
|
||||
switch (width) {
|
||||
case 3344: width -= 66;
|
||||
@@ -8846,24 +8913,53 @@
|
||||
@@ -8846,24 +8914,53 @@
|
||||
if (load_raw == &CLASS lossless_jpeg_load_raw)
|
||||
load_raw = &CLASS hasselblad_load_raw;
|
||||
if (raw_width == 7262) {
|
||||
@@ -1540,7 +1550,7 @@
|
||||
} else if (raw_width == 4090) {
|
||||
strcpy (model, "V96C");
|
||||
height -= (top_margin = 6);
|
||||
@@ -8921,6 +9017,7 @@
|
||||
@@ -8921,6 +9018,7 @@
|
||||
filters = 0x16161616;
|
||||
}
|
||||
} else if (!strcmp(make,"Leica") || !strcmp(make,"Panasonic")) {
|
||||
@@ -1548,7 +1558,7 @@
|
||||
if ((flen - data_offset) / (raw_width*8/7) == raw_height)
|
||||
load_raw = &CLASS panasonic_load_raw;
|
||||
if (!load_raw) {
|
||||
@@ -8938,6 +9035,7 @@
|
||||
@@ -8938,6 +9036,7 @@
|
||||
}
|
||||
filters = 0x01010101 * (uchar) "\x94\x61\x49\x16"
|
||||
[((filters-1) ^ (left_margin & 1) ^ (top_margin << 1)) & 3];
|
||||
@@ -1556,7 +1566,7 @@
|
||||
} else if (!strcmp(model,"C770UZ")) {
|
||||
height = 1718;
|
||||
width = 2304;
|
||||
@@ -9155,6 +9253,18 @@
|
||||
@@ -9155,6 +9254,18 @@
|
||||
memcpy (rgb_cam, cmatrix, sizeof cmatrix);
|
||||
raw_color = 0;
|
||||
}
|
||||
@@ -1575,7 +1585,7 @@
|
||||
if (raw_color) adobe_coeff (make, model);
|
||||
if (load_raw == &CLASS kodak_radc_load_raw)
|
||||
if (raw_color) adobe_coeff ("Apple","Quicktake");
|
||||
@@ -9169,9 +9279,9 @@
|
||||
@@ -9169,9 +9280,9 @@
|
||||
if (raw_width < width ) raw_width = width;
|
||||
}
|
||||
if (!tiff_bps) tiff_bps = 12;
|
||||
@@ -1587,7 +1597,7 @@
|
||||
is_raw = 0;
|
||||
#ifdef NO_JASPER
|
||||
if (load_raw == &CLASS redcine_load_raw) {
|
||||
@@ -9250,194 +9360,249 @@
|
||||
@@ -9250,194 +9361,249 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2016,7 +2026,7 @@
|
||||
|
||||
struct tiff_tag {
|
||||
ushort tag, type;
|
||||
@@ -9461,590 +9626,11 @@
|
||||
@@ -9461,590 +9627,11 @@
|
||||
char desc[512], make[64], model[64], soft[32], date[20], artist[64];
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user