D65 or D50 sRGB

I'm trying to get some clarity around exactly which color-spaces are used in libraw's output, as I haven't yet been able to get my colors to look "right". I see in internal/dcraw_common.cpp, there is an xyzd50_srgb matrix. Given the name, and the numbers that are listed, this looks to be using a D50 whitepoint. However, the Wikipedia article on sRGB lists a different matrix which seems to assume a D65 whitepoint. The Wikipedia article seems to agree with most sources I find online, including W3.

Supposing I wanted libraw to produce images whose colors matched the JPEG previews that are embedded into the raw files, do I need to change this matrix to its D65 counterpart? If so, would it make sense to add another colorspace for "sRGB D65" or similar?

... And actually, looking more closely, it looks like the xyzd50_srgb matrix isn't included in the out_rgb array at all -- when I specify output_color = 1, is it just using the identity matrix (rgb_rgb)?

Ok, backing up a little bit. I guess my question is this: how do I get libraw to output in D65 sRGB colorspace?

Thanks for your help.


Yes, camera profiles are

Yes, camera profiles are already camera-RGB-to-sRGB, so matrix mentioned does not matter in color space conversion. It is used only in output profile calculations (this profile is embedded into TIFF files recorded by dcraw_ppm_tiff_writer())

To match camera JPEG colors you need to use same (in-camera) color profile and tonal (contrast) curve.

-- Alex Tutubalin