[argyllcms] Re: xicclu

  • From: Graeme Gill <graeme@xxxxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Fri, 30 Dec 2005 13:01:18 +1100

Klaus Karcher wrote:

but now to the problem I've encountered with xicclu:

xicclu -fb -ip -pj /any/cmyk/profile.icc:
10.000000 0.000000 -30.000000 [Jab] -> Lut -> nan nan nan nan [CMYK]
20.000000 0.000000 -60.000000 [Jab] -> Lut -> nan nan nan nan [CMYK]
30.000000 0.000000 -90.000000 [Jab] -> Lut -> nan nan nan nan [CMYK]

... same story with -fif, other Rendering Intents or RGB-Profiles:
as soon as J/a = -1/3 and b=0, xicclu returns nan

I'm neither a programmer nor know much about Color Appearance Models, but I fiddled about with gdb and guess that the trigger is the evaluation of the Helmholtz-Kohlraush effect in cam_to_XYZ() (file cam02.c):

Actually there is a problem whenever J == 0. There are severe problems with the whole of CIECAM02, when applied to real world tasks like gamut mapping, and although I have tried to work around these problems, I don't think I've solved the issues completely. (The Helmholtz-Kohlraush correction exacerbates things.) There were two papers on this issue at the last CIC (See <http://www.imaging.org/store/epub.cfm?abstrid=33548>, and <http://www.imaging.org/store/epub.cfm?abstrid=33567>), although both of these papers use rather a different approach to address the problem than the approach I've chosen.

A workaround seems to be to add the following at about line 512 of cam02.c:

-------------------------------------------------------
    /* Achromatic response */
    A = spow(J, 1.0/(s->C * s->z)) * s->Aw;

+   /* Avoid numerical issues when J == 0.0 */
+   if (fabs(J) < 1e-8)
+       J = J < 0.0 ? -1e-8 : 1e-8;

    /* Preliminary Saturation - always +ve */
    tt = fabs(J);
    ss = pow(C/(pow(tt, 0.5) * s->nn), 1.0/0.9);    /* keep +ve */

-------------------------------------------------------

I'll include this in the next release.

Graeme Gill.

Other related posts: