Add new comment

dcraw does all processing

dcraw does all processing until convert_to_rgb() in camera native color space and in 16-bit integers (no conversion to 0-1 float).

dcraw -d is completely diferent from dcraw -D because 'scale_colors()' call is used with -d. It scales input data range (12 or 14 bit, for example) to full 0..65535 scale (based on camera theoretical maximum, so underexposed images are not brightened more than needed).
dcraw -d -W will brighten output to get 1% of pixels in saturation.

Here is 'dcraw annotated and outlined': http://ninedegreesbelow.com/files/dcraw-c-code-annotated-code.html
(and preface: http://ninedegreesbelow.com/photography/dcraw-c-code-annotated.html ), hope it will help you with dcraw internals.

-- Alex Tutubalin @LibRaw LLC