Add new comment

Two notes:

Two notes:
1) Not sure what 'irreversible raw file' is. If you mean 'highlights compression' used in many lossy formats (Nikon, Sony, DNGs), than yes, first step is to make data from file back to linear space.

5) Mapping to logical 0-1 values: from developer (programmer) point of view, 'logical 0-1' means 'zeroes and ones only'. If I understand you correctly, in our (programmer) terms, you mean 0...1.0 'floating point' range with intermediate values.
Practically, this conversion is not mandatory unless 'possible data maximum' is correct. One may use, for example, 0...16383 range for 14 bit data.

dcraw -D -W

-D means 'document mode 2' so: unchanged raw values (linearized on your step 1) are contained in dcraw's image[] array after processing. Black level is not subtracted.

-W means 'no automatic brightening', so image histogram is not calculated and data are converted to 2.2 gamma and scaled to 8 bits (if no other keys are passed to dcraw)

Without -W, image histogram is calculated and output is scaled to have 1% of pixels in saturation.

-- Alex Tutubalin @LibRaw LLC