Different _mul(s)

Image icon Untitled.png384.57 KB


In my understanding, pre_mul, user_mul and cam_mul were mutually exclusive:
if use_camera_wb=1, cam_mul was being used, if use_camera_wb=0, it was pre_mul, and if pre_mul was defined, then pre_mul was being used instead of the 2 others.

However I ran the following test, showing that it is not true:

no_auto_bright = 1

In [...], I try to use "as shot" white balance, setting either user_mul, pre_mul or use_camera_wb=1.
I was expecting all 3 pictures to be identical... but they're all different!

Here are the images.
Any cue?


As written on my pictures, I

As written on my pictures, I put either:
a copy of all 4 cam_mul values in user_mul
a copy of all 4 cam_mul values in pre_mul

I found some LibRaw code (scale colors) where either user_mul or cam_mul are being copied to pre_mul, which seem to confirm what I thought...
I just cannot understand why my pictures are different... I'll have to re-check...


So, after re-checking:

If I copy cam_mul to pre_mul BEFORE unpack(), I get the same picture (picture1) as if I copy cam_mul to user_mul.

If I copy cam_mul to pre_mul AFTER unpack(), I get picture2, different from the first one. However, copying cam_mul to user_mul after unpack() still produces picture1.
That may be simply because the right way to do is to set user_mul, not pre_mul... ;)

What worries me is that if I use_camera_wb=1, and do not touch user_mul nor pre_mul, I get picture3 (different from picture1). I was expecting to get picture1...

Things are complicated

Things are complicated because unpack() saves all color data into rawdata.color (and raw2image restores it). This is made to restore postprocessing initial state to run dcraw_process() multiple times with single unpack().

So, just use recommended way:
- default settings (nothing touched in params) to get daylight WB
- use_camera_wb=1 to get As shot
- use_auto_wb - to get automatic WB
- user_mul[] to get custom WB

If you mix these 3 customs settings, result is undefined (precedence is not specified, take look into source if you interested)

-- Alex Tutubalin



Still, it worries me that use_camera_wb=1 and user_mul=copyof(cam_mul) -not touching anything else- create 2 different pictures.

I had the idea to put use_camera_wb=1 AFTER open() instead of before. If I use it that way, then I get the same picture as with user_mul=copyof(cam_mul).

Do you confirm that this picture I get using use_camera_wb=1 AFTER open() or user_mul=copyof(cam_mul) is the correct "as shot" one, and that use_camera_wb=1 should be used after open() and not before?

I was referring to that page telling that use_camera_wb could affect open(), and therefore was affecting it before open(), but maybe it's wrong...

Looks like Sony file (ARW

Looks like Sony file (ARW extension).

For Sony files (with color profile data embedded in file), if use_camera_wb is on, then camera color matrix is used instead of LibRaw built in.

To get same results for use_camera_wb and user_mul set to camera WB values, set use_camera_matrix to 0

-- Alex Tutubalin

Is the camera color matrix

Is the camera color matrix you're talking about rgb_cam?
Since it gets only used when use_camera_matrix=1, I guess that this matrix is a "camera as shot" to rgb6500K... Is that Right?

In the case of my image, there is quite a big difference between use_camera_matrix=1 and LibRaw built in... LibRaw built in produces a much warmer image -I like it better on that specific picture-...
Any idea about the reason behind that? Are Sony raw files known to have differences between the camera_matrix and the cam_mul they include? Or is cam_mul not in the raw file but calculated from camera_matrix for Sony raws?



LibRaw's embedded color

LibRaw's embedded color profile (usually very similar to Adobe's) may differ from camera provided color data, so result difference is expected.

-- Alex Tutubalin