DCRAW is known for being a linear-output RAW developer. David Coffin claims there is no improvement in applying gamma before the final 16-bit integer rounding. Images produced by DCRAW can be de-linearized in PS just by converting from the output colour profile into the same one but with gamma, and it works.
However this creates the expected holes in the histogram which mean lower tonal richness in the left end. Another fellow and me have introduced a
-g option into DCRAW so that -g 2.2 (or any value) can be used to apply a gamma curve to the output right
before the final rounding to 16-bit integer.
I wonder if the improvement will be useful in the end or not, but looking at the histograms they are simply superb, all levels get nicely filled.
Moreover we have just applied a perfect gamma curve (OUT=IN^(1/2.2)) which in sRGB means more expansion in the deep shadows of the histogram so it's easier to handle them preventing black aggregation. Of course a specific sRGB-like profile but with the exact gamma parameter has to be assigned so that the image looks the same as developed and assigned in the normalized sRGB.
This is the comparision between the exact and sRGB 2.2 gamma:
I will offer the dcraw.exe for download soon.
The changes applied in the code don't go very far from just doing:
FORC3 img[c] = CLIP((int)
65535.0*pow(out[c]
/65535.0,1/user_gamma));
instead the original DCRAW code:
FORC3 img[c] = CLIP((int) out[c]);
These are the histograms when developing linear sRGB and converting to non-linear sRGB in PS:
(top:general view, bottom: 1:2 zoom view, maximum zoom for 15-bit PS images)
dcraw -o 1 -4And these are the same areas of the histogram when using the new non-linear DCRAW:
dcraw -o 1 -g 2.2 -4Increased tonal richness and precision, and easier to handle shadows with PS curves (since they don't remain so close to 0) in sRGB.
This is what the image looks like:
Left: developed in linear sRGB and converted again into sRGB in PS (de-linearized)
Centre: developed in pure 2.2 gamma with DCRAW and assigned to sRGB (shadows look lifted)
Right: same as centre but assigned to a specific sRGB-like profile but using exact 2.2 gamma. Looks identical as left but with the higher quality histogram.
Do you think this is useful?
BTW looking at ACR originated histograms, they also contain big holes in the shadows what makes me think ACR does not stay floating point up to the very last stage, but rounds to integer before the gamma.