72#pragma warning( disable: 4786)
87#ifdef USEREFICCMAXNAMESPACE
105 m_nInputChannels = m_nOutputChannels = 0;
143 memcpy(m_pMatrix, matrix.
m_pMatrix, num);
151 memcpy(m_pOffset, matrix.
m_pOffset, num);
159 memcpy(m_pWhite, matrix.
m_pWhite, num);
194 memcpy(m_pMatrix, matrix.
m_pMatrix, num);
205 memcpy(m_pOffset, matrix.
m_pOffset, num);
216 memcpy(m_pWhite, matrix.
m_pWhite, num);
282 m_nInputChannels = nInputChannels;
283 m_nOutputChannels = nOutputChannels;
292 if (!m_pMatrix || !m_pOffset || !m_pWhite) {
316 sprintf(buf,
"BEGIN_%s %d %d \n", GetDescribeName(), m_nInputChannels, m_nOutputChannels);
319 sprintf(buf,
"RANGE %f %f %d\n",
icF16toF(m_Range.start),
icF16toF(m_Range.end), m_Range.steps);
322 sDescription +=
"White\n";
323 for (j=0; j<(int)m_Range.steps; j++) {
326 sprintf(buf,
"%12.8lf", m_pWhite[j]);
329 sDescription +=
"\n";
331 sDescription +=
"BLACK_OFFSET\n";
332 for (j=0; j<(int)m_Range.steps; j++) {
335 sprintf(buf,
"%12.8lf", m_pOffset[j]);
338 sDescription +=
"\n";
341 sDescription +=
"CHANNEL_DATA\n";
342 for (j=0; j<m_nOutputChannels; j++) {
343 for (i=0; i<(int)m_Range.steps; i++) {
346 sprintf(buf,
"%12.8lf", data[i]);
349 sDescription +=
"\n";
350 data += m_nInputChannels;
354 sprintf(buf,
"END_%s\n", GetDescribeName());
381 if (headerSize > size)
394 if (!pIO->
Read32(&m_nReserved))
397 if (!pIO->
Read16(&nInputChannels))
400 if (!pIO->
Read16(&nOutputChannels))
412 if (!pIO->
Read16(&m_nReserved2))
415 SetSize(nInputChannels, nOutputChannels, range);
416 if (!m_pWhite || !m_pMatrix || !m_pOffset)
464 if (!pIO->
Write32(&m_nReserved))
467 if (!pIO->
Write16(&m_nInputChannels))
470 if (!pIO->
Write16(&m_nOutputChannels))
473 if (!pIO->
Write16(&m_Range.start))
476 if (!pIO->
Write16(&m_Range.end))
479 if (!pIO->
Write16(&m_Range.steps))
482 if (!pIO->
Write16(&m_nReserved2))
489 else if (m_Range.steps) {
519 std::string mpeSigPath = sigPath +
icGetSigPath(GetType());
522 if (!m_Range.steps) {
527 sReport += sSigPathName;
528 sReport +=
" - Cannot have zero spectral range steps!\n";
532 if (m_nOutputChannels != 3) {
537 sReport += sSigPathName;
538 sReport +=
" - Output Channels must be 3!\n";
547 sReport += sSigPathName;
548 sReport +=
" - Has Empty White data!\n";
557 sReport += sSigPathName;
558 sReport +=
" - Has Empty Matrix data!\n";
567 sReport += sSigPathName;
568 sReport +=
" - Has Empty Matrix Constant data!\n";
572 if (m_Range.start>= m_Range.end || !m_Range.steps) {
577 sReport += sSigPathName;
578 sReport +=
" - Has an invalid spectral range!\n";
597 if (!m_pOffset ||!pMPE || !m_pMatrix || m_nOutputChannels != 3)
624 pMtx = m_pApplyMtx->entry(0);
625 for (i=0; i<m_nInputChannels; i++) {
627 pSrc += m_Range.steps;
630 pMtx[m_nInputChannels] = xyz[1];
631 pMtx[2*m_nInputChannels] = xyz[2];
654 m_pApplyMtx->VectorMult(dstPixel, srcPixel);
655 dstPixel[0] += m_xyzOffset[0];
656 dstPixel[1] += m_xyzOffset[1];
657 dstPixel[2] += m_xyzOffset[2];
679 if (!m_pOffset ||!pMPE || !m_pMatrix || m_nInputChannels != 3 || m_nOutputChannels != 3)
708 pMtx = m_pApplyMtx->entry(0);
709 for (i=0; i<m_nInputChannels; i++) {
711 pSrc += m_Range.steps;
714 pMtx[m_nInputChannels] = xyz[1];
715 pMtx[2*m_nInputChannels] = xyz[2];
719 m_pApplyMtx->Invert();
738 xyz[0] = srcPixel[0] - m_xyzOffset[0];
739 xyz[1] = srcPixel[1] - m_xyzOffset[1];
740 xyz[2] = srcPixel[2] - m_xyzOffset[2];
741 m_pApplyMtx->VectorMult(dstPixel, xyz);
762 std::string mpeSigPath = sigPath +
icGetSigPath(GetType());
765 if (m_nInputChannels != 3) {
770 sReport += sSigPathName;
771 sReport +=
" - Input Channels must be 3!\n";
797 m_nInputChannels = 0;
798 m_nOutputChannels = 0;
943 m_nOutputChannels = nOutputChannels;
946 m_nStorageType = nStorageType;
1004 if (headerSize > size)
1014 if (!pIO->
Read32(&m_nReserved))
1017 if (!pIO->
Read16(&m_nInputChannels))
1020 if (!pIO->
Read16(&m_nOutputChannels))
1023 if (!pIO->
Read32(&m_flags))
1026 if (!pIO->
Read16(&m_Range.start))
1029 if (!pIO->
Read16(&m_Range.end))
1032 if (!pIO->
Read16(&m_Range.steps))
1035 if (!pIO->
Read16(&m_nStorageType))
1040 if (pIO->
Read8(gridPoints, 16)!=16) {
1049 m_pCLUT->SetClipFunc(
NoClip);
1052 if (!nBytesPerPoint)
1055 m_pCLUT->Init(gridPoints, size - headerSize, (
icUInt8Number)nBytesPerPoint);
1062 icInt32Number nPoints = m_pCLUT->NumPoints()*(int)m_Range.steps;
1064 switch(m_nStorageType) {
1089 if (m_Range.steps *nBytesPerPoint > size - headerSize - nPoints*nBytesPerPoint)
1096 switch(m_nStorageType) {
1145 if (!pIO->
Write32(&m_nReserved))
1148 if (!pIO->
Write16(&m_nInputChannels))
1151 if (!pIO->
Write16(&m_nOutputChannels))
1157 if (!pIO->
Write16(&m_Range.start))
1160 if (!pIO->
Write16(&m_Range.end))
1163 if (!pIO->
Write16(&m_Range.steps))
1166 if (!pIO->
Write16(&m_nStorageType))
1173 for (i=0; i<16; i++)
1174 gridPoints[i] = m_pCLUT->GridPoint(i);
1176 if (pIO->
Write8(gridPoints, 16)!=16)
1180 icInt32Number nPoints = m_pCLUT->NumPoints()*(int)m_Range.steps;
1182 switch(m_nStorageType) {
1209 switch(m_nStorageType) {
1234 else if (m_Range.steps) {
1280 const CIccCLUT *pCLUT = m_pApplyCLUT;
1282 switch(m_interpType) {
1284 pCLUT->
Interp1d(dstPixel, srcPixel);
1287 pCLUT->
Interp2d(dstPixel, srcPixel);
1293 pCLUT->
Interp3d(dstPixel, srcPixel);
1296 pCLUT->
Interp4d(dstPixel, srcPixel);
1299 pCLUT->
Interp5d(dstPixel, srcPixel);
1302 pCLUT->
Interp6d(dstPixel, srcPixel);
1324 std::string mpeSigPath = sigPath +
icGetSigPath(GetType());
1332 sReport += sSigPathName;
1333 sReport +=
" - Invalid storageType value!\n";
1342 sReport += sSigPathName;
1343 sReport +=
" - Has No CLUT!\n";
1352 sReport += sSigPathName;
1353 sReport +=
" - Has Empty White data!\n";
1357 if (!m_Range.steps) {
1362 sReport += sSigPathName;
1363 sReport +=
" - Cannot have zero spectral range steps!\n";
1367 if (m_Range.start>= m_Range.end || !m_Range.steps) {
1372 sReport += sSigPathName;
1373 sReport +=
" - Has an invalid spectral range!\n";
1571 for (i=0; i<3; i++) {
1573 for (j=0; j<illumRange.
steps; j++) {
1584 pApplyMtx = &observer;
1586 pApplyMtx = rangeRef->
Mult(&observer);
1594 if (pApplyMtx!=&observer)
1613 if (!bUseAbsolute) {
1614 xyzscale[0] = xyzi[0] / xyzW[0];
1615 xyzscale[1] = xyzi[1] / xyzW[1];
1616 xyzscale[2] = xyzi[2] / xyzW[2];
1622 if (!bUseAbsolute) {
1623 pDst[0] *= xyzscale[0];
1624 pDst[1] *= xyzscale[1];
1625 pDst[2] *= xyzscale[2];
1639 if (pApplyMtx!=&observer)
1805 sDescription += buf;
1808 sDescription += buf;
1810 sDescription +=
"White\n";
1813 sDescription +=
" ";
1814 sprintf(buf,
"%12.8lf",
m_pWhite[j]);
1815 sDescription += buf;
1817 sDescription +=
"\n";
1820 sDescription += buf;
1846 if (headerSize > size)
1862 if (!pIO->
Read16(&nInputChannels))
1865 if (!pIO->
Read16(&nOutputChannels))
1880 if (!
SetSize(nInputChannels, nOutputChannels, range))
1957 if (!bUseAbsolute) {
1994 sReport += sSigPathName;
1995 sReport +=
" - Cannot have zero spectral range steps!\n";
2004 sReport += sSigPathName;
2005 sReport +=
" - Output Channels must be 3!\n";
2014 sReport += sSigPathName;
2015 sReport +=
" - Has Empty White data!\n";
2025 sReport += sSigPathName;
2026 sReport +=
" - Has an invalid spectral range!\n";
2109 for (i=0; i<3; i++) {
2111 for (j=0; j<illumRange.
steps; j++) {
2132 if (!bUseAbsolute) {
2141#ifdef USEREFICCMAXNAMESPACE
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
@ icValidateCriticalError
static icFloatNumber NoClip(icFloatNumber v)
icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Name: icMaxStatus.
std::string icGetSigPath(icUInt32Number nSig)
icUInt8Number icGetStorageTypeBytes(icUInt16Number nStorageType)
const char * icMsgValidateCriticalError
void icXYZtoLab(icFloatNumber *Lab, const icFloatNumber *XYZ, const icFloatNumber *WhiteXYZ)
icFloatNumber icF16toF(icFloat16Number num)
unsigned int icUInt32Number
Class: CIccApplyMpeSpectralCLUT.
virtual ~CIccApplyMpeSpectralCLUT()
Name: CIccApplyMpeSpectralCLUT::~CIccApplyMpeSpectralCLUT.
CIccApplyMpeSpectralCLUT(CIccMultiProcessElement *pElem, CIccApplyCLUT *pApply)
Name: CIccApplyMpeSpectralCLUT::CIccApplyMpeSpectralCLUT.
Class: CIccTagMultiProcessElement.
void Interp4d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp4d.
icUInt8Number GetInputDim() const
icUInt16Number GetOutputChannels() const
void SetClipFunc(icCLUTCLIPFUNC ClipFunc)
void Begin()
Name: CIccCLUT::Begin.
void Interp2d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp2d.
void Interp6d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp6d.
void Interp3d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp3d.
void Interp5d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp5d.
icUInt32Number NumPoints() const
icFloatNumber * GetData(int index)
const icUInt8Number * GridPointArray() const
void Interp3dTetra(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp3dTetra.
void Interp1d(icFloatNumber *destPixel, const icFloatNumber *srcPixel) const
Name: CIccCLUT::Interp1d.
void InterpND(icFloatNumber *destPixel, const icFloatNumber *srcPixel, CIccApplyCLUT *pApply) const
Name: CIccCLUT::InterpND.
bool Init(icUInt8Number nGridPoints, icUInt32Number nMaxSize=0, icUInt8Number nBytesPerPoint=4)
Name: CIccCLUT::Init.
icInt32Number ReadFloat16Float(void *pBufFloat, icInt32Number nNum=1)
icInt32Number ReadFloat32Float(void *pBufFloat, icInt32Number nNum=1)
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)
icInt32Number WriteFloat16Float(void *pBuf16, icInt32Number nNum=1)
icInt32Number ReadUInt8Float(void *pBufFloat, icInt32Number nNum=1)
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
icInt32Number WriteFloat32Float(void *pBufFloat, icInt32Number nNum=1)
icInt32Number WriteUInt8Float(void *pBuf16, icInt32Number nNum=1)
icInt32Number ReadUInt16Float(void *pBufFloat, icInt32Number nNum=1)
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
icInt32Number WriteUInt16Float(void *pBuf16, icInt32Number nNum=1)
std::string GetSigPathName(std::string sigPath)
icFloatNumber * entry(icUInt16Number nRow, icUInt16Number nCol=0)
CIccMatrixMath * Mult(const CIccMatrixMath *matrix) const
Name: CIccMatrixMath::Mult.
static CIccMatrixMath * rangeMap(const icSpectralRange &from, const icSpectralRange &to)
Name: CIccMatrixMath::rangeMap.
virtual void VectorMult(icFloatNumber *pDst, const icFloatNumber *pSrc) const
Name: CIccMatrixMath::VectorMult.
virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
Name: CIccMpeEmissionCLUT::Begin.
virtual void Apply(CIccApplyMpe *pApply, icFloatNumber *dstPixel, const icFloatNumber *srcPixel) const
Name: CIccMpeEmissionMatrix::Apply.
virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
Name: CIccMpeEmissionMatrix::Begin.
virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
Name: CIccMpeEmissionObserver::Begin.
virtual void Apply(CIccApplyMpe *pApply, icFloatNumber *dstPixel, const icFloatNumber *srcPixel) const
Name: CIccMpeInvEmissionMatrix::Apply.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const
Name: CIccMpeInvEmissionMatrix::Validate.
virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
Name: CIccMpeInvEmissionMatrix::Begin.
virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
Name: CIccMpeReflectanceCLUT::Begin.
virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
Name: CIccMpeReflectanceObserver::Begin.
Class: CIccMpeSpectralCLUT.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const
Name: CIccMpeSpectralCLUT::Validate.
CIccMpeSpectralCLUT()
Name: CIccMpeSpectralCLUT::CIccMpeSpectralCLUT.
virtual ~CIccMpeSpectralCLUT()
Name: CIccMpeSpectralCLUT::~CIccMpeSpectralCLUT.
icUInt16Number m_nStorageType
virtual void Apply(CIccApplyMpe *pApply, icFloatNumber *dstPixel, const icFloatNumber *srcPixel) const
Name: CIccMpeEmissionCLUT::Apply.
virtual bool Write(CIccIO *pIO)
Name: CIccMpeSpectralCLUT::Write.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccMpeSpectralCLUT::Read.
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccMpeSpectralCLUT::Describe.
void SetData(CIccCLUT *pCLUT, icUInt16Number nStorageType, const icSpectralRange &range, icFloatNumber *pWhite, icUInt16Number nOutputChannels=3)
Name: CIccMpeSpectralCLUT::SetCLUT.
icCLUTElemType m_interpType
void copyData(const CIccMpeSpectralCLUT &ITPC)
Name: &CIccMpeSpectralCLUT::operator=.
virtual CIccApplyMpe * GetNewApply(CIccApplyTagMpe *pApplyTag)
Name: CIccMpeSpectralCLUT::GetNewApply.
Class: CIccMpeSpectralMatrix.
virtual ~CIccMpeSpectralMatrix()
Name: CIccMpeSpectralMatrix::~CIccMpeSpectralMatrix.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccMpeSpectralMatrix::Read.
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccMpeSpectralMatrix::Describe.
icUInt16Number m_nReserved2
CIccMpeSpectralMatrix()
Name: CIccMpeSpectralMatrix::CIccMpeSpectralMatrix.
void copyData(const CIccMpeSpectralMatrix &ITPC)
Name: &CIccMpeSpectralMatrix::operator=.
icFloatNumber * m_pOffset
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const
Name: CIccMpeSpectralMatrix::Validate.
icFloatNumber * m_pMatrix
virtual bool Write(CIccIO *pIO)
Name: CIccMpeSpectralMatrix::Write.
bool SetSize(icUInt16Number nInputChannels, icUInt16Number nOutputChannels, const icSpectralRange &range)
Name: CIccMpeSpectralMatrix::SetSize.
Class: CIccMpeSpectralObserver.
virtual const char * GetDescribeName() const =0
virtual bool Write(CIccIO *pIO)
Name: CIccMpeSpectralObserver::Write.
void copyData(const CIccMpeSpectralObserver &ITPC)
Name: &CIccMpeSpectralObserver::operator=.
CIccMpeSpectralObserver()
Name: CIccMpeSpectralObserver::CIccMpeSpectralObserver.
virtual void Apply(CIccApplyMpe *pApply, icFloatNumber *dstPixel, const icFloatNumber *srcPixel) const
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccMpeSpectralObserver::Read.
virtual ~CIccMpeSpectralObserver()
Name: CIccMpeSpectralObserver::~CIccMpeSpectralObserver.
bool SetSize(icUInt16Number nInputChannels, icUInt16Number nOutputChannels, const icSpectralRange &range)
Name: CIccMpeSpectralObserver::SetSize.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const
Name: CIccMpeSpectralObserver::Validate.
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccMpeSpectralObserver::Describe.
CIccMatrixMath * m_pApplyMtx
icFloatNumber m_xyzscale[3]
Class: CIccMultiProcessElement.
icUInt16Number m_nOutputChannels
virtual icElemTypeSignature GetType() const =0
icUInt16Number m_nInputChannels
icUInt32Number m_nReserved
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const =0
Name: CIccProcessElement::Validate.
Class: CIccTagMultiProcessElement.
IIccProfileConnectionConditions * GetAppliedPCC()
Class: CIccTagSpectralViewingConditions.
const icFloatNumber * getIlluminant(icSpectralRange &illumRange) const
icFloatNumber * getEmissiveObserver(const icSpectralRange &range, const icFloatNumber *pWhite, icFloatNumber *obsMatrix=NULL)
virtual const CIccTagSpectralViewingConditions * getPccViewingConditions()=0