Generic white-balance and color correction when dcraw_process()

I am creating a post-processing pipeline that will deal with a large variety of cameras (makes, models, lenses etc...)

All Formats supported by libraw will likely be encountered at some point.

All of the images will, at some point, call dcraw_process().

But, during testing, i have observed that some images tend to come out "dark", and some have "not ideal" white-balancing.

In search for a comparison, i looked at the images using FastRawViewer and they look EXCELLENT there!

Knowing that FastRawViewer uses Libraw also, i was wondering what could i tweak in order to achieve "universal" good post-processed images (i wouldn't go so far as to try and achieve Excellent outcomes)?

Simply put: i want to show the images as close as possible to how FastRawViewer shows them...

My flow is simple:
libraw->open_file();
libraw->imgdata.params.output_bps = 8;

// camera_wb sometimes give better results than auto, but auto is better in majority of cases
// this is something i would like to maybe automate to get better results from
libraw->imgdata.params.use_auto_wb = 1;
libraw->imgdata.params.use_camera_wb = 0;

libraw->unpack();
libraw->dcraw_process();

// jpeg extraction from here...

Here is one example ( i could find more if needed ):
Raw image: https://drive.google.com/file/d/1rRvgW_CP2YPiNnnCII7ftQlNx58vhlNp/view?u...
processed jpeg: https://drive.google.com/file/d/1oM-XKrdnVLPjU9Y2s__n0IwC_Qsh-Yu5/view?u...

Forums: 

FastRawViewer uses own

FastRawViewer uses own postprocessing, not LibRaw's

-- Alex Tutubalin @LibRaw LLC

Than you so much for the

Than you so much for the quick response.

I didn't know FastRawViewer has it's own processing. That's interesting...

I too was able to achieve that image, but only after i manually switched the wb method.

Anyway, since i cant invest in a whole new post-processing infra at the moment, and considering your comment:

"I do not think that auto-balance is well suited for such images with overall warm tint."

can you suggest a good way to detect said warm tints, so as to switch from auto to camera wb automatically, or is this something only human eye can detect and decern?

auto balance is based on the

auto balance is based on the idea of a "average gray" world, which is not true for global colored scenes.
If you take a photo of a green grass, then the result of automatic white balance will not satisfy you too.

-- Alex Tutubalin @LibRaw LLC