74 #pragma warning( disable: 4786)
86#ifdef USEREFICCMAXNAMESPACE
116 if (p1-p0 <= 0.00001) {
129 return Find(v, p0, v0, np, nv);
131 return Find(v, np, nv, p1, v1);
145 m_nSize = nSize <0 ? 0 : nSize;
185 if (&CurveTag ==
this)
236 if (headerSize > size)
246 if (!pIO->
Read32(&m_nReserved))
292 if (!pIO->
Write32(&m_nReserved))
323 sprintf(buf,
"BEGIN_CURVE In_Out\n");
325 sDescription +=
"Y = X\n";
327 else if (m_nSize==1) {
329 sprintf(buf,
"BEGIN_CURVE In_Out\n");
331 sprintf(buf,
"Y = X ^ %.4lf\n", dGamma);
337 sprintf(buf,
"BEGIN_LUT In_Out 1 1\n");
340 if (nVerboseness > 75) {
341 sDescription +=
"IN OUT\n";
343 for (i=0; i<(int)m_nSize; i++) {
384 sprintf(buf,
"BEGIN_CURVE %s\n",
szName);
386 sDescription +=
"Y = X\n";
388 else if (m_nSize==1) {
390 sprintf(buf,
"BEGIN_CURVE %s\n",
szName);
392 sprintf(buf,
"Y = X ^ %.4lf\n", dGamma);
398 sprintf(buf,
"BEGIN_LUT %s 1 1\n",
szName);
400 if (nVerboseness > 75) {
402 sDescription +=
"IN OUT\n";
404 sDescription.reserve(sDescription.size() + m_nSize * 20);
406 for (i=0; i<(int)m_nSize; i++) {
444 if (!nSize && m_Curve) {
465 if (m_nSize < nSize) {
466 memset(&m_Curve[m_nSize], 0, (nSize-m_nSize)*
sizeof(
icFloatNumber));
475 for (i=0; i<nSize; i++) {
546 for (i=0; i<m_nSize; i++) {
571 else if(v>1.0) v = 1.0;
583 if (nIndex == m_nMaxIndex) {
584 return m_Curve[nIndex];
624 if (m_Curve[0]>0.0 || m_Curve[m_nSize-1]<1.0) {
626 sReport += sSigPathName;
627 sReport +=
" - Curve cannot be accurately inverted.\n";
648 m_nFunctionType = 0xffff;
688 if (&ParamCurveTag ==
this)
741 if ( nHdrSize > size)
749 !pIO->
Read32(&m_nReserved) ||
750 !pIO->
Read16(&nFunctionType) ||
751 !pIO->
Read16(&m_nReserved2))
754 SetFunctionType(nFunctionType);
766 for (i=0; i<m_nNumParam; i++) {
768 if (!pIO->
Read32(&num, 1))
803 !pIO->
Write16(&m_nFunctionType) ||
809 for (i=0; i<m_nNumParam; i++) {
837 sprintf(buf,
"FunctionType: %04Xh\n", m_nFunctionType);
840 switch(m_nFunctionType) {
842 sprintf(buf,
"Y = X ^ %.4lf\n", m_dParam[0]);
847 sprintf(buf,
"Y = 0 when (X < %.4lf / %.4lf)\n",
848 -m_dParam[2], m_dParam[1]);
851 sprintf(buf,
"Y = (%.4lf * X + %.4lf) ^ %.4lf when (X >= %.4lf / %.4lf)\n",
852 m_dParam[1], m_dParam[2], m_dParam[0],
853 m_dParam[2], m_dParam[1]);
858 sprintf(buf,
"Y = %.4lf when (X < %.4lf / %.4lf)\n", m_dParam[3],
859 -m_dParam[2], m_dParam[1]);
862 sprintf(buf,
"Y = (%.4lf * X + %.4lf) ^ %.4lf + %.4lf when (X >= %.4lf / %.4lf)\n",
863 m_dParam[1], m_dParam[2], m_dParam[0],
865 -m_dParam[2], m_dParam[1]);
870 sprintf(buf,
"Y = %lf * X when (X < %.4lf)\n",
871 m_dParam[3], m_dParam[4]);
874 sprintf(buf,
"Y = (%.4lf * X + %.4lf) ^ %.4lf when (X >= %.4lf)\n",
875 m_dParam[1], m_dParam[2], m_dParam[0],
881 sprintf(buf,
"Y = %lf * X + %.4lf when (X < %.4lf)\n",
882 m_dParam[3], m_dParam[6], m_dParam[4]);
885 sprintf(buf,
"Y = (%.4lf * X + %.4lf) ^ %.4lf + %.4lf when (X >= %.4lf)\n",
886 m_dParam[1], m_dParam[2], m_dParam[0],
887 m_dParam[5], m_dParam[4]);
893 sprintf(buf,
"Unknown Function with %d parameters:\n", m_nNumParam);
896 for (i=0; i<m_nNumParam; i++) {
897 sprintf(buf,
"Param[%d] = %.4lf\n", i, m_dParam[i]);
922 sprintf(buf,
"BEGIN_CURVE %s\n",
szName);
924 Describe(sDescription, nVerboseness);
945 switch(nFunctionType) {
972 m_nNumParam = nNumParam;
973 m_nFunctionType = nFunctionType;
996 switch(m_nFunctionType) {
1028 switch(m_nFunctionType) {
1037 return (
icFloatNumber)pow((
double)a*X + b, (
double)m_dParam[0]);
1048 return (
icFloatNumber)pow((
double)a*X + b, (
double)m_dParam[0]) + m_dParam[3];
1055 if (X >= m_dParam[4]) {
1056 return (
icFloatNumber)pow((
double)m_dParam[1]*X + m_dParam[2], (
double)m_dParam[0]);
1059 return m_dParam[3]*X;
1063 if (X >= m_dParam[4]) {
1064 return (
icFloatNumber)pow((
double)m_dParam[1]*X + m_dParam[2], (
double)m_dParam[0]) + m_dParam[5];
1067 return m_dParam[3]*X + m_dParam[6];
1098 if (m_nReserved2!=0) {
1100 sReport += sSigPathName;
1101 sReport +=
" - Reserved Value must be zero.\n";
1106 switch(m_nFunctionType) {
1108 if (m_nNumParam!=1) {
1110 sReport += sSigPathName;
1111 sReport +=
" - Number of parameters inconsistent with function type.\n";
1117 if (m_nNumParam!=3) {
1119 sReport += sSigPathName;
1120 sReport +=
" - Number of parameters inconsistent with function type.\n";
1126 if (m_nNumParam!=4) {
1128 sReport += sSigPathName;
1129 sReport +=
" - Number of parameters inconsistent with function type.\n";
1135 if (m_nNumParam!=5) {
1137 sReport += sSigPathName;
1138 sReport +=
" - Number of parameters inconsistent with function type.\n";
1144 if (m_nNumParam!=7) {
1146 sReport += sSigPathName;
1147 sReport +=
" - Number of parameters inconsistent with function type.\n";
1154 sReport += sSigPathName;
1155 sReport +=
" - Unknown function type.\n";
1162 if (lval>0.0 || uval<1.0) {
1164 sReport += sSigPathName;
1165 sReport +=
" - Curve cannot be accurately inverted.\n";
1248 m_pCurve->
Describe(sDescription, nVerboseness);
1251 sDescription +=
"TagSegmentedCurve is undefined\n";
1268 sprintf(buf,
"BEGIN_SEGMENTED_CURVE %s\n",
szName);
1269 sDescription += buf;
1270 Describe(sDescription, nVerboseness);
1285 if (pCurve->
Read(size, pIO)) {
1307 return m_pCurve->Write(pIO);
1351 return m_pCurve->Apply(v);
1367 sReport +=
"Invalid Segmented Curve Data!\n";
1372 return m_pCurve->Validate(sigPath, sReport, NULL);
1405 m_bUseConstants = bUseConstants;
1406 m_e[0] = m_e[4] = m_e[8] = 1.0;
1407 m_e[1] = m_e[2] = m_e[3] =
1408 m_e[5] = m_e[6] = m_e[7] = 0.0;
1410 if (!m_bUseConstants) {
1411 m_e[9] = m_e[10] = m_e[11] = 0.0;
1429 memcpy(m_e, MatrixClass.
m_e,
sizeof(m_e));
1445 if (&MatrixClass ==
this)
1449 memcpy(m_e, MatrixClass.
m_e,
sizeof(m_e));
1470 sprintf(buf,
"BEGIN_MATRIX %s\n",
szName);
1471 sDescription += buf;
1473 if (!m_bUseConstants) {
1474 sprintf(buf,
"%8.4lf %8.4lf %8.4lf\n",
1475 m_e[0], m_e[1], m_e[2]);
1476 sDescription += buf;
1477 sprintf(buf,
"%8.4lf %8.4lf %8.4lf\n",
1478 m_e[3], m_e[4], m_e[5]);
1479 sDescription += buf;
1480 sprintf(buf,
"%8.4lf %8.4lf %8.4lf\n",
1481 m_e[6], m_e[7], m_e[8]);
1482 sDescription += buf;
1485 sprintf(buf,
"%8.4lf %8.4lf %8.4lf + %8.4lf\n",
1486 m_e[0], m_e[1], m_e[2], m_e[9]);
1487 sDescription += buf;
1488 sprintf(buf,
"%8.4lf %8.4lf %8.4lf + %8.4lf\n",
1489 m_e[3], m_e[4], m_e[5], m_e[10]);
1490 sDescription += buf;
1491 sprintf(buf,
"%8.4lf %8.4lf %8.4lf + %8.4lf\n",
1492 m_e[6], m_e[7], m_e[8], m_e[11]);
1493 sDescription += buf;
1510 if (m_bUseConstants) {
1511 if (fabs(m_e[9])>0.0 || fabs(m_e[10])>0.0 || fabs(m_e[11])>0.0) {
1520 if (fabs(m_e[1])>0.0 || fabs(m_e[2])>0.0 || fabs(m_e[3])>0.0 ||
1521 fabs(m_e[5])>0.0 || fabs(m_e[6])>0.0 || fabs(m_e[7])>0.0)
1550 if (m_bUseConstants) {
1586 for (
int i=0; i<9; i++) {
1589 if (m_e[0]!=1.0 || m_e[4]!=1.0 || m_e[9]!=1.0 || sum!=3.0) {
1591 sReport += sSigPathName;
1592 sReport +=
" - Matrix must be identity.\n";
1660 if (nSrcChannels > 6) {
1667 if (!m_df || !m_s || !m_g || !m_ig)
1687 m_nInput = nInputChannels;
1688 m_nOutput = nOutputChannels;
1689 m_nPrecision = nPrecision;
1692 memset(&m_nReserved2, 0 ,
sizeof(m_nReserved2));
1720 memcpy(m_GridPoints, ICLUT.
m_GridPoints,
sizeof(m_GridPoints));
1721 memcpy(m_DimSize, ICLUT.
m_DimSize,
sizeof(m_DimSize));
1722 memcpy(m_GridAdr, ICLUT.
m_GridAdr,
sizeof(m_GridAdr));
1723 memcpy(&m_nReserved2, &ICLUT.
m_nReserved2,
sizeof(m_nReserved2));
1725 int num = NumPoints()*m_nOutput;
1745 if (&CLUTTag ==
this)
1756 memcpy(m_GridPoints, CLUTTag.
m_GridPoints,
sizeof(m_GridPoints));
1757 memcpy(m_DimSize, CLUTTag.
m_DimSize,
sizeof(m_DimSize));
1758 memcpy(m_GridAdr, CLUTTag.
m_GridAdr,
sizeof(m_GridAdr));
1759 memcpy(m_nReserved2, &CLUTTag.
m_nReserved2,
sizeof(m_nReserved2));
1764 num = NumPoints()*m_nOutput;
1789 delete [] m_nOffset;
1805 memset(&m_GridPoints, 0,
sizeof(m_GridPoints));
1809 memset(m_GridPoints, nGridPoints, m_nInput);
1810 return Init(&m_GridPoints[0], nMaxSize, nBytesPerPoint);
1825 if (nMaxSize && !nBytesPerPoint)
1829 memset(m_nReserved2, 0,
sizeof(m_nReserved2));
1830 if (pGridPoints!=&m_GridPoints[0]) {
1834 memcpy(m_GridPoints, pGridPoints, m_nInput);
1836 memset(m_GridPoints+m_nInput, 0, 16-m_nInput);
1840 for (
int i = 0; i < m_nInput; i++) {
1841 if (pGridPoints[i] < 2)
1856 m_DimSize[i] = m_nOutput;
1857 nNumPoints = m_GridPoints[i];
1858 for (i--; i>=0; i--) {
1859 m_DimSize[i] = m_DimSize[i+1] * m_GridPoints[i+1];
1860 nNumPoints *= m_GridPoints[i];
1861 if (nMaxSize && nNumPoints * m_nOutput * nBytesPerPoint > nMaxSize)
1873 return (m_pData != NULL);
1897 if (nNum * nPrecision > size)
1900 if (m_pData == NULL)
1903 if (nPrecision==1) {
1907 else if (nPrecision==2) {
1937 if (nPrecision==1) {
1941 else if (nPrecision==2) {
1971 if (pIO->
Read8(m_GridPoints, 16)!=16 ||
1972 !pIO->
Read8(&m_nPrecision) ||
1973 pIO->
Read8(&m_nReserved2[0], 3)!=3)
1976 if (!Init(m_GridPoints, size - 20, m_nPrecision))
1979 return ReadData(size-20, pIO, m_nPrecision);
1998 if (pIO->
Write8(m_GridPoints, 16)!=16 ||
1999 !pIO->
Write8(&m_nPrecision) ||
2000 pIO->
Write8(&m_nReserved2[0], 3)!=3)
2003 return WriteData(pIO, m_nPrecision);
2021 if (nIndex < m_nInput) {
2023 for (i=0; i<m_GridPoints[nIndex]; i++) {
2024 m_GridAdr[nIndex] = i;
2025 Iterate(sDescription, nIndex+1, nPos, bUseLegacy);
2026 nPos += m_DimSize[nIndex];
2030 icChar *ptr = m_pOutText;
2034 for (i=0; i<m_nInput; i++) {
2037 ptr += sprintf(ptr,
" %s", m_pVal);
2042 for (i=0; i<m_nOutput; i++) {
2043 icColorValue(m_pVal, pData[i], m_csOutput, i, bUseLegacy);
2045 ptr += sprintf(ptr,
" %s", m_pVal);
2048 sDescription += (
const icChar*)m_pOutText;
2068 memset(&m_fGridAdr[0], 0,
sizeof(m_fGridAdr));
2072 for (i=0; i<m_GridPoints[0]; i++) {
2073 for (j=0; j<m_GridPoints[1]; j++) {
2074 for (k=0; k<m_GridPoints[2]; k++) {
2079 index = (m_DimSize[0]*i + m_DimSize[1]*j + m_DimSize[2]*k);
2080 pExec->
PixelOp(m_fGridAdr, &m_pData[index]);
2086 else if (m_nInput==4) {
2089 for (i=0; i<m_GridPoints[0]; i++) {
2090 for (j=0; j<m_GridPoints[1]; j++) {
2091 for (k=0; k<m_GridPoints[2]; k++) {
2092 for (l=0; l<m_GridPoints[3]; l++) {
2098 index = (m_DimSize[0]*i + m_DimSize[1]*j +
2099 m_DimSize[2]*k + m_DimSize[3]*l);
2100 pExec->
PixelOp(m_fGridAdr, &m_pData[index]);
2108 SubIterate(pExec, 0, 0);
2128 if (nIndex < m_nInput) {
2130 for (i=0; i<m_GridPoints[nIndex]; i++) {
2132 SubIterate(pExec, nIndex+1, nPos);
2133 nPos += m_DimSize[nIndex];
2137 pExec->
PixelOp(m_fGridAdr, &m_pData[nPos]);
2156 int nVerboseness,
bool bUseLegacy)
2158 icChar szOutText[200000], szColor[40];
2161 sprintf(szOutText,
"BEGIN_LUT %s %d %d\n",
szName, m_nInput, m_nOutput);
2162 sDescription += szOutText;
2164 if (nVerboseness > 75) {
2166 for (i=0; i<m_nInput; i++) {
2168 sprintf(szOutText,
" %s=%d", szColor, m_GridPoints[i]);
2169 sDescription += szOutText;
2172 sDescription +=
" ";
2174 for (i=0; i<m_nOutput; i++) {
2176 sprintf(szOutText,
" %s", szColor);
2177 sDescription += szOutText;
2180 sDescription +=
"\n";
2182 if (nVerboseness > 75) {
2184 for (i=0; i<m_nInput; i++) {
2186 len += strlen(szColor);
2188 for (i=0; i<m_nOutput; i++) {
2190 len += strlen(szColor);
2192 len += m_nInput + m_nOutput + 6;
2194 sDescription.reserve(sDescription.size() + NumPoints()*len);
2197 m_csInput = csInput;
2198 m_csOutput = csOutput;
2199 m_pOutText = szOutText;
2201 memset(m_GridAdr, 0, 16);
2203 Iterate(sDescription, 0, 0, bUseLegacy);
2221 for (i=0; i<m_nInput; i++) {
2222 m_MaxGridPoint[i] = m_GridPoints[i] - 1;
2224 m_nNodes = (1<<m_nInput);
2227 delete [] m_nOffset;
2232 m_nOffset[0] = n000 = 0;
2233 m_nOffset[1] = n001 = m_DimSize[0];
2235 else if (m_nInput==2) {
2236 m_nOffset[0] = n000 = 0;
2237 m_nOffset[1] = n001 = m_DimSize[0];
2238 m_nOffset[2] = n010 = m_DimSize[1];
2239 m_nOffset[3] = n011 = n001 + n010;
2241 else if (m_nInput==3) {
2242 m_nOffset[0] = n000 = 0;
2243 m_nOffset[1] = n001 = m_DimSize[0];
2244 m_nOffset[2] = n010 = m_DimSize[1];
2245 m_nOffset[3] = n011 = n001 + n010;
2246 m_nOffset[4] = n100 = m_DimSize[2];
2247 m_nOffset[5] = n101 = n100 + n001;
2248 m_nOffset[6] = n110 = n100 + n010;
2249 m_nOffset[7] = n111 = n110 + n001;
2251 else if (m_nInput == 4) {
2253 m_nOffset[ 1] = n001 = m_DimSize[ 0];
2254 m_nOffset[ 2] = n010 = m_DimSize[ 1];
2255 m_nOffset[ 3] = m_nOffset[ 2] + m_nOffset[ 1];
2256 m_nOffset[ 4] = n100 = m_DimSize[ 2];
2257 m_nOffset[ 5] = m_nOffset[ 4] + m_nOffset[ 1];
2258 m_nOffset[ 6] = m_nOffset[ 4] + m_nOffset[ 2];
2259 m_nOffset[ 7] = m_nOffset[ 4] + m_nOffset[ 3];
2260 m_nOffset[ 8] = n1000 = m_DimSize[ 3];
2261 m_nOffset[ 9] = m_nOffset[ 8] + m_nOffset[ 1];
2262 m_nOffset[10] = m_nOffset[ 8] + m_nOffset[ 2];
2263 m_nOffset[11] = m_nOffset[ 8] + m_nOffset[ 3];
2264 m_nOffset[12] = m_nOffset[ 8] + m_nOffset[ 4];
2265 m_nOffset[13] = m_nOffset[ 8] + m_nOffset[ 5];
2266 m_nOffset[14] = m_nOffset[ 8] + m_nOffset[ 6];
2267 m_nOffset[15] = m_nOffset[ 8] + m_nOffset[ 7];
2269 else if (m_nInput == 5) {
2271 m_nOffset[ 1] = n001 = m_DimSize[ 0];
2272 m_nOffset[ 2] = n010 = m_DimSize[ 1];
2273 m_nOffset[ 3] = m_nOffset[ 2] + m_nOffset[ 1];
2274 m_nOffset[ 4] = n100 = m_DimSize[ 2];
2275 m_nOffset[ 5] = m_nOffset[ 4] + m_nOffset[ 1];
2276 m_nOffset[ 6] = m_nOffset[ 4] + m_nOffset[ 2];
2277 m_nOffset[ 7] = m_nOffset[ 4] + m_nOffset[ 3];
2278 m_nOffset[ 8] = n1000 = m_DimSize[ 3];
2279 m_nOffset[ 9] = m_nOffset[ 8] + m_nOffset[ 1];
2280 m_nOffset[10] = m_nOffset[ 8] + m_nOffset[ 2];
2281 m_nOffset[11] = m_nOffset[ 8] + m_nOffset[ 3];
2282 m_nOffset[12] = m_nOffset[ 8] + m_nOffset[ 4];
2283 m_nOffset[13] = m_nOffset[ 8] + m_nOffset[ 5];
2284 m_nOffset[14] = m_nOffset[ 8] + m_nOffset[ 6];
2285 m_nOffset[15] = m_nOffset[ 8] + m_nOffset[ 7];
2286 m_nOffset[16] = n10000 = m_DimSize[ 4];
2287 m_nOffset[17] = m_nOffset[16] + m_nOffset[ 1];
2288 m_nOffset[18] = m_nOffset[16] + m_nOffset[ 2];
2289 m_nOffset[19] = m_nOffset[16] + m_nOffset[ 3];
2290 m_nOffset[20] = m_nOffset[16] + m_nOffset[ 4];
2291 m_nOffset[21] = m_nOffset[16] + m_nOffset[ 5];
2292 m_nOffset[22] = m_nOffset[16] + m_nOffset[ 6];
2293 m_nOffset[23] = m_nOffset[16] + m_nOffset[ 7];
2294 m_nOffset[24] = m_nOffset[16] + m_nOffset[ 8];
2295 m_nOffset[25] = m_nOffset[16] + m_nOffset[ 9];
2296 m_nOffset[26] = m_nOffset[16] + m_nOffset[10];
2297 m_nOffset[27] = m_nOffset[16] + m_nOffset[11];
2298 m_nOffset[28] = m_nOffset[16] + m_nOffset[12];
2299 m_nOffset[29] = m_nOffset[16] + m_nOffset[13];
2300 m_nOffset[30] = m_nOffset[16] + m_nOffset[14];
2301 m_nOffset[31] = m_nOffset[16] + m_nOffset[15];
2303 else if (m_nInput == 6) {
2305 m_nOffset[ 1] = n001 = m_DimSize[ 0];
2306 m_nOffset[ 2] = n010 = m_DimSize[ 1];
2307 m_nOffset[ 3] = m_nOffset[ 2] + m_nOffset[ 1];
2308 m_nOffset[ 4] = n100 = m_DimSize[ 2];
2309 m_nOffset[ 5] = m_nOffset[ 4] + m_nOffset[ 1];
2310 m_nOffset[ 6] = m_nOffset[ 4] + m_nOffset[ 2];
2311 m_nOffset[ 7] = m_nOffset[ 4] + m_nOffset[ 3];
2312 m_nOffset[ 8] = n1000 = m_DimSize[ 3];
2313 m_nOffset[ 9] = m_nOffset[ 8] + m_nOffset[ 1];
2314 m_nOffset[10] = m_nOffset[ 8] + m_nOffset[ 2];
2315 m_nOffset[11] = m_nOffset[ 8] + m_nOffset[ 3];
2316 m_nOffset[12] = m_nOffset[ 8] + m_nOffset[ 4];
2317 m_nOffset[13] = m_nOffset[ 8] + m_nOffset[ 5];
2318 m_nOffset[14] = m_nOffset[ 8] + m_nOffset[ 6];
2319 m_nOffset[15] = m_nOffset[ 8] + m_nOffset[ 7];
2320 m_nOffset[16] = n10000 = m_DimSize[ 4];
2321 m_nOffset[17] = m_nOffset[16] + m_nOffset[ 1];
2322 m_nOffset[18] = m_nOffset[16] + m_nOffset[ 2];
2323 m_nOffset[19] = m_nOffset[16] + m_nOffset[ 3];
2324 m_nOffset[20] = m_nOffset[16] + m_nOffset[ 4];
2325 m_nOffset[21] = m_nOffset[16] + m_nOffset[ 5];
2326 m_nOffset[22] = m_nOffset[16] + m_nOffset[ 6];
2327 m_nOffset[23] = m_nOffset[16] + m_nOffset[ 7];
2328 m_nOffset[24] = m_nOffset[16] + m_nOffset[ 8];
2329 m_nOffset[25] = m_nOffset[16] + m_nOffset[ 9];
2330 m_nOffset[26] = m_nOffset[16] + m_nOffset[10];
2331 m_nOffset[27] = m_nOffset[16] + m_nOffset[11];
2332 m_nOffset[28] = m_nOffset[16] + m_nOffset[12];
2333 m_nOffset[29] = m_nOffset[16] + m_nOffset[13];
2334 m_nOffset[30] = m_nOffset[16] + m_nOffset[14];
2335 m_nOffset[31] = m_nOffset[16] + m_nOffset[15];
2336 m_nOffset[32] = n100000 = m_DimSize[5];
2337 m_nOffset[33] = m_nOffset[32] + m_nOffset[ 1];
2338 m_nOffset[34] = m_nOffset[32] + m_nOffset[ 2];
2339 m_nOffset[35] = m_nOffset[32] + m_nOffset[ 3];
2340 m_nOffset[36] = m_nOffset[32] + m_nOffset[ 4];
2341 m_nOffset[37] = m_nOffset[32] + m_nOffset[ 5];
2342 m_nOffset[38] = m_nOffset[32] + m_nOffset[ 6];
2343 m_nOffset[39] = m_nOffset[32] + m_nOffset[ 7];
2344 m_nOffset[40] = m_nOffset[32] + m_nOffset[ 8];
2345 m_nOffset[41] = m_nOffset[32] + m_nOffset[ 9];
2346 m_nOffset[42] = m_nOffset[32] + m_nOffset[10];
2347 m_nOffset[43] = m_nOffset[32] + m_nOffset[11];
2348 m_nOffset[44] = m_nOffset[32] + m_nOffset[12];
2349 m_nOffset[45] = m_nOffset[32] + m_nOffset[13];
2350 m_nOffset[46] = m_nOffset[32] + m_nOffset[14];
2351 m_nOffset[47] = m_nOffset[32] + m_nOffset[15];
2352 m_nOffset[48] = m_nOffset[32] + m_nOffset[16];
2353 m_nOffset[49] = m_nOffset[32] + m_nOffset[17];
2354 m_nOffset[50] = m_nOffset[32] + m_nOffset[18];
2355 m_nOffset[51] = m_nOffset[32] + m_nOffset[19];
2356 m_nOffset[52] = m_nOffset[32] + m_nOffset[20];
2357 m_nOffset[53] = m_nOffset[32] + m_nOffset[21];
2358 m_nOffset[54] = m_nOffset[32] + m_nOffset[22];
2359 m_nOffset[55] = m_nOffset[32] + m_nOffset[23];
2360 m_nOffset[56] = m_nOffset[32] + m_nOffset[24];
2361 m_nOffset[57] = m_nOffset[32] + m_nOffset[25];
2362 m_nOffset[58] = m_nOffset[32] + m_nOffset[26];
2363 m_nOffset[59] = m_nOffset[32] + m_nOffset[27];
2364 m_nOffset[60] = m_nOffset[32] + m_nOffset[28];
2365 m_nOffset[61] = m_nOffset[32] + m_nOffset[29];
2366 m_nOffset[62] = m_nOffset[32] + m_nOffset[30];
2367 m_nOffset[63] = m_nOffset[32] + m_nOffset[31];
2377 for (count=0; count<m_nInput; count++) {
2378 m_nPower[count] = (1<<(m_nInput-1-count));
2384 if (j == nPower[1]) {
2385 m_nOffset[j] = m_DimSize[count];
2386 nPower[0] = (1<<count);
2388 nPower[1] = (1<<count);
2392 m_nOffset[j] = m_nOffset[nPower[0]] + m_nOffset[nFlag];
2407 if (!rv->
Init(m_nInput, m_nNodes)) {
2451 for (i=0; i<m_nOutput; i++, p++) {
2452 pv = p[n000]*dF0 + p[n001]*dF1;
2506 for (i=0; i<m_nOutput; i++, p++) {
2507 pv = p[n000]*dF0 + p[n001]*dF1 + p[n010]*dF2 + p[n011]*dF3;
2560 for (i=0; i<m_nOutput; i++, p++) {
2563 destPixel[i] = (p[n000] + t*(p[n110]-p[n010]) +
2564 u*(p[n010]-p[n000]) +
2565 v*(p[n111]-p[n110]));
2568 destPixel[i] = (p[n000] + t*(p[n111]-p[n011]) +
2569 u*(p[n011]-p[n001]) +
2570 v*(p[n001]-p[n000]));
2573 destPixel[i] = (p[n000] + t*(p[n111]-p[n011]) +
2574 u*(p[n010]-p[n000]) +
2575 v*(p[n011]-p[n010]));
2580 destPixel[i] = (p[n000] + t*(p[n101]-p[n001]) +
2581 u*(p[n111]-p[n101]) +
2582 v*(p[n001]-p[n000]));
2585 destPixel[i] = (p[n000] + t*(p[n100]-p[n000]) +
2586 u*(p[n111]-p[n101]) +
2587 v*(p[n101]-p[n100]));
2590 destPixel[i] = (p[n000] + t*(p[n100]-p[n000]) +
2591 u*(p[n110]-p[n100]) +
2592 v*(p[n111]-p[n110]));
2660 for (i=0; i<m_nOutput; i++, p++) {
2661 pv = p[n000]*dF0 + p[n001]*dF1 + p[n010]*dF2 + p[n011]*dF3 +
2662 p[n100]*dF4 + p[n101]*dF5 + p[n110]*dF6 + p[n111]*dF7;
2725 icFloatNumber *p = &m_pData[iw*n001 + ix*n010 + iy*n100 + iz*n1000];
2730 dF[ 0] = ns* nt* nu* nv;
2731 dF[ 1] = ns* nt* nu* v;
2732 dF[ 2] = ns* nt* u* nv;
2733 dF[ 3] = ns* nt* u* v;
2734 dF[ 4] = ns* t* nu* nv;
2735 dF[ 5] = ns* t* nu* v;
2736 dF[ 6] = ns* t* u* nv;
2737 dF[ 7] = ns* t* u* v;
2738 dF[ 8] = s* nt* nu* nv;
2739 dF[ 9] = s* nt* nu* v;
2740 dF[10] = s* nt* u* nv;
2741 dF[11] = s* nt* u* v;
2742 dF[12] = s* t* nu* nv;
2743 dF[13] = s* t* nu* v;
2744 dF[14] = s* t* u* nv;
2745 dF[15] = s* t* u* v;
2747 for (i=0; i<m_nOutput; i++, p++) {
2748 for (pv=0, j=0; j<16; j++)
2749 pv += p[m_nOffset[j]] * dF[j];
2820 icFloatNumber *p = &m_pData[ig0*n001 + ig1*n010 + ig2*n100 + ig3*n1000 + ig4*n10000];
2825 dF[ 0] = ns0 * ns1 * ns2 * ns3 * ns4;
2826 dF[ 1] = ns0 * ns1 * ns2 * ns3 * s4;
2827 dF[ 2] = ns0 * ns1 * ns2 * s3 * ns4;
2828 dF[ 3] = ns0 * ns1 * ns2 * s3 * s4;
2829 dF[ 4] = ns0 * ns1 * s2 * ns3 * ns4;
2830 dF[ 5] = ns0 * ns1 * s2 * ns3 * s4;
2831 dF[ 6] = ns0 * ns1 * s2 * s3 * ns4;
2832 dF[ 7] = ns0 * ns1 * s2 * s3 * s4;
2833 dF[ 8] = ns0 * s1 * ns2 * ns3 * ns4;
2834 dF[ 9] = ns0 * s1 * ns2 * ns3 * s4;
2835 dF[10] = ns0 * s1 * ns2 * s3 * ns4;
2836 dF[11] = ns0 * s1 * ns2 * s3 * s4;
2837 dF[12] = ns0 * s1 * s2 * ns3 * ns4;
2838 dF[13] = ns0 * s1 * s2 * ns3 * s4;
2839 dF[14] = ns0 * s1 * s2 * s3 * ns4;
2840 dF[15] = ns0 * s1 * s2 * s3 * s4;
2841 dF[16] = s0 * ns1 * ns2 * ns3 * ns4;
2842 dF[17] = s0 * ns1 * ns2 * ns3 * s4;
2843 dF[18] = s0 * ns1 * ns2 * s3 * ns4;
2844 dF[19] = s0 * ns1 * ns2 * s3 * s4;
2845 dF[20] = s0 * ns1 * s2 * ns3 * ns4;
2846 dF[21] = s0 * ns1 * s2 * ns3 * s4;
2847 dF[22] = s0 * ns1 * s2 * s3 * ns4;
2848 dF[23] = s0 * ns1 * s2 * s3 * s4;
2849 dF[24] = s0 * s1 * ns2 * ns3 * ns4;
2850 dF[25] = s0 * s1 * ns2 * ns3 * s4;
2851 dF[26] = s0 * s1 * ns2 * s3 * ns4;
2852 dF[27] = s0 * s1 * ns2 * s3 * s4;
2853 dF[28] = s0 * s1 * s2 * ns3 * ns4;
2854 dF[29] = s0 * s1 * s2 * ns3 * s4;
2855 dF[30] = s0 * s1 * s2 * s3 * ns4;
2856 dF[31] = s0 * s1 * s2 * s3 * s4;
2858 for (i=0; i<m_nOutput; i++, p++) {
2859 for (pv=0.0, j=0; j<32; j++)
2860 pv += p[m_nOffset[j]] * dF[j];
2941 icFloatNumber *p = &m_pData[ig0*n001 + ig1*n010 + ig2*n100 + ig3*n1000 + ig4*n10000 + ig5*n100000];
2946 dF[ 0] = ns0 * ns1 * ns2 * ns3 * ns4 * ns5;
2947 dF[ 1] = ns0 * ns1 * ns2 * ns3 * ns4 * s5;
2948 dF[ 2] = ns0 * ns1 * ns2 * ns3 * s4 * ns5;
2949 dF[ 3] = ns0 * ns1 * ns2 * ns3 * s4 * s5;
2950 dF[ 4] = ns0 * ns1 * ns2 * s3 * ns4 * ns5;
2951 dF[ 5] = ns0 * ns1 * ns2 * s3 * ns4 * s5;
2952 dF[ 6] = ns0 * ns1 * ns2 * s3 * s4 * ns5;
2953 dF[ 7] = ns0 * ns1 * ns2 * s3 * s4 * s5;
2954 dF[ 8] = ns0 * ns1 * s2 * ns3 * ns4 * ns5;
2955 dF[ 9] = ns0 * ns1 * s2 * ns3 * ns4 * s5;
2956 dF[10] = ns0 * ns1 * s2 * ns3 * s4 * ns5;
2957 dF[11] = ns0 * ns1 * s2 * ns3 * s4 * s5;
2958 dF[12] = ns0 * ns1 * s2 * s3 * ns4 * ns5;
2959 dF[13] = ns0 * ns1 * s2 * s3 * ns4 * s5;
2960 dF[14] = ns0 * ns1 * s2 * s3 * s4 * ns5;
2961 dF[15] = ns0 * ns1 * s2 * s3 * s4 * s5;
2962 dF[16] = ns0 * s1 * ns2 * ns3 * ns4 * ns5;
2963 dF[17] = ns0 * s1 * ns2 * ns3 * ns4 * s5;
2964 dF[18] = ns0 * s1 * ns2 * ns3 * s4 * ns5;
2965 dF[19] = ns0 * s1 * ns2 * ns3 * s4 * s5;
2966 dF[20] = ns0 * s1 * ns2 * s3 * ns4 * ns5;
2967 dF[21] = ns0 * s1 * ns2 * s3 * ns4 * s5;
2968 dF[22] = ns0 * s1 * ns2 * s3 * s4 * ns5;
2969 dF[23] = ns0 * s1 * ns2 * s3 * s4 * s5;
2970 dF[24] = ns0 * s1 * s2 * ns3 * ns4 * ns5;
2971 dF[25] = ns0 * s1 * s2 * ns3 * ns4 * s5;
2972 dF[26] = ns0 * s1 * s2 * ns3 * s4 * ns5;
2973 dF[27] = ns0 * s1 * s2 * ns3 * s4 * s5;
2974 dF[28] = ns0 * s1 * s2 * s3 * ns4 * ns5;
2975 dF[29] = ns0 * s1 * s2 * s3 * ns4 * s5;
2976 dF[30] = ns0 * s1 * s2 * s3 * s4 * ns5;
2977 dF[31] = ns0 * s1 * s2 * s3 * s4 * s5;
2978 dF[32] = s0 * ns1 * ns2 * ns3 * ns4 * ns5;
2979 dF[33] = s0 * ns1 * ns2 * ns3 * ns4 * s5;
2980 dF[34] = s0 * ns1 * ns2 * ns3 * s4 * ns5;
2981 dF[35] = s0 * ns1 * ns2 * ns3 * s4 * s5;
2982 dF[36] = s0 * ns1 * ns2 * s3 * ns4 * ns5;
2983 dF[37] = s0 * ns1 * ns2 * s3 * ns4 * s5;
2984 dF[38] = s0 * ns1 * ns2 * s3 * s4 * ns5;
2985 dF[39] = s0 * ns1 * ns2 * s3 * s4 * s5;
2986 dF[40] = s0 * ns1 * s2 * ns3 * ns4 * ns5;
2987 dF[41] = s0 * ns1 * s2 * ns3 * ns4 * s5;
2988 dF[42] = s0 * ns1 * s2 * ns3 * s4 * ns5;
2989 dF[43] = s0 * ns1 * s2 * ns3 * s4 * s5;
2990 dF[44] = s0 * ns1 * s2 * s3 * ns4 * ns5;
2991 dF[45] = s0 * ns1 * s2 * s3 * ns4 * s5;
2992 dF[46] = s0 * ns1 * s2 * s3 * s4 * ns5;
2993 dF[47] = s0 * ns1 * s2 * s3 * s4 * s5;
2994 dF[48] = s0 * s1 * ns2 * ns3 * ns4 * ns5;
2995 dF[49] = s0 * s1 * ns2 * ns3 * ns4 * s5;
2996 dF[50] = s0 * s1 * ns2 * ns3 * s4 * ns5;
2997 dF[51] = s0 * s1 * ns2 * ns3 * s4 * s5;
2998 dF[52] = s0 * s1 * ns2 * s3 * ns4 * ns5;
2999 dF[53] = s0 * s1 * ns2 * s3 * ns4 * s5;
3000 dF[54] = s0 * s1 * ns2 * s3 * s4 * ns5;
3001 dF[55] = s0 * s1 * ns2 * s3 * s4 * s5;
3002 dF[56] = s0 * s1 * s2 * ns3 * ns4 * ns5;
3003 dF[57] = s0 * s1 * s2 * ns3 * ns4 * s5;
3004 dF[58] = s0 * s1 * s2 * ns3 * s4 * ns5;
3005 dF[59] = s0 * s1 * s2 * ns3 * s4 * s5;
3006 dF[60] = s0 * s1 * s2 * s3 * ns4 * ns5;
3007 dF[61] = s0 * s1 * s2 * s3 * ns4 * s5;
3008 dF[62] = s0 * s1 * s2 * s3 * s4 * ns5;
3009 dF[63] = s0 * s1 * s2 * s3 * s4 * s5;
3011 for (i=0; i<m_nOutput; i++, p++) {
3012 for (pv=0, j=0; j<64; j++)
3013 pv += p[m_nOffset[j]] * dF[j];
3038 for (i=0; i<m_nInput; i++) {
3039 g[i] =
UnitClip(srcPixel[i]) * m_MaxGridPoint[i];
3041 s[m_nInput-1-i] = g[i] - ig[i];
3042 if (ig[i]==m_MaxGridPoint[i]) {
3044 s[m_nInput-1-i] = 1.0;
3046 index += ig[i]*m_DimSize[i];
3054 for (i=0; i<m_nNodes; i++) {
3059 for (i=0; i<m_nInput; i++) {
3060 temp[0] = 1.0f - s[i];
3062 index = m_nPower[i];
3063 for (j=0; j<m_nNodes; j++) {
3064 df[j] *= temp[nFlag];
3065 if ((j+1)%index == 0)
3071 for (i=0; i<m_nOutput; i++, p++) {
3072 for (pv=0, j=0; j<m_nNodes; j++)
3073 pv += p[m_nOffset[j]] * df[j];
3102 if (m_nReserved2[0]!=0 || m_nReserved2[1]!=0 || m_nReserved2[2]!=0) {
3104 sReport += sSigPathName;
3105 sReport +=
" - Reserved Value must be zero.\n";
3112 for (
int i=0; i<m_nInput; i++) {
3113 if (m_GridPoints[i]<2) {
3115 sReport += sSigPathName;
3116 sprintf(temp,
" - CLUT: At least 2 grid points should be present in dimension %u.\n",i );
3149 m_bInputMatrix =
true;
3150 m_bUseMCurvesAsBCurves =
false;
3183 nCurves = !IsInputB() ? m_nInput : m_nOutput;
3186 for (i=0; i<nCurves; i++)
3194 nCurves = IsInputMatrix() ? m_nInput : m_nOutput;
3197 for (i=0; i<nCurves; i++)
3205 nCurves = IsInputB() ? m_nInput : m_nOutput;
3208 for (i=0; i<nCurves; i++)
3258 nCurves = !IsInputB() ? m_nInput : m_nOutput;
3261 for (i=0; i<nCurves; i++)
3269 nCurves = IsInputMatrix() ? m_nInput : m_nOutput;
3272 for (i=0; i<nCurves; i++)
3280 nCurves = IsInputB() ? m_nInput : m_nOutput;
3283 for (i=0; i<nCurves; i++)
3326 if (IsInputMatrix()) {
3328 for (i=0; i<m_nInput; i++)
3330 delete m_CurvesB[i];
3332 delete [] m_CurvesB;
3337 for (i=0; i<m_nInput; i++)
3339 delete m_CurvesM[i];
3341 delete [] m_CurvesM;
3347 for (i=0; i<m_nOutput; i++)
3349 delete m_CurvesA[i];
3351 delete [] m_CurvesA;
3358 for (i=0; i<m_nInput; i++)
3360 delete m_CurvesA[i];
3362 delete [] m_CurvesA;
3367 for (i=0; i<m_nOutput; i++)
3369 delete m_CurvesM[i];
3371 delete [] m_CurvesM;
3376 for (i=0; i<m_nOutput; i++)
3378 delete m_CurvesB[i];
3380 delete [] m_CurvesB;
3410 m_nInput = nInputChannels;
3411 m_nOutput = nOutputChannels;
3427 m_csInput = csInput;
3428 m_csOutput = csOutput;
3444 icChar buf[128], color[40];
3447 if (IsInputMatrix()) {
3448 if (m_CurvesB && !m_bUseMCurvesAsBCurves) {
3449 for (i=0; i<m_nInput; i++) {
3451 sprintf(buf,
"B_Curve_%s", color);
3452 m_CurvesB[i]->DumpLut(sDescription, buf, m_csInput, i, nVerboseness);
3457 m_Matrix->DumpLut(sDescription,
"Matrix", nVerboseness);
3460 for (i=0; i<m_nInput; i++) {
3462 if (!m_bUseMCurvesAsBCurves)
3463 sprintf(buf,
"M_Curve_%s", color);
3465 sprintf(buf,
"B_Curve_%s", color);
3466 m_CurvesM[i]->DumpLut(sDescription, buf, m_csInput, i, nVerboseness);
3471 m_CLUT->DumpLut(sDescription,
"CLUT", m_csInput, m_csOutput, nVerboseness, GetType()==
icSigLut16Type);
3474 for (i=0; i<m_nOutput; i++) {
3476 sprintf(buf,
"A_Curve_%s", color);
3477 m_CurvesA[i]->DumpLut(sDescription, buf, m_csOutput, i, nVerboseness);
3483 for (i=0; i<m_nInput; i++) {
3485 sprintf(buf,
"A_Curve_%s", color);
3486 m_CurvesA[i]->DumpLut(sDescription, buf, m_csInput, i, nVerboseness);
3491 m_CLUT->DumpLut(sDescription,
"CLUT", m_csInput, m_csOutput, nVerboseness);
3494 for (i=0; i<m_nOutput; i++) {
3496 sprintf(buf,
"M_Curve_%s", color);
3497 m_CurvesM[i]->DumpLut(sDescription, buf, m_csOutput, i, nVerboseness);
3502 m_Matrix->DumpLut(sDescription,
"Matrix", nVerboseness);
3505 for (i=0; i<m_nOutput; i++) {
3507 sprintf(buf,
"B_Curve_%s", color);
3508 m_CurvesB[i]->DumpLut(sDescription, buf, m_csOutput, i, nVerboseness);
3539 sReport += sSigPathName;
3540 sReport +=
" - Tag validation incomplete: Pointer to profile unavailable.\n";
3554 if (m_nInput!=nInput) {
3556 sReport += sSigPathName;
3557 sReport +=
" - Incorrect number of input channels.\n";
3562 if (m_nOutput!=nOutput) {
3564 sReport += sSigPathName;
3565 sReport +=
" - Incorrect number of output channels.\n";
3577 if (m_nInput!=nInput) {
3579 sReport += sSigPathName;
3580 sReport +=
" - Incorrect number of input channels.\n";
3585 if (m_nOutput!=nOutput) {
3587 sReport += sSigPathName;
3588 sReport +=
" - Incorrect number of output channels.\n";
3600 if (m_nInput != nInput) {
3602 sReport += sSigPathName;
3603 sReport +=
" - Incorrect number of input channels.\n";
3608 if (m_nOutput != nOutput) {
3610 sReport += sSigPathName;
3611 sReport +=
" - Incorrect number of output channels.\n";
3620 if (m_nInput!=nInput) {
3622 sReport += sSigPathName;
3623 sReport +=
" - Incorrect number of input channels.\n";
3628 if (m_nOutput!=nOutput) {
3630 sReport += sSigPathName;
3631 sReport +=
" - Incorrect number of output channels.\n";
3640 nOutput = m_nOutput;
3645 if (nInput!=nOutput) {
3648 sReport += sSigPathName;
3649 sReport +=
" - CLUT must be present.\n";
3655 rv =
icMaxStatus(rv, m_CLUT->Validate(sigPath, sReport, pProfile));
3678 memset(m_CurvesA, 0, nCurves *
sizeof(
LPIccCurve));
3698 icUInt8Number nCurves = IsInputMatrix() ? m_nInput : m_nOutput;
3701 memset(m_CurvesM, 0, nCurves *
sizeof(
LPIccCurve));
3723 memset(m_CurvesB, 0, nCurves *
sizeof(
LPIccCurve));
3764 m_CLUT =
new CIccCLUT(m_nInput, m_nOutput, nPrecision);
3766 m_CLUT->Init(pGridPoints);
3817 m_CLUT =
new CIccCLUT(m_nInput, m_nOutput, nPrecision);
3819 m_CLUT->Init(nGridPoints);
3835 m_bInputMatrix =
false;
3836 m_nReservedWord = 0;
3868 if (&ITLA2B ==
this)
3914 nStart = pIO->
Tell();
3915 nEnd = nStart + size;
3922 pIO->
Read32(Offset, 5)!=5)
3936 for (i=0; i<nCurves; i++) {
3951 if (!pCurves[i]->
Read(nEnd - pIO->
Tell(), pIO))
3954 if (!pIO->
Sync32(Offset[1]))
3971 for (i=0; i<12; i++) {
3972 if (pIO->
Read32(&tmp, 1)!=1)
3987 for (i=0; i<nCurves; i++) {
4002 if (!pCurves[i]->
Read(nEnd - pIO->
Tell(), pIO))
4005 if (!pIO->
Sync32(Offset[2]))
4029 for (i=0; i<nCurves; i++) {
4044 if (!pCurves[i]->
Read(nEnd - pIO->
Tell(), pIO))
4047 if (!pIO->
Sync32(Offset[4]))
4075 nStart = pIO->
Tell();
4076 memset(&Offset[0], 0,
sizeof(Offset));
4085 nOffsetPos = pIO->
Tell();
4086 if (pIO->
Write32(Offset, 5)!=5)
4091 Offset[0] = pIO->
Tell() - nStart;
4094 for (i=0; i<nCurves; i++) {
4110 Offset[1] = pIO->
Tell() - nStart;
4112 for (i=0; i<12; i++) {
4122 Offset[2] = pIO->
Tell() - nStart;
4125 for (i=0; i<nCurves; i++) {
4139 Offset[3] = pIO->
Tell() - nStart;
4150 Offset[4] = pIO->
Tell() - nStart;
4153 for (i=0; i<nCurves; i++) {
4170 if (pIO->
Write32(&Offset[0], 5)!=5)
4214 for (i=0; i<nOutput; i++) {
4220 sReport += sSigPathName;
4221 sReport +=
" - Incorrect number of B-curves.\n";
4228 for (i=0; i<nOutput; i++) {
4234 sReport += sSigPathName;
4235 sReport +=
" - Incorrect number of M-curves.\n";
4244 sReport += sSigPathName;
4245 sReport +=
" - CLUT must be present if using A-curves.\n";
4250 for (i=0; i<nInput; i++) {
4256 sReport += sSigPathName;
4257 sReport +=
" - Incorrect number of A-curves.\n";
4316 if (&ITLB2A ==
this)
4349 sReport += sSigPathName;
4350 sReport +=
" - Tag validation incomplete: Pointer to profile unavailable.\n";
4373 sReport += sSigPathName;
4374 sReport +=
" - Incorrect number of output channels.\n";
4380 for (i=0; i<nInput; i++) {
4386 sReport += sSigPathName;
4387 sReport +=
" - Incorrect number of B-curves.\n";
4394 for (i=0; i<nInput; i++) {
4400 sReport += sSigPathName;
4401 sReport +=
" - Incorrect number of M-curves.\n";
4410 sReport += sSigPathName;
4411 sReport +=
" - CLUT must be present if using A-curves.\n";
4416 for (i=0; i<nOutput; i++) {
4422 sReport += sSigPathName;
4423 sReport +=
" - Incorrect number of A-curves.\n";
4536 nStart = pIO->
Tell();
4537 nEnd = nStart + size;
4543 !pIO->
Read8(&nGrid) ||
4555 if (256 > nEnd - pIO->
Tell())
4580 if (pCurves == NULL)
4584 if (256 > nEnd - pIO->
Tell())
4632 for (i=0; i<9; i++) {
4678 XYZMatrix[0] = XYZMatrix[4] = XYZMatrix[8] =
icDtoF(1.0);
4702 pIO->
Write32(XYZMatrix, 9) != 9)
4717 for (j=0; j<256; j++) {
4748 for (j=0; j<256; j++) {
4814 for (i=0; i<nInput; i++) {
4819 if (pTagCurve->
GetSize()==1) {
4821 sReport += sSigPathName;
4822 sReport +=
" - lut8Tags do not support single entry gamma curves.\n";
4829 sReport += sSigPathName;
4830 sReport +=
" - Incorrect number of B-curves.\n";
4841 for (
int i=0; i<9; i++) {
4846 sReport += sSigPathName;
4847 sReport +=
" - Matrix must be identity.\n";
4854 for (i=0; i<nOutput; i++) {
4859 if (pTagCurve->
GetSize()==1) {
4861 sReport += sSigPathName;
4862 sReport +=
" - lut8Tags do not support single entry gamma curves.\n";
4869 sReport += sSigPathName;
4870 sReport +=
" - Incorrect number of A-curves.\n";
4984 nStart = pIO->
Tell();
4985 nEnd = nStart + size;
4991 !pIO->
Read8(&nGrid) ||
4994 !pIO->
Read16(&nInputEntries) ||
4995 !pIO->
Read16(&nOutputEntries))
5011 if (!pCurve->
SetSize(nInputEntries))
5014 if (pIO->
ReadUInt16Float(&(*pCurve)[0], nInputEntries) != nInputEntries)
5036 if (!pCurve->
SetSize(nOutputEntries))
5039 if (pIO->
ReadUInt16Float(&(*pCurve)[0], nOutputEntries) != nOutputEntries)
5079 for (i=0; i<9; i++) {
5119 for (i=0; i<9; i++) {
5125 XYZMatrix[0] = XYZMatrix[4] = XYZMatrix[8] =
icDtoF(1.0);
5149 pIO->
Write32(XYZMatrix, 9) != 9 ||
5150 !pIO->
Write16(&nInputEntries) ||
5151 !pIO->
Write16(&nOutputEntries))
5180 if (pIO->
WriteUInt16Float(&(*pCurve)[0], nOutputEntries) != nOutputEntries)
5239 for (i=0; i<nInput; i++) {
5244 if (pTagCurve->
GetSize()==1) {
5246 sReport += sSigPathName;
5247 sReport +=
" - lut16Tags do not support single entry gamma curves.\n";
5254 sReport += sSigPathName;
5255 sReport +=
" - Incorrect number of B-curves.\n";
5266 for (
int i=0; i<9; i++) {
5271 sReport += sSigPathName;
5272 sReport +=
" - Matrix must be identity.\n";
5279 for (i=0; i<nOutput; i++) {
5284 if (pTagCurve->
GetSize()==1) {
5286 sReport += sSigPathName;
5287 sReport +=
" - lut16Tags do not support single entry gamma curves.\n";
5294 sReport += sSigPathName;
5295 sReport +=
" - Incorrect number of A-curves.\n";
5357 if (nOutputChannels > 0)
5419 if (&InGamutBoundaryTag ==
this)
5636 sDescription += buf;
5639 sDescription += buf;
5641 if (nVerboseness > 75) {
5646 sprintf(buf,
"V = %d:\t",i);
5647 sDescription += buf;
5651 sDescription += buf;
5656 sDescription += buf;
5661 sDescription += buf;
5665 sDescription += buf;
5671 sDescription += buf;
5822 sReport += sSigPathName;
5823 sReport +=
" - Invalid tag.\n";
5834#ifdef USEREFICCMAXNAMESPACE
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
@ icValidateCriticalError
static icFloatNumber ClutUnitClip(icFloatNumber v)
static bool IsUnity(const icFloatNumber &num)
const icFloatNumber VERYSMALLNUM
icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Name: icMaxStatus.
std::string icGetSigPath(icUInt32Number nSig)
const char * icMsgValidateWarning
icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
void * icRealloc(void *ptr, size_t size)
Name: icRealloc.
icFloatNumber icFtoD(icS15Fixed16Number num)
void icColorValue(icChar *szValue, icFloatNumber nValue, icColorSpaceSignature csSig, int nIndex, bool bUseLegacy)
icS15Fixed16Number icDtoF(icFloatNumber num)
const char * icMsgValidateNonCompliant
void icColorIndexName(icChar *szName, icColorSpaceSignature csSig, int nIndex, int nColors, const icChar *szUnknown)
const char * icMsgValidateCriticalError
icSignature icGetFirstSigPathSig(std::string sigPath)
unsigned int icUInt32Number
CIccApplyCLUT()
Name: CIccApplyCLUT::CIccApplyCLUT.
virtual ~CIccApplyCLUT()
Name: CIccApplyNDLutXform::~CIccApplyNDLutXform.
bool Init(icUInt8Number nSrcChannels, icUInt32Number nNodes)
Name: CIccApplyCLUT::Init.
void Interp4d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp4d.
icUInt8Number GetInputDim() const
icUInt16Number GetOutputChannels() const
void Begin()
Name: CIccCLUT::Begin.
void Interp2d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp2d.
icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Name: CIccCLUT::Validate.
void Interp6d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp6d.
void Interp3d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp3d.
icUInt32Number m_DimSize[16]
void DumpLut(std::string &sDescription, const icChar *szName, icColorSpaceSignature csInput, icColorSpaceSignature csOutput, int nVerboseness, bool bUseLegacy=false)
Name: CIccCLUT::DumpLut.
icUInt8Number m_GridAdr[16]
CIccCLUT & operator=(const CIccCLUT &CLUTClass)
Name: CIccCLUT::operator=.
CIccCLUT(icUInt8Number nInputChannels, icUInt16Number nOutputChannels, icUInt8Number nPrecision=2)
Name: CIccCLUT::CIccCLUT.
void Interp5d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp5d.
void Iterate(IIccCLUTExec *pExec)
Name: CIccCLUT::Iterate.
icUInt8Number m_nPrecision
bool WriteData(CIccIO *pIO, icUInt8Number nPrecision)
Name: CIccCLUT::WriteData.
icColorSpaceSignature m_csOutput
void SubIterate(IIccCLUTExec *pExec, icUInt8Number nIndex, icUInt32Number nPos)
Name: CIccCLUT::SubIterate.
icUInt32Number m_nNumPoints
bool ReadData(icUInt32Number size, CIccIO *pIO, icUInt8Number nPrecision)
Name: CIccCLUT::ReadData.
icUInt8Number GridPoints() const
virtual ~CIccCLUT()
Name: CIccCLUT::~CIccCLUT.
void Interp3dTetra(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp3dTetra.
icUInt8Number m_nReserved2[3]
bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccCLUT::Read.
bool Write(CIccIO *pIO)
Name: CIccCLUT::Write.
icColorSpaceSignature m_csInput
CIccApplyCLUT * GetNewApply()
void Interp1d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp1d.
void InterpND(icFloatNumber *destPixel, const icFloatNumber *srcPixel, CIccApplyCLUT *pApply) const
Name: CIccCLUT::InterpND.
bool Init(icUInt8Number nGridPoints, icUInt32Number nMaxSize=0, icUInt8Number nBytesPerPoint=4)
Name: CIccCLUT::Init.
icUInt8Number m_GridPoints[16]
virtual CIccTag * NewCopy() const
Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
icFloatNumber Find(icFloatNumber v)
virtual void Describe(std::string &sDescription, int nVerboseness=100)=0
icInt32Number ReadFloat32Float(void *pBufFloat, icInt32Number nNum=1)
virtual icInt32Number Write8(void *pBuf8, icInt32Number nNum=1)
virtual icInt32Number GetLength()
icInt32Number Write16(void *pBuf16, icInt32Number nNum=1)
virtual icInt32Number Read8(void *pBuf8, icInt32Number nNum=1)
icInt32Number Read16(void *pBuf16, icInt32Number nNum=1)
virtual icInt32Number Tell()
bool Align32()
Write operation to make sure that filelength is evenly divisible by 4.
icInt32Number ReadUInt8Float(void *pBufFloat, icInt32Number nNum=1)
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
virtual icInt32Number Seek(icInt32Number nOffset, icSeekVal pos)
icInt32Number WriteFloat32Float(void *pBufFloat, icInt32Number nNum=1)
icInt32Number WriteUInt8Float(void *pBuf16, icInt32Number nNum=1)
icInt32Number ReadUInt16Float(void *pBufFloat, icInt32Number nNum=1)
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
bool Sync32(icUInt32Number nOffset=0)
Operation to make sure read position is evenly divisible by 4.
icInt32Number WriteUInt16Float(void *pBuf16, icInt32Number nNum=1)
std::string GetSigPathName(std::string sigPath)
LPIccCurve * NewCurvesB()
Name: CIccMBB::NewCurvesB.
CIccMatrix * NewMatrix()
Name: CIccMBB::NewMatrix.
virtual ~CIccMBB()
Name: CIccMBB::~CIccMBB.
virtual bool IsInputMatrix()
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccMBB::Describe.
virtual void SetColorSpaces(icColorSpaceSignature csInput, icColorSpaceSignature csOutput)
Name: CIccMBB::SetColorSpaces.
CIccCLUT * SetCLUT(CIccCLUT *clut)
Name: CIccMBB::SetCLUT.
CIccMBB & operator=(const CIccMBB &IMBB)
Name: CIccMBB::operator=.
LPIccCurve * NewCurvesM()
Name: CIccMBB::NewCurvesM.
CIccMBB()
Name: CIccMBB::CIccMBB.
LPIccCurve * NewCurvesA()
Name: CIccMBB::NewCurvesA.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL)
Name: CIccMBB::Validate.
icColorSpaceSignature m_csOutput
bool m_bUseMCurvesAsBCurves
void Cleanup()
Name: CIccMBB::Cleanup.
icColorSpaceSignature m_csInput
CIccCLUT * NewCLUT(icUInt8Number nGridPoints, icUInt8Number nPrecision=2)
Name: CIccMBB::NewCLUT.
void Init(icUInt8Number nInputChannels, icUInt8Number nOutputChannels)
Name: CIccMBB::Init.
CIccMatrix(bool bUseConstants=true)
Name: CIccMatrix::CIccMatrix.
CIccMatrix & operator=(const CIccMatrix &MatrixClass)
Name: CIccMatrix::operator=.
virtual bool IsIdentity()
Name: CIccMatrix::IsIdentity.
icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Name: CIccMatrix::Validate.
void DumpLut(std::string &sDescription, const icChar *szName, int nVerboseness)
Name: CIccTagParametricCurve::DumpLut.
virtual void Apply(icFloatNumber *Pixel) const
Name: CIccMatrix::Apply.
Class: CIccSegmentedCurve.
virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
Name: CIccSegmentedCurve::Begin.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccSegmentedCurve::Read.
virtual CIccCurveSetCurve * NewCopy() const
virtual ~CIccTagCurve()
Name: CIccTagCurve::~CIccTagCurve.
icUInt16Number m_nMaxIndex
virtual bool IsIdentity()
Name: CIccTagCurve::IsIdentity.
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccTagCurve::Describe.
virtual void DumpLut(std::string &sDescription, const icChar *szName, icColorSpaceSignature csSig, int nIndex, int nVerboseness)
Name: CIccTagCurve::DumpLut.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccTagCurve::Read.
CIccTagCurve(int nSize=0)
Name: CIccTagCurve::CIccTagCurve.
bool SetGamma(icFloatNumber gamma)
Name: refIccMAX::CIccTagCurve::SetGamma.
CIccTagCurve & operator=(const CIccTagCurve &CurveTag)
Name: CIccTagCurve::operator=.
virtual icFloatNumber Apply(icFloatNumber v) const
Name: CIccTagCurve::Apply.
icUInt32Number GetSize() const
bool SetSize(icUInt32Number nSize, icTagCurveSizeInit nSizeOpt=icInitZero)
Name: CIccTagCurve::SetSize.
virtual bool Write(CIccIO *pIO)
Name: CIccTagCurve::Write.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Name: CIccTagCurve::Validate.
Class: CIccTagGamutBoundaryDesc.
icGamutBoundaryTriangle * m_Triangles
CIccTagGamutBoundaryDesc & operator=(const CIccTagGamutBoundaryDesc &InGamutBoundaryTag)
Name: CIccTagGamutBoundaryDescription::operator=.
virtual bool Write(CIccIO *pIO)
Name: CIccTagGamutBoundaryDescription::Write.
icInt32Number m_NumberOfTriangles
bool setVertex(icInt32Number vertexNumber, icFloatNumber *pcsCoords, icFloatNumber *deviceCoords=NULL)
Name: CIccTagGamutBoundaryDescription::setVertex.
icInt16Number m_nPCSChannels
icFloatNumber * m_DeviceValues
icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile) const
Name: CIccTagGamutBoundaryDescription::Validate.
icFloatNumber * m_PCSValues
icInt16Number m_nDeviceChannels
bool getTriangle(icInt32Number triangleNumber, icGamutBoundaryTriangle &triangle)
Name: CIccTagGamutBoundaryDescription::getTriangle.
bool setTriangle(icInt32Number triangleNumber, icGamutBoundaryTriangle &triangle)
Name: CIccTagGamutBoundaryDescription::setTriangle.
icInt32Number m_NumberOfVertices
CIccTagGamutBoundaryDesc()
Name: CIccTagGamutBoundaryDescription::CIccTagGamutBoundaryDescription.
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccTagGamutBoundaryDescription::Describe.
icFloatNumber * getVertexPCSCoord(icInt32Number vertexNumber)
Name: CIccTagGamutBoundaryDescription::getVertexPCSCoord.
virtual icTagTypeSignature GetType() const
Function: GetType()
icFloatNumber * getVertexDeviceCoord(icInt32Number vertexNumber)
Name: CIccTagGamutBoundaryDescription::getVertexDeviceCoord.
virtual ~CIccTagGamutBoundaryDesc()
Name: CIccTagGamutBoundaryDescription::CIccTagGamutBoundaryDescription.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccTagGamutBoundaryDescription::Read.
icUInt32Number m_nReserved
static CIccTag * Create(icTagTypeSignature sig)
Name: CIccTag::Create.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Function: Validate Each derived tag will implement it's own IsValid() function.
icUInt8Number m_nReservedByte
icS15Fixed16Number m_XYZMatrix[9]
virtual icTagTypeSignature GetType() const
Function: GetType()
bool Write(CIccIO *pIO)
Name: CIccTagLut16::Write.
virtual ~CIccTagLut16()
Name: CIccTagLut16::~CIccTagLut16.
CIccTagLut16()
Name: CIccTagLut16::CIccTagLut16.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL)
Name: CIccTagLut16::Validate.
bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccTagLut16::Read.
CIccTagLut16 & operator=(const CIccTagLut16 &ITL)
Name: CIccTagLut16::operator=.
virtual void SetColorSpaces(icColorSpaceSignature csInput, icColorSpaceSignature csOutput)
Name: CIccTagLut16::SetColorSpaces.
CIccTagLut8()
Name: CIccTagLut8::CIccTagLut8.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL)
Name: CIccTagLut8::Validate.
virtual icTagTypeSignature GetType() const
Function: GetType()
icUInt8Number m_nReservedByte
virtual ~CIccTagLut8()
Name: CIccTagLut8::~CIccTagLut8.
icS15Fixed16Number m_XYZMatrix[9]
bool Write(CIccIO *pIO)
Name: CIccTagLut8::Write.
CIccTagLut8 & operator=(const CIccTagLut8 &ITL)
Name: CIccTagLut8::operator=.
bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccTagLut8::Read.
virtual void SetColorSpaces(icColorSpaceSignature csInput, icColorSpaceSignature csOutput)
Name: CIccTagLut8::SetColorSpaces.
virtual icTagTypeSignature GetType() const
Function: GetType()
CIccTagLutAtoB()
Name: CIccTagLutAtoB::CIccTagLutAtoB.
bool Write(CIccIO *pIO)
Name: CIccTagLutAtoB::Write.
icUInt16Number m_nReservedWord
CIccTagLutAtoB & operator=(const CIccTagLutAtoB &ITLA2B)
Name: CIccTagLutAtoB::operator=.
virtual ~CIccTagLutAtoB()
Name: CIccTagLutAtoB::~CIccTagLutAtoB.
bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccTagLutAtoB::Read.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL)
Name: CIccTagLutAtoB::Validate.
CIccTagLutBtoA & operator=(const CIccTagLutBtoA &ITLB2A)
Name: CIccTagLutBtoA::operator=.
virtual icTagTypeSignature GetType() const
Function: GetType()
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL)
Name: CIccTagLutBtoA::Validate.
CIccTagLutBtoA()
Name: CIccTagLutBtoA::CIccTagLutBtoA.
Class: CIccTagParametricCurve.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Name: CIccTagParametricCurve::Validate.
virtual icFloatNumber Apply(icFloatNumber v) const
Name: CIccTagParametricCurve::Apply.
icUInt16Number m_nFunctionType
virtual bool IsIdentity()
Name: CIccTagParametricCurve::IsIdentity.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccTagParametricCurve::Read.
CIccTagParametricCurve()
Name: CIccTagParametricCurve::CIccTagParametricCurve.
virtual void DumpLut(std::string &sDescription, const icChar *szName, icColorSpaceSignature csSig, int nIndex, int nVerboseness)
Name: CIccTagParametricCurve::DumpLut.
virtual ~CIccTagParametricCurve()
Name: CIccTagParametricCurve::~CIccTagParametricCurve.
virtual bool Write(CIccIO *pIO)
Name: CIccTagParametricCurve::Write.
icUInt16Number m_nNumParam
CIccTagParametricCurve & operator=(const CIccTagParametricCurve &ParamCurveTag)
Name: CIccTagParametricCurve::operator=.
bool SetFunctionType(icUInt16Number nFunctionType)
Name: CIccTagParametricCurve::SetFunctionType.
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccTagParametricCurve::Describe.
Class: CIccTagSegmentedCurve.
virtual void DumpLut(std::string &sDescription, const icChar *szName, icColorSpaceSignature csSig, int nIndex, int nVerboseness)
Name: CIccTagSegmentedCurve::DumpLut.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Name: CIccTagSegmentedCurve::Validate.
CIccTagSegmentedCurve & operator=(const CIccTagSegmentedCurve &CurveTag)
Name: CIccTagSegmentedCurve::CIccTagSegmentedCurve.
virtual void Begin()
Name: CIccTagSegmentedCurve::Begin.
void SetCurve(CIccSegmentedCurve *pCurve)
Name: CIccTagSegmentedCurve::SetCurve.
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccTagSegmentedCurve::Describe.
virtual ~CIccTagSegmentedCurve()
Name: CIccTagSegmentedCurve::~CIccTagSegmentedCurve.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccTagSegmentedCurve::Read.
virtual bool Write(CIccIO *pIO)
Name: CIccTagSegmentedCurve::Write.
virtual bool IsIdentity()
Name: CIccTagSegmentedCurve::IsIdentity.
CIccTagSegmentedCurve()
Name: CIccTagSegmentedCurve::CIccTagSegmentedCurve.
CIccSegmentedCurve * m_pCurve
virtual icFloatNumber Apply(icFloatNumber v) const
Name: CIccTagSegmentedCurve::Apply.
Interface Class: IIccCLUTExec.
virtual void PixelOp(icFloatNumber *pGridAdr, icFloatNumber *pData)=0
static icFloatNumber UnitClip(icFloatNumber v)