InternationalColorConsortium/DemoIccMAX

Color management result by CMM may be "-nan(ind)"

Opened this issue · 0 comments

I noticed that when I apply the profile below to CMM, "-nan(ind)" may be returned.

InputProfile : ICCProfile_sRGB_v5.xml.icc
OutputProfile : ICCProfile_AdobeRGB_v5.xml.icc

For example, if you input a RGB device value = ( 0, 0, 64) (normalized RGB value = ( 0, 0, 0.2510),
the output will be a normalized RGB value = ( -nan(ind), -nan(ind), 0.2462).

This is because x is slightly negative in the calculation of pow (float x, float y) in the following part, probably because of a calculation error, and it is out of the definition range.

default:
return (icFloatNumber)(pow(m_params[1] * v + m_params[2], m_params[0]) + m_params[3]);

Before calculating the pow, I think it might be a good idea to include a process such as rounding the range of x to 0-1.
Alternatively, improvements may be needed elsewhere.

I attached the sample code and profiles.
TestSample.zip

Thank you for your contribution.