72#pragma warning( disable: 4786)
85#ifdef USEREFICCMAXNAMESPACE
166 m_nInputChannels = 0;
167 m_nOutputChannels = 0;
192 memcpy(m_pData, elem.
m_pData, m_nSize);
221 memcpy(m_pData, elem.
m_pData, m_nSize);
272 m_nInputChannels = nInputChannels;
273 m_nOutputChannels = nOutputChannels;
288 icChar buf[128], sigbuf[40];
290 sprintf(buf,
"Unknown Element(%s) Type of %u Bytes.",
294 if (nVerboseness > 50) {
295 sDescription +=
"\n\nData Follows:\n";
297 icMemDump(sDescription, m_pData, m_nSize);
348 if (nHeaderSize > nSize)
358 if (!pIO->
Read32(&m_nReserved))
361 if (!pIO->
Read16(&m_nInputChannels))
364 if (!pIO->
Read16(&m_nOutputChannels))
370 if (!SetDataSize(nDataSize,
false))
400 if (!pIO->
Write32(&m_nReserved))
403 if (!pIO->
Write16(&m_nInputChannels))
406 if (!pIO->
Write16(&m_nOutputChannels))
434 sReport += sSigPathName;
435 sReport +=
" - Contains unknown processing element type (";
460 if (m_nReserved!=0) {
462 sReport += sSigPathName;
463 sReport +=
" - Reserved Value must be zero.\n";
485 m_nLastNumChannels = 0;
503 m_nLastNumChannels = 0;
505 if (m_nMaxChannels) {
536 if (m_nMaxChannels) {
590 m_nLastNumChannels = 0;
608 return (!m_nMaxChannels || (m_pixelBuf1!=NULL && m_pixelBuf2!=NULL));
642 CIccApplyMpeList::iterator i;
644 for (i=m_list->begin(); i!=m_list->end(); i++) {
679 m_list->push_back(ptr);
703 m_nInputChannels = nInputChannels;
704 m_nOutputChannels = nOutputChannels;
706 m_pAppliedPCC = NULL;
707 m_pProfilePCC = NULL;
709 m_pCmmEnvVarLookup = NULL;
733 CIccMultiProcessElementList::iterator i;
736 for (i=lut.
m_list->begin(); i!= lut.
m_list->end(); i++) {
738 m_list->push_back(ptr);
777 CIccMultiProcessElementList::iterator i;
780 for (i=lut.
m_list->begin(); i!= lut.
m_list->end(); i++) {
782 m_list->push_back(ptr);
835 CIccMultiProcessElementList::iterator i;
837 for (i=m_list->begin(); i!=m_list->end(); i++) {
838 if (!map[i->ptr].offset) {
839 map[i->ptr].offset = 1;
869 CIccMultiProcessElementList::iterator i;
871 for (i=m_list->begin(); i!=m_list->end(); i++) {
872 if (!i->ptr->IsSupported())
896 sprintf(buf,
"BEGIN MULTI_PROCESS_ELEMENT_TAG %d %d\n", m_nInputChannels, m_nOutputChannels);
898 sDescription +=
"\n";
900 CIccMultiProcessElementList::iterator i;
903 for (j=0, i=m_list->begin(); i!=m_list->end(); j++, i++) {
904 sprintf(buf,
"PROCESS_ELEMENT #%d\n", j+1);
906 i->ptr->Describe(sDescription, nVerboseness);
907 sDescription +=
"\n";
909 sDescription +=
"END MULTI_PROCESS_ELEMENT_TAG\n";
932 m_list->push_back(ptr);
955 m_list->push_front(ptr);
979 if (headerSize > size)
993 if (!pIO->
Read32(&m_nReserved))
996 if (!pIO->
Read16(&m_nInputChannels))
999 if (!pIO->
Read16(&m_nOutputChannels))
1002 if (!pIO->
Read32(&m_nProcElements))
1022 for (i=0; i<m_nProcElements; i++) {
1023 if (!pIO->
Read32(&m_position[i].offset))
1025 if (!pIO->
Read32(&m_position[i].size))
1032 for (i=0; i<m_nProcElements; i++) {
1033 if (m_position[i].offset+m_position[i].size > size) {
1046 if (!pIO->
Read32(&sigElem)) {
1059 if (!element->
Read(m_position[i].size, pIO)) {
1064 loadedElements[m_position[i].offset] = element;
1068 m_list->push_back(ptr);
1096 if (!pIO->
Write32(&m_nReserved))
1099 if (!pIO->
Write16(&m_nInputChannels))
1102 if (!pIO->
Write16(&m_nOutputChannels))
1109 m_nProcElements = 0;
1112 if (!pIO->
Write32(&m_nProcElements))
1115 if (m_nProcElements) {
1119 delete [] m_position;
1129 for (j=0; j<m_nProcElements; j++) {
1130 if (pIO->
Write32(zeros, 2)!=2)
1135 CIccMultiProcessElementList::iterator i;
1140 for (j=0, i=m_list->begin(); i!=m_list->end(); i++, j++) {
1141 if (map.find(i->ptr)==map.end()) {
1142 start = pIO->
Tell();
1144 if (!i->ptr->Write(pIO))
1152 position.
offset = start - tagStart;
1153 position.
size = end - start;
1155 map[i->ptr] = position;
1157 m_position[j] = map[i->ptr];
1165 for (j=0; j<m_nProcElements; j++) {
1166 if (!pIO->
Write32(&m_position[j].offset))
1168 if (!pIO->
Write32(&m_position[j].size))
1194 CIccMultiProcessElementList::iterator i;
1197 for(i=m_list->begin(), j=0; j<nIndex && i!=m_list->end(); i++, j++);
1199 if (i!=m_list->end())
1235 CIccMultiProcessElementList::const_iterator i;
1237 for (i = m_list->begin(); i!= m_list->end(); i++) {
1238 if (i->ptr->IsLateBinding()) {
1261 CIccMultiProcessElementList::const_iterator i;
1263 for (i = m_list->begin(); i!= m_list->end(); i++) {
1264 if (i->ptr->IsLateBindingReflectance()) {
1291 if (!m_list || !m_list->size()) {
1292 if (m_nInputChannels != m_nOutputChannels)
1298 m_pProfilePCC = pProfilePCC;
1299 m_pAppliedPCC = pAppliedPCC;
1300 m_pCmmEnvVarLookup = pCmmEnvVarLookup;
1302 CIccMultiProcessElementList::iterator i;
1308 i = m_list->begin();
1309 if (i->ptr->NumInputChannels() != m_nInputChannels)
1312 for (; i!= m_list->end(); i++) {
1320 if (m_nBufChannels < last->NumOutputChannels())
1323 if (!last->
Begin(nInterp,
this))
1332 m_pAppliedPCC = NULL;
1333 m_pProfilePCC = NULL;
1353 CIccMultiProcessElementList::iterator i;
1356 for (n=0, i=m_list->begin(); i!= m_list->end(); i++, n++) {
1357 if (i->ptr == pElem)
1360 if (i==m_list->end())
1368 return m_list->begin();
1373 return m_list->end();
1396 if (!pApplyBuf->
Begin()) {
1401 if (!m_list || !m_list->size())
1404 CIccMultiProcessElementList::iterator i, last;
1405 last = GetLastElem();
1406 for (i=GetFirstElem(); i!=last;) {
1409 GetNextElemIterator(i);
1417#ifdef DEBUG_MPE_APPLY
1420 printf(
"Mpe%d:", nCount);
1424 printf(
" %.3f", pPixel[i]);
1442 if (!pApply || !pApply->
GetList() || !pApply->
GetList()->size()) {
1443 memcpy(pDestPixel, pSrcPixel, m_nInputChannels*
sizeof(
icFloatNumber));
1447#ifdef DEBUG_MPE_APPLY
1449 printf(
"Start of MPE APPLY\n");
1450 DumpMpeApplyPixe(nCount++, pSrcPixel, m_nInputChannels);
1460 if (next==pApply->
end()) {
1462 if (pSrcPixel==pDestPixel) {
1463 i->ptr->Apply(pApplyBuf->
GetDstBuf(), pSrcPixel);
1467 i->ptr->Apply(pDestPixel, pSrcPixel);
1469#ifdef DEBUG_MPE_APPLY
1470 DumpMpeApplyPixe(nCount++, pSrcPixel, m_nInputChannels);
1474 i->ptr->Apply(pApplyBuf->
GetDstBuf(), pSrcPixel);
1476#ifdef DEBUG_MPE_APPLY
1477 DumpMpeApplyPixe(nCount++, pApplyBuf->
GetDstBuf(), m_nInputChannels);
1484 while (next != pApply->
end()) {
1487 if (!pElem->
IsAcs()) {
1490#ifdef DEBUG_MPE_APPLY
1491 DumpMpeApplyPixe(nCount++, pApplyBuf->
GetDstBuf(), m_nInputChannels);
1501 i->ptr->Apply(pDestPixel, pApplyBuf->
GetSrcBuf());
1503#ifdef DEBUG_MPE_APPLY
1504 DumpMpeApplyPixe(nCount++, pDestPixel, m_nInputChannels);
1509#ifdef DEBUG_MPE_APPLY
1510 printf(
"End MPE Apply\n\n");
1527 const CIccProfile* pProfile )
const
1533 bool bMatchChannels =
true;
1535 if (!m_list || !m_list->size()) {
1536 if (m_nInputChannels != m_nOutputChannels) {
1538 sReport += sSigPathName;
1539 sReport +=
" No processing elements and input and output channels do not match!\n";
1544 sReport += sSigPathName;
1545 sReport +=
" No processing elements.\n";
1552 sReport += sSigPathName;
1553 sReport +=
" - Tag validation incomplete: Pointer to profile unavailable.\n";
1567 if (m_nInputChannels != nInput) {
1569 sReport += sSigPathName;
1570 sReport +=
" - Incorrect number of input channels.\n";
1575 if (m_nOutputChannels != nOutput) {
1577 sReport += sSigPathName;
1578 sReport +=
" - Incorrect number of output channels.\n";
1590 if (m_nInputChannels!=nInput) {
1592 sReport += sSigPathName;
1593 sReport +=
" - Incorrect number of input channels.\n";
1598 if (m_nOutputChannels!=nOutput) {
1600 sReport += sSigPathName;
1601 sReport +=
" - Incorrect number of output channels.\n";
1613 if (m_nInputChannels != nInput) {
1615 sReport += sSigPathName;
1616 sReport +=
" - Incorrect number of input channels.\n";
1621 if (m_nOutputChannels != nOutput) {
1623 sReport += sSigPathName;
1624 sReport +=
" - Incorrect number of output channels.\n";
1636 if (m_nInputChannels!=nInput) {
1638 sReport += sSigPathName;
1639 sReport +=
" - Incorrect number of input channels.\n";
1644 if (m_nOutputChannels!=nOutput) {
1646 sReport += sSigPathName;
1647 sReport +=
" - Incorrect number of output channels.\n";
1659 if (m_nInputChannels != nInput) {
1661 sReport += sSigPathName;
1662 sReport +=
" - Incorrect number of input channels.\n";
1667 if (m_nOutputChannels != nOutput) {
1669 sReport += sSigPathName;
1670 sReport +=
" - Incorrect number of output channels.\n";
1679 if (m_nInputChannels != 3) {
1681 sReport += sSigPathName;
1682 sReport +=
" - Incorrect number of input channels.\n";
1686 if (m_nOutputChannels != 3) {
1688 sReport += sSigPathName;
1689 sReport +=
" - Incorrect number of output channels.\n";
1703 nInput = nOutput = 0;
1708 nInput = nOutput = 0;
1713 nInput = nOutput = 0;
1729 nInput = nOutput = 0;
1734 nInput = nOutput = 0;
1739 nInput = nOutput = 0;
1751 if (m_nInputChannels != nInput) {
1753 sReport += sSigPathName;
1754 sReport +=
" - Incorrect number of input channels.\n";
1759 if (m_nOutputChannels != nOutput) {
1761 sReport += sSigPathName;
1762 sReport +=
" - Incorrect number of output channels.\n";
1772 if (m_nInputChannels != nInput) {
1774 sReport += sSigPathName;
1775 sReport +=
" - Incorrect number of input channels.\n";
1780 if (m_nOutputChannels != nOutput) {
1782 sReport += sSigPathName;
1783 sReport +=
" - Incorrect number of output channels.\n";
1796 if (m_nInputChannels != nInput) {
1798 sReport += sSigPathName;
1799 sReport +=
" - Incorrect number of input channels.\n";
1804 if (m_nOutputChannels != nOutput) {
1806 sReport += sSigPathName;
1807 sReport +=
" - Incorrect number of output channels.\n";
1820 if (m_nInputChannels != nInput) {
1822 sReport += sSigPathName;
1823 sReport +=
" - Incorrect number of input channels.\n";
1828 if (m_nOutputChannels != nOutput) {
1830 sReport += sSigPathName;
1831 sReport +=
" - Incorrect number of output channels.\n";
1840 sReport += sSigPathName;
1841 sReport +=
" - Unknown tag - Cannot validate input and output channels!\n";
1843 bMatchChannels =
false;
1847 if (!m_list || !m_list->size()) {
1851 CIccMultiProcessElementList::iterator i = m_list->begin();
1854 if (bMatchChannels && i->ptr->NumInputChannels() != m_nInputChannels) {
1856 sReport += sSigPathName;
1857 sReport +=
"Mis-matching number of input channels in first process element!\n";
1861 for (; i!= m_list->end(); i++) {
1865 sReport += sSigPathName;
1870 sReport += i->ptr->GetClassName();
1872 sReport +=
" Mis-matching number of channels in last process element!\n";
1884 sReport += sSigPathName;
1885 sReport +=
" Mis-matching number of output channels!\n";
1892#ifdef USEREFICCMAXNAMESPACE
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
@ icValidateCriticalError
std::map< icUInt32Number, CIccMultiProcessElement * > CIccLutOffsetMap
std::map< CIccMultiProcessElement *, icPositionNumber > CIccLutPtrMap
std::list< CIccMultiProcessElementPtr > CIccMultiProcessElementList
CIccApplyMpeList::iterator CIccApplyMpeIter
std::list< CIccApplyMpePtr > CIccApplyMpeList
icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Name: icMaxStatus.
std::string icGetSigPath(icUInt32Number nSig)
const char * icMsgValidateWarning
icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
icUInt32Number icGetSpectralSpaceSamples(const icHeader *pHdr)
icUInt32Number icGetMaterialColorSpaceSamples(icMaterialColorSignature sig)
void icMemDump(std::string &sDump, void *pBuf, icUInt32Number nNum)
const char * icMsgValidateNonCompliant
const char * icMsgValidateCriticalError
icSignature icGetFirstSigPathSig(std::string sigPath)
const icChar * icGetSig(icChar *pBuf, icUInt32Number nSig, bool bGetHexVal)
unsigned int icUInt32Number
CIccApplyMpe(CIccMultiProcessElement *pElem)
Name: CIccApplyMpe::CIccApplyMpe.
virtual ~CIccApplyMpe()
Name: CIccApplyMpe::~CIccApplyMpe.
Class: CIccTagMultiProcessElement.
CIccDblPixelBuffer * GetBuf()
CIccApplyTagMpe(CIccTagMultiProcessElement *pTag)
Name: CIccApplyTagMpe::CIccApplyTagMpe.
virtual ~CIccApplyTagMpe()
Name: CIccApplyTagMpe::~CIccApplyTagMpe.
virtual bool AppendElem(CIccMultiProcessElement *pElem)
Name: CIccApplyTagMpe::CIccApplyTagMpe.
CIccApplyMpeList * GetList()
Class: CIccDblPixelBuffer.
CIccDblPixelBuffer & operator=(const CIccDblPixelBuffer &buf)
Name: CIccDblPixelBuffer::CIccDblPixelBuffer.
void UpdateChannels(icUInt16Number nNumChannels)
icFloatNumber * GetSrcBuf()
icUInt16Number m_nMaxChannels
icFloatNumber * m_pixelBuf2
icFloatNumber * m_pixelBuf1
bool Begin()
Name: CIccDblPixelBuffer::CIccDblPixelBuffer.
void Clean()
Name: CIccDblPixelBuffer::CIccDblPixelBuffer.
virtual ~CIccDblPixelBuffer()
Name: CIccDblPixelBuffer::~CIccDblPixelBuffer.
CIccDblPixelBuffer()
Name: CIccDblPixelBuffer::CIccDblPixelBuffer.
icFloatNumber * GetDstBuf()
virtual icInt32Number Write8(void *pBuf8, icInt32Number nNum=1)
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 Read32(void *pBuf32, icInt32Number nNum=1)
std::string GetSigPathName(std::string sigPath)
static CIccMultiProcessElement * CreateElement(icElemTypeSignature elemTypeSig)
Function: CreateElement(elemTypeSig) Create a element of type elemTypeSig.
void SetType(icElemTypeSignature sig)
Name: CIccMpeUnknown::SetType.
virtual bool Write(CIccIO *pIO)
Name: CIccMpeUnknown::Write.
virtual ~CIccMpeUnknown()
Name: CIccMpeUnknown::~CIccMpeUnknown.
icUInt16Number m_nOutputChannels
CIccMpeUnknown & operator=(const CIccMpeUnknown &elem)
Name: CIccMpeUnknown::operator=.
icUInt32Number m_nReserved
icElemTypeSignature m_sig
bool SetDataSize(icUInt32Number nSize, bool bZeroData=true)
Name: CIccMpeUnknown::SetDataSize.
virtual bool Read(icUInt32Number nSize, CIccIO *pIO)
Name: CIccMpeUnknown::Read.
icUInt16Number m_nInputChannels
void SetChannels(icUInt16Number nInputChannels, icUInt16Number nOutputChannels)
Name: CIccMpeUnknown::Describe.
CIccMpeUnknown()
Name: CIccMpeUnknown::CIccMpeUnknown.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const
Name: CIccMpeUnknown::Validate.
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccMpeUnknown::Describe.
Class: CIccMultiProcessElement.
virtual void Apply(CIccApplyMpe *pApply, icFloatNumber *pDestPixel, const icFloatNumber *pSrcPixel) const =0
virtual icUInt16Number NumOutputChannels() const
virtual CIccMultiProcessElement * NewCopy() const =0
virtual bool Begin(icElemInterp nIterp=icElemInterpLinear, CIccTagMultiProcessElement *pMPE=NULL)=0
virtual bool Read(icUInt32Number size, CIccIO *pIO)=0
static CIccMultiProcessElement * Create(icElemTypeSignature sig)
Name: CIccMultiProcessElement::Create.
virtual CIccApplyMpe * GetNewApply(CIccApplyTagMpe *pApplyTag)
Name: CIccMultiProcessElement::GetNewApply()
virtual const icChar * GetClassName() const =0
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const =0
Name: CIccProcessElement::Validate.
Class: CIccProcessElementPtr.
CIccMultiProcessElement * ptr
icUInt32Number m_nReserved
Class: CIccTagMultiProcessElement.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccTagMultiProcessElement::Read.
virtual bool IsSupported()
Name: CIccTagMultiProcessElement::IsSupported.
virtual void Attach(CIccMultiProcessElement *pElement)
Name: CIccTagMultiProcessElement::Attach.
virtual bool Begin(icElemInterp nInterp=icElemInterpLinear, IIccProfileConnectionConditions *pProfilePCC=NULL, IIccProfileConnectionConditions *pAppliedPCC=NULL, IIccCmmEnvVarLookup *pCmmEnvVarLookup=NULL)
Name: CIccTagMultiProcessElement::Begin.
icUInt16Number m_nInputChannels
IIccCmmEnvVarLookup * m_pCmmEnvVarLookup
virtual CIccMultiProcessElementList::iterator GetLastElem()
virtual ~CIccTagMultiProcessElement()
Name: CIccTagMultiProcessElement::~CIccTagMultiProcessElement.
icUInt16Number m_nOutputChannels
CIccMultiProcessElementList * m_list
virtual CIccMultiProcessElementList::iterator GetFirstElem()
virtual CIccApplyTagMpe * GetNewApply()
Name: CIccTagMultiProcessElement::GetNewApply.
virtual void Apply(CIccApplyTagMpe *pApply, icFloatNumber *pDestPixel, const icFloatNumber *pSrcPixel) const
Name: CIccTagMultiProcessElement::Apply.
IIccProfileConnectionConditions * m_pAppliedPCC
icUInt32Number m_nProcElements
virtual bool Write(CIccIO *pIO)
Name: CIccTagMultiProcessElement::Write.
virtual void Clean()
Name: CIccTagMultiProcessElement::Clean.
CIccTagMultiProcessElement & operator=(const CIccTagMultiProcessElement &lut)
Name: &operator=.
virtual void Insert(CIccMultiProcessElement *pElement)
Name: CIccTagMultiProcessElement::Insert.
bool IsLateBinding() const
Name: CIccTagMultiProcessElement::IsLateBinding.
icPositionNumber * m_position
CIccTagMultiProcessElement(icUInt16Number nInputChannels=0, icUInt16Number nOutputChannels=0)
Name: CIccTagMultiProcessElement::CIccTagMultiProcessElement.
bool IsLateBindingReflectance() const
Name: CIccTagMultiProcessElement::IsLateBindingReflectance.
CIccMultiProcessElement * GetElement(int nIndex)
Name: CIccTagMultiProcessElement::GetElement.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Name: CIccTagMultiProcessElement::Validate.
virtual void GetNextElemIterator(CIccMultiProcessElementList::iterator &itr)
Name: CIccTagMultiProcessElement::GetNextElemIterator.
virtual icInt32Number ElementIndex(CIccMultiProcessElement *pElem)
Name: CIccTagMultiProcessElement::ElementIndex.
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccTagMultiProcessElement::Describe.
IIccProfileConnectionConditions * m_pProfilePCC