Little CMS2 - LCMS2 - Does it work / What's the issue?

I was reminded of this reading a post yesterday.
Aurelien Pierre and maybe others have I believe said it doesn’t work. It’s hard to reconcile this with all the work that Elle Stone did. As quoted yesterday - LCMS2 unbounded ICC profile conversions

Can she possibly have done so much investigation and not noticed if it “was not working”? Maybe AP meant is was working, but not properly (or as he would like). Maybe LCMS2 became broken at some point. Does anyone have any knowledge about this. It is unsatisfactory that there is so little detail (unless I’ve missed it). It raises questions, for example if it doesn’t work, should the option be removed from DT’s preferences?

I’ve done some testing and LCMS2 (aka LittleCMS 2) does make a difference.

If you tick the box for it in prefs, you will subsequently have options for rendering intent in Output Profile and other places (see manual).

One option, perceptual, is traditionally quite useful because it brings out-of-gamut colours into range. For this to work in DT, you need an output profile with a LUT. Here I am using one from the International Color Consortium’s website, free to download, called sRGB_v4_ICC_preference.icc.

With LCMS2 on, the following outputs are all different, so it is doing something!
sRGB_v4_ICC_preference and perceptual
sRGB_v4_ICC_preference and relative colorimetric
sRGB websafe and perceptual

sRGB websafe does not have a LUT and apparently this means perceptual rendering is not possible. Websafe without LCMS2 gives the same output as with LCMS2 on and perceptual intent.

There is no difference between some of the intents, at least not with my test pic. So with sRGB_v4_ICC_preference,
Saturation = Perceptual
Absolute colorimetric = Relative col.

To further confuse (me), there is this from the DT manual (9.6) describing the option to turn LCMS2 on:
If the given ICC is LUT-based or contains both a LUT and a matrix, darktable will use LittleCMS 2 to render the colors regardless of this parameter’s value (default off).
and yet using sRGB_v4_ICC_preference causes this message in the Terminal window:
[dt_ioppr_set_pipe_output_profile_info] unsupported output profile 0 /home/bill/.config/darktable-3jul/color/out/sRGB_v4_ICC_preference.icc, it will be replaced with sRGB
If it was replaced, the outputs would not be different, but they are different.

So this is a messy area and could do with some clarity and perhaps tidying up. Devs and those who understand, please shed light!

2 Likes

Ooops, here are the three different renderings -

and here’s one of the XMPs, minimal processing, all the same except for rendering intent.
IMG_3129-sunset-on-ferry-2-LUT-perceptual-V1-SN-sRGB.xmp (39.7 KB)
Note, I’m not trying to produce nice images here, just experimenting.

I will check at home where the error message comes from. However from memory, I believe that the output color profile module does its job with the profiles you gave. The error message is when the output color profile is ”announced” on the pipe so that other modules (such as filmic v6) can use the information. Can’t check the XMP right now, but which filmic version did you use? For this test one should probably use something else than filmic v6 to avoid the gamut mapping there kicking in and causing confusion. Also, could you please label which image is which?

If you hover over the images, the popup pretty much identifies them but to be clearer,
1st is sRGB websafe
2nd is sRGB_v4_ICC_preference + perceptual
3rd is sRGB_v4_ICC_preference + relative colorimetric

I deliberately didn’t use filmic for this, it’s really just white balance, exposure and output.

1 Like

Thanks. While you’re at it, Could you post yet another rendering with integrated sRGB websafe profile and relative colorimetric intent? I’ll try to look at this and give a detailed answer later.

IMG_3129-sunset-on-ferry-3-websafe-rel-col-V1-SN-sRGB.xmp (17.5 KB)

This is close but not the same as websafe perceptual (=websafe with no LCMS2). If you put one on top of the other in Gimp with subtract blending, here’s what you get -

and if you exaggerate it with a Levels adjustment you get

Thanks @RawConvert for doing these tests. Many people have probably been wondering about these matters.

The sRGB_v4_ICC_preference.icc is a so-called LUT profile which, instead of a matrix and curves, contains look-up tables for different rendering intents that tell how colors should be mapped from a reference medium to the output (or something along the lines of this).

sRGB (web-safe) built-in profile in darktable is a profile of the “matrix + curves” type.

The error:

[dt_ioppr_set_pipe_output_profile_info] unsupported output profile 0 /home/bill/.config/darktable-3jul/color/out/sRGB_v4_ICC_preference.icc, it will be replaced with sRGB

just tells that darktable won’t be able to use profile internally for some things. Namely, the output profile is used for:

  • color managing the sliders in color balance rgb and color calibration (so nothing that relates to the final image, just UI)
  • final gamut mapping in filmic rgb v6 color science

These functions will then fall back to the built-in sRGB profile. However, the output color profile module will apply the requested color profile and intent (using Little CMS 2) at export. This is also apparent from the results you posted.

  1. The sRGB web-safe rendering (first image) clearly shows gamut escape in the brightest highlights - RGB channel values higher than 1 clipped, thus the initially orange highlights turn into yellow when the red channel can’t go high enough.

  2. The v4 profile with perceptual rendering intent preserves the hue better in the highlights and results in kind of a heavy compression.

  3. The v4 profile with relative colorimetric intent also shows the gamut escape in highlights and looks pretty similar to the first one there. It also seems like a bit of an outlier – the shadows are quite a lot darker than any of the other renderings. I’m not experienced enough in ICC profiles to be able to tell what might be the reason for that. However, the whitepaper about usage of the v4 profile might be a good place to start if someone wants to find out.

  4. sRGB (web-safe) with relative colorimetric rendering intent is essentially similar to the same profile with the perceptual rendering intent. This is to be expected since the profile doesn’t contain any “intent look-up tables”.

One of the discussions about LCMS2 you are referring to might be this one on GitHub. There it is stated that LCMS2 doesn’t do gamut-mapping at output or honor the intent. This seems to stand true in cases where a “matrix + curves” type profile is used. The necessary information (LUTs) to apply the perceptual rendering intent just isn’t present. Someone linked this comment from the author of LCMS2 where it is stated that LCMS2 applies the rendering intent if an intent table exists. This is pretty much consistent with your findings in this thread, and I’m quite glad to see it in action. So, well done! I hope others also find this informative.

8 Likes

Thanks to you both for looking in to this and taking the time to explain how it works. The presence of filmic v6 can really dampen any changes that you see on screen. I hadn’t really even thought about that. I knew from a few things that i have read about v6 that there had been this introduction of gamut mapping or at least changes to it but I was actually shocked when I compared turning softproofing on and off with it present vs being disabled…

I think this is why I felt it wasn’t working as I thought, ie the softproofing and likely as my monitor is not so far from srgb then with v6 enabled there wasn’t much of a change that I noticed…

Thx again