'Cannot use camera white balance' error in console when using Sony files and RT compiled with gcc 4.8.x, Issue 2121

This commit is contained in:
Ingo
2014-01-01 23:06:24 +01:00
parent e0a9dce133
commit b633f0b762
2 changed files with 54 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
--- dcraw.c 2013-11-07 16:47:20.881721251 +0100
+++ dcraw.cc 2013-12-17 15:35:08.487517380 +0100
--- dcraw.c 2014-01-01 15:42:38 +0000
+++ dcraw.cc 2014-01-01 18:32:58 +0000
@@ -1,3 +1,15 @@
+/*RT*/#include <glib.h>
+/*RT*/#include <glib/gstdio.h>
@@ -147,15 +147,9 @@
#define SWAP(a,b) { a=a+b; b=a-b; a=a-b; }
/*
@@ -250,10 +212,11 @@
{ 1,3,1,2,3,2,3,2,0,2,0,1,1,0,3,0 },
{ 0,2,0,3,1,0,0,1,1,3,3,2,3,2,2,1 },
{ 2,1,3,2,3,1,2,1,0,3,0,2,0,2,0,2 },
- { 0,3,1,0,0,2,0,3,2,1,3,1,1,3,1,3 } };
+ { 0,3,1,0,0,2,0,3,2,1,3,1,1,3,1,3 } };
@@ -254,6 +216,7 @@
- if (filters == 1) return filter[(row+top_margin)&15][(col+left_margin)&15];
+ if (filters == 1) return filter[(row+top_margin)&15][(col+left_margin)&15];
if (filters == 1) return filter[(row+top_margin)&15][(col+left_margin)&15];
if (filters == 9) return xtrans[(row+top_margin+6)%6][(col+left_margin+6)%6];
+
return FC(row,col);
@@ -264,7 +258,20 @@
if (start) {
for (p=0; p < 4; p++)
pad[p] = key = key * 48828125 + 1;
@@ -2445,7 +2408,8 @@
@@ -2386,8 +2349,10 @@
for (p=0; p < 127; p++)
pad[p] = htonl(pad[p]);
}
- while (len--)
- *data++ ^= pad[p++ & 127] = pad[(p+1) & 127] ^ pad[(p+65) & 127];
+ while (len--){
+ *data++ ^= pad[p & 127] = pad[(p+1) & 127] ^ pad[(p+65) & 127];
+ p++;
+ }
}
void CLASS sony_load_raw()
@@ -2445,7 +2410,8 @@
ushort pix[16];
int row, col, val, max, min, imax, imin, sh, bit, i;
@@ -274,7 +281,7 @@
merror (data, "sony_arw2_load_raw()");
for (row=0; row < height; row++) {
fread (data, 1, raw_width, ifp);
@@ -2464,11 +2428,13 @@
@@ -2464,11 +2430,13 @@
bit += 7;
}
for (i=0; i < 16; i++, col+=2)
@@ -289,7 +296,7 @@
}
void CLASS samsung_load_raw()
@@ -2690,7 +2656,7 @@
@@ -2690,7 +2658,7 @@
void CLASS foveon_decoder (unsigned size, unsigned code)
{
@@ -298,12 +305,9 @@
struct decode *cur;
int i, len;
@@ -4002,240 +3968,9 @@
image[row*width+col][c] = sum[c] / sum[c+4];
@@ -4003,239 +3971,8 @@
}
}
+
+/* RT: delete interpolation functions */
-void CLASS lin_interpolate()
-{
@@ -493,7 +497,8 @@
- int dir[5] = { 1, width, -1, -width, 1 };
- int row, col, diff[2], guess[2], c, d, i;
- ushort (*pix)[4];
-
+/* RT: delete interpolation functions */
- border_interpolate(3);
- if (verbose) fprintf (stderr,_("PPG interpolation...\n"));
-
@@ -541,7 +546,7 @@
void CLASS cielab (ushort rgb[3], short lab[3])
{
@@ -4496,112 +4231,7 @@
@@ -4496,112 +4233,7 @@
}
#undef fcol
@@ -654,7 +659,7 @@
#undef TS
void CLASS median_filter()
@@ -4771,7 +4401,7 @@
@@ -4771,7 +4403,7 @@
}
}
@@ -663,7 +668,7 @@
void CLASS parse_makernote (int base, int uptag)
{
@@ -5177,7 +4807,7 @@
@@ -5177,7 +4809,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",
@@ -672,7 +677,7 @@
float romm_cam[3][3];
fseek (ifp, offset, SEEK_SET);
@@ -5265,6 +4895,8 @@
@@ -5265,6 +4897,8 @@
wbi = -2;
}
if (tag == 2118) wbtemp = getint(type);
@@ -681,7 +686,7 @@
if (tag == 2130 + wbi)
FORC3 mul[c] = getreal(type);
if (tag == 2140 + wbi && wbi >= 0)
@@ -5284,8 +4916,8 @@
@@ -5284,8 +4918,8 @@
}
}
@@ -692,7 +697,7 @@
int CLASS parse_tiff_ifd (int base)
{
@@ -5299,7 +4931,7 @@
@@ -5299,7 +4933,7 @@
unsigned sony_curve[] = { 0,0,0,0,0,4095 };
unsigned *buf, sony_offset=0, sony_length=0, sony_key=0;
struct jhead jh;
@@ -701,7 +706,7 @@
if (tiff_nifds >= sizeof tiff_ifd / sizeof tiff_ifd[0])
return 1;
@@ -5647,6 +5279,7 @@
@@ -5647,6 +5281,7 @@
break;
case 61450:
blrr = blrc = 2;
@@ -709,7 +714,7 @@
case 50714: /* BlackLevel */
black = getreal(type);
if ((unsigned)(filters+1) < 1000) break;
@@ -5737,12 +5370,13 @@
@@ -5737,12 +5372,13 @@
fread (buf, sony_length, 1, ifp);
sony_decrypt (buf, sony_length/4, 1, sony_key);
sfp = ifp;
@@ -729,7 +734,7 @@
ifp = sfp;
free (buf);
}
@@ -5766,6 +5400,7 @@
@@ -5766,6 +5402,7 @@
int CLASS parse_tiff (int base)
{
int doff;
@@ -737,7 +742,7 @@
fseek (ifp, base, SEEK_SET);
order = get2();
@@ -5843,7 +5478,7 @@
@@ -5843,7 +5480,7 @@
case 8: load_raw = &CLASS eight_bit_load_raw; break;
case 12: if (tiff_ifd[raw].phint == 2)
load_flags = 6;
@@ -746,7 +751,7 @@
case 14: load_flags = 0;
case 16: load_raw = &CLASS unpacked_load_raw;
if (!strncmp(make,"OLYMPUS",7) &&
@@ -5959,7 +5594,7 @@
@@ -5959,7 +5596,7 @@
{
const char *file, *ext;
char *jname, *jfile, *jext;
@@ -755,7 +760,7 @@
ext = strrchr (ifname, '.');
file = strrchr (ifname, '/');
@@ -5981,13 +5616,14 @@
@@ -5981,13 +5618,14 @@
} else
while (isdigit(*--jext)) {
if (*jext != '9') {
@@ -772,7 +777,7 @@
if (verbose)
fprintf (stderr,_("Reading metadata from %s ...\n"), jname);
parse_tiff (12);
@@ -6330,7 +5966,11 @@
@@ -6330,7 +5968,11 @@
order = get2();
hlen = get4();
if (get4() == 0x48454150) /* "HEAP" */
@@ -784,7 +789,7 @@
if (parse_tiff (save+6)) apply_tiff();
fseek (ifp, save+len, SEEK_SET);
}
@@ -6582,7 +6222,8 @@
@@ -6582,7 +6224,8 @@
{
static const struct {
const char *prefix;
@@ -794,7 +799,7 @@
} table[] = {
{ "AgfaPhoto DC-833m", 0, 0, /* DJC */
{ 11438,-3762,-1115,-2409,9914,2497,-1227,2295,5300 } },
@@ -7383,6 +7024,27 @@
@@ -7383,6 +7026,27 @@
}
break;
}
@@ -822,7 +827,7 @@
}
void CLASS simple_coeff (int index)
@@ -7682,13 +7344,20 @@
@@ -7682,13 +7346,20 @@
fread (head, 1, 32, ifp);
fseek (ifp, 0, SEEK_END);
flen = fsize = ftell(ifp);
@@ -845,7 +850,7 @@
parse_ciff (hlen, flen-hlen, 0);
load_raw = &CLASS canon_load_raw;
} else if (parse_tiff(0)) apply_tiff();
@@ -7734,6 +7403,7 @@
@@ -7734,6 +7405,7 @@
fseek (ifp, 100+28*(shot_select > 0), SEEK_SET);
parse_tiff (data_offset = get4());
parse_tiff (thumb_offset+12);
@@ -853,7 +858,7 @@
apply_tiff();
} else if (!memcmp (head,"RIFF",4)) {
fseek (ifp, 0, SEEK_SET);
@@ -7839,15 +7509,18 @@
@@ -7839,15 +7511,18 @@
if (make[0] == 0) parse_smal (0, flen);
if (make[0] == 0) {
parse_jpeg(0);
@@ -881,7 +886,7 @@
}
for (i=0; i < sizeof corp / sizeof *corp; i++)
@@ -7878,7 +7551,7 @@
@@ -7878,7 +7553,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")))
@@ -890,7 +895,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 +7699,7 @@
@@ -8026,7 +7701,7 @@
width -= 44;
} else if (!strcmp(model,"D3200") ||
!strcmp(model,"D600") ||
@@ -899,11 +904,10 @@
width -= 46;
} else if (!strcmp(model,"D4")) {
width -= 52;
@@ -8630,195 +8303,8 @@
cmsCloseProfile (hInProfile);
@@ -8631,194 +8306,7 @@
}
#endif
-
-void CLASS convert_to_rgb()
-{
- int row, col, c, i, j, k;
@@ -1092,12 +1096,11 @@
- if (flip & 1) col = iwidth - 1 - col;
- return row * iwidth + col;
-}
+
+/* RT: removed unused functions */
struct tiff_tag {
ushort tag, type;
@@ -8841,584 +8327,12 @@
@@ -8841,584 +8329,12 @@
unsigned gps[26];
char desc[512], make[64], model[64], soft[32], date[20], artist[64];
};