Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
IccUtil.cpp File Reference
#include "IccIO.h"
#include "IccUtil.h"
#include "IccTagFactory.h"
#include "IccStructFactory.h"
#include "IccArrayFactory.h"
#include "IccMpeFactory.h"
#include <stdlib.h>
#include <memory.h>
#include <ctype.h>
#include <math.h>
#include <string.h>
#include <time.h>
+ Include dependency graph for IccUtil.cpp:

Go to the source code of this file.

Macros

#define DUMPBYTESPERLINE   16
 
#define PI   3.1415926535897932384626433832795
 

Functions

icUInt8Number icABtoU8 (icFloatNumber num)
 
void icColorIndexName (icChar *szName, icColorSpaceSignature csSig, int nIndex, int nColors, const icChar *szUnknown)
 
void icColorValue (icChar *szValue, icFloatNumber nValue, icColorSpaceSignature csSig, int nIndex, bool bUseLegacy)
 
icFloatNumber icCubeth (icFloatNumber v)
 
icFloatNumber icDeltaE (const icFloatNumber *lab1, const icFloatNumber *lab2)
 
void icDeNormXyz (icFloatNumber *XYZ, icFloatNumber *WhiteXYZ)
 
icS15Fixed16Number icDtoF (icFloatNumber num)
 
icU8Fixed8Number icDtoUCF (icFloatNumber num)
 
icU16Fixed16Number icDtoUF (icFloatNumber num)
 
icU1Fixed15Number icDtoUSF (icFloatNumber num)
 
icFloatNumber icF16toF (icFloat16Number num)
 
icFloatNumber icFtoD (icS15Fixed16Number num)
 
icFloat16Number icFtoF16 (icFloat32Number num)
 
icUInt16Number icFtoU16 (icFloatNumber num)
 
icUInt8Number icFtoU8 (icFloatNumber num)
 
const icCharicGet16bitSig (icChar *pBuf, icUInt16Number nSig, bool bGetHexVal)
 
const icCharicGetColorSig (icChar *pBuf, icUInt32Number nSig, bool bGetHexVal)
 
const icCharicGetColorSigStr (icChar *pBuf, icUInt32Number nSig)
 
icSignature icGetFirstSigPathSig (std::string sigPath)
 
icSignature icGetLastSigPathSig (std::string sigPath)
 
icUInt32Number icGetMaterialColorSpaceSamples (icMaterialColorSignature sig)
 
icSignature icGetSecondSigPathSig (std::string sigPath)
 
const icCharicGetSig (icChar *pBuf, icUInt32Number nSig, bool bGetHexVal)
 
std::string icGetSigPath (icUInt32Number nSig)
 
const icCharicGetSigStr (icChar *pBuf, icUInt32Number nSig)
 
icUInt32Number icGetSigVal (const icChar *pBuf)
 
icUInt32Number icGetSpaceSamples (icColorSpaceSignature sig)
 
icUInt32Number icGetSpectralSpaceSamples (const icHeader *pHdr)
 
icUInt8Number icGetStorageTypeBytes (icUInt16Number nStorageType)
 
static icInt32Number icHexDigit (icChar digit)
 
icFloatNumber icICubeth (icFloatNumber v)
 
icUInt32Number icIntMax (icUInt32Number v1, icUInt32Number v2)
 
icUInt32Number icIntMin (icUInt32Number v1, icUInt32Number v2)
 
bool icIsIllumD50 (icXYZNumber xyz)
 
bool icIsNear (icFloatNumber v1, icFloatNumber v2, icFloatNumber nearRange)
 Name: icIsNear.
 
static bool icIsS15Fixed16NumberNear (icS15Fixed16Number F, icFloatNumber D)
 
bool icIsSpaceCLR (icColorSpaceSignature sig)
 
void icLab2Lch (icFloatNumber *Lch, icFloatNumber *Lab)
 
void icLabFromPcs (icFloatNumber *Lab)
 Floating point encoding of Lab in PCS is in range 0.0 to 1.0.
 
void icLabToPcs (icFloatNumber *Lab)
 
void icLabtoXYZ (icFloatNumber *XYZ, const icFloatNumber *Lab, const icFloatNumber *WhiteXYZ)
 
void icLch2Lab (icFloatNumber *Lab, icFloatNumber *Lch)
 
void icMatrixDump (std::string &sDump, icS15Fixed16Number *pMatrix)
 
bool icMatrixInvert3x3 (icFloatNumber *M)
 Name: icMatrixInvert3x3.
 
void icMatrixMultiply3x3 (icFloatNumber *result, const icFloatNumber *l, const icFloatNumber *r)
 Name: icMatrixMultiply3x3.
 
icFloatNumber icMax (icFloatNumber v1, icFloatNumber v2)
 
icValidateStatus icMaxStatus (icValidateStatus s1, icValidateStatus s2)
 Name: icMaxStatus.
 
void icMemDump (std::string &sDump, void *pBuf, icUInt32Number nNum)
 
icFloatNumber icMin (icFloatNumber v1, icFloatNumber v2)
 
void icNormXyz (icFloatNumber *XYZ, icFloatNumber *WhiteXYZ)
 
void * icRealloc (void *ptr, size_t size)
 Name: icRealloc.
 
icFloatNumber icRmsDif (const icFloatNumber *v1, const icFloatNumber *v2, icUInt32Number nSample)
 
double icRoundOffset (double v)
 Name: icRoundOffset.
 
bool icSameSpectralRange (const icSpectralRange &rng1, const icSpectralRange &rng2)
 
static icFloatNumber icSq (icFloatNumber x)
 
icFloatNumber icU16toF (icUInt16Number num)
 
icFloatNumber icU8toAB (icUInt8Number num)
 
icFloatNumber icU8toF (icUInt8Number num)
 
icFloatNumber icUCFtoD (icU8Fixed8Number num)
 
icFloatNumber icUFtoD (icU16Fixed16Number num)
 
icFloatNumber icUSFtoD (icU1Fixed15Number num)
 
bool icValidOverlap (const icPositionNumber &pos1, const icPositionNumber &pos2, bool bAllowSame)
 Name: icValidOverlap.
 
bool icValidTagPos (const icPositionNumber &pos, icUInt32Number nTagHeaderSize, icUInt32Number nTagSize, bool bAllowEmpty)
 Name: icValidTagPos.
 
void icVectorApplyMatrix3x3 (icFloatNumber *result, const icFloatNumber *m, const icFloatNumber *v)
 Name: icVectorApplyMatrix3x3.
 
void icXyzFromPcs (icFloatNumber *XYZ)
 Floating point encoding of XYZ in PCS is in range 0.0 to 1.0 (Note: X=1.0 is encoded as about 0.5)
 
void icXYZtoLab (icFloatNumber *Lab, const icFloatNumber *XYZ, const icFloatNumber *WhiteXYZ)
 
void icXyzToPcs (icFloatNumber *XYZ)
 

Variables

icFloatNumber icD50XYZ [3] = { 0.9642f, 1.0000f, 0.8249f }
 
icFloatNumber icD50XYZxx [3] = { 96.42f, 100.00f, 82.49f }
 
const char * icMsgValidateCriticalError = "Error! - "
 
const char * icMsgValidateInformation = "Information - "
 
const char * icMsgValidateNonCompliant = "NonCompliant! - "
 
const char * icMsgValidateWarning = "Warning! - "
 

Macro Definition Documentation

◆ DUMPBYTESPERLINE

#define DUMPBYTESPERLINE   16

Definition at line 949 of file IccUtil.cpp.

Referenced by icMemDump().

◆ PI

#define PI   3.1415926535897932384626433832795

Definition at line 84 of file IccUtil.cpp.

Referenced by icLab2Lch(), and icLch2Lab().

Function Documentation

◆ icABtoU8()

icUInt8Number icABtoU8 ( icFloatNumber num)

Definition at line 766 of file IccUtil.cpp.

767{
768 icFloatNumber v = num + 128.0f;
769 if (v<0)
770 v=0;
771 else if (v>255)
772 v=255;
773
774 return (icUInt8Number)(v + 0.5);
775}
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
unsigned char icUInt8Number
Number definitions.

◆ icColorIndexName()

void icColorIndexName ( icChar * szName,
icColorSpaceSignature csSig,
int nIndex,
int nColors,
const icChar * szUnknown )

Definition at line 295 of file IccUtil.cpp.

297{
298 icChar szSig[5] = {0};
299 int i;
300
301 if (csSig!=icSigUnknownData) {
302 szSig[0] = (icChar)(csSig>>24);
303 szSig[1] = (icChar)(csSig>>16);
304 szSig[2] = (icChar)(csSig>>8);
305 szSig[3] = (icChar)(csSig);
306 szSig[4] = '\0';
307
308 for (i=3; i>0; i--) {
309 if (szSig[i]==' ')
310 szSig[i]='\0';
311 }
312 if (nColors==1) {
313 strcpy(szName, szSig);
314 }
315 else if ((size_t)nColors == strlen(szSig)) {
316 sprintf(szName, "%s_%c", szSig, szSig[nIndex]);
317 }
318 else {
319 sprintf(szName, "%s_%d", szSig, nIndex+1);
320 }
321 }
322 else if (nColors==1) {
323 strcpy(szName, szUnknown);
324 }
325 else {
326 sprintf(szName, "%s_%d", szUnknown, nIndex+1);
327 }
328}
char icChar
Definition IccDefs.h:109
const icChar * szName
#define icSigUnknownData

References icSigUnknownData, and szName.

Referenced by CIccMBB::Describe(), CIccTagNamedColor2::Describe(), and CIccCLUT::DumpLut().

+ Here is the caller graph for this function:

◆ icColorValue()

void icColorValue ( icChar * szValue,
icFloatNumber nValue,
icColorSpaceSignature csSig,
int nIndex,
bool bUseLegacy )

Definition at line 330 of file IccUtil.cpp.

333{
334 if (csSig==icSigLabData) {
335 if (!bUseLegacy) {
336 if (!nIndex || nIndex>2)
337 sprintf(szValue, "%7.3lf", nValue * 100.0);
338 else
339 sprintf(szValue, "%8.3lf", nValue * 255.0 - 128.0);
340 }
341 else {
342 if (!nIndex || nIndex>2)
343 sprintf(szValue, "%7.3lf", nValue * 100.0 * 65535.0 / 65280.0);
344 else
345 sprintf(szValue, "%8.3lf", nValue * 255.0 * 65535.0 / 65280.0 - 128.0);
346 }
347 }
348 else if (csSig==icSigUnknownData) {
349 sprintf(szValue, "%8.5lf", nValue);
350 }
351 else {
352 sprintf(szValue, "%7.3lf", nValue * 100.0);
353 }
354}
@ icSigLabData

References icSigLabData, and icSigUnknownData.

Referenced by CIccTagCurve::Describe(), CIccTagNamedColor2::Describe(), CIccCLUT::DumpLut(), CIccTagCurve::DumpLut(), and CIccCLUT::Iterate().

+ Here is the caller graph for this function:

◆ icCubeth()

Definition at line 805 of file IccUtil.cpp.

806{
807 if (v> 0.008856) {
808 return (icFloatNumber)ICC_CBRTF(v);
809 }
810 else {
811 return (icFloatNumber)(7.787037037037037037037037037037*v + 16.0/116.0);
812 }
813}
#define ICC_CBRTF(v)

References ICC_CBRTF.

Referenced by CIccOpDefToLab::Exec(), and icXYZtoLab().

+ Here is the caller graph for this function:

◆ icDeltaE()

icFloatNumber icDeltaE ( const icFloatNumber * lab1,
const icFloatNumber * lab2 )

Definition at line 527 of file IccUtil.cpp.

528{
529 return (icFloatNumber)sqrt(icSq(lab1[0]-lab2[0]) + icSq(lab1[1]-lab2[1]) + icSq(lab1[2]-lab2[2]));
530}
static icFloatNumber icSq(icFloatNumber x)
Definition IccUtil.cpp:521

References icSq().

Referenced by CIccMinMaxEval::Compare(), CIccPRMG::EvaluateProfile(), CIccTagNamedColor2::FindCachedPCSColor(), and CIccArrayNamedColor::FindPcsColor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icDeNormXyz()

void icDeNormXyz ( icFloatNumber * XYZ,
icFloatNumber * WhiteXYZ )

Definition at line 795 of file IccUtil.cpp.

796{
797 if (!WhiteXYZ)
798 WhiteXYZ = icD50XYZ;
799
800 XYZ[0] = XYZ[0] * WhiteXYZ[0];
801 XYZ[1] = XYZ[1] * WhiteXYZ[1];
802 XYZ[2] = XYZ[2] * WhiteXYZ[2];
803}
icFloatNumber icD50XYZ[3]
Definition IccUtil.cpp:782

References icD50XYZ.

◆ icDtoF()

Definition at line 545 of file IccUtil.cpp.

546{
548
549 if (num<-32768.0)
550 num = -32768.0;
551 else if (num>32767.0)
552 num = 32767.0;
553
554 rv = (icS15Fixed16Number)icRoundOffset((double)num*65536.0);
555
556 return rv;
557}
double icRoundOffset(double v)
Name: icRoundOffset.
Definition IccUtil.cpp:223
icInt32Number icS15Fixed16Number
Fixed numbers.

References icRoundOffset().

Referenced by CIccTagLut16::CIccTagLut16(), CIccTagLut8::CIccTagLut8(), CIccDefaultEncProfileConverter::ConvertFromParams(), main(), CIccProfileXml::ParseBasic(), CIccTagXmlFixedNum< T, Tsig >::ParseXml(), CIccTagXmlMeasurement::ParseXml(), CIccTagXmlResponseCurveSet16::ParseXml(), CIccTagXmlViewingConditions::ParseXml(), CIccTagXmlXYZ::ParseXml(), CIccTagLut16::SetColorSpaces(), CIccTagLut8::SetColorSpaces(), CIccTagLut16::Write(), CIccTagLut8::Write(), CIccTagLutAtoB::Write(), and CIccTagParametricCurve::Write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icDtoUCF()

Definition at line 608 of file IccUtil.cpp.

609{
611
612 if (num<0)
613 num = 0;
614 else if (num>255.0)
615 num = 255.0;
616
617 rv = (icU8Fixed8Number)icRoundOffset(num*256.0);
618
619 return rv;
620}
icUInt16Number icU8Fixed8Number
Definition IccDefs.h:83

References icRoundOffset().

+ Here is the call graph for this function:

◆ icDtoUF()

Definition at line 566 of file IccUtil.cpp.

567{
569
570 if (num<0)
571 num = 0;
572 else if (num>65535.0)
573 num = 65535.0;
574
575 rv = (icU16Fixed16Number)icRoundOffset((double)num*65536.0);
576
577 return rv;
578}
icUInt32Number icU16Fixed16Number

References icRoundOffset().

Referenced by CIccTagXmlChromaticity::ParseXml(), CIccTagXmlFixedNum< T, Tsig >::ParseXml(), and CIccTagChromaticity::Validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icDtoUSF()

Definition at line 587 of file IccUtil.cpp.

588{
590
591 if (num<0)
592 num = 0;
593 else if (num>65535.0/32768.0)
594 num = 65535.0/32768.0;
595
596 rv = (icU1Fixed15Number)icRoundOffset(num*32768.0);
597
598 return rv;
599}
icUInt16Number icU1Fixed15Number
Definition IccDefs.h:82

References icRoundOffset().

+ Here is the call graph for this function:

◆ icF16toF()

icFloatNumber icF16toF ( icFloat16Number num)

Definition at line 629 of file IccUtil.cpp.

630{
631 icUInt16Number numsgn, numexp, nummnt;
632 icUInt32Number rv, rvsgn, rvexp, rvmnt;
633 icInt32Number tmpexp;
634 icFloatNumber * rvfp, rvf;
635 int exp;
636
637 if (!(num & 0x7FFF)) {
638 rv = ((icUInt32Number) num) << 16;
639 } else {
640 numsgn = num & 0x8000;
641 numexp = num & 0x7C00;
642 nummnt = num & 0x03FF;
643 if (!numexp) {
644 exp = -1;
645 do {
646 exp++;
647 nummnt <<= 1;
648 } while (!(nummnt & 0x0400)); // Shift until leading bit overflows into exponent bit
649 rvsgn = ((icUInt32Number) numsgn) << 16;
650 tmpexp = ((icUInt32Number) (numexp >> 10)) - 15 + 127 - exp;
651 rvexp = (icUInt32Number) (tmpexp << 23);
652 rvmnt = ((icUInt32Number) (nummnt & 0x03FFu)) << 13;
653 rv = (rvsgn | rvexp | rvmnt);
654 } else if (numexp == 0x7C00) {
655 if (!nummnt) {
656 rv = (((icUInt32Number) numsgn) << 16) | ((icUInt32Number) 0x7F800000);
657 } else {
658 rv = (icUInt32Number) 0xFFC00000;
659 }
660 } else {
661 rvsgn = ((icUInt32Number) numsgn) << 16;
662 tmpexp = ((icUInt32Number) (numexp >> 10)) - 15 + 127;
663 rvexp = (icUInt32Number) (tmpexp << 23);
664 rvmnt = ((icUInt32Number) nummnt) << 13;
665 rv = (rvsgn | rvexp | rvmnt);
666 }
667 }
668 rvfp = (icFloatNumber*)&rv;
669 rvf = *rvfp;
670 return rvf;
671}
unsigned int icUInt32Number
unsigned short icUInt16Number
long icInt32Number

Referenced by CIccInfo::CheckData(), CIccMpeSpectralMatrix::Describe(), CIccMpeSpectralObserver::Describe(), CIccTagEmbeddedProfile::Describe(), CIccTagSpectralDataInfo::Describe(), CIccTagSpectralViewingConditions::Describe(), CIccSparseMatrixFloat16::get(), main(), main(), MyChild::MyChild(), CIccSampledCurveSegmentXml::ParseXml(), CIccSinglSampledeCurveXml::ParseXml(), CIccIO::ReadFloat16Float(), CIccMatrixMath::SetRange(), CIccMpeXmlEmissionCLUT::ToXml(), CIccMpeXmlEmissionMatrix::ToXml(), CIccMpeXmlEmissionObserver::ToXml(), CIccMpeXmlInvEmissionMatrix::ToXml(), CIccMpeXmlReflectanceCLUT::ToXml(), CIccMpeXmlReflectanceObserver::ToXml(), CIccTagXmlSpectralDataInfo::ToXml(), CIccTagXmlSpectralViewingConditions::ToXml(), and CIccProfileXml::ToXmlWithBlanks().

+ Here is the caller graph for this function:

◆ icFtoD()

◆ icFtoF16()

Definition at line 673 of file IccUtil.cpp.

674{
676 icUInt16Number rvsgn, rvexp, rvmnt;
677 icUInt32Number flt, *fltp, fltsgn, fltexp, fltmnt;
678 int exp;
679
680 fltp = (icUInt32Number*)&num;
681 flt = *fltp;
682 if (!(flt & 0x7FFFFFFF)) {
683 rv = (icUInt16Number) (flt >> 16);
684 } else {
685 fltsgn = flt & 0x80000000;
686 fltexp = flt & 0x7F800000;
687 fltmnt = flt & 0x007FFFFF;
688 if (!fltexp) {
689 rv = (icUInt16Number) (fltsgn >> 16);
690 } else if (fltexp == 0x7F800000) {
691 if (!fltmnt) {
692 rv = (icUInt16Number) ((fltsgn >> 16) | 0x7C00); // Signed Inf
693 } else {
694 rv = (icUInt16Number) 0xFE00; // NaN
695 }
696 } else { // Normalized number
697 rvsgn = (icUInt16Number) (fltsgn >> 16);
698 exp = ((int)(fltexp >> 23)) - 127 + 15;
699 if (exp >= 0x1F) { // Overflow
700 rv = (icUInt16Number) ((fltsgn >> 16) | 0x7C00); // Signed Inf
701 } else if (exp <= 0) { // Underflow
702 if ((14 - exp) > 24) {
703 rvmnt = (icUInt16Number) 0; // Set mantissa to zero
704 } else {
705 fltmnt |= 0x00800000; // Include hidden leading bit
706 rvmnt = (icUInt16Number) (fltmnt >> (14 - exp));
707 if ((fltmnt >> (13 - exp)) & 0x00000001) // Rounding?
708 rvmnt += (icUInt16Number) 1;
709 }
710 rv = (rvsgn | rvmnt);
711 } else {
712 rvexp = (icUInt16Number) (exp << 10);
713 rvmnt = (icUInt16Number) (fltmnt >> 13);
714 if (fltmnt & 0x00001000) // Rounding?
715 rv = (rvsgn | rvexp | rvmnt) + (icUInt16Number) 1;
716 else
717 rv = (rvsgn | rvexp | rvmnt);
718 }
719 }
720 }
721 return rv;
722}

Referenced by CIccProfileXml::ParseBasic(), CIccMpeXmlEmissionCLUT::ParseXml(), CIccMpeXmlEmissionMatrix::ParseXml(), CIccMpeXmlEmissionObserver::ParseXml(), CIccMpeXmlInvEmissionMatrix::ParseXml(), CIccMpeXmlReflectanceCLUT::ParseXml(), CIccMpeXmlReflectanceObserver::ParseXml(), CIccTagXmlSpectralDataInfo::ParseXml(), CIccTagXmlSpectralViewingConditions::ParseXml(), CIccSparseMatrixFloat16::set(), and CIccIO::WriteFloat16Float().

+ Here is the caller graph for this function:

◆ icFtoU16()

icUInt16Number icFtoU16 ( icFloatNumber num)

Definition at line 745 of file IccUtil.cpp.

746{
748
749 if (num<0)
750 num = 0;
751 else if (num>1.0)
752 num = 1.0;
753
754 rv = (icUInt16Number)icRoundOffset(num*65535.0);
755
756 return rv;
757}

References icRoundOffset().

Referenced by CIccTagXmlColorantTable::ParseXml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icFtoU8()

icUInt8Number icFtoU8 ( icFloatNumber num)

Definition at line 724 of file IccUtil.cpp.

725{
726 icUInt8Number rv;
727
728 if (num<0)
729 num = 0;
730 else if (num>1.0)
731 num = 1.0;
732
733 rv = (icUInt8Number)icRoundOffset(num*255.0);
734
735 return rv;
736}

References icRoundOffset().

+ Here is the call graph for this function:

◆ icGet16bitSig()

const icChar * icGet16bitSig ( icChar * pBuf,
icUInt16Number nSig,
bool bGetHexVal )

Definition at line 1000 of file IccUtil.cpp.

1001{
1002 icUInt16Number sig = nSig;
1003 icUInt8Number c;
1004
1005 if (!nSig) {
1006 strcpy(pBuf, "NULL");
1007 return pBuf;
1008 }
1009
1010 pBuf[0] = '\'';
1011 c = (icUInt8Number)(sig >> 8);
1012 if (!isprint(c))
1013 c = '?';
1014 pBuf[1] = c;
1015 c = (icUInt8Number)(sig & 0x00FF);
1016 if (!isprint(c))
1017 c = '?';
1018 pBuf[2] = c;
1019
1020 if (bGetHexVal)
1021 sprintf(pBuf + 3, "' = %04X", nSig);
1022 else
1023 sprintf(pBuf + 3, "'");
1024
1025 return pBuf;
1026}
icArraySignature sig

References sig.

◆ icGetColorSig()

const icChar * icGetColorSig ( icChar * pBuf,
icUInt32Number nSig,
bool bGetHexVal )

Definition at line 1088 of file IccUtil.cpp.

1089{
1090 icUInt32Number sig=nSig;
1091
1092 switch (icGetColorSpaceType(nSig)) {
1093 case icSigNChannelData:
1099
1100 pBuf[0]='\"';
1101 pBuf[1] = (icUInt8Number)(sig>>24);
1102 sig<<=8;
1103 pBuf[2] = (icUInt8Number)(sig>>24);
1104 sprintf(pBuf+3, "%04X\"", icNumColorSpaceChannels(nSig));
1105 return pBuf;
1106
1107 default:
1108 {
1109
1110 int i, j=-1;
1111 icUInt8Number c;
1112 bool bNeedHexVal = false;
1113
1114 pBuf[0] = '\'';
1115 for (i=1; i<5; i++) {
1116 c=(icUInt8Number)(sig>>24);
1117 if (!isprint(c)) {
1118 c = '?';
1119 bNeedHexVal = true;
1120 }
1121 pBuf[i]=c;
1122 sig <<=8;
1123 }
1124
1125 if (bGetHexVal)
1126 sprintf(pBuf+5, "' = %08X", nSig);
1127 else if (bNeedHexVal) {
1128 sprintf(pBuf, "%08Xh", nSig);
1129 }
1130 else
1131 sprintf(pBuf+5, "'");
1132 }
1133 }
1134
1135 return pBuf;
1136}
#define icNumColorSpaceChannels(sig)
#define icGetColorSpaceType(sig)
@ icSigNChannelData
@ icSigReflectanceSpectralData
@ icSigTransmisionSpectralData
@ icSigBiSpectralReflectanceData
@ icSigRadiantSpectralData
@ icSigSparseMatrixReflectanceData

References icGetColorSpaceType, icNumColorSpaceChannels, icSigBiSpectralReflectanceData, icSigNChannelData, icSigRadiantSpectralData, icSigReflectanceSpectralData, icSigSparseMatrixReflectanceData, icSigTransmisionSpectralData, and sig.

Referenced by CIccCfgColorData::toLegacy().

+ Here is the caller graph for this function:

◆ icGetColorSigStr()

const icChar * icGetColorSigStr ( icChar * pBuf,
icUInt32Number nSig )

Definition at line 1139 of file IccUtil.cpp.

1140{
1141 icUInt32Number sig=nSig;
1142
1143 switch (icGetColorSpaceType(nSig)) {
1144 case icSigNChannelData:
1150
1151 pBuf[0] = (icUInt8Number)(sig>>24);
1152 sig<<=8;
1153 pBuf[1] = (icUInt8Number)(sig>>24);
1154 sprintf(pBuf+2, "%04X", icNumColorSpaceChannels(nSig));
1155 return pBuf;
1156
1157 default:
1158 {
1159
1160 int i, j=-1;
1161 icUInt8Number c;
1162 bool bGetHexVal = false;
1163
1164 for (i=0; i<4; i++) {
1165 c=(icUInt8Number)(sig>>24);
1166 if (!c) {
1167 j=i;
1168 }
1169 else if (j!=-1) {
1170 bGetHexVal = true;
1171 }
1172 else if (!isprint(c) ||c==':') {
1173 c='?';
1174 bGetHexVal = true;
1175 }
1176 pBuf[i]=c;
1177 sig <<=8;
1178 }
1179
1180 if (bGetHexVal)
1181 sprintf(pBuf, "%08Xh", nSig);
1182 else
1183 pBuf[4] = '\0';
1184 }
1185 }
1186
1187 return pBuf;
1188}

References icGetColorSpaceType, icNumColorSpaceChannels, icSigBiSpectralReflectanceData, icSigNChannelData, icSigRadiantSpectralData, icSigReflectanceSpectralData, icSigSparseMatrixReflectanceData, icSigTransmisionSpectralData, and sig.

Referenced by CIccTagSpectralDataInfo::Describe(), CIccCfgColorData::toJson(), CIccCfgDataApply::toJson(), CIccTagXmlSpectralDataInfo::ToXml(), and CIccProfileXml::ToXmlWithBlanks().

+ Here is the caller graph for this function:

◆ icGetFirstSigPathSig()

icSignature icGetFirstSigPathSig ( std::string sigPath)

Definition at line 1201 of file IccUtil.cpp.

1202{
1203 icSignature rv = 0;
1204 const char *ptr = sigPath.c_str();
1205 while(*ptr==':') {
1206 std::string sigStr;
1207 ptr++;
1208 while(*ptr && *ptr!=':') {
1209 sigStr += *ptr;
1210 ptr++;
1211 }
1212 rv = icGetSigVal(sigStr.c_str());
1213 //Skip embedded tag path entry
1214 if (rv != icSigEmbeddedV5ProfileTag)
1215 break;
1216 }
1217 return rv;
1218}
icUInt32Number icGetSigVal(const icChar *pBuf)
Definition IccUtil.cpp:1258
icUInt32Number icSignature
@ icSigEmbeddedV5ProfileTag

References icGetSigVal(), and icSigEmbeddedV5ProfileTag.

Referenced by CIccCLUT::Validate(), CIccMatrix::Validate(), CIccMBB::Validate(), CIccTagArray::Validate(), CIccTagColorantTable::Validate(), CIccTagCurve::Validate(), CIccTagFloatNum< T, Tsig >::Validate(), CIccTagLut16::Validate(), CIccTagLut8::Validate(), CIccTagLutAtoB::Validate(), CIccTagLutBtoA::Validate(), CIccTagMultiProcessElement::Validate(), CIccTagNum< T, Tsig >::Validate(), CIccTagParametricCurve::Validate(), CIccTagSignature::Validate(), CIccTagSparseMatrixArray::Validate(), CIccTagSpectralDataInfo::Validate(), and CIccTagText::Validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icGetLastSigPathSig()

icSignature icGetLastSigPathSig ( std::string sigPath)

Definition at line 1220 of file IccUtil.cpp.

1221{
1222 size_t n = sigPath.length();
1223 if (!n)
1224 return icGetSigVal(sigPath.c_str());
1225
1226 const char *sig = sigPath.c_str();
1227
1228 for (n = n - 1; n > 0; n--) {
1229 if (sig[n] == ':') {
1230 break;
1231 }
1232 }
1233 if (/* n >= 0 && */ sig[n] == ':')
1234 n++;
1235 return icGetSigVal(sig+n);
1236}

References icGetSigVal(), and sig.

+ Here is the call graph for this function:

◆ icGetMaterialColorSpaceSamples()

icUInt32Number icGetMaterialColorSpaceSamples ( icMaterialColorSignature sig)

Definition at line 1391 of file IccUtil.cpp.

1392{
1394 return 0;
1395
1397}
icColorSpaceSignature
Color Space Signatures.
@ icSigSrcMCSChannelData

References icGetColorSpaceType, icNumColorSpaceChannels, icSigSrcMCSChannelData, and sig.

Referenced by CIccTagArray::Validate(), CIccTagFloatNum< T, Tsig >::Validate(), CIccTagMultiProcessElement::Validate(), and CIccTagNum< T, Tsig >::Validate().

+ Here is the caller graph for this function:

◆ icGetSecondSigPathSig()

icSignature icGetSecondSigPathSig ( std::string sigPath)

Definition at line 1238 of file IccUtil.cpp.

1239{
1240 icSignature rv = 0;
1241 const char *ptr = sigPath.c_str();
1242 if(*ptr==':') {
1243 std::string sigStr;
1244 ptr++;
1245 ptr = strchr(ptr+1, ':');
1246 if (ptr) {
1247 ptr++;
1248 while(*ptr && *ptr!=':') {
1249 sigStr += *ptr;
1250 ptr++;
1251 }
1252 rv = icGetSigVal(sigStr.c_str());
1253 }
1254 }
1255 return rv;
1256}

References icGetSigVal().

Referenced by CIccTagSparseMatrixArray::Validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icGetSig()

const icChar * icGetSig ( icChar * pBuf,
icUInt32Number nSig,
bool bGetHexVal )

Definition at line 1028 of file IccUtil.cpp.

1029{
1030 int i;
1031 icUInt32Number sig=nSig;
1032 icUInt8Number c;
1033
1034 if (!nSig) {
1035 strcpy(pBuf, "NULL");
1036 return pBuf;
1037 }
1038
1039 pBuf[0] = '\'';
1040 for (i=1; i<5; i++) {
1041 c=(icUInt8Number)(sig>>24);
1042 if (!isprint(c))
1043 c='?';
1044 pBuf[i]=c;
1045 sig <<=8;
1046 }
1047
1048 if (bGetHexVal)
1049 sprintf(pBuf+5, "' = %08X", nSig);
1050 else
1051 sprintf(pBuf+5, "'");
1052
1053 return pBuf;
1054}

References sig.

Referenced by CIccMpeAcs::Describe(), CIccMpeUnknown::Describe(), CIccTagEmbeddedProfile::Describe(), CIccTagProfileSeqDesc::Describe(), SIccCalcOp::Describe(), DumpTag(), CIccBasicMpeFactory::GetElementSigName(), CIccInfo::GetUnknownName(), main(), MyChild::MyChild(), and CIccMpeUnknown::Validate().

+ Here is the caller graph for this function:

◆ icGetSigPath()

std::string icGetSigPath ( icUInt32Number nSig)

Definition at line 1191 of file IccUtil.cpp.

1192{
1193 char buf[20];
1194 std::string rv = ":";
1195
1196 rv += icGetSigStr(buf, nSig);
1197
1198 return rv;
1199}
const icChar * icGetSigStr(icChar *pBuf, icUInt32Number nSig)
Definition IccUtil.cpp:1056

References icGetSigStr().

Referenced by CIccArrayColorantInfo::Validate(), CIccArrayUnknown::Validate(), CIccMpeCalculator::Validate(), CIccMpeCLUT::Validate(), CIccMpeCurveSet::Validate(), CIccMpeExtCLUT::Validate(), CIccMpeInvEmissionMatrix::Validate(), CIccMpeMatrix::Validate(), CIccMpeSpectralCLUT::Validate(), CIccMpeSpectralMatrix::Validate(), CIccMpeSpectralObserver::Validate(), CIccMpeTintArray::Validate(), CIccMpeToneMap::Validate(), CIccMultiProcessElement::Validate(), CIccSegmentedCurve::Validate(), CIccStructUnknown::Validate(), CIccTagArray::Validate(), CIccTagColorantOrder::Validate(), CIccTagLut16::Validate(), CIccTagLut8::Validate(), CIccTagLutAtoB::Validate(), CIccTagLutBtoA::Validate(), CIccTagMultiProcessElement::Validate(), CIccTagProfileSeqDesc::Validate(), CIccTagProfileSequenceId::Validate(), and CIccTagStruct::Validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icGetSigStr()

const icChar * icGetSigStr ( icChar * pBuf,
icUInt32Number nSig )

Definition at line 1056 of file IccUtil.cpp.

1057{
1058 int i, j=-1;
1059 icUInt32Number sig=nSig;
1060 icUInt8Number c;
1061 bool bGetHexVal = false;
1062
1063 for (i=0; i<4; i++) {
1064 c=(icUInt8Number)(sig>>24);
1065 if (!c) {
1066 j=i;
1067 }
1068 else if (j!=-1) {
1069 bGetHexVal = true;
1070 }
1071 else if (!isprint(c) ||c==':') {
1072 c='?';
1073 bGetHexVal = true;
1074 }
1075 pBuf[i]=c;
1076 sig <<=8;
1077 }
1078
1079 if (bGetHexVal)
1080 sprintf(pBuf, "%08Xh", nSig);
1081 else
1082 pBuf[4] = '\0';
1083
1084 return pBuf;
1085}

References sig.

Referenced by SIccCalcOp::Describe(), CIccBasicArrayFactory::GetArraySigName(), CIccBasicStructFactory::GetStructSigName(), icGetSigPath(), icProfDescToXml(), jsonFromEnvMap(), CIccMpeXmlBAcs::ToXml(), CIccMpeXmlEAcs::ToXml(), CIccMpeXmlTintArray::ToXml(), CIccMpeXmlUnknown::ToXml(), CIccTagXmlArray::ToXml(), CIccTagXmlDict::ToXml(), CIccTagXmlMultiLocalizedUnicode::ToXml(), CIccTagXmlProfileSequenceId::ToXml(), CIccTagXmlSignature::ToXml(), CIccTagXmlStruct::ToXml(), CIccTagXmlTextDescription::ToXml(), and CIccProfileXml::ToXmlWithBlanks().

+ Here is the caller graph for this function:

◆ icGetSigVal()

icUInt32Number icGetSigVal ( const icChar * pBuf)

Definition at line 1258 of file IccUtil.cpp.

1259{
1261
1262 switch(strlen(pBuf)) {
1263 case 0:
1264 return 0;
1265
1266 case 1:
1267 return (icUInt32Number)((((unsigned long)pBuf[0])<<24) +
1268 0x202020);
1269
1270 case 2:
1271 return (icUInt32Number)((((unsigned long)pBuf[0])<<24) +
1272 (((unsigned long)pBuf[1])<<16) +
1273 0x2020);
1274
1275 case 3:
1276 return (icUInt32Number)((((unsigned long)pBuf[0])<<24) +
1277 (((unsigned long)pBuf[1])<<16) +
1278 (((unsigned long)pBuf[2])<<8) +
1279 0x20);
1280
1281 case 4:
1282 default:
1283 return (icUInt32Number)((((unsigned long)pBuf[0])<<24) +
1284 (((unsigned long)pBuf[1])<<16) +
1285 (((unsigned long)pBuf[2])<<8) +
1286 (((unsigned long)pBuf[3])));
1287
1288 case 6: //Channel based color signatures
1289 sscanf(pBuf+2, "%x", &v);
1290
1291 return (icUInt32Number)((((unsigned long)pBuf[0])<<24) +
1292 (((unsigned long)pBuf[1])<<16) +
1293 v);
1294
1295 case 8:
1296 case 9:
1297 sscanf(pBuf, "%x", &v);
1298 return v;
1299 }
1300}

Referenced by CIccCfgProfileSequence::fromArgs(), CIccCfgColorData::fromLegacy(), CIccInfo::GetSigPathName(), icGetFirstSigPathSig(), icGetLastSigPathSig(), icGetSecondSigPathSig(), icXmlGetChildSigVal(), icXmlStrToSig(), jsonToColorSpace(), jsonToValue(), main(), main(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccTagXmlDict::ParseXml(), CIccTagXmlMultiLocalizedUnicode::ParseXml(), CIccTagXmlProfileSequenceId::ParseXml(), CIccTagXmlSignature::ParseXml(), CIccTagXmlSpectralDataInfo::ParseXml(), CIccTagXmlStruct::ParseXml(), and CIccTagXmlUnknown::ParseXml().

+ Here is the caller graph for this function:

◆ icGetSpaceSamples()

icUInt32Number icGetSpaceSamples ( icColorSpaceSignature sig)

Definition at line 1303 of file IccUtil.cpp.

1304{
1305 switch(sig) {
1306 case icSigGrayData:
1307 case icSigGamutData:
1308 return 1;
1309
1310 case icSig2colorData:
1311 return 2;
1312
1313 case icSigXYZData:
1314 case icSigLabData:
1315 case icSigLuvData:
1316 case icSigYCbCrData:
1317 case icSigYxyData:
1318 case icSigRgbData:
1319 case icSigHsvData:
1320 case icSigHlsData:
1321 case icSigCmyData:
1322 case icSig3colorData:
1323 case icSigDevLabData:
1324 case icSigDevXYZData:
1325 return 3;
1326
1327 case icSigCmykData:
1328 case icSig4colorData:
1329 return 4;
1330
1331 default:
1332 switch (icGetColorSpaceType(sig)) {
1333 case icSigNChannelData:
1341
1342 default:
1343 {
1344 icChar szSig[5] = {0};
1345 szSig[0] = (icChar)(sig>>24);
1346 szSig[1] = (icChar)(sig>>16);
1347 szSig[2] = (icChar)(sig>>8);
1348 szSig[3] = (icChar)(sig);
1349 szSig[4] = '\0';
1350
1351 if (!strcmp(szSig+1, "CLR")) {
1352 int d0 = icHexDigit(szSig[0]);
1353 if (d0>=0)
1354 return d0;
1355 }
1356 else if (!strncmp(szSig, "MCH", 3)) { //Litte CMS multi-channel notation (not part of ICC specification)
1357 int d0 = icHexDigit(szSig[3]);
1358 if (d0>=0)
1359 return d0;
1360 }
1361 }
1362 return 0;
1363 }
1364 }
1365}
#define icSigDevXYZData
Definition IccDefs.h:92
#define icSigDevLabData
Additional convenience color space signatures to distinguish between device encoding and PCS encoding...
Definition IccDefs.h:91
static icInt32Number icHexDigit(icChar digit)
Definition IccUtil.cpp:251
@ icSig2colorData
@ icSigLuvData
@ icSigXYZData
@ icSigCmykData
@ icSigRgbData
@ icSigHlsData
@ icSig4colorData
@ icSigYCbCrData
@ icSigCmyData
@ icSigGrayData
@ icSig3colorData
@ icSigHsvData
@ icSigYxyData
#define icSigGamutData
Convenience Enum Definitions - Not defined in ICC specification.

References icGetColorSpaceType, icHexDigit(), icNumColorSpaceChannels, icSig2colorData, icSig3colorData, icSig4colorData, icSigBiSpectralReflectanceData, icSigCmyData, icSigCmykData, icSigDevLabData, icSigDevXYZData, icSigGamutData, icSigGrayData, icSigHlsData, icSigHsvData, icSigLabData, icSigLuvData, icSigNChannelData, icSigRadiantSpectralData, icSigReflectanceSpectralData, icSigRgbData, icSigSparseMatrixReflectanceData, icSigSrcMCSChannelData, icSigTransmisionSpectralData, icSigXYZData, icSigYCbCrData, icSigYxyData, and sig.

Referenced by CIccCfgColorData::addFields(), CCubeWriter::begin(), CDevLinkWriter::begin(), CIccApplyBPC::calcSrcBlackPoint(), CIccEvalCompare::EvaluateProfile(), CIccCfgColorData::fromLegacy(), CIccInfo::GetColorSpaceSigName(), icGetSpectralSpaceSamples(), IsValidBitmapType(), IsValidColorType(), main(), main(), main(), CIccArrayNamedColor::SetColorSpaces(), CIccCfgColorData::spaceName(), CIccMBB::Validate(), CIccTagColorantOrder::Validate(), CIccTagColorantTable::Validate(), CIccTagLut16::Validate(), CIccTagLut8::Validate(), CIccTagLutAtoB::Validate(), CIccTagLutBtoA::Validate(), CIccTagMultiProcessElement::Validate(), CIccTagNamedColor2::Validate(), CIccTagResponseCurveSet16::Validate(), and CIccTagSparseMatrixArray::Validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icGetSpectralSpaceSamples()

icUInt32Number icGetSpectralSpaceSamples ( const icHeader * pHdr)

Definition at line 1367 of file IccUtil.cpp.

1368{
1369 if (pHdr->spectralPCS)
1371 else
1372 return icGetSpaceSamples(pHdr->pcs);
1373}
icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
Definition IccUtil.cpp:1303
icSpectralColorSignature spectralPCS
icColorSpaceSignature pcs

References icGetSpaceSamples(), icHeader::pcs, and icHeader::spectralPCS.

Referenced by CIccTagMultiProcessElement::Validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icGetStorageTypeBytes()

icUInt8Number icGetStorageTypeBytes ( icUInt16Number nStorageType)

Definition at line 1375 of file IccUtil.cpp.

1376{
1377 switch (nStorageType) {
1378 case icValueTypeUInt8:
1379 return 1;
1380 case icValueTypeUInt16:
1381 case icValueTypeFloat16:
1382 return 2;
1383 case icValueTypeFloat32:
1384 return 4;
1385 default:
1386 return 0;
1387 }
1388}
@ icValueTypeFloat16
@ icValueTypeUInt8
@ icValueTypeUInt16
@ icValueTypeFloat32

References icValueTypeFloat16, icValueTypeFloat32, icValueTypeUInt16, and icValueTypeUInt8.

Referenced by CIccMpeExtCLUT::Read(), and CIccMpeSpectralCLUT::Read().

+ Here is the caller graph for this function:

◆ icHexDigit()

static icInt32Number icHexDigit ( icChar digit)
static

Definition at line 251 of file IccUtil.cpp.

252{
253 if (digit>='0' && digit<='9')
254 return digit-'0';
255 if (digit>='A' && digit<='F')
256 return digit-'A'+10;
257/* if (digit>='a' && digit<='f')
258 return digit-'a'+10;*/
259 return -1;
260}

Referenced by icGetSpaceSamples(), and icIsSpaceCLR().

+ Here is the caller graph for this function:

◆ icICubeth()

icFloatNumber icICubeth ( icFloatNumber v)

Definition at line 815 of file IccUtil.cpp.

816{
817 if (v > 0.20689303448275862068965517241379)
818 return v*v*v;
819 else
820#ifndef SAMPLEICC_NOCLIPLABTOXYZ
821 if (v>16.0/116.0)
822#endif
823 return (icFloatNumber)((v - 16.0 / 116.0) / 7.787037037037037037037037037037);
824#ifndef SAMPLEICC_NOCLIPLABTOXYZ
825 else
826 return 0.0;
827#endif
828}

Referenced by CIccOpDefFromLab::Exec(), and icLabtoXYZ().

+ Here is the caller graph for this function:

◆ icIntMax()

Definition at line 913 of file IccUtil.cpp.

914{
915 return( v1 > v2 ? v1 : v2 );
916}

Referenced by CIccCalculatorFunc::CheckUnderflowOverflow(), main(), and main().

+ Here is the caller graph for this function:

◆ icIntMin()

Definition at line 908 of file IccUtil.cpp.

909{
910 return( v1 < v2 ? v1 : v2 );
911}

Referenced by CIccCalculatorFunc::CheckUnderflowOverflow(), CIccCalculatorFunc::DescribeSequence(), CIccMpeXmlCalculator::ParseXml(), CIccCalculatorFunc::SequenceNeedTempReset(), and CIccToneMapFunc::SetFunction().

+ Here is the caller graph for this function:

◆ icIsIllumD50()

bool icIsIllumD50 ( icXYZNumber xyz)

Definition at line 363 of file IccUtil.cpp.

364{
365 return icIsS15Fixed16NumberNear(xyz.X, 0.9642f) &&
366 icIsS15Fixed16NumberNear(xyz.Y, 1.0000f) &&
367 icIsS15Fixed16NumberNear(xyz.Z, 0.8249f);
368}
static bool icIsS15Fixed16NumberNear(icS15Fixed16Number F, icFloatNumber D)
Definition IccUtil.cpp:356
icS15Fixed16Number Y
icS15Fixed16Number Z
icS15Fixed16Number X

References icIsS15Fixed16NumberNear(), icXYZNumber::X, icXYZNumber::Y, and icXYZNumber::Z.

+ Here is the call graph for this function:

◆ icIsNear()

bool icIsNear ( icFloatNumber v1,
icFloatNumber v2,
icFloatNumber nearRange )

Name: icIsNear.

Purpose: Checks if two numbers are close to each other in value

Args: v1 - first value v2 - second value range -

Return: true if v1 is near v2 within range

Definition at line 142 of file IccUtil.cpp.

143{
144 return fabs(v1 - v2) <= nearRange;
145}

Referenced by CIccFormulaCurveSegment::Begin(), CCubeWriter::begin(), CDevLinkWriter::begin(), CIccFormulaCurveSegment::Describe(), CubeFile::isCustomInputRange(), and CIccTagSpectralViewingConditions::setIlluminant().

+ Here is the caller graph for this function:

◆ icIsS15Fixed16NumberNear()

static bool icIsS15Fixed16NumberNear ( icS15Fixed16Number F,
icFloatNumber D )
static

Definition at line 356 of file IccUtil.cpp.

357{
359
360 return (icUInt32Number)(F*10000.0f + 0.5) == (icUInt32Number)(D*10000.0f + 0.5);
361}
#define F(x, y, z)
Definition IccMD5.cpp:64
icFloatNumber icFtoD(icS15Fixed16Number num)
Definition IccUtil.cpp:559

References F, and icFtoD().

Referenced by icIsIllumD50().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icIsSpaceCLR()

bool icIsSpaceCLR ( icColorSpaceSignature sig)

Definition at line 262 of file IccUtil.cpp.

263{
264 icChar szSig[5] = {0};
265 szSig[0] = (icChar)(sig>>24);
266 szSig[1] = (icChar)(sig>>16);
267 szSig[2] = (icChar)(sig>>8);
268 szSig[3] = (icChar)(sig);
269 szSig[4] = '\0';
270
271 int d0 = icHexDigit(szSig[0]);
272
273 if (szSig[0]=='n' && szSig[1]=='c')
274 return true;
275 else if (!strcmp(szSig+1, "CLR")) {
276 icInt32Number d0 = icHexDigit(szSig[0]);
277 if (d0>=1)
278 return true;
279 }
280 else if (!strcmp(szSig+2, "CL")) {
281 icInt32Number d0 = icHexDigit(szSig[0]);
282 icInt32Number d1 = icHexDigit(szSig[1]);
283
284 if (d0>=0 && d1>=0) {
285 icInt32Number n = (d0<<4) + d1;
286
287 if (n>0xf)
288 return true;
289 }
290 }
291
292 return false;
293}

References icHexDigit(), and sig.

Referenced by CDevLinkWriter::begin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icLab2Lch()

void icLab2Lch ( icFloatNumber * Lch,
icFloatNumber * Lab )

Definition at line 881 of file IccUtil.cpp.

882{
883 if (!Lab) {
884 Lab = Lch;
885 }
886 else
887 Lch[0] = Lab[0];
888
889 icFloatNumber c = (icFloatNumber)sqrt((double)Lab[1]*Lab[1] + (double)Lab[2]*Lab[2]);
890 icFloatNumber h = (icFloatNumber)(atan2(Lab[2], Lab[1]) * 180.0 / PI);
891 while (h<0.0)
892 h+=360.0;
893
894 Lch[1] = c;
895 Lch[2] = h;
896}
#define PI
Definition IccUtil.cpp:84

References PI.

Referenced by CIccPRMG::InGamut().

+ Here is the caller graph for this function:

◆ icLabFromPcs()

void icLabFromPcs ( icFloatNumber * Lab)

Floating point encoding of Lab in PCS is in range 0.0 to 1.0.

Here are some conversion routines to convert to regular Lab encoding

Definition at line 919 of file IccUtil.cpp.

920{
921 Lab[0] *= 100.0;
922 Lab[1] = (icFloatNumber)(Lab[1]*255.0 - 128.0);
923 Lab[2] = (icFloatNumber)(Lab[2]*255.0 - 128.0);
924}

Referenced by CIccTagColorantTable::Describe(), CIccEvalCompare::EvaluateProfile(), CIccPRMG::EvaluateProfile(), CIccTagNamedColor2::FindCachedPCSColor(), CIccTagNamedColor2::InitFindCachedPCSColor(), main(), CIccApplyBPC::pcs2lab(), CIccTagXmlColorantTable::ToXml(), and CIccTagXmlNamedColor2::ToXml().

+ Here is the caller graph for this function:

◆ icLabToPcs()

void icLabToPcs ( icFloatNumber * Lab)

Definition at line 927 of file IccUtil.cpp.

928{
929 Lab[0] /= 100.0;
930 Lab[1] = (icFloatNumber)((Lab[1] + 128.0) / 255.0);
931 Lab[2] = (icFloatNumber)((Lab[2] + 128.0) / 255.0);
932}

Referenced by CIccApplyBPC::lab2pcs(), main(), CIccTagXmlColorantTable::ParseXml(), and CIccTagXmlNamedColor2::ParseXml().

+ Here is the caller graph for this function:

◆ icLabtoXYZ()

void icLabtoXYZ ( icFloatNumber * XYZ,
const icFloatNumber * Lab,
const icFloatNumber * WhiteXYZ )

Definition at line 830 of file IccUtil.cpp.

831{
832 if (!Lab)
833 Lab = XYZ;
834
835 if (!WhiteXYZ)
836 WhiteXYZ = icD50XYZ;
837
838 icFloatNumber fy = (icFloatNumber)((Lab[0] + 16.0) / 116.0);
839
840 XYZ[0] = icICubeth((icFloatNumber)(Lab[1]/500.0 + fy)) * WhiteXYZ[0];
841 XYZ[1] = icICubeth(fy) * WhiteXYZ[1];
842 XYZ[2] = icICubeth((icFloatNumber)(fy - Lab[2]/200.0)) * WhiteXYZ[2];
843
844}
icFloatNumber icICubeth(icFloatNumber v)
Definition IccUtil.cpp:815

References icD50XYZ, and icICubeth().

Referenced by CIccApplyBPC::calcDstBlackPoint(), CIccApplyBPC::calcSrcBlackPoint(), CIccApplyBPC::lab2pcs(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icLch2Lab()

void icLch2Lab ( icFloatNumber * Lab,
icFloatNumber * Lch )

Definition at line 866 of file IccUtil.cpp.

867{
868 if (!Lch) {
869 Lch = Lab;
870 }
871 else
872 Lab[0] = Lch[0];
873
874 icFloatNumber a = (icFloatNumber)(Lch[1] * cos(Lch[2] * PI / 180.0));
875 icFloatNumber b = (icFloatNumber)(Lch[1] * sin(Lch[2] * PI / 180.0));
876
877 Lab[1] = a;
878 Lab[2] = b;
879}

References PI.

◆ icMatrixDump()

void icMatrixDump ( std::string & sDump,
icS15Fixed16Number * pMatrix )

Definition at line 988 of file IccUtil.cpp.

989{
990 icChar buf[128];
991
992 sprintf(buf, "%8.4lf %8.4lf %8.4lf\n", icFtoD(pMatrix[0]), icFtoD(pMatrix[1]), icFtoD(pMatrix[2]));
993 sDump += buf;
994 sprintf(buf, "%8.4lf %8.4lf %8.4lf\n", icFtoD(pMatrix[3]), icFtoD(pMatrix[4]), icFtoD(pMatrix[5]));
995 sDump += buf;
996 sprintf(buf, "%8.4lf %8.4lf %8.4lf\n", icFtoD(pMatrix[6]), icFtoD(pMatrix[7]), icFtoD(pMatrix[8]));
997 sDump += buf;
998}

References icFtoD().

Referenced by CIccTagFixedNum< T, Tsig >::Describe().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icMatrixInvert3x3()

bool icMatrixInvert3x3 ( icFloatNumber * M)

Name: icMatrixInvert3x3.

Purpose: Inversion of a 3x3 matrix using the Adjoint Cofactor and the determinant of the 3x3 matrix.

Note: Matrix index positions: 0 1 2 3 4 5 6 7 8

Args: M = matrix to invert.

Return: true = matrix is invertible and stored back into M, false = matrix is not invertible.

Definition at line 391 of file IccUtil.cpp.

392{
393 const icFloatNumber epsilon = 1e-8f;
394
395 icFloatNumber m48 = M[4]*M[8];
396 icFloatNumber m75 = M[7]*M[5];
397 icFloatNumber m38 = M[3]*M[8];
398 icFloatNumber m65 = M[6]*M[5];
399 icFloatNumber m37 = M[3]*M[7];
400 icFloatNumber m64 = M[6]*M[4];
401
402 icFloatNumber det = M[0]*(m48 - m75) -
403 M[1]*(m38 - m65) +
404 M[2]*(m37 - m64);
405
406 if (det>-epsilon && det<epsilon)
407 return false;
408
409 icFloatNumber Co[9] = {0};
410
411 Co[0] = +(m48 - m75);
412 Co[1] = -(m38 - m65);
413 Co[2] = +(m37 - m64);
414
415 Co[3] = -(M[1]*M[8] - M[7]*M[2]);
416 Co[4] = +(M[0]*M[8] - M[6]*M[2]);
417 Co[5] = -(M[0]*M[7] - M[6]*M[1]);
418
419 Co[6] = +(M[1]*M[5] - M[4]*M[2]);
420 Co[7] = -(M[0]*M[5] - M[3]*M[2]);
421 Co[8] = +(M[0]*M[4] - M[3]*M[1]);
422
423 M[0] = Co[0] / det;
424 M[1] = Co[3] / det;
425 M[2] = Co[6] / det;
426
427 M[3] = Co[1] / det;
428 M[4] = Co[4] / det;
429 M[5] = Co[7] / det;
430
431 M[6] = Co[2] / det;
432 M[7] = Co[5] / det;
433 M[8] = Co[8] / det;
434
435 return true;
436}

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), CIccMatrixMath::Invert(), CIccSimpleMatrixInverter::Invert(), and CIccSimpleMatrixSolver::Solve().

+ Here is the caller graph for this function:

◆ icMatrixMultiply3x3()

void icMatrixMultiply3x3 ( icFloatNumber * result,
const icFloatNumber * l,
const icFloatNumber * r )

Name: icMatrixMultiply3x3.

Purpose: Multiply two 3x3 matricies resulting in a 3x3 matrix.

Note: Matrix index positions: 0 1 2 3 4 5 6 7 8

Args: result = matrix to recieve result. l = left matrix to multiply (matrix multiplication is order dependent) r = right matrix to multiply (matrix multiplicaiton is order dependent)

Definition at line 457 of file IccUtil.cpp.

460{
461 const unsigned int e11 = 0;
462 const unsigned int e12 = 1;
463 const unsigned int e13 = 2;
464 const unsigned int e21 = 3;
465 const unsigned int e22 = 4;
466 const unsigned int e23 = 5;
467 const unsigned int e31 = 6;
468 const unsigned int e32 = 7;
469 const unsigned int e33 = 8;
470 result[e11] = l[e11] * r[e11] + l[e12] * r[e21] + l[e13] * r[e31];
471 result[e12] = l[e11] * r[e12] + l[e12] * r[e22] + l[e13] * r[e32];
472 result[e13] = l[e11] * r[e13] + l[e12] * r[e23] + l[e13] * r[e33];
473 result[e21] = l[e21] * r[e11] + l[e22] * r[e21] + l[e23] * r[e31];
474 result[e22] = l[e21] * r[e12] + l[e22] * r[e22] + l[e23] * r[e32];
475 result[e23] = l[e21] * r[e13] + l[e22] * r[e23] + l[e23] * r[e33];
476 result[e31] = l[e31] * r[e11] + l[e32] * r[e21] + l[e33] * r[e31];
477 result[e32] = l[e31] * r[e12] + l[e32] * r[e22] + l[e33] * r[e32];
478 result[e33] = l[e31] * r[e13] + l[e32] * r[e23] + l[e33] * r[e33];
479}

◆ icMax()

Definition at line 903 of file IccUtil.cpp.

904{
905 return( v1 > v2 ? v1 : v2 );
906}

Referenced by CIccFormulaCurveSegment::Apply(), CIccOpDefMaximum::Exec(), and CIccOpDefVectorMaximum::Exec().

+ Here is the caller graph for this function:

◆ icMaxStatus()

Name: icMaxStatus.

Purpose: return worst status

Args: s1, s2

Return:

Definition at line 244 of file IccUtil.cpp.

245{
246 if (s1>s2)
247 return s1;
248 return s2;
249}

Referenced by CIccInfo::CheckData(), CIccInfo::CheckData(), CIccInfo::CheckData(), CIccInfo::CheckData(), main(), MyDialog::MyDialog(), CIccArrayColorantInfo::Validate(), CIccArrayNamedColor::Validate(), CIccArrayUnknown::Validate(), CIccCLUT::Validate(), CIccFormulaCurveSegment::Validate(), CIccMBB::Validate(), CIccMpeCalculator::Validate(), CIccMpeCAM::Validate(), CIccMpeCurveSet::Validate(), CIccMpeInvEmissionMatrix::Validate(), CIccMpeSpectralCLUT::Validate(), CIccMpeSpectralMatrix::Validate(), CIccMpeSpectralObserver::Validate(), CIccMpeToneMap::Validate(), CIccResponseCurveStruct::Validate(), CIccSampledCalculatorCurve::Validate(), CIccSampledCurveSegment::Validate(), CIccSegmentedCurve::Validate(), CIccSingleSampledCurve::Validate(), CIccStructBRDF::Validate(), CIccStructColorantInfo::Validate(), CIccStructNamedColor::Validate(), CIccStructUnknown::Validate(), CIccTagArray::Validate(), CIccTagChromaticity::Validate(), CIccTagCicp::Validate(), CIccTagColorantOrder::Validate(), CIccTagColorantTable::Validate(), CIccTagCurve::Validate(), CIccTagData::Validate(), CIccTagDateTime::Validate(), CIccTagDict::Validate(), CIccTagEmbeddedHeightImage::Validate(), CIccTagEmbeddedNormalImage::Validate(), CIccTagEmbeddedProfile::Validate(), CIccTagFloatNum< T, Tsig >::Validate(), CIccTagGamutBoundaryDesc::Validate(), CIccTagLut16::Validate(), CIccTagLut8::Validate(), CIccTagLutAtoB::Validate(), CIccTagLutBtoA::Validate(), CIccTagMeasurement::Validate(), CIccTagMultiLocalizedUnicode::Validate(), CIccTagMultiProcessElement::Validate(), CIccTagNamedColor2::Validate(), CIccTagNum< T, Tsig >::Validate(), CIccTagParametricCurve::Validate(), CIccTagProfileSeqDesc::Validate(), CIccTagProfileSequenceId::Validate(), CIccTagResponseCurveSet16::Validate(), CIccTagSignature::Validate(), CIccTagSparseMatrixArray::Validate(), CIccTagSpectralDataInfo::Validate(), CIccTagSpectralViewingConditions::Validate(), CIccTagStruct::Validate(), CIccTagText::Validate(), CIccTagTextDescription::Validate(), CIccTagUtf16Text::Validate(), CIccTagUtf8Text::Validate(), CIccTagViewingConditions::Validate(), CIccTagXYZ::Validate(), CIccTagZipUtf8Text::Validate(), CIccToneMapFunc::Validate(), and ValidateIccProfile().

◆ icMemDump()

void icMemDump ( std::string & sDump,
void * pBuf,
icUInt32Number nNum )

Definition at line 951 of file IccUtil.cpp.

952{
953 icUInt8Number *pData = (icUInt8Number *)pBuf;
954 icChar buf[80] = {0};
955 icChar num[10] = {0};
956
957 icInt32Number i, j;
959
961 sDump.reserve(sDump.size() + lines*79);
962
963 for (i=0; i<(icInt32Number)nNum; i++, pData++) {
965 if (!j) {
966 if (i) {
967 sDump += (const icChar*)buf;
968 }
969 memset(buf, ' ', 76);
970 buf[76] = ' ';
971 buf[77] = '\n';
972 buf[78] = '\0';
973 sprintf(num, "%08X:", i);
974 strncpy(buf, num, 9);
975 }
976
977 sprintf(num, "%02X", *pData);
978 strncpy(buf+10+j*3, num, 2);
979
980 c=*pData;
981 if (!isprint(c))
982 c='.';
983 buf[10+16*3 + 1 + j] = c;
984 }
985 sDump += buf;
986}
#define DUMPBYTESPERLINE
Definition IccUtil.cpp:949

References DUMPBYTESPERLINE.

Referenced by CIccMpeAcs::Describe(), CIccMpeUnknown::Describe(), CIccTagData::Describe(), CIccTagUnknown::Describe(), CIccTagZipUtf8Text::Describe(), and MyTagDialog::MyTagDialog().

+ Here is the caller graph for this function:

◆ icMin()

Definition at line 898 of file IccUtil.cpp.

899{
900 return( v1 < v2 ? v1 : v2 );
901}

Referenced by CIccEvalCompare::EvaluateProfile(), CIccOpDefMinimum::Exec(), and CIccOpDefVectorMinimum::Exec().

+ Here is the caller graph for this function:

◆ icNormXyz()

void icNormXyz ( icFloatNumber * XYZ,
icFloatNumber * WhiteXYZ )

Definition at line 785 of file IccUtil.cpp.

786{
787 if (!WhiteXYZ)
788 WhiteXYZ = icD50XYZ;
789
790 XYZ[0] = XYZ[0] / WhiteXYZ[0];
791 XYZ[1] = XYZ[1] / WhiteXYZ[1];
792 XYZ[2] = XYZ[2] / WhiteXYZ[2];
793}

References icD50XYZ.

◆ icRealloc()

void * icRealloc ( void * ptr,
size_t size )

Name: icRealloc.

Purpose: realloc memory allocated by malloc or calloc freeing old memory on failure.

Args: ptr - memory block to realloc size - new size of memory block

Return: pointer to reallocated memory block or NULL on failure. Old memory is released on error.

Definition at line 111 of file IccUtil.cpp.

112{
113 void *nptr;
114
115 if (ptr)
116 nptr = realloc(ptr, size);
117 else
118 nptr = malloc(size);
119
120 if (!nptr && ptr)
121 free(ptr);
122
123 return nptr;
124}

Referenced by CIccTagZipUtf8Text::AllocBuffer(), CIccUTF16String::FromUtf8(), CIccTagText::GetBuffer(), CIccTagTextDescription::GetBuffer(), CIccTagUtf16Text::GetBuffer(), CIccTagUtf8Text::GetBuffer(), CIccTagTextDescription::GetUnicodeBuffer(), CIccUTF16String::operator=(), CIccUTF16String::operator=(), CIccTagDict::Read(), CIccTagText::Release(), CIccTagTextDescription::Release(), CIccTagUtf16Text::Release(), CIccTagUtf8Text::Release(), CIccTagTextDescription::ReleaseUnicode(), CIccTagSparseMatrixArray::Reset(), CIccUTF16String::Resize(), CIccMpeCalculator::SetElem(), CIccLocalizedUnicode::SetSize(), CIccTagArray::SetSize(), CIccTagChromaticity::SetSize(), CIccTagColorantOrder::SetSize(), CIccTagColorantTable::SetSize(), CIccTagCurve::SetSize(), CIccTagData::SetSize(), CIccTagEmbeddedHeightImage::SetSize(), CIccTagEmbeddedNormalImage::SetSize(), CIccTagFixedNum< T, Tsig >::SetSize(), CIccTagFloatNum< T, Tsig >::SetSize(), CIccTagNum< T, Tsig >::SetSize(), and CIccTagXYZ::SetSize().

+ Here is the caller graph for this function:

◆ icRmsDif()

icFloatNumber icRmsDif ( const icFloatNumber * v1,
const icFloatNumber * v2,
icUInt32Number nSample )

Definition at line 532 of file IccUtil.cpp.

533{
534 icFloatNumber sum=0;
536 for (i=0; i<nSample; i++) {
537 sum += icSq(v1[i] - v2[i]);
538 }
539 if (nSample)
540 sum /= nSample;
541
542 return (icFloatNumber)sqrt(sum);
543}

References icSq().

Referenced by CIccArrayNamedColor::FindSpectralColor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icRoundOffset()

double icRoundOffset ( double v)

Name: icRoundOffset.

Purpose: Adds offset to floating point value for purposes of rounding by casting to and integer based value

Args: v - value to offset

Return: v with offset added - suitable for casting to some form of integer

Definition at line 223 of file IccUtil.cpp.

224{
225 if (v < 0.0)
226 return v - 0.5;
227 else
228 return v + 0.5;
229}

Referenced by icDtoF(), icDtoUCF(), icDtoUF(), icDtoUSF(), icFtoU16(), and icFtoU8().

+ Here is the caller graph for this function:

◆ icSameSpectralRange()

bool icSameSpectralRange ( const icSpectralRange & rng1,
const icSpectralRange & rng2 )

Definition at line 1399 of file IccUtil.cpp.

1400{
1401 return (rng1.start == rng2.start &&
1402 rng1.end == rng2.end &&
1403 rng1.steps == rng2.steps);
1404}
icUInt16Number steps
icFloat16Number start
icFloat16Number end

References icSpectralRange::end, icSpectralRange::start, and icSpectralRange::steps.

◆ icSq()

static icFloatNumber icSq ( icFloatNumber x)
inlinestatic

Definition at line 521 of file IccUtil.cpp.

522{
523 return x*x;
524}

Referenced by icDeltaE(), and icRmsDif().

+ Here is the caller graph for this function:

◆ icU16toF()

icFloatNumber icU16toF ( icUInt16Number num)

Definition at line 759 of file IccUtil.cpp.

760{
761 icFloatNumber rv = (icFloatNumber)((icFloatNumber)num / 65535.0);
762
763 return rv;
764}

Referenced by CIccTagColorantTable::Describe(), CIccTagNum< T, Tsig >::GetValues(), CIccTagNum< T, Tsig >::Interpolate(), CIccTagXmlColorantTable::ToXml(), and CIccTagNum< T, Tsig >::ValuePos().

+ Here is the caller graph for this function:

◆ icU8toAB()

icFloatNumber icU8toAB ( icUInt8Number num)

Definition at line 777 of file IccUtil.cpp.

778{
779 return (icFloatNumber)num - 128.0f;
780}

◆ icU8toF()

icFloatNumber icU8toF ( icUInt8Number num)

Definition at line 738 of file IccUtil.cpp.

739{
740 icFloatNumber rv = (icFloatNumber)((icFloatNumber)num / 255.0);
741
742 return rv;
743}

Referenced by CIccTagNum< T, Tsig >::GetValues(), CIccTagNum< T, Tsig >::Interpolate(), and CIccTagNum< T, Tsig >::ValuePos().

+ Here is the caller graph for this function:

◆ icUCFtoD()

Definition at line 622 of file IccUtil.cpp.

623{
624 icFloatNumber rv = (icFloatNumber)((icFloatNumber)num / 256.0);
625
626 return rv;
627}

◆ icUFtoD()

Definition at line 580 of file IccUtil.cpp.

581{
582 icFloatNumber rv = (icFloatNumber)((double)num / 65536.0);
583
584 return rv;
585}

Referenced by CIccTagChromaticity::Describe(), CIccTagFixedNum< T, Tsig >::Describe(), CIccTagFixedNum< T, Tsig >::GetValues(), CIccTagFixedNum< T, Tsig >::Interpolate(), CIccTagXmlChromaticity::ToXml(), CIccTagXmlFixedNum< T, Tsig >::ToXml(), and CIccTagFixedNum< T, Tsig >::ValuePos().

+ Here is the caller graph for this function:

◆ icUSFtoD()

Definition at line 601 of file IccUtil.cpp.

602{
603 icFloatNumber rv = (icFloatNumber)((icFloatNumber)num / 32768.0);
604
605 return rv;
606}

Referenced by CIccTagColorantTable::Describe().

+ Here is the caller graph for this function:

◆ icValidOverlap()

bool icValidOverlap ( const icPositionNumber & pos1,
const icPositionNumber & pos2,
bool bAllowSame )

Name: icValidOverlap.

Purpose: Checks if pos overlap is acceptable

Args: pos1 - first positionNumber pos2 - second positionNumber bAllowSame - allow to positions to cover the same area

Return: true if v1 is near v2 within range

Definition at line 195 of file IccUtil.cpp.

196{
197 if ((icUInt64Number)pos1.offset + pos1.size <= (icUInt64Number)pos2.offset ||
198 (icUInt64Number)pos1.offset >= (icUInt64Number)pos2.offset + pos2.size)
199 return true;
200
201 if (bAllowSame && pos1.offset == pos2.offset || pos1.size == pos2.size)
202 return true;
203
204 return false;
205}
icUInt32Number icUInt64Number[2]
icUInt32Number offset
icUInt32Number size

References icPositionNumber::offset, and icPositionNumber::size.

Referenced by CIccMpeToneMap::Read().

+ Here is the caller graph for this function:

◆ icValidTagPos()

bool icValidTagPos ( const icPositionNumber & pos,
icUInt32Number nTagHeaderSize,
icUInt32Number nTagSize,
bool bAllowEmpty )

Name: icValidTagPos.

Purpose: Checks if pos is valid for data within a tag

Args: pos - first value nTagHeaderSize - size of tag header nTagSize - total size of tag data

Return: true pos is valid

Definition at line 163 of file IccUtil.cpp.

164{
165 if (bAllowEmpty && !pos.size || !pos.offset)
166 return true;
167
168 if (pos.offset < nTagHeaderSize)
169 return false;
170 if ((icUInt64Number)pos.offset + pos.size > (icUInt64Number)nTagSize)
171 return false;
172
173 if (!pos.size && !bAllowEmpty)
174 return false;
175
176 return true;
177}

References icPositionNumber::offset, and icPositionNumber::size.

Referenced by CIccMpeToneMap::Read().

+ Here is the caller graph for this function:

◆ icVectorApplyMatrix3x3()

void icVectorApplyMatrix3x3 ( icFloatNumber * result,
const icFloatNumber * m,
const icFloatNumber * v )

Name: icVectorApplyMatrix3x3.

Purpose: Applies a 3x3 matrix to a 3 element column vector.

Note: Matrix index positions: 0 1 2 3 4 5 6 7 8

Note: result = m x v

Args: result = vector to receive result. m = matrix to multiply v = vector to apply matrix to

Definition at line 502 of file IccUtil.cpp.

505{
506 const unsigned int e11 = 0;
507 const unsigned int e12 = 1;
508 const unsigned int e13 = 2;
509 const unsigned int e21 = 3;
510 const unsigned int e22 = 4;
511 const unsigned int e23 = 5;
512 const unsigned int e31 = 6;
513 const unsigned int e32 = 7;
514 const unsigned int e33 = 8;
515 result[0] = m[e11] * v[0] + m[e12] * v[1] + m[e13] * v[2];
516 result[1] = m[e21] * v[0] + m[e22] * v[1] + m[e23] * v[2];
517 result[2] = m[e31] * v[0] + m[e32] * v[1] + m[e33] * v[2];
518}

Referenced by CIccSimpleMatrixSolver::Solve().

+ Here is the caller graph for this function:

◆ icXyzFromPcs()

void icXyzFromPcs ( icFloatNumber * XYZ)

Floating point encoding of XYZ in PCS is in range 0.0 to 1.0 (Note: X=1.0 is encoded as about 0.5)

Here are some conversion routines to convert to regular XYZ encoding

Definition at line 934 of file IccUtil.cpp.

935{
936 XYZ[0] = (icFloatNumber)(XYZ[0] * 65535.0 / 32768.0);
937 XYZ[1] = (icFloatNumber)(XYZ[1] * 65535.0 / 32768.0);
938 XYZ[2] = (icFloatNumber)(XYZ[2] * 65535.0 / 32768.0);
939}

Referenced by CIccTagNamedColor2::FindCachedPCSColor(), CIccTagNamedColor2::InitFindCachedPCSColor(), main(), CIccApplyBPC::pcs2lab(), and CIccTagXmlNamedColor2::ToXml().

+ Here is the caller graph for this function:

◆ icXYZtoLab()

void icXYZtoLab ( icFloatNumber * Lab,
const icFloatNumber * XYZ,
const icFloatNumber * WhiteXYZ )

Definition at line 846 of file IccUtil.cpp.

847{
848 icFloatNumber Xn, Yn, Zn;
849
850 if (!XYZ)
851 XYZ = Lab;
852
853 if (!WhiteXYZ)
854 WhiteXYZ = icD50XYZ;
855
856 Xn = icCubeth(XYZ[0] / WhiteXYZ[0]);
857 Yn = icCubeth(XYZ[1] / WhiteXYZ[1]);
858 Zn = icCubeth(XYZ[2] / WhiteXYZ[2]);
859
860 Lab[0] = (icFloatNumber)(116.0 * Yn - 16.0);
861 Lab[1] = (icFloatNumber)(500.0 * (Xn - Yn));
862 Lab[2] = (icFloatNumber)(200.0 * (Yn - Zn));
863
864}
icFloatNumber icCubeth(icFloatNumber v)
Definition IccUtil.cpp:805

References icCubeth(), and icD50XYZ.

Referenced by CIccMpeSpectralObserver::Apply(), CIccMpeEmissionCLUT::Begin(), CIccMpeReflectanceCLUT::Begin(), CIccApplyBPC::calcDstBlackPoint(), CIccTagNamedColor2::FindCachedPCSColor(), CIccArrayNamedColor::FindPcsColor(), CIccTagNamedColor2::InitFindCachedPCSColor(), main(), and CIccApplyBPC::pcs2lab().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icXyzToPcs()

void icXyzToPcs ( icFloatNumber * XYZ)

Definition at line 941 of file IccUtil.cpp.

942{
943 XYZ[0] = (icFloatNumber)(XYZ[0] * 32768.0 / 65535.0);
944 XYZ[1] = (icFloatNumber)(XYZ[1] * 32768.0 / 65535.0);
945 XYZ[2] = (icFloatNumber)(XYZ[2] * 32768.0 / 65535.0);
946}

Referenced by CIccApplyBPC::CalcFactors(), CIccApplyBPC::lab2pcs(), main(), and CIccTagXmlNamedColor2::ParseXml().

+ Here is the caller graph for this function:

Variable Documentation

◆ icD50XYZ

icFloatNumber icD50XYZ[3] = { 0.9642f, 1.0000f, 0.8249f }

◆ icD50XYZxx

icFloatNumber icD50XYZxx[3] = { 96.42f, 100.00f, 82.49f }

Definition at line 783 of file IccUtil.cpp.

783{ 96.42f, 100.00f, 82.49f };

◆ icMsgValidateCriticalError

◆ icMsgValidateInformation

const char* icMsgValidateInformation = "Information - "

Definition at line 93 of file IccUtil.cpp.

Referenced by CIccMpeToneMap::Validate().

◆ icMsgValidateNonCompliant

◆ icMsgValidateWarning