Output Color Options

I'm using LibRaw in a macOS application for quickly showing thumbnails to a user of RAW files that aren't natively supported by macOS. It's working great, but I'm a bit confused by the documentation for:

dcraw_process

It says:

"The function is intended solely for demonstration and testing purposes; it is assumed that its source code will be used in most real applications as the reference material concerning the order of RAW data processing."

I don't intend to do any RAW processing myself so I'm relying on this method to produce an image that can be displayed to the user. Should I not be using it?

Along the same lines, if I do use that method, I'm curious what configuration options I should set to get an image that is visually similar to those produces by other RAW engines. I appreciate that not all RAW engines are the same, but the images I'm getting a considerably less saturated and contain considerably less contrast than those coming from other applications (including FastRawViewer).

The following settings are passable, but are there better ones I could be using?

  processor->imgdata.params.use_camera_wb = 1;
  processor->imgdata.params.gamm[0] = 1.0 / 2.4;
  processor->imgdata.params.gamm[1] = 12.92;

Thank you.

Forums: 

dcraw_process is derived

dcraw_process is derived (without any significant changes) from dcraw.c code
It is slow and image processing options are limited.

You may play with dcraw_emu sample and different command line options to get output that suits your needs. Each dcraw_emu command-line parameter translates into LibRaw.imgdata.params value.

-- Alex Tutubalin

Thanks Alex. Given your reply

Thanks Alex. Given your reply, am I correct in assuming that applications like FastRawViewer are not using dcraw for processing and are instead using their own algorithms?

On a related note, in Apple's Core Image framework for macOS, they have a filter called CIRawFilter that can take RAW data as input. The header file states that the following formats are supported:

kCVPixelFormatType_14Bayer_GRBG, 
kCVPixelFormatType_14Bayer_RGGB, 
kCVPixelFormatType_14Bayer_BGGR, 
kCVPixelFormatType_14Bayer_GBRG

If I want to try and use Core Image for post-processing, is there a way to get the unprocessed image data from LibRaw in any of the formats listed above?

Yes, FastRawViewer uses

Yes, FastRawViewer uses LibRaw (+RawSpeed +Adobe DNG SDK) to decode raw data and its own (post)processing code (written in SSE3/AVX2 assembly for speed, that's why FRV is Fast)

RawDigger uses LibRaw (+libs listed above) for decoding and dcraw_process() (with bilinear 'demosaic', fast but far from perfect), because RGB rendering is only for user reference (we plan to change demosaic to own code in future releases to provide better rendering, because many users use RawDigger as raw processor :).

I'm not familiar with Apple Core Image. It is very likely it will accept (cropped?) imgdata.rawdata.rawimage[] as input to CIRawFilter (this is flat array of unprocessed raw values decoded from camera).

-- Alex Tutubalin

Thanks for the additional

Thanks for the additional information and openness Alex, much appreciated.