Set white level for ARW2 to 16300 to reduce camconst.json maintenance need.

This commit is contained in:
torger
2013-12-17 15:46:09 +01:00
parent 33708560ce
commit 6cc95767e8
2 changed files with 28 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
--- dcraw.c 2013-11-07 16:47:20.881721251 +0100
+++ dcraw.cc 2013-12-16 15:36:08.177247923 +0100
+++ dcraw.cc 2013-12-17 15:35:08.487517380 +0100
@@ -1,3 +1,15 @@
+/*RT*/#include <glib.h>
+/*RT*/#include <glib/gstdio.h>
@@ -274,7 +274,7 @@
merror (data, "sony_arw2_load_raw()");
for (row=0; row < height; row++) {
fread (data, 1, raw_width, ifp);
@@ -2464,11 +2428,12 @@
@@ -2464,11 +2428,13 @@
bit += 7;
}
for (i=0; i < 16; i++, col+=2)
@@ -285,10 +285,11 @@
}
free (data);
+ maximum = curve[0x7ff << 1]; // RT: fix maximum.
+ maximum = 16300; // RT: conservative white level tested on various ARW2 cameras. This constant was set in 2013-12-17, may need re-evaluation in the future.
}
void CLASS samsung_load_raw()
@@ -2690,7 +2655,7 @@
@@ -2690,7 +2656,7 @@
void CLASS foveon_decoder (unsigned size, unsigned code)
{
@@ -297,7 +298,7 @@
struct decode *cur;
int i, len;
@@ -4002,240 +3967,9 @@
@@ -4002,240 +3968,9 @@
image[row*width+col][c] = sum[c] / sum[c+4];
}
}
@@ -540,7 +541,7 @@
void CLASS cielab (ushort rgb[3], short lab[3])
{
@@ -4496,112 +4230,7 @@
@@ -4496,112 +4231,7 @@
}
#undef fcol
@@ -653,7 +654,7 @@
#undef TS
void CLASS median_filter()
@@ -4771,7 +4400,7 @@
@@ -4771,7 +4401,7 @@
}
}
@@ -662,7 +663,7 @@
void CLASS parse_makernote (int base, int uptag)
{
@@ -5177,7 +4806,7 @@
@@ -5177,7 +4807,7 @@
{ "","DCB2","Volare","Cantare","CMost","Valeo 6","Valeo 11","Valeo 22",
"Valeo 11p","Valeo 17","","Aptus 17","Aptus 22","Aptus 75","Aptus 65",
"Aptus 54S","Aptus 65S","Aptus 75S","AFi 5","AFi 6","AFi 7",
@@ -671,7 +672,7 @@
float romm_cam[3][3];
fseek (ifp, offset, SEEK_SET);
@@ -5265,6 +4894,8 @@
@@ -5265,6 +4895,8 @@
wbi = -2;
}
if (tag == 2118) wbtemp = getint(type);
@@ -680,7 +681,7 @@
if (tag == 2130 + wbi)
FORC3 mul[c] = getreal(type);
if (tag == 2140 + wbi && wbi >= 0)
@@ -5284,8 +4915,8 @@
@@ -5284,8 +4916,8 @@
}
}
@@ -691,7 +692,7 @@
int CLASS parse_tiff_ifd (int base)
{
@@ -5299,7 +4930,7 @@
@@ -5299,7 +4931,7 @@
unsigned sony_curve[] = { 0,0,0,0,0,4095 };
unsigned *buf, sony_offset=0, sony_length=0, sony_key=0;
struct jhead jh;
@@ -700,7 +701,7 @@
if (tiff_nifds >= sizeof tiff_ifd / sizeof tiff_ifd[0])
return 1;
@@ -5647,6 +5278,7 @@
@@ -5647,6 +5279,7 @@
break;
case 61450:
blrr = blrc = 2;
@@ -708,7 +709,7 @@
case 50714: /* BlackLevel */
black = getreal(type);
if ((unsigned)(filters+1) < 1000) break;
@@ -5737,12 +5369,13 @@
@@ -5737,12 +5370,13 @@
fread (buf, sony_length, 1, ifp);
sony_decrypt (buf, sony_length/4, 1, sony_key);
sfp = ifp;
@@ -728,7 +729,7 @@
ifp = sfp;
free (buf);
}
@@ -5766,6 +5399,7 @@
@@ -5766,6 +5400,7 @@
int CLASS parse_tiff (int base)
{
int doff;
@@ -736,7 +737,7 @@
fseek (ifp, base, SEEK_SET);
order = get2();
@@ -5843,7 +5477,7 @@
@@ -5843,7 +5478,7 @@
case 8: load_raw = &CLASS eight_bit_load_raw; break;
case 12: if (tiff_ifd[raw].phint == 2)
load_flags = 6;
@@ -745,7 +746,7 @@
case 14: load_flags = 0;
case 16: load_raw = &CLASS unpacked_load_raw;
if (!strncmp(make,"OLYMPUS",7) &&
@@ -5959,7 +5593,7 @@
@@ -5959,7 +5594,7 @@
{
const char *file, *ext;
char *jname, *jfile, *jext;
@@ -754,7 +755,7 @@
ext = strrchr (ifname, '.');
file = strrchr (ifname, '/');
@@ -5981,13 +5615,14 @@
@@ -5981,13 +5616,14 @@
} else
while (isdigit(*--jext)) {
if (*jext != '9') {
@@ -771,7 +772,7 @@
if (verbose)
fprintf (stderr,_("Reading metadata from %s ...\n"), jname);
parse_tiff (12);
@@ -6330,7 +5965,11 @@
@@ -6330,7 +5966,11 @@
order = get2();
hlen = get4();
if (get4() == 0x48454150) /* "HEAP" */
@@ -783,7 +784,7 @@
if (parse_tiff (save+6)) apply_tiff();
fseek (ifp, save+len, SEEK_SET);
}
@@ -6582,7 +6221,8 @@
@@ -6582,7 +6222,8 @@
{
static const struct {
const char *prefix;
@@ -793,7 +794,7 @@
} table[] = {
{ "AgfaPhoto DC-833m", 0, 0, /* DJC */
{ 11438,-3762,-1115,-2409,9914,2497,-1227,2295,5300 } },
@@ -7383,6 +7023,27 @@
@@ -7383,6 +7024,27 @@
}
break;
}
@@ -821,7 +822,7 @@
}
void CLASS simple_coeff (int index)
@@ -7682,13 +7343,20 @@
@@ -7682,13 +7344,20 @@
fread (head, 1, 32, ifp);
fseek (ifp, 0, SEEK_END);
flen = fsize = ftell(ifp);
@@ -844,7 +845,7 @@
parse_ciff (hlen, flen-hlen, 0);
load_raw = &CLASS canon_load_raw;
} else if (parse_tiff(0)) apply_tiff();
@@ -7734,6 +7402,7 @@
@@ -7734,6 +7403,7 @@
fseek (ifp, 100+28*(shot_select > 0), SEEK_SET);
parse_tiff (data_offset = get4());
parse_tiff (thumb_offset+12);
@@ -852,7 +853,7 @@
apply_tiff();
} else if (!memcmp (head,"RIFF",4)) {
fseek (ifp, 0, SEEK_SET);
@@ -7839,15 +7508,18 @@
@@ -7839,15 +7509,18 @@
if (make[0] == 0) parse_smal (0, flen);
if (make[0] == 0) {
parse_jpeg(0);
@@ -880,7 +881,7 @@
}
for (i=0; i < sizeof corp / sizeof *corp; i++)
@@ -7878,7 +7550,7 @@
@@ -7878,7 +7551,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")))
@@ -889,7 +890,7 @@
if (width >= 4960 && !strncmp(model,"K-5",3))
{ left_margin = 10; width = 4950; filters = 0x16161616; }
if (width == 4736 && !strcmp(model,"K-7"))
@@ -8026,7 +7698,7 @@
@@ -8026,7 +7699,7 @@
width -= 44;
} else if (!strcmp(model,"D3200") ||
!strcmp(model,"D600") ||
@@ -898,7 +899,7 @@
width -= 46;
} else if (!strcmp(model,"D4")) {
width -= 52;
@@ -8630,195 +8302,8 @@
@@ -8630,195 +8303,8 @@
cmsCloseProfile (hInProfile);
}
#endif
@@ -1096,7 +1097,7 @@
struct tiff_tag {
ushort tag, type;
@@ -8841,584 +8326,12 @@
@@ -8841,584 +8327,12 @@
unsigned gps[26];
char desc[512], make[64], model[64], soft[32], date[20], artist[64];
};