diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 295826826..5c00bfe21 100755 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -320,6 +320,11 @@ than measure white levels). If you experience a black level issue it's more likely due to a format parsing bug which should be fixed in DCRaw and/or RawTherapee's raw format parser. +How does a black level issue look? If the image has a color cast and is +possibly duller than normal it's likely that black levels are off. The color +cast is typically stronger in darker colors but it can be hard to see, it's +more often experienced as a cast over the whole image. + */ {"camera_constants": [ diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index ea2e8b708..add80ba15 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -5278,6 +5278,7 @@ guess_cfa_pc: break; case 61450: blrr = blrc = 2; + if (filters == UINT_MAX) filters = 0x94949494; /* RT: Fuji X100 fix for dcraw 9.19 to get proper black level parsing, hopefully works for other Fuji cameras too! */ case 50714: /* BlackLevel */ black = getreal(type); if ((unsigned)(filters+1) < 1000) break; diff --git a/rtengine/dcraw.patch b/rtengine/dcraw.patch old mode 100644 new mode 100755 index 688623980..13727dbf0 --- a/rtengine/dcraw.patch +++ b/rtengine/dcraw.patch @@ -1,5 +1,5 @@ ---- dcraw.c 2013-08-12 09:32:14.000000000 +0200 -+++ dcraw.cc 2013-11-03 10:34:08.000000000 +0100 +--- dcraw.c 2013-11-07 16:47:20.881721251 +0100 ++++ dcraw.cc 2013-11-18 11:32:46.856425587 +0100 @@ -1,3 +1,15 @@ +/*RT*/#include +/*RT*/#include @@ -700,7 +700,15 @@ if (tiff_nifds >= sizeof tiff_ifd / sizeof tiff_ifd[0]) return 1; -@@ -5737,12 +5368,13 @@ +@@ -5647,6 +5278,7 @@ + break; + case 61450: + blrr = blrc = 2; ++ if (filters == UINT_MAX) filters = 0x94949494; /* RT: Fuji X100 fix for dcraw 9.19 to get proper black level parsing, hopefully works for other Fuji cameras too! */ + case 50714: /* BlackLevel */ + black = getreal(type); + if ((unsigned)(filters+1) < 1000) break; +@@ -5737,12 +5369,13 @@ fread (buf, sony_length, 1, ifp); sony_decrypt (buf, sony_length/4, 1, sony_key); sfp = ifp; @@ -720,7 +728,7 @@ ifp = sfp; free (buf); } -@@ -5766,6 +5398,7 @@ +@@ -5766,6 +5399,7 @@ int CLASS parse_tiff (int base) { int doff; @@ -728,7 +736,7 @@ fseek (ifp, base, SEEK_SET); order = get2(); -@@ -5843,7 +5476,7 @@ +@@ -5843,7 +5477,7 @@ case 8: load_raw = &CLASS eight_bit_load_raw; break; case 12: if (tiff_ifd[raw].phint == 2) load_flags = 6; @@ -737,7 +745,7 @@ case 14: load_flags = 0; case 16: load_raw = &CLASS unpacked_load_raw; if (!strncmp(make,"OLYMPUS",7) && -@@ -5959,7 +5592,7 @@ +@@ -5959,7 +5593,7 @@ { const char *file, *ext; char *jname, *jfile, *jext; @@ -746,7 +754,7 @@ ext = strrchr (ifname, '.'); file = strrchr (ifname, '/'); -@@ -5981,13 +5614,14 @@ +@@ -5981,13 +5615,14 @@ } else while (isdigit(*--jext)) { if (*jext != '9') { @@ -763,7 +771,7 @@ if (verbose) fprintf (stderr,_("Reading metadata from %s ...\n"), jname); parse_tiff (12); -@@ -6330,7 +5964,11 @@ +@@ -6330,7 +5965,11 @@ order = get2(); hlen = get4(); if (get4() == 0x48454150) /* "HEAP" */ @@ -775,7 +783,7 @@ if (parse_tiff (save+6)) apply_tiff(); fseek (ifp, save+len, SEEK_SET); } -@@ -6582,7 +6220,8 @@ +@@ -6582,7 +6221,8 @@ { static const struct { const char *prefix; @@ -785,7 +793,7 @@ } table[] = { { "AgfaPhoto DC-833m", 0, 0, /* DJC */ { 11438,-3762,-1115,-2409,9914,2497,-1227,2295,5300 } }, -@@ -7383,6 +7022,27 @@ +@@ -7383,6 +7023,27 @@ } break; } @@ -813,7 +821,7 @@ } void CLASS simple_coeff (int index) -@@ -7682,13 +7342,20 @@ +@@ -7682,13 +7343,20 @@ fread (head, 1, 32, ifp); fseek (ifp, 0, SEEK_END); flen = fsize = ftell(ifp); @@ -836,7 +844,7 @@ parse_ciff (hlen, flen-hlen, 0); load_raw = &CLASS canon_load_raw; } else if (parse_tiff(0)) apply_tiff(); -@@ -7734,6 +7401,7 @@ +@@ -7734,6 +7402,7 @@ fseek (ifp, 100+28*(shot_select > 0), SEEK_SET); parse_tiff (data_offset = get4()); parse_tiff (thumb_offset+12); @@ -844,7 +852,7 @@ apply_tiff(); } else if (!memcmp (head,"RIFF",4)) { fseek (ifp, 0, SEEK_SET); -@@ -7839,15 +7507,18 @@ +@@ -7839,15 +7508,18 @@ if (make[0] == 0) parse_smal (0, flen); if (make[0] == 0) { parse_jpeg(0); @@ -872,7 +880,7 @@ } for (i=0; i < sizeof corp / sizeof *corp; i++) -@@ -7878,7 +7549,7 @@ +@@ -7878,7 +7550,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"))) @@ -881,7 +889,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 +7697,7 @@ +@@ -8026,7 +7698,7 @@ width -= 44; } else if (!strcmp(model,"D3200") || !strcmp(model,"D600") || @@ -890,7 +898,7 @@ width -= 46; } else if (!strcmp(model,"D4")) { width -= 52; -@@ -8630,195 +8301,8 @@ +@@ -8630,195 +8302,8 @@ cmsCloseProfile (hInProfile); } #endif @@ -1088,7 +1096,7 @@ struct tiff_tag { ushort tag, type; -@@ -8841,584 +8325,12 @@ +@@ -8841,584 +8326,12 @@ unsigned gps[26]; char desc[512], make[64], model[64], soft[32], date[20], artist[64]; };