The DNGs I get from CHDK use zero to represent bad pixels. RawTherapee interpolates these pixels but by default dcraw doesn't. The code to do it is already in there we just need to let dcraw know that it needs to interpolate these pixels. Below is a patch that adds a new -Z option to dcraw which forces it to interpolate pixels with a value of zero.
--- dcraw.c.bak
+++ dcraw.c
@@ -115,7 +115,7 @@
unsigned thumb_length, meta_length, profile_length;
unsigned thumb_misc, *oprof, fuji_layout, shot_select=0, multi_out=0;
unsigned tiff_nifds, tiff_samples, tiff_bps, tiff_compress;
-unsigned black, maximum, mix_green, raw_color, zero_is_bad;
+unsigned black, maximum, mix_green, raw_color, zero_is_bad, force_zero_is_bad;
unsigned zero_after_ff, is_raw, dng_version, is_foveon, data_error;
unsigned tile_width, tile_length, gpsdata[32], load_flags;
unsigned flip, tiff_flip, filters, colors;
@@ -10146,6 +10146,7 @@
puts(_("-6 Write 16-bit instead of 8-bit"));
puts(_("-4 Linear 16-bit, same as \"-6 -W -g 1 1\""));
puts(_("-T Write TIFF instead of PPM"));
+ puts(_("-Z Force interpolation of pixels in the RAW data with a value of zero."));
puts("");
return 1;
}
@@ -10210,6 +10211,7 @@
case '4': gamm[0] = gamm[1] =
no_auto_bright = 1;
case '6': output_bps = 16; break;
+ case 'Z': force_zero_is_bad = 1; break;
default:
fprintf (stderr,_("Unknown option \"-%c\".\n"), opt);
return 1;
@@ -10406,7 +10408,7 @@
crop_masked_pixels();
free (raw_image);
}
- if (zero_is_bad) remove_zeroes();
+ if (zero_is_bad || force_zero_is_bad) remove_zeroes();
bad_pixels (bpfile);
if (dark_frame) subtract (dark_frame);
quality = 2 + !fuji_width;