72 #pragma warning( disable: 4786)
86#ifdef USEREFICCMAXNAMESPACE
102CIccProfile::CIccProfile()
105 memset(&m_Header, 0,
sizeof(m_Header));
106 m_Tags =
new(TagEntryList);
107 m_TagVals =
new(TagPtrList);
124CIccProfile::CIccProfile(
const CIccProfile &Profile)
127 memset(&m_Header, 0,
sizeof(m_Header));
128 m_Tags =
new(TagEntryList);
129 m_TagVals =
new(TagPtrList);
130 memcpy(&m_Header, &Profile.m_Header,
sizeof(m_Header));
132 if (!Profile.m_TagVals->empty()) {
133 TagPtrList::const_iterator i;
134 IccTagPtr tagptr = {0};
135 for (i=Profile.m_TagVals->begin(); i!=Profile.m_TagVals->end(); i++) {
136 tagptr.ptr = i->ptr->NewCopy();
137 m_TagVals->push_back(tagptr);
141 if (!Profile.m_Tags->empty()) {
142 TagEntryList::const_iterator i;
143 IccTagEntry entry = {};
144 for (i=Profile.m_Tags->begin(); i!=Profile.m_Tags->end(); i++) {
145 TagPtrList::const_iterator j, k;
148 for (j=Profile.m_TagVals->begin(), k=m_TagVals->begin(); j!=Profile.m_TagVals->end() && k!=m_TagVals->end(); j++, k++) {
149 if (i->pTag == j->ptr) {
156 if (j==Profile.m_TagVals->end()) {
160 memcpy(&entry.TagInfo, &i->TagInfo,
sizeof(
icTag));
161 m_Tags->push_back(entry);
182CIccProfile &CIccProfile::operator=(
const CIccProfile &Profile)
184 if (&Profile ==
this)
189 memcpy(&m_Header, &Profile.m_Header,
sizeof(m_Header));
191 if (!Profile.m_TagVals->empty()) {
192 TagPtrList::const_iterator i;
193 IccTagPtr tagptr = {0};
194 for (i=Profile.m_TagVals->begin(); i!=Profile.m_TagVals->end(); i++) {
195 tagptr.ptr = i->ptr->NewCopy();
196 m_TagVals->push_back(tagptr);
200 if (!Profile.m_Tags->empty()) {
201 TagEntryList::const_iterator i;
202 IccTagEntry entry = {};
203 for (i=Profile.m_Tags->begin(); i!=Profile.m_Tags->end(); i++) {
204 TagPtrList::const_iterator j, k;
207 for (j=Profile.m_TagVals->begin(), k=m_TagVals->begin(); j!=Profile.m_TagVals->end() && k!=m_TagVals->end(); j++, k++) {
208 if (i->pTag == j->ptr) {
215 if (j==Profile.m_TagVals->end()) {
219 memcpy(&entry.TagInfo, &i->TagInfo,
sizeof(
icTag));
220 m_Tags->push_back(entry);
237CIccProfile::~CIccProfile()
252void CIccProfile::Cleanup()
259 TagPtrList::iterator i;
261 for (i=m_TagVals->begin(); i!=m_TagVals->end(); i++) {
267 memset(&m_Header, 0,
sizeof(m_Header));
285 TagEntryList::const_iterator i;
287 for (i=m_Tags->begin(); i!=m_Tags->end(); i++) {
289 return (IccTagEntry*)&(i->TagInfo);
309bool CIccProfile::AreTagsUnique()
const
311 TagEntryList::const_iterator i, j;
313 for (i=m_Tags->begin(); i!=m_Tags->end(); i++) {
315 for (j++; j!= m_Tags->end(); j++) {
316 if (i->TagInfo.sig == j->TagInfo.sig)
339IccTagEntry* CIccProfile::GetTag(
CIccTag *pTag)
const
341 TagEntryList::const_iterator i;
343 for (i=m_Tags->begin(); i!=m_Tags->end(); i++) {
345 return (IccTagEntry*)&(i->TagInfo);
370 IccTagEntry *pEntry = GetTag(
sig);
373 if (!pEntry->pTag && m_pAttachIO)
374 LoadTag(pEntry, m_pAttachIO);
398 IccTagEntry* pEntry = GetTag(
sig);
429 CIccTag *pTag = FindTag(tagSig);
431 if (pTag && pTag->
GetType()==typeSig)
457 IccTagEntry *pEntry = GetTag(
sig);
459 if (pEntry && m_pAttachIO) {
465 if (!pIO->
Alloc(pEntry->TagInfo.size)) {
497 IccTagEntry *pEntry = GetTag(
sig);
500 if (pEntry->pTag == pTag)
506 IccTagEntry Entry = {};
508 Entry.TagInfo.offset = 0;
509 Entry.TagInfo.size = 0;
512 m_Tags->push_back(Entry);
514 TagPtrList::iterator i;
516 for (i=m_TagVals->begin(); i!=m_TagVals->end(); i++)
520 if (i==m_TagVals->end()) {
521 IccTagPtr TagPtr = {};
523 m_TagVals->push_back(TagPtr);
547 TagEntryList::iterator i;
549 for (i=m_Tags->begin(); i!=m_Tags->end(); i++) {
553 if (i!=m_Tags->end()) {
584CIccIO* CIccProfile::ConnectSubProfile(
CIccIO *pIO,
bool bOwnIO)
const
586 TagEntryList::iterator i;
588 for (i = m_Tags->begin(); i != m_Tags->end(); i++) {
624bool CIccProfile::Attach(
CIccIO *pIO,
bool bUseSubProfile)
629 if (!ReadBasic(pIO)) {
634 if (bUseSubProfile) {
635 CIccIO *pSubIO = ConnectSubProfile(pIO,
true);
639 if (!ReadBasic(pSubIO)) {
665bool CIccProfile::Detach()
668 TagEntryList::iterator i;
670 for (i = m_Tags->begin(); i != m_Tags->end(); i++) {
697bool CIccProfile::ReadTags(CIccProfile* pProfile)
699 CIccIO *pIO = m_pAttachIO;
701 if (pProfile && pProfile->m_pAttachIO) {
702 pIO = pProfile->m_pAttachIO;
705 TagEntryList::iterator i;
709 for (i = m_Tags->begin(); i != m_Tags->end(); i++) {
719 for (i=m_Tags->begin(); i!=m_Tags->end(); i++) {
720 if (!LoadTag((IccTagEntry*)&(i->TagInfo), pIO,
true)) {
748bool CIccProfile::Read(
CIccIO *pIO,
bool bUseSubProfile)
753 if (!ReadBasic(pIO)) {
758 if (bUseSubProfile) {
759 CIccIO *pSubIO = ConnectSubProfile(pIO,
false);
763 if (!ReadBasic(pSubIO)) {
771 TagEntryList::iterator i;
773 for (i=m_Tags->begin(); i!=m_Tags->end(); i++) {
774 if (!LoadTag((IccTagEntry*)&(i->TagInfo), pIO)) {
806 if (!ReadBasic(pIO)) {
808 sReport +=
" - Unable to read profile!**\n\tProfile has invalid structure!\n";
815 if (!CheckFileSize(pIO)) {
817 sReport +=
"Bad Header File Size\n";
827 if (memcmp((
char *) profileID.
ID8, (
char *) m_Header.profileID.ID8, 16) != 0) {
830 sReport +=
"Bad Profile ID\n";
834 sReport +=
"Version 2 profile has non-zero reserved data that doesn't match calculated Profile ID\n";
840 sReport +=
"Version 2 profile has non-zero reserved data that matches calculated Profile ID\n";
846 TagEntryList::iterator i;
848 for (i=m_Tags->begin(); i!=m_Tags->end(); i++) {
849 if ((i->TagInfo.offset % 4) != 0) {
852 sReport +=
" - Offset is not aligned on 4-byte boundary!\n";
856 if (!LoadTag((IccTagEntry*)&(i->TagInfo), pIO)) {
860 sReport +=
" - Tag has invalid structure!\n";
887bool CIccProfile::Write(
CIccIO *pIO, icProfileIDSaveMethod nWriteId)
894 pIO->
Write32(&m_Header.version);
895 pIO->
Write32(&m_Header.deviceClass);
896 pIO->
Write32(&m_Header.colorSpace);
898 pIO->
Write16(&m_Header.date.year);
899 pIO->
Write16(&m_Header.date.month);
900 pIO->
Write16(&m_Header.date.day);
901 pIO->
Write16(&m_Header.date.hours);
902 pIO->
Write16(&m_Header.date.minutes);
903 pIO->
Write16(&m_Header.date.seconds);
905 pIO->
Write32(&m_Header.platform);
907 pIO->
Write32(&m_Header.manufacturer);
909 pIO->
Write64(&m_Header.attributes);
910 pIO->
Write32(&m_Header.renderingIntent);
911 pIO->
Write32(&m_Header.illuminant.X);
912 pIO->
Write32(&m_Header.illuminant.Y);
913 pIO->
Write32(&m_Header.illuminant.Z);
914 pIO->
Write32(&m_Header.creator);
915 pIO->
Write8(&m_Header.profileID,
sizeof(m_Header.profileID));
916 pIO->
Write32(&m_Header.spectralPCS);
917 pIO->
Write16(&m_Header.spectralRange.start);
918 pIO->
Write16(&m_Header.spectralRange.end);
919 pIO->
Write16(&m_Header.spectralRange.steps);
920 pIO->
Write16(&m_Header.biSpectralRange.start);
921 pIO->
Write16(&m_Header.biSpectralRange.end);
922 pIO->
Write16(&m_Header.biSpectralRange.steps);
924 pIO->
Write32(&m_Header.deviceSubClass);
925 pIO->
Write8(&m_Header.reserved[0],
sizeof(m_Header.reserved));
927 TagEntryList::iterator i, j;
930 for (count=0, i=m_Tags->begin(); i!= m_Tags->end(); i++) {
940 for (i=m_Tags->begin(); i!= m_Tags->end(); i++) {
942 i->TagInfo.offset = 0;
946 pIO->
Write32(&i->TagInfo.offset);
947 pIO->
Write32(&i->TagInfo.size);
952 for (i=m_Tags->begin(); i!= m_Tags->end(); i++) {
954 for (j=m_Tags->begin(); j!=i; j++) {
955 if (i->pTag == j->pTag)
962 i->TagInfo.size = pIO->
GetLength() - i->TagInfo.offset;
967 i->TagInfo.offset = j->TagInfo.offset;
968 i->TagInfo.size = j->TagInfo.size;
976 for (i=m_Tags->begin(); i!= m_Tags->end(); i++) {
979 pIO->
Write32(&i->TagInfo.offset);
980 pIO->
Write32(&i->TagInfo.size);
992 case icVersionBasedID:
996 case icAlwaysWriteID:
1010 pIO->
Write8(&m_Header.profileID,
sizeof(m_Header.profileID));
1016bool CIccProfile::ReadProfileID(
icProfileID &profileID)
1019 memset(&profileID, 0,
sizeof(profileID));
1036void CIccProfile::InitHeader()
1049 newtime = gmtime( &long_time );
1051 m_Header.date.year = newtime->tm_year+1900;
1052 m_Header.date.month = newtime->tm_mon+1;
1053 m_Header.date.day = newtime->tm_mday;
1054 m_Header.date.hours = newtime->tm_hour;
1055 m_Header.date.minutes = newtime->tm_min;
1056 m_Header.date.seconds = newtime->tm_sec;
1061 m_Header.manufacturer=0;
1063 m_Header.attributes=0;
1070 m_Header.spectralRange.start = 0;
1071 m_Header.spectralRange.end = 0;
1072 m_Header.spectralRange.steps = 0;
1073 m_Header.biSpectralRange.start = 0;
1074 m_Header.biSpectralRange.end = 0;
1075 m_Header.biSpectralRange.steps = 0;
1077 memset(&m_Header.profileID, 0,
sizeof(m_Header.profileID));
1078 memset(&m_Header.reserved[0], 0,
sizeof(m_Header.reserved));
1095bool CIccProfile::ReadBasic(
CIccIO *pIO)
1099 !pIO->
Read32(&m_Header.size) ||
1100 !pIO->
Read32(&m_Header.cmmId) ||
1101 !pIO->
Read32(&m_Header.version) ||
1102 !pIO->
Read32(&m_Header.deviceClass) ||
1103 !pIO->
Read32(&m_Header.colorSpace) ||
1104 !pIO->
Read32(&m_Header.pcs) ||
1105 !pIO->
Read16(&m_Header.date.year) ||
1106 !pIO->
Read16(&m_Header.date.month) ||
1107 !pIO->
Read16(&m_Header.date.day) ||
1108 !pIO->
Read16(&m_Header.date.hours) ||
1109 !pIO->
Read16(&m_Header.date.minutes) ||
1110 !pIO->
Read16(&m_Header.date.seconds) ||
1111 !pIO->
Read32(&m_Header.magic) ||
1112 !pIO->
Read32(&m_Header.platform) ||
1113 !pIO->
Read32(&m_Header.flags) ||
1114 !pIO->
Read32(&m_Header.manufacturer) ||
1115 !pIO->
Read32(&m_Header.model) ||
1116 !pIO->
Read64(&m_Header.attributes) ||
1117 !pIO->
Read32(&m_Header.renderingIntent) ||
1118 !pIO->
Read32(&m_Header.illuminant.X) ||
1119 !pIO->
Read32(&m_Header.illuminant.Y) ||
1120 !pIO->
Read32(&m_Header.illuminant.Z) ||
1121 !pIO->
Read32(&m_Header.creator) ||
1122 pIO->
Read8(&m_Header.profileID,
sizeof(m_Header.profileID))!=
sizeof(m_Header.profileID) ||
1123 !pIO->
Read32(&m_Header.spectralPCS) ||
1124 !pIO->
Read16(&m_Header.spectralRange.start) ||
1125 !pIO->
Read16(&m_Header.spectralRange.end) ||
1126 !pIO->
Read16(&m_Header.spectralRange.steps) ||
1127 !pIO->
Read16(&m_Header.biSpectralRange.start) ||
1128 !pIO->
Read16(&m_Header.biSpectralRange.end) ||
1129 !pIO->
Read16(&m_Header.biSpectralRange.steps) ||
1130 !pIO->
Read32(&m_Header.mcs) ||
1131 !pIO->
Read32(&m_Header.deviceSubClass) ||
1132 pIO->
Read8(&m_Header.reserved[0],
sizeof(m_Header.reserved))!=
sizeof(m_Header.reserved)) {
1140 IccTagEntry TagEntry = {};
1142 TagEntry.pTag = NULL;
1144 if (!pIO->
Read32(&count))
1148 for (i=0; i<count; i++) {
1149 if (!pIO->
Read32(&TagEntry.TagInfo.sig) ||
1150 !pIO->
Read32(&TagEntry.TagInfo.offset) ||
1151 !pIO->
Read32(&TagEntry.TagInfo.size)) {
1154 m_Tags->push_back(TagEntry);
1179bool CIccProfile::LoadTag(IccTagEntry *pTagEntry,
CIccIO *pIO,
bool bReadAll)
1184 if (pTagEntry->pTag)
1185 return pTagEntry->pTag->ReadAll();
1187 if (pTagEntry->TagInfo.offset<
sizeof(m_Header) ||
1188 !pTagEntry->TagInfo.size) {
1198 if (!pIO->
Read32(&sigType))
1214 if (!pTag->
Read(pTagEntry->TagInfo.size, pIO,
this)) {
1226 switch(pTagEntry->TagInfo.sig) {
1231 ((
CIccMBB*)pTag)->SetColorSpaces(m_Header.colorSpace, m_Header.pcs);
1238 ((
CIccMBB*)pTag)->SetColorSpaces(m_Header.pcs, m_Header.colorSpace);
1251 m_Header.spectralPCS,
1252 &m_Header.spectralRange,
1253 &m_Header.biSpectralRange);
1263 pTagEntry->pTag = pTag;
1265 IccTagPtr TagPtr = {};
1269 m_TagVals->push_back(TagPtr);
1271 TagEntryList::iterator i;
1273 for (i=m_Tags->begin(); i!= m_Tags->end(); i++) {
1274 if (i->TagInfo.offset == pTagEntry->TagInfo.offset &&
1301bool CIccProfile::DetachTag(
CIccTag *pTag)
1306 TagPtrList::iterator i;
1308 for (i=m_TagVals->begin(); i!=m_TagVals->end(); i++) {
1313 if (i==m_TagVals->end())
1316 m_TagVals->erase(i);
1318 TagEntryList::iterator j;
1319 for (j=m_Tags->begin(); j!=m_Tags->end();) {
1320 if (j->pTag == pTag) {
1330 return (fabsf(x-y)<eps);
1334 return (fabs(x-y)<eps);
1355 switch(m_Header.deviceClass) {
1372 sprintf(buf,
" - %s not supported in Version %s profiles!\n", classInfo.
GetProfileClassSigName(m_Header.deviceClass),
1392 sReport +=
" - Invalid MCS designator\n";
1398 sReport +=
" - Invalid MCS designator for device class\n";
1427 if (m_Header.cmmId ||
1429 m_Header.date.day || m_Header.date.month || m_Header.date.year ||
1430 m_Header.date.hours || m_Header.date.minutes || m_Header.date.seconds ||
1431 m_Header.platform ||
1433 m_Header.manufacturer ||
1435 m_Header.attributes ||
1436 m_Header.renderingIntent ||
1437 m_Header.illuminant.X || m_Header.illuminant.Y || m_Header.illuminant.Z ||
1439 m_Header.profileID.ID32[0] || m_Header.profileID.ID32[1] ||
1440 m_Header.profileID.ID32[2] || m_Header.profileID.ID32[3] ||
1441 m_Header.spectralPCS ||
1442 m_Header.spectralRange.start || m_Header.spectralRange.end || m_Header.spectralRange.steps ||
1443 m_Header.biSpectralRange.start || m_Header.biSpectralRange.end || m_Header.biSpectralRange.steps
1446 sprintf(buf,
" - Encoding Class has non-zero Header data were zeros are required!\n");
1461 switch(m_Header.pcs) {
1477 sprintf(buf,
" - Spectral PCS usage in version %s ICC profile!\n", Info.
GetVersionName(m_Header.version));
1484 if (m_Header.spectralRange.start ||
1485 m_Header.spectralRange.end ||
1486 m_Header.spectralRange.steps ||
1487 m_Header.biSpectralRange.start ||
1488 m_Header.biSpectralRange.end ||
1489 m_Header.biSpectralRange.steps) {
1491 sprintf(buf,
"%s - Spectral PCS wavelengths defined with no spectral PCS!\n", Info.
GetColorSpaceSigName(m_Header.pcs));
1500 if (
icNumColorSpaceChannels(m_Header.spectralPCS)!=m_Header.biSpectralRange.steps * m_Header.spectralRange.steps) {
1502 sReport +=
"Number of channels defined for spectral PCS do not match spectral range definitions.\n";
1507 if (
icF16toF(m_Header.biSpectralRange.end)<=
icF16toF(m_Header.biSpectralRange.start)) {
1509 sprintf(buf,
"end BiDir Spectral PCS wavelength must be larger than start BiDir Spectral PCS wavelength!\n");
1514 if (m_Header.biSpectralRange.steps<2) {
1516 sprintf(buf,
"%d: Must have more 2 or more BiDir spectral wavelength steps!\n", m_Header.biSpectralRange.steps);
1520 if (
icF16toF(m_Header.spectralRange.end)<=
icF16toF(m_Header.spectralRange.start)) {
1522 sprintf(buf,
"end Spectral PCS wavelength must be larger than start Spectral PCS wavelength!\n");
1526 if (m_Header.spectralRange.steps<2) {
1528 sprintf(buf,
"%d: Must have more 2 or more spectral wavelength steps!\n", m_Header.spectralRange.steps);
1539 sReport +=
"Number of channels defined for spectral PCS do not match spectral range definition.\n";
1542 if (
icF16toF(m_Header.spectralRange.end)<=
icF16toF(m_Header.spectralRange.start)) {
1544 sprintf(buf,
"end Spectral PCS wavelength must be larger than start Spectral PCS wavelength!\n");
1549 if (m_Header.spectralRange.steps<2) {
1551 sprintf(buf,
"%d: Must have more 2 or more spectral wavelength steps!\n", m_Header.spectralRange.steps);
1555 if (m_Header.biSpectralRange.start ||
1556 m_Header.biSpectralRange.end ||
1557 m_Header.biSpectralRange.steps) {
1559 sprintf(buf,
"%s - Spectral PCS wavelengths defined with no spectral PCS!\n", Info.
GetColorSpaceSigName(m_Header.pcs));
1575 sprintf(buf,
"Both Colorimetric PCS or Spectral PCS are not defined!\n");
1584 switch(m_Header.platform) {
1595 sprintf(buf,
"%s: Unknown platform signature.\n", Info.
GetPlatformSigName(m_Header.platform));
1603 sReport +=
"Reserved profile flags (bits 2-15) are non-zero.\n";
1606 else if (m_Header.version ==
icVersionNumberV5 && m_Header.flags & 0x0000FFF8) {
1608 sReport +=
"Reserved profile flags (bits 3-15) are non-zero.\n";
1611 else if (m_Header.flags & 0x0000FFF0) {
1613 sReport +=
"Reserved profile flags (bits 4-15) are non-zero.\n";
1617 if(m_Header.flags & 0xFFFF0000) {
1619 sReport +=
"Vendor-specific profile flags (bits 16-32) are non-zero.\n";
1624 if(m_Header.attributes & 0x0000FFF0) {
1626 sReport +=
"Reserved device attributes (bits 4-31) are non-zero.\n";
1629 if(m_Header.attributes & 0xFFFF0000) {
1631 sReport +=
"Vendor-specific device attributes (bits 32-63) are non-zero.\n";
1637 if (bcdpair<0x05 && (m_Header.version & 0x0000FFFF)) {
1639 sReport +=
"Version number bytes 10 and 11 are reserved but non-zero.\n";
1644 bcdpair = (
icUInt8Number)((m_Header.version & 0x00FF0000) >> 16);
1645 if ((bcdpair > 0x40) || (bcdpair & 0x0F)) {
1647 sReport +=
"Version 2 minor number is unexpected.\n";
1652 bcdpair = (
icUInt8Number)((m_Header.version & 0x00FF0000) >> 16);
1653 if ((bcdpair > 0x40) || (bcdpair & 0x0F)) {
1655 sReport +=
"Version 4 minor number is unexpected.\n";
1660 bcdpair = (
icUInt8Number)((m_Header.version & 0x00FF0000) >> 16);
1661 if ((bcdpair > 0x10) || (bcdpair & 0x0F)) {
1663 sReport +=
"Version 5 minor number is unexpected.\n";
1669 sprintf(buf,
"Major version number (%d) is unexpected.\n", ((bcdpair >> 4) * 10 + (bcdpair & 0x0F)));
1714 switch(m_Header.renderingIntent) {
1740 sReport +=
"Non D50 Illuminant XYZ values";
1746 int sum=0, num =
sizeof(m_Header.reserved) /
sizeof(m_Header.reserved[0]);
1747 for (
int i=0; i<num; i++) {
1748 sum += m_Header.reserved[i];
1752 sReport +=
"Reserved value must be zero.\n";
1771bool CIccProfile::CheckTagExclusion(std::string &sReport)
const
1777 sprintf(buf,
"%s", Info.
GetSigName(m_Header.deviceClass));
1786 sReport +=
"Tag exclusion test failed.\n";
1791 switch(m_Header.deviceClass) {
1800 sReport +=
"Tag exclusion test failed.\n";
1816 sReport +=
"Tag exclusion test failed.\n";
1829 sReport +=
"Tag exclusion test failed.\n";
1843 sReport +=
"Tag exclusion test failed.\n";
1879 TagEntryList::const_iterator i;
1880 for (i=m_Tags->begin(); i!=m_Tags->end(); i++) {
1881 tagsig = i->TagInfo.sig;
1882 typesig = i->pTag->GetType();
1883 structSig = i->pTag->GetTagStructType();
1884 arraySig = i->pTag->GetTagArrayType();
1886 if (!IsTypeValid(tagsig, typesig, structSig, arraySig)) {
1889 sprintf(buf,
" %s: Invalid tag type (Might be critical!).\n", Info.
GetTagTypeSigName(typesig));
2244#
if defined(XRITE_ADDITIONS)
2245 typeSig != icSigZipXmlType_XRITE &&
2390 if (m_Tags->size() <= 0) {
2392 sReport +=
"No tags present.\n";
2403 sReport +=
"Required tags missing.\n";
2412 sReport +=
"Required tags missing.\n";
2419 sReport +=
"Media white point tag missing.\n";
2431 sReport +=
"Gray TRC tag missing.\n";
2441 sReport +=
"Critical tag(s) missing.\n";
2452 sReport +=
"Gray TRC tag missing.\n";
2462 sReport +=
"Critical tag(s) missing.\n";
2473 sReport +=
"Gray TRC tag missing.\n";
2482 sReport +=
"Critical tag(s) missing.\n";
2488 sReport +=
"Gamut tag missing.\n";
2493 switch (m_Header.colorSpace) {
2510 sReport +=
"xCLR output profile is missing colorantTableTag\n";
2524 sReport +=
"Critical tag(s) missing.\n";
2531 sReport +=
"Required tag(s) missing.\n";
2539 sReport +=
"Required tag(s) missing.\n";
2548 sReport +=
"Critical tag(s) missing.\n";
2556 sReport +=
"Critical tag(s) missing.\n";
2564 sReport +=
"Critical tag(s) missing.\n";
2572 sReport +=
"Unknown Profile Class.\n";
2580 if (m_Header.spectralPCS) {
2587 sReport +=
"Critical tag(s) missing.\n";
2597 sReport +=
"Critical tag(s) missing.\n";
2606 if (m_Header.spectralPCS) {
2613 sReport +=
"Critical tag(s) missing.\n";
2624 sReport +=
"Critical tag(s) missing.\n";
2633 if (m_Header.spectralPCS) {
2642 sReport +=
"Critical tag(s) missing.\n";
2651 sReport +=
"Critical tag(s) missing.\n";
2657 sReport +=
"Gamut tag missing.\n";
2661 if (m_Header.version >= 0x04000000L) {
2662 switch (m_Header.colorSpace) {
2679 sReport +=
"xCLR output profile is missing colorantTableTag\n";
2694 sReport +=
"Critical tag(s) missing.\n";
2701 sReport +=
"Required tag(s) missing.\n";
2709 sReport +=
"Required tag(s) missing.\n";
2716 if (m_Header.spectralPCS) {
2723 sReport +=
"Critical tag(s) missing.\n";
2730 if (m_Header.spectralPCS) {
2736 sReport +=
"Critical tag(s) missing.\n";
2745 sReport +=
"Critical tag(s) missing.\n";
2753 sReport +=
"Critical tag missing.\n";
2761 sReport +=
"Critical tag(s) missing.\n";
2769 sReport +=
"Critical tag(s) missing.\n";
2776 sReport +=
"Unknown Profile Class.\n";
2783 if (!CheckTagExclusion(sReport)) {
2804bool CIccProfile::CheckFileSize(
CIccIO *pIO)
const
2812 FileSize = pIO->
Tell();
2820 if (FileSize != m_Header.size)
2823 if ((m_Header.version>=
icVersionNumberV4_2) && ((FileSize%4 != 0) || (m_Header.size%4 != 0)))
2845icValidateStatus CIccProfile::Validate(std::string &sReport, std::string sSigPath)
const
2853 if (!AreTagsUnique()) {
2855 sReport +=
" - There are duplicate tags.\n";
2864 TagEntryList::iterator i;
2865 for (i=m_Tags->begin(); i!=m_Tags->end(); i++) {
2985 pXYZ[0] =
icFtoD(m_Header.illuminant.X);
2986 pXYZ[1] =
icFtoD(m_Header.illuminant.Y);
2987 pXYZ[2] =
icFtoD(m_Header.illuminant.Z);
3013 pXYZ[0] =
icFtoD(m_Header.illuminant.X) * Y;
3014 pXYZ[1] =
icFtoD(m_Header.illuminant.Y) * Y;
3015 pXYZ[2] =
icFtoD(m_Header.illuminant.Z) * Y;
3045 pXYZ[0] =
icFtoD(pMediaXYZ->
X);
3046 pXYZ[1] =
icFtoD(pMediaXYZ->
Y);
3047 pXYZ[2] =
icFtoD(pMediaXYZ->
Z);
3052 pXYZ[0] =
icFtoD(m_Header.illuminant.X);
3053 pXYZ[1] =
icFtoD(m_Header.illuminant.Y);
3054 pXYZ[2] =
icFtoD(m_Header.illuminant.Z);
3092 pXYZ[0] = 683.0f * obs->
RowSum(0);
3093 pXYZ[1] = 683.0f * obs->
RowSum(1);
3094 pXYZ[2] = 683.0f * obs->
RowSum(2);
3129 pXYZ[0] =
icFtoD(m_Header.illuminant.X);
3130 pXYZ[1] =
icFtoD(m_Header.illuminant.Y);
3131 pXYZ[2] =
icFtoD(m_Header.illuminant.Z);
3139 pXYZ[0] = obs->
RowSum(0);
3140 pXYZ[1] = obs->
RowSum(1);
3141 pXYZ[2] = obs->
RowSum(2);
3148 pXYZ[0] =
icFtoD(m_Header.illuminant.X);
3149 pXYZ[1] =
icFtoD(m_Header.illuminant.Y);
3150 pXYZ[2] =
icFtoD(m_Header.illuminant.Z);
3173 if (!pView || !pTag) {
3179 pXYZ[0] =
icFtoD(pMediaXYZ->
X);
3180 pXYZ[1] =
icFtoD(pMediaXYZ->
Y);
3181 pXYZ[2] =
icFtoD(pMediaXYZ->
Z);
3185 pXYZ[0] =
icFtoD(m_Header.illuminant.X);
3186 pXYZ[1] =
icFtoD(m_Header.illuminant.Y);
3187 pXYZ[2] =
icFtoD(m_Header.illuminant.Z);
3277 if (!pFileIO->
Open(szFilename,
"rb")) {
3282 CIccProfile *pIcc =
new CIccProfile;
3284 if (!pIcc->Read(pFileIO, bUseSubProfile)) {
3310CIccProfile*
ReadIccProfile(
const icWChar *szFilename,
bool bUseSubProfile)
3314 if (!pFileIO->
Open(szFilename, L
"rb")) {
3319 CIccProfile *pIcc =
new CIccProfile;
3321 if (!pIcc->Read(pFileIO)) {
3357 CIccProfile *pIcc =
new CIccProfile;
3359 if (!pIcc->Read(pMemIO)) {
3390 if (!pFileIO->
Open(szFilename,
"rb")) {
3395 CIccProfile *pIcc =
new CIccProfile;
3397 if (!pIcc->Attach(pFileIO, bUseSubProfile)) {
3423CIccProfile*
OpenIccProfile(
const icWChar *szFilename,
bool bUseSubProfile)
3427 if (!pFileIO->
Open(szFilename, L
"rb")) {
3432 CIccProfile *pIcc =
new CIccProfile;
3434 if (!pIcc->Attach(pFileIO, bUseSubProfile)) {
3469 CIccProfile *pIcc =
new CIccProfile;
3471 if (!pIcc->Attach(pMemIO, bUseSubProfile)) {
3502 sReport +=
"- Invalid I/O Handle\n";
3507 CIccProfile *pIcc =
new CIccProfile;
3514 nStatus = pIcc->ReadValidate(pIO, sReport);
3524 nStatus = pIcc->Validate(sReport);
3551 if (!pFileIO->
Open(szFilename, L
"rb")) {
3582 if (!pFileIO->
Open(szFilename,
"rb")) {
3585 sReport += szFilename;
3586 sReport +=
"- Invalid Filename\n";
3591 CIccProfile *pIcc =
new CIccProfile;
3598 nStatus = pIcc->ReadValidate(pFileIO, sReport);
3608 nStatus =
icMaxStatus(nStatus, pIcc->Validate(sReport));
3635 if (!FileIO.
Open(szFilename,
"w+b")) {
3639 if (!pIcc->Write(&FileIO, nWriteId)) {
3670 if (!pIcc->Write(&FileIO, nWriteId)) {
3693bool SaveIccProfile(
const icWChar *szFilename, CIccProfile *pIcc, icProfileIDSaveMethod nWriteId)
3700 if (!FileIO.
Open(szFilename, L
"w+b")) {
3704 if (!pIcc->Write(&FileIO, nWriteId)) {
3741 num = pIO->
Read8(&buffer[0],1024);
3743 memset(buffer+44, 0, 4);
3744 memset(buffer+64, 0, 4);
3745 memset(buffer+84, 0, 16);
3772 if (!FileIO.
Open(szFilename,
"rb")) {
3797 if (!FileIO.
Open(szFilename, L
"rb")) {
3808#ifdef USEREFICCMAXNAMESPACE
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
@ icValidateCriticalError
void icMD5Init(MD5_CTX *context)
MD5 initialization.
void icMD5Final(unsigned char *digest, MD5_CTX *context)
MD5 finalization.
void icMD5Update(MD5_CTX *context, unsigned char *input, unsigned int inputLen)
MD5 block update operation.
IccMD5.H - header file for IccMD5.cpp.
static bool compare_float(float x, float y, float eps=0.01f)
CIccProfile * ValidateIccProfile(CIccIO *pIO, std::string &sReport, icValidateStatus &nStatus)
Name: ValidateIccProfile.
bool SaveIccProfile(const icChar *szFilename, CIccProfile *pIcc, icProfileIDSaveMethod nWriteId)
Name: SaveIccProfile.
CIccProfile * ReadIccProfile(const icChar *szFilename, bool bUseSubProfile)
Name: ReadIccProfile.
CIccProfile * OpenIccProfile(const icChar *szFilename, bool bUseSubProfile)
Name: OpenIccProfile.
void CalcProfileID(CIccIO *pIO, icProfileID *pProfileID)
Name: CalcProfileID.
IIccArray * icGetTagArrayHandler(CIccTag *pTag)
icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Name: icMaxStatus.
std::string icGetSigPath(icUInt32Number nSig)
const char * icMsgValidateWarning
icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
bool icIsIllumD50(icXYZNumber xyz)
icFloatNumber icFtoD(icS15Fixed16Number num)
bool icIsSpaceCLR(icColorSpaceSignature sig)
icS15Fixed16Number icDtoF(icFloatNumber num)
const char * icMsgValidateNonCompliant
const char * icMsgValidateCriticalError
icFloatNumber icF16toF(icFloat16Number num)
static const CFAllocatorContext context
unsigned int icUInt32Number
Class: CIccArrayNamedColor.
void SetColorSpaces(icColorSpaceSignature csPcs, icColorSpaceSignature csDevice, icSpectralColorSignature csSpectralPCS=icSigNoSpectralData, const icSpectralRange *pSpectralRange=NULL, const icSpectralRange *pBiSPectralRange=NULL)
bool Attach(CIccIO *pIO, icInt32Number nSize=0, bool bOwnIO=false)
bool Open(const icChar *szFilename, const icChar *szAttr)
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 Write32(void *pBuf32, icInt32Number nNum=1)
virtual icInt32Number Seek(icInt32Number nOffset, icSeekVal pos)
icInt32Number Write64(void *pBuf64, icInt32Number nNum=1)
icInt32Number Read64(void *pBuf64, icInt32Number nNum=1)
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
bool IsProfileIDCalculated(icProfileID *profileID)
const icChar * GetVersionName(icUInt32Number val)
const icChar * GetCmmSigName(icCmmSignature sig)
const icChar * GetProfileClassSigName(icProfileClassSignature sig)
bool IsValidSpace(icColorSpaceSignature sig)
const icChar * GetTagSigName(icTagSignature sig)
bool IsValidSpectralSpace(icColorSpaceSignature sig)
const icChar * GetPlatformSigName(icPlatformSignature sig)
const icChar * GetColorSpaceSigName(icColorSpaceSignature sig)
const icChar * GetTagTypeSigName(icTagTypeSignature sig)
const icChar * GetSigName(icUInt32Number val)
const icChar * GetRenderingIntentName(icRenderingIntent val, bool bIsV5=false)
icValidateStatus CheckData(std::string &sReport, const icDateTimeNumber &dateTime, std::string sDesc="")
icFloatNumber * entry(icUInt16Number nRow, icUInt16Number nCol=0)
icFloatNumber RowSum(icUInt16Number nRow) const
Name: CIccMatrixMath::RowSum.
void VectorScale(const icFloatNumber *vec)
Name: CIccMatrixMath::VectorScale.
virtual void VectorMult(icFloatNumber *pDst, const icFloatNumber *pSrc) const
Name: CIccMatrixMath::VectorMult.
void Scale(icFloatNumber v)
Name: CIccMatrixMath::Scale.
bool Alloc(icUInt32Number nSize, bool bWrite=false)
virtual icInt32Number Seek(icInt32Number nOffset, icSeekVal pos)
icUInt8Number * GetData()
virtual icInt32Number GetLength()
bool Attach(icUInt8Number *pData, icUInt32Number nSize, bool bWrite=false)
virtual icTagTypeSignature GetType() const
Function: GetType()
static CIccTag * Create(icTagTypeSignature sig)
Name: CIccTag::Create.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Function: Read(size, pIO) - Read tag from file.
virtual bool IsNumArrayType() const
virtual icArraySignature GetTagArrayType() const
virtual bool ReadAll()
Function: ReadAll() - Read All sub data for tag from file.
Class: CIccTagNamedColor2.
virtual bool GetValues(icFloatNumber *DstVector, icUInt32Number nStart=0, icUInt32Number nVectorSize=1) const =0
virtual icUInt32Number GetNumValues() const =0
Class: CIccTagSpectralDataInfo.
icSpectralRange m_biSpectralRange
icSpectralRange m_spectralRange
Class: CIccTagSpectralViewingConditions.
CIccMatrixMath * getObserverMatrix(const icSpectralRange &newRange) const
icFloatNumber getIlluminantCCT() const
icIlluminant getStdIllumiant() const
icFloatXYZNumber m_illuminantXYZ
const icFloatNumber * getIlluminant(icSpectralRange &illumRange) const
icStandardObserver getStdObserver() const
icXYZNumber * GetXYZ(icUInt32Number index)
icFloatNumber * getEmissiveObserver(const icSpectralRange &range, const icFloatNumber *pWhite, icFloatNumber *obsMatrix=NULL)
virtual const CIccTagSpectralViewingConditions * getPccViewingConditions()=0
CIccMatrixMath * getReflectanceObserver(const icSpectralRange &rangeRef)
Lists of tags, tags, profile header and profile structure.