Join GitHub today
[cmake] Add support for LCMS2 #11072
Add missing icc support to color management.
Motivation and Context
How Has This Been Tested?
Built and briefly runtime tested with and without liblcms2 present in system.
Screenshots (if appropriate):
Types of change
I use the ICC Profile with Colour Management on my Linux installation without any problems. I noticed that the problem in LibreELEC occurs with the lcms2 library, and I'm currently using the 2.7 version whereas the crash log shows that they're using the 2.8 version.
Just looking at the code of these 2 versions, there do seem to be some substantial changes in the code, especially in the underlying methods used (the xform method). It seems to use something called "strides" now (no idea what that is though). Here is a full comparison of the changes in the source file between 2.7 and 2.8:
I believe this is the relevant commit where most of these changes seem to be made:
I don't know what these changes in the library actually do, but I think it may have changed the behaviour of the cmsDoTransform method in way that could cause this problem or maybe even have introduced a bug there. I hope this information will help solve the problem.
I just tested whether the new version really does break the color correction, but it doesn't seem like it does. On Debian Unstable, I upgraded liblcms2-dev from 2.7-1 to 2.8-2 and Kodi still plays everything correctly with color correction. I tried turning color management on and off while playing a video (as described in the LibreELEC PR), but that works correctly too. I looked at the patches applied to liblcms2 on Debian (https://sources.debian.net/patches/lcms2/2.8-2/) and they don't seem relevant to this problem.
I think a more consistent reproduction recipe would be needed here.
I think I managed to reproduce the problem. It seems to occur when you use the ICC mode but don't configure an actual ICC profile file.
The obvious solution is to actually select an ICC profile when you configure that mode in Colour Management. Once I selected my ICC profile, it all worked correctly. Perhaps this can be enforced so you always have to provide an ICC profile when you use that mode in Colour Management.
I looked at some other places in the Settings where similar behaviour is implemented and I think there are 2 ways for this to work:
I would personally prefer the second option as it feels the most user-friendly (but I'm not an expert in these things). Either way though, I think the discrepancies between the OSD and System settings I mentioned in the second option, should also be resolved.
Shouldn't the change in how the UI looks and behaves for Colour Management be completely separate from whether or not lcms2 should be included in cmake?
I think this could be merged and the UI and behaviour fixes for Colour Management can be done independently. Currently, Colour Management works just fine, the problems in the LibreELEC PR were due to improper configuration (caused by the current UI and behaviour).
Of course, the question of which platforms this should apply to is still open.