IccMAX 2.1.27
Color Profile Tools
Loading...
Searching...
No Matches
CIccMpeXmlMatrix Class Reference

#include <IccMpeXml.h>

+ Inheritance diagram for CIccMpeXmlMatrix:
+ Collaboration diagram for CIccMpeXmlMatrix:

Public Member Functions

virtual ~CIccMpeXmlMatrix ()
 
virtual void Apply (CIccApplyMpe *pApply, icFloatNumber *dstPixel, const icFloatNumber *srcPixel) const
 
virtual bool Begin (icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 
bool GetApplyConstants () const
 
virtual icAcsSignature GetBAcsSig ()
 
virtual const char * GetClassName () const
 
icFloatNumberGetConstants () const
 
virtual icAcsSignature GetEAcsSig ()
 
virtual const char * GetExtClassName ()
 
virtual IIccExtensionMpeGetExtension ()
 
icFloatNumberGetMatrix () const
 
virtual CIccApplyMpeGetNewApply (CIccApplyTagMpe *pApplyTag)
 
virtual icElemTypeSignature GetType () const
 
virtual bool IsAcs ()
 
virtual bool IsLateBinding () const
 
virtual bool IsLateBindingReflectance () const
 
virtual bool IsSupported ()
 
virtual CIccMultiProcessElementNewCopy () const
 
virtual icUInt16Number NumInputChannels () const
 
virtual icUInt16Number NumOutputChannels () const
 
virtual bool ParseXml (xmlNode *pNode, std::string &parseStr)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 
bool SetSize (icUInt16Number nInputChannels, icUInt16Number nOutputChannels, bool bUseConstants=true)
 
virtual bool ToXml (std::string &xml, std::string blanks="")
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const
 
virtual bool Write (CIccIO *pIO)
 

Static Public Member Functions

static CIccMultiProcessElementCreate (icElemTypeSignature sig)
 

Data Fields

icUInt32Number m_nReserved
 

Protected Attributes

bool m_bApplyConstants
 
icUInt16Number m_nInputChannels
 
icUInt16Number m_nOutputChannels
 
icFloatNumberm_pConstants
 
icFloatNumberm_pMatrix
 
icUInt32Number m_size
 
icMatrixElemType m_type
 

Detailed Description

Constructor & Destructor Documentation

◆ ~CIccMpeXmlMatrix()

virtual CIccMpeXmlMatrix::~CIccMpeXmlMatrix ( )
inlinevirtual
169{}

Member Function Documentation

◆ Apply()

void CIccMpeMatrix::Apply ( CIccApplyMpe pApply,
icFloatNumber dstPixel,
const icFloatNumber srcPixel 
) const
virtualinherited

Name: CIccMpeMatrix::Apply

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

5242{
5243 icFloatNumber *data = m_pMatrix;
5244 if (data) {
5245 if (m_bApplyConstants) {
5246 switch (m_type) {
5247 case ic3x3Matrix:
5248 *dstPixel++ = data[ 0]*srcPixel[0] + data[ 1]*srcPixel[1] + data[ 2]*srcPixel[2] + m_pConstants[0];
5249 *dstPixel++ = data[ 3]*srcPixel[0] + data[ 4]*srcPixel[1] + data[ 5]*srcPixel[2] + m_pConstants[1];
5250 *dstPixel = data[ 6]*srcPixel[0] + data[ 7]*srcPixel[1] + data[ 8]*srcPixel[2] + m_pConstants[2];
5251 break;
5252
5253 case ic3x4Matrix:
5254 *dstPixel++ = data[ 0]*srcPixel[0] + data[ 1]*srcPixel[1] + data[ 2]*srcPixel[2] + m_pConstants[0];
5255 *dstPixel++ = data[ 3]*srcPixel[0] + data[ 4]*srcPixel[1] + data[ 5]*srcPixel[2] + m_pConstants[1];
5256 *dstPixel++ = data[ 6]*srcPixel[0] + data[ 7]*srcPixel[1] + data[ 8]*srcPixel[2] + m_pConstants[2];
5257 *dstPixel = data[ 9]*srcPixel[0] + data[10]*srcPixel[1] + data[11]*srcPixel[2] + m_pConstants[3];
5258 break;
5259
5260 case ic4x3Matrix:
5261 *dstPixel++ = data[ 0]*srcPixel[0] + data[ 1]*srcPixel[1] + data[ 2]*srcPixel[2] + data[ 3]*srcPixel[3] + m_pConstants[0];
5262 *dstPixel++ = data[ 4]*srcPixel[0] + data[ 5]*srcPixel[1] + data[ 6]*srcPixel[2] + data[ 7]*srcPixel[3] + m_pConstants[1];
5263 *dstPixel = data[ 8]*srcPixel[0] + data[ 9]*srcPixel[1] + data[10]*srcPixel[2] + data[11]*srcPixel[3] + m_pConstants[2];
5264 break;
5265
5266 case ic4x4Matrix:
5267 *dstPixel++ = data[ 0]*srcPixel[0] + data[ 1]*srcPixel[1] + data[ 2]*srcPixel[2] + data[ 3]*srcPixel[3] + m_pConstants[0];
5268 *dstPixel++ = data[ 4]*srcPixel[0] + data[ 5]*srcPixel[1] + data[ 6]*srcPixel[2] + data[ 7]*srcPixel[3] + m_pConstants[1];
5269 *dstPixel++ = data[ 8]*srcPixel[0] + data[ 9]*srcPixel[1] + data[10]*srcPixel[2] + data[11]*srcPixel[3] + m_pConstants[2];
5270 *dstPixel = data[12]*srcPixel[0] + data[13]*srcPixel[1] + data[14]*srcPixel[2] + data[15]*srcPixel[3] + m_pConstants[3];
5271 break;
5272
5273 case icOtherMatrix:
5274 default:
5275 {
5276 int i, j;
5277
5278 for (j=0; j<m_nOutputChannels; j++) {
5279 *dstPixel = m_pConstants[j];
5280
5281 for (i=0; i<m_nInputChannels; i++) {
5282 *dstPixel += data[i]*srcPixel[i];
5283 }
5284
5285 data += i;
5286 dstPixel++;
5287 }
5288 }
5289 break;
5290 }
5291 }
5292 else {
5293 switch (m_type) {
5294 case ic3x3Matrix:
5295 *dstPixel++ = data[0] * srcPixel[0] + data[1] * srcPixel[1] + data[2] * srcPixel[2];
5296 *dstPixel++ = data[3] * srcPixel[0] + data[4] * srcPixel[1] + data[5] * srcPixel[2];
5297 *dstPixel = data[6] * srcPixel[0] + data[7] * srcPixel[1] + data[8] * srcPixel[2];
5298 break;
5299
5300 case ic3x4Matrix:
5301 *dstPixel++ = data[0] * srcPixel[0] + data[1] * srcPixel[1] + data[2] * srcPixel[2];
5302 *dstPixel++ = data[3] * srcPixel[0] + data[4] * srcPixel[1] + data[5] * srcPixel[2];
5303 *dstPixel++ = data[6] * srcPixel[0] + data[7] * srcPixel[1] + data[8] * srcPixel[2];
5304 *dstPixel = data[9] * srcPixel[0] + data[10] * srcPixel[1] + data[11] * srcPixel[2];
5305 break;
5306
5307 case ic4x3Matrix:
5308 *dstPixel++ = data[0] * srcPixel[0] + data[1] * srcPixel[1] + data[2] * srcPixel[2] + data[3] * srcPixel[3];
5309 *dstPixel++ = data[4] * srcPixel[0] + data[5] * srcPixel[1] + data[6] * srcPixel[2] + data[7] * srcPixel[3];
5310 *dstPixel = data[8] * srcPixel[0] + data[9] * srcPixel[1] + data[10] * srcPixel[2] + data[11] * srcPixel[3];
5311 break;
5312
5313 case ic4x4Matrix:
5314 *dstPixel++ = data[0] * srcPixel[0] + data[1] * srcPixel[1] + data[2] * srcPixel[2] + data[3] * srcPixel[3];
5315 *dstPixel++ = data[4] * srcPixel[0] + data[5] * srcPixel[1] + data[6] * srcPixel[2] + data[7] * srcPixel[3];
5316 *dstPixel++ = data[8] * srcPixel[0] + data[9] * srcPixel[1] + data[10] * srcPixel[2] + data[11] * srcPixel[3];
5317 *dstPixel = data[12] * srcPixel[0] + data[13] * srcPixel[1] + data[14] * srcPixel[2] + data[15] * srcPixel[3];
5318 break;
5319
5320 case icOtherMatrix:
5321 default:
5322 {
5323 int i, j;
5324
5325 for (j = 0; j < m_nOutputChannels; j++) {
5326 *dstPixel = 0.0f;
5327
5328 for (i = 0; i < m_nInputChannels; i++) {
5329 *dstPixel += data[i] * srcPixel[i];
5330 }
5331
5332 data += i;
5333 dstPixel++;
5334 }
5335 }
5336 break;
5337 }
5338 }
5339 }
5340 else if (m_bApplyConstants) {
5341 memcpy(dstPixel, m_pConstants, m_nOutputChannels*sizeof(icFloatNumber));
5342 }
5343 else {
5344 memset(dstPixel, 0, m_nOutputChannels * sizeof(icFloatNumber));
5345 }
5346}
@ ic3x3Matrix
Definition IccMpeBasic.h:585
@ icOtherMatrix
Definition IccMpeBasic.h:589
@ ic3x4Matrix
Definition IccMpeBasic.h:586
@ ic4x3Matrix
Definition IccMpeBasic.h:587
@ ic4x4Matrix
Definition IccMpeBasic.h:588
float icFloatNumber
Definition IccDefs.h:101
icFloatNumber * m_pConstants
Definition IccMpeBasic.h:629
bool m_bApplyConstants
Definition IccMpeBasic.h:632
icFloatNumber * m_pMatrix
Definition IccMpeBasic.h:628
icMatrixElemType m_type
Definition IccMpeBasic.h:631
icUInt16Number m_nOutputChannels
Definition IccTagMPE.h:192
icUInt16Number m_nInputChannels
Definition IccTagMPE.h:191

References ic3x3Matrix, ic3x4Matrix, ic4x3Matrix, ic4x4Matrix, icOtherMatrix, CIccMpeMatrix::m_bApplyConstants, CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMpeMatrix::m_pConstants, CIccMpeMatrix::m_pMatrix, and CIccMpeMatrix::m_type.

◆ Begin()

bool CIccMpeMatrix::Begin ( icElemInterp  nInterp,
CIccTagMultiProcessElement pMPE 
)
virtualinherited

Name: CIccMpeMatrix::Begin

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

5205{
5206 m_bApplyConstants = false;
5207 if (m_pConstants) {
5208 int i;
5209 for (i = 0; i < m_nOutputChannels; i++) {
5210 if (icNotZero(m_pConstants[i])) {
5211 m_bApplyConstants = true;
5212 break;
5213 }
5214 }
5215 }
5216
5219 else if (m_nInputChannels==3 && m_nOutputChannels==4)
5221 else if (m_nInputChannels==4 && m_nOutputChannels==3)
5223 else if (m_nInputChannels==4 && m_nOutputChannels==4)
5225 else
5227
5228 return true;
5229}
#define icNotZero(v)
Definition IccUtil.h:89

References ic3x3Matrix, ic3x4Matrix, ic4x3Matrix, ic4x4Matrix, icOtherMatrix, CIccMpeMatrix::m_bApplyConstants, CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMpeMatrix::m_pConstants, and CIccMpeMatrix::m_type.

◆ Create()

CIccMultiProcessElement * CIccMultiProcessElement::Create ( icElemTypeSignature  sig)
staticinherited

Name: CIccMultiProcessElement::Create

Purpose:

Args:

Return:

132{
134}
static CIccMultiProcessElement * CreateElement(icElemTypeSignature elemTypeSig)
Definition IccMpeFactory.h:213

References CIccMpeCreator::CreateElement().

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), CIccSampledCalculatorCurve::Read(), CIccMpeCalculator::Read(), and CIccTagMultiProcessElement::Read().

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

◆ Describe()

void CIccMpeMatrix::Describe ( std::string &  sDescription,
int  nVerboseness 
)
virtualinherited

Name: CIccMpeMatrix::Describe

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

5017{
5018 icChar buf[81];
5019 int i, j;
5020 icFloatNumber *data = m_pMatrix;
5021
5022 sprintf(buf, "BEGIN_ELEM_MATRIX %d %d\n", m_nInputChannels, m_nOutputChannels);
5023 sDescription += buf;
5024
5025 for (j=0; j<m_nOutputChannels; j++) {
5026 if (data) {
5027 for (i=0; i<m_nInputChannels; i++) {
5028 if (i)
5029 sDescription += " ";
5030 sprintf(buf, "%12.8lf", data[i]);
5031 sDescription += buf;
5032 }
5033 if (m_pConstants) {
5034 sprintf(buf, " + %12.8lf\n", m_pConstants[j]);
5035 sDescription += buf;
5036 }
5037 data += i;
5038 }
5039 else {
5040 sprintf(buf, "ZeroRow + %12.8lf\n", m_pConstants[j]);
5041 sDescription += buf;
5042 }
5043 }
5044 sDescription += "END_ELEM_MATRIX\n";
5045}
char icChar
Definition IccDefs.h:110

References CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMpeMatrix::m_pConstants, and CIccMpeMatrix::m_pMatrix.

◆ GetApplyConstants()

bool CIccMpeMatrix::GetApplyConstants ( ) const
inlineinherited

◆ GetBAcsSig()

virtual icAcsSignature CIccMultiProcessElement::GetBAcsSig ( )
inlinevirtualinherited

Reimplemented in CIccMpeBAcs.

178{ return icSigAcsZero; }
#define icSigAcsZero
Definition icProfileHeader.h:1100

Referenced by CIccMpeAcs::Describe().

+ Here is the caller graph for this function:

◆ GetClassName()

virtual const char * CIccMpeXmlMatrix::GetClassName ( ) const
inlinevirtual

Reimplemented from CIccMpeMatrix.

171{ return "CIccMpeXmlMatrix"; }

◆ GetConstants()

icFloatNumber * CIccMpeMatrix::GetConstants ( ) const
inlineinherited
619{return m_pConstants;}

References CIccMpeMatrix::m_pConstants.

◆ GetEAcsSig()

virtual icAcsSignature CIccMultiProcessElement::GetEAcsSig ( )
inlinevirtualinherited

Reimplemented in CIccMpeEAcs.

179{ return icSigAcsZero; }

◆ GetExtClassName()

virtual const char * CIccMpeXml::GetExtClassName ( )
inlinevirtualinherited

Implements IIccExtensionMpe.

84{ return "CIccMpeXml"; }

◆ GetExtension()

virtual IIccExtensionMpe * CIccMpeXmlMatrix::GetExtension ( )
inlinevirtual

Reimplemented from CIccMultiProcessElement.

173{ return this; }

◆ GetMatrix()

icFloatNumber * CIccMpeMatrix::GetMatrix ( ) const
inlineinherited
618{return m_pMatrix;}

References CIccMpeMatrix::m_pMatrix.

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams().

+ Here is the caller graph for this function:

◆ GetNewApply()

CIccApplyMpe * CIccMultiProcessElement::GetNewApply ( CIccApplyTagMpe pApplyTag)
virtualinherited

Name: CIccMultiProcessElement::GetNewApply()

Purpose:

Args:

Return:

Reimplemented in CIccMpeCLUT, CIccMpeCalculator, and CIccMpeSpectralCLUT.

147{
148 return new CIccApplyMpe(this);
149}
Definition IccTagMPE.h:203

References CIccApplyMpe::CIccApplyMpe().

Referenced by CIccApplyTagMpe::AppendElem(), and CIccMpeCalculator::GetNewApply().

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

◆ GetType()

virtual icElemTypeSignature CIccMpeMatrix::GetType ( ) const
inlinevirtualinherited

Implements CIccMultiProcessElement.

608{ return icSigMatrixElemType; }
@ icSigMatrixElemType
Definition icProfileHeader.h:644

References icSigMatrixElemType.

Referenced by CIccMpeMatrix::Validate(), and CIccMpeMatrix::Write().

+ Here is the caller graph for this function:

◆ IsAcs()

virtual bool CIccMultiProcessElement::IsAcs ( )
inlinevirtualinherited

Reimplemented in CIccMpeAcs.

177{ return false; }

Referenced by CIccTagMultiProcessElement::Apply().

+ Here is the caller graph for this function:

◆ IsLateBinding()

virtual bool CIccMultiProcessElement::IsLateBinding ( ) const
inlinevirtualinherited

Reimplemented in CIccMpeCalculator, CIccMpeSpectralMatrix, CIccMpeSpectralCLUT, and CIccMpeSpectralObserver.

184{ return false; }

Referenced by CIccMpeCalculator::IsLateBinding(), and CIccTagMultiProcessElement::IsLateBinding().

+ Here is the caller graph for this function:

◆ IsLateBindingReflectance()

virtual bool CIccMultiProcessElement::IsLateBindingReflectance ( ) const
inlinevirtualinherited

Reimplemented in CIccMpeCalculator, CIccMpeReflectanceCLUT, and CIccMpeReflectanceObserver.

185{ return false; }

Referenced by CIccMpeCalculator::IsLateBindingReflectance(), and CIccTagMultiProcessElement::IsLateBindingReflectance().

+ Here is the caller graph for this function:

◆ IsSupported()

virtual bool CIccMultiProcessElement::IsSupported ( )
inlinevirtualinherited

Reimplemented in CIccMpeUnknown.

162{ return true; }

Referenced by CIccTagMultiProcessElement::IsSupported().

+ Here is the caller graph for this function:

◆ NewCopy()

virtual CIccMultiProcessElement * CIccMpeMatrix::NewCopy ( ) const
inlinevirtualinherited

Implements CIccMultiProcessElement.

605{ return new CIccMpeMatrix(*this);}
CIccMpeMatrix()
Definition IccMpeBasic.cpp:4853

References CIccMpeMatrix::CIccMpeMatrix().

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams().

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

◆ NumInputChannels()

◆ NumOutputChannels()

◆ ParseXml()

bool CIccMpeXmlMatrix::ParseXml ( xmlNode *  pNode,
std::string &  parseStr 
)
virtual

Implements CIccMpeXml.

1237{
1238 icUInt16Number nInputChannels = atoi(icXmlAttrValue(pNode, "InputChannels"));
1239 icUInt16Number nOutputChannels = atoi(icXmlAttrValue(pNode, "OutputChannels"));
1240 if (!nInputChannels || !nOutputChannels) {
1241 parseStr += "Invalid InputChannels or OutputChannels In MatrixElement\n";
1242 return false;
1243 }
1244
1245 xmlNode *pData;
1246
1247 pData = icXmlFindNode(pNode->children, "MatrixData");
1248 if (pData) {
1249 SetSize(nInputChannels, nOutputChannels);
1250
1252 return false;
1253
1254 const char *invert = icXmlAttrValue(pData, "InvertMatrix", "false");
1255 if (!stricmp(invert, "true")) {
1257 parseStr += "Inversion of MatrixData requires square matrix\n";
1258 return false;
1259 }
1261 if (!pInverter || !pInverter->Invert(m_pMatrix, m_nOutputChannels, m_nInputChannels)) {
1262 parseStr += "Unable to invert matrix!\n";
1263 return false;
1264 }
1265 }
1266 }
1267 else { //Having no MatrixData implies having a matrix full of zeros which is represented by m_pMatrix set to NULL
1268 SetSize(0, nOutputChannels); //Initialize with m_pMatrix set to NULL
1269 m_nInputChannels = nInputChannels; //Fix m_nInputChannels
1270 }
1271
1272 pData = icXmlFindNode(pNode->children, "ConstantData");
1273 if (pData) {
1275 return false;
1276 }
1277 return true;
1278}
unsigned short icUInt16Number
Definition icProfileHeader.h:256
IIccMatrixInverter ICCPROFLIB_API * IccGetDefaultMatrixInverter()
Definition IccSolve.cpp:287
#define stricmp
Definition IccProfLibConf.h:149
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
Definition IccUtilXml.cpp:687
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault="")
Definition IccUtilXml.cpp:572
bool SetSize(icUInt16Number nInputChannels, icUInt16Number nOutputChannels, bool bUseConstants=true)
Definition IccMpeBasic.cpp:4974
Definition IccSolve.h:149
virtual bool Invert(icFloatNumber *dMatrix, icUInt16Number nRows, icUInt16Number nCols)=0
static bool ParseArray(T *buf, icUInt32Number nBufSize, xmlNode *pNode)
Definition IccUtilXml.cpp:1034

References IccGetDefaultMatrixInverter(), icXmlAttrValue(), icXmlFindNode(), IIccMatrixInverter::Invert(), CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMpeMatrix::m_pConstants, CIccMpeMatrix::m_pMatrix, CIccXmlArrayType< T, Tsig >::ParseArray(), and CIccMpeMatrix::SetSize().

+ Here is the call graph for this function:

◆ Read()

bool CIccMpeMatrix::Read ( icUInt32Number  size,
CIccIO pIO 
)
virtualinherited

Name: CIccMpeMatrix::Read

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

5058{
5060
5061 icUInt32Number headerSize = sizeof(icElemTypeSignature) +
5062 sizeof(icUInt32Number) +
5063 sizeof(icUInt16Number) +
5064 sizeof(icUInt16Number);
5065
5066 if (headerSize > size)
5067 return false;
5068
5069 icUInt32Number dataSize = size - headerSize;
5070
5071 if (!pIO) {
5072 return false;
5073 }
5074
5075 icUInt16Number nInputChannels, nOutputChannels;
5076
5077 if (!pIO->Read32(&sig))
5078 return false;
5079
5080 if (!pIO->Read32(&m_nReserved))
5081 return false;
5082
5083 if (!pIO->Read16(&nInputChannels))
5084 return false;
5085
5086 if (!pIO->Read16(&nOutputChannels))
5087 return false;
5088
5089 if (dataSize >= (icUInt32Number)nInputChannels * nOutputChannels * sizeof(icFloatNumber) &&
5090 dataSize < ((icUInt32Number)nInputChannels+1) * nOutputChannels * sizeof(icFloatNumber)) {
5091 //Matrix with no constants
5092 if (!SetSize(nInputChannels, nOutputChannels, false))
5093 return false;
5094
5095 if (!m_pMatrix)
5096 return false;
5097
5098 //Read Matrix data
5100 return false;
5101 }
5102 else if (dataSize < (icUInt32Number)nInputChannels * nOutputChannels *sizeof(icFloatNumber) &&
5103 dataSize >= (icUInt32Number)nOutputChannels * sizeof(icFloatNumber)) {
5104 //Constants with no matrix
5105 if (!SetSize(0, nOutputChannels))
5106 return false;
5107
5108 m_nInputChannels = nInputChannels;
5109
5110 //Read Constant data
5112 return false;
5113 }
5114 else {
5115 if ((icUInt32Number)nInputChannels*nOutputChannels > dataSize ||
5116 ((icUInt32Number)nInputChannels*nOutputChannels + nOutputChannels) > dataSize ||
5117 ((icUInt32Number)nInputChannels*nOutputChannels + nOutputChannels) * sizeof(icFloat32Number) > dataSize)
5118 return false;
5119
5120 //Matrix with constants
5121 if (!SetSize(nInputChannels, nOutputChannels))
5122 return false;
5123
5124 if (!m_pMatrix)
5125 return false;
5126
5127 if ((m_size + nOutputChannels)*sizeof(icFloat32Number) > dataSize)
5128 return false;
5129
5130 //Read Matrix data
5132 return false;
5133
5134 //Read Constant data
5136 return false;
5137 }
5138
5139 return true;
5140}
float icFloat32Number
Definition icProfileHeader.h:313
long icInt32Number
Definition icProfileHeader.h:291
icElemTypeSignature
Definition icProfileHeader.h:641
unsigned long icUInt32Number
Definition icProfileHeader.h:262
icUInt32Number m_size
Definition IccMpeBasic.h:630
icInt32Number ReadFloat32Float(void *pBufFloat, icInt32Number nNum=1)
Definition IccIO.cpp:302
icInt32Number Read16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:114
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
icUInt32Number m_nReserved
Definition IccTagMPE.h:188

References CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMultiProcessElement::m_nReserved, CIccMpeMatrix::m_pConstants, CIccMpeMatrix::m_pMatrix, CIccMpeMatrix::m_size, CIccIO::Read16(), CIccIO::Read32(), CIccIO::ReadFloat32Float(), and CIccMpeMatrix::SetSize().

+ Here is the call graph for this function:

◆ SetSize()

bool CIccMpeMatrix::SetSize ( icUInt16Number  nInputChannels,
icUInt16Number  nOutputChannels,
bool  bUseConstants = true 
)
inherited

Name: CIccMpeMatrix::SetSize

Purpose:

Args:

Return:

4975{
4976 if (m_pMatrix) {
4977 free(m_pMatrix);
4978 m_pMatrix = NULL;
4979 }
4980 if (m_pConstants) {
4981 free(m_pConstants);
4982 m_pConstants = NULL;
4983 }
4984
4985 m_size = (icUInt32Number)nInputChannels * nOutputChannels;
4986
4987 if (m_size) {
4988 m_pMatrix = (icFloatNumber*)calloc(m_size, sizeof(icFloatNumber));
4989 if (!m_pMatrix)
4990 return false;
4991 }
4992
4993 if (bUseConstants) {
4994 m_pConstants = (icFloatNumber*)calloc(nOutputChannels, sizeof(icFloatNumber));
4995
4996 if (!m_pConstants)
4997 return false;
4998 }
4999
5000 m_nInputChannels = nInputChannels;
5001 m_nOutputChannels = nOutputChannels;
5002
5003 return true;
5004}

References CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMpeMatrix::m_pConstants, CIccMpeMatrix::m_pMatrix, and CIccMpeMatrix::m_size.

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), ParseXml(), and CIccMpeMatrix::Read().

+ Here is the caller graph for this function:

◆ ToXml()

bool CIccMpeXmlMatrix::ToXml ( std::string &  xml,
std::string  blanks = "" 
)
virtual

Implements CIccMpeXml.

1184{
1185 char buf[128];
1186 sprintf(buf, "<MatrixElement InputChannels=\"%d\" OutputChannels=\"%d\"", NumInputChannels(), NumOutputChannels());
1187 xml += blanks + buf;
1188
1189 if (m_nReserved) {
1190 sprintf(buf, " Reserved=\"%u\"", m_nReserved);
1191 xml += buf;
1192 }
1193 xml += ">\n";
1194
1195 int i, j, n;
1196
1197 if (m_pMatrix) {
1198 xml += blanks + " <MatrixData>\n";
1199
1200 for (n=0, j=0; j<NumOutputChannels(); j++) {
1201 xml += blanks + " ";
1202 for (i=0; i<NumInputChannels(); i++, n++) {
1203 sprintf(buf, " " icXmlFloatFmt, m_pMatrix[n]);
1204 xml += buf;
1205 }
1206 xml += "\n";
1207 }
1208 xml += blanks + " </MatrixData>\n";
1209 }
1210
1211 if (m_pConstants) {
1212 for (i = 0; i < NumOutputChannels(); i++) {
1213 if (icNotZero(m_pConstants[i]))
1214 break;
1215 }
1216 if (i < NumOutputChannels()) {
1217 xml += blanks + " <ConstantData>\n";
1218
1219 xml += blanks + " ";
1220 for (i = 0; i < NumOutputChannels(); i++) {
1221 sprintf(buf, " " icXmlFloatFmt, m_pConstants[i]);
1222 xml += buf;
1223 }
1224 xml += "\n";
1225
1226 xml += blanks + " </ConstantData>\n";
1227 }
1228 }
1229
1230 xml += blanks + "</MatrixElement>\n";
1231
1232 return true;
1233}
#define icXmlFloatFmt
Definition IccXmlConfig.h:75
virtual icUInt16Number NumInputChannels() const
Definition IccTagMPE.h:159
virtual icUInt16Number NumOutputChannels() const
Definition IccTagMPE.h:160

References CIccMultiProcessElement::m_nReserved, CIccMpeMatrix::m_pConstants, CIccMpeMatrix::m_pMatrix, CIccMultiProcessElement::NumInputChannels(), and CIccMultiProcessElement::NumOutputChannels().

+ Here is the call graph for this function:

◆ Validate()

icValidateStatus CIccMpeMatrix::Validate ( std::string  sigPath,
std::string &  sReport,
const CIccTagMultiProcessElement pMPE = NULL,
const CIccProfile pProfile = NULL 
) const
virtualinherited

Name: CIccMpeMatrix::Validate

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

5359{
5360 std::string mpeSigPath = sigPath + icGetSigPath(GetType());
5361 icValidateStatus rv = CIccMultiProcessElement::Validate(sigPath, sReport, pMPE, pProfile);
5362
5363 if (!m_pConstants) {
5364 CIccInfo Info;
5365 std::string sSigPathName = Info.GetSigPathName(mpeSigPath);
5366
5367 sReport += icMsgValidateCriticalError;
5368 sReport += sSigPathName;
5369 sReport += " - Has Empty Matrix Constant data!\n";
5371 }
5372
5373 return rv;
5374}
icValidateStatus
Definition IccDefs.h:119
@ icValidateCriticalError
Definition IccDefs.h:123
ICCPROFLIB_API std::string icGetSigPath(icUInt32Number sig)
Definition IccUtil.cpp:1191
ICCPROFLIB_API const char * icMsgValidateCriticalError
Definition IccUtil.cpp:92
Definition IccUtil.h:303
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614
virtual icElemTypeSignature GetType() const
Definition IccMpeBasic.h:608
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const =0
Definition IccTagMPE.cpp:454

References CIccInfo::GetSigPathName(), CIccMpeMatrix::GetType(), icGetSigPath(), icMsgValidateCriticalError, icValidateCriticalError, CIccMpeMatrix::m_pConstants, and CIccMultiProcessElement::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccMpeMatrix::Write ( CIccIO pIO)
virtualinherited

Name: CIccMpeMatrix::Write

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

5153{
5155
5156 if (!pIO)
5157 return false;
5158
5159 if (!pIO->Write32(&sig))
5160 return false;
5161
5162 if (!pIO->Write32(&m_nReserved))
5163 return false;
5164
5165 if (!pIO->Write16(&m_nInputChannels))
5166 return false;
5167
5168 if (!pIO->Write16(&m_nOutputChannels))
5169 return false;
5170
5171 if (m_pMatrix) {
5173 return false;
5174 }
5175
5176 //Write Constant data
5177 if (m_pConstants) {
5179 return false;
5180 }
5181 else {
5182 //Write zero constants because spec says it they have to be there
5183 icFloat32Number zero = 0;
5184 int i;
5185 for (i = 0; i < m_nOutputChannels; i++) {
5186 if (!pIO->WriteFloat32Float(&zero, 1))
5187 return false;
5188 }
5189 }
5190
5191 return true;
5192}
icInt32Number Write16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:122
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152
icInt32Number WriteFloat32Float(void *pBufFloat, icInt32Number nNum=1)
Definition IccIO.cpp:321

References CIccMpeMatrix::GetType(), CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMultiProcessElement::m_nReserved, CIccMpeMatrix::m_pConstants, CIccMpeMatrix::m_pMatrix, CIccMpeMatrix::m_size, CIccIO::Write16(), CIccIO::Write32(), and CIccIO::WriteFloat32Float().

+ Here is the call graph for this function:

Field Documentation

◆ m_bApplyConstants

◆ m_nInputChannels

icUInt16Number CIccMultiProcessElement::m_nInputChannels
protectedinherited

Referenced by CIccMpeBAcs::CIccMpeBAcs(), CIccMpeBAcs::CIccMpeBAcs(), CIccMpeCalculator::CIccMpeCalculator(), CIccMpeCalculator::CIccMpeCalculator(), CIccMpeCAM::CIccMpeCAM(), CIccMpeCLUT::CIccMpeCLUT(), CIccMpeCLUT::CIccMpeCLUT(), CIccMpeCurveSet::CIccMpeCurveSet(), CIccMpeCurveSet::CIccMpeCurveSet(), CIccMpeEAcs::CIccMpeEAcs(), CIccMpeEAcs::CIccMpeEAcs(), CIccMpeExtCLUT::CIccMpeExtCLUT(), CIccMpeMatrix::CIccMpeMatrix(), CIccMpeMatrix::CIccMpeMatrix(), CIccMpeSpectralCLUT::CIccMpeSpectralCLUT(), CIccMpeSpectralCLUT::CIccMpeSpectralCLUT(), CIccMpeSpectralMatrix::CIccMpeSpectralMatrix(), CIccMpeSpectralMatrix::CIccMpeSpectralMatrix(), CIccMpeSpectralObserver::CIccMpeSpectralObserver(), CIccMpeSpectralObserver::CIccMpeSpectralObserver(), CIccMpeTintArray::CIccMpeTintArray(), CIccMpeTintArray::CIccMpeTintArray(), CIccMpeToneMap::CIccMpeToneMap(), CIccMpeToneMap::CIccMpeToneMap(), CIccMultiProcessElement::CIccMultiProcessElement(), CIccMpeAcs::Apply(), CIccMpeCurveSet::Apply(), CIccMpeMatrix::Apply(), CIccMpeAcs::Begin(), CIccMpeCurveSet::Begin(), CIccMpeMatrix::Begin(), CIccMpeCLUT::Begin(), CIccMpeEmissionMatrix::Begin(), CIccMpeInvEmissionMatrix::Begin(), CIccMpeEmissionCLUT::Begin(), CIccMpeReflectanceCLUT::Begin(), CIccMpeEmissionObserver::Begin(), CIccMpeReflectanceObserver::Begin(), CIccMpeSpectralCLUT::copyData(), CIccMpeSpectralMatrix::copyData(), CIccMpeSpectralObserver::copyData(), CIccMpeCurveSet::Describe(), CIccMpeMatrix::Describe(), CIccMpeCalculator::Describe(), CIccMpeSpectralMatrix::Describe(), CIccMpeSpectralObserver::Describe(), CIccMpeXmlCalculator::Flatten(), CIccMultiProcessElement::NumInputChannels(), CIccMpeEmissionMatrix::numVectors(), CIccMpeBAcs::operator=(), CIccMpeCalculator::operator=(), CIccMpeCLUT::operator=(), CIccMpeCurveSet::operator=(), CIccMpeEAcs::operator=(), CIccMpeMatrix::operator=(), CIccMpeTintArray::operator=(), CIccMpeToneMap::operator=(), CIccMpeXmlTintArray::ParseXml(), CIccMpeXmlToneMap::ParseXml(), ParseXml(), CIccMpeXmlCLUT::ParseXml(), CIccMpeXmlExtCLUT::ParseXml(), CIccMpeXmlBAcs::ParseXml(), CIccMpeXmlEAcs::ParseXml(), CIccMpeXmlJabToXYZ::ParseXml(), CIccMpeXmlXYZToJab::ParseXml(), CIccMpeXmlCalculator::ParseXml(), CIccMpeXmlEmissionCLUT::ParseXml(), CIccMpeXmlReflectanceCLUT::ParseXml(), CIccMpeAcs::Read(), CIccMpeCurveSet::Read(), CIccMpeTintArray::Read(), CIccMpeToneMap::Read(), CIccMpeMatrix::Read(), CIccMpeCLUT::Read(), CIccMpeExtCLUT::Read(), CIccMpeCAM::Read(), CIccMpeSpectralCLUT::Read(), CIccMpeCLUT::SetCLUT(), CIccMpeCurveSet::SetCurve(), CIccMpeSpectralCLUT::SetData(), CIccMpeCalculator::SetSize(), CIccMpeMatrix::SetSize(), CIccMpeSpectralMatrix::SetSize(), CIccMpeSpectralObserver::SetSize(), CIccMpeCurveSet::SetSize(), CIccMpeCurveSet::Validate(), CIccMpeTintArray::Validate(), CIccMpeToneMap::Validate(), CIccMpeCAM::Validate(), CIccMpeInvEmissionMatrix::Validate(), CIccMpeAcs::Write(), CIccMpeCurveSet::Write(), CIccMpeTintArray::Write(), CIccMpeToneMap::Write(), CIccMpeMatrix::Write(), CIccMpeCLUT::Write(), CIccMpeExtCLUT::Write(), CIccMpeCAM::Write(), CIccMpeCalculator::Write(), CIccMpeSpectralMatrix::Write(), CIccMpeSpectralCLUT::Write(), and CIccMpeSpectralObserver::Write().

◆ m_nOutputChannels

icUInt16Number CIccMultiProcessElement::m_nOutputChannels
protectedinherited

Referenced by CIccMpeBAcs::CIccMpeBAcs(), CIccMpeBAcs::CIccMpeBAcs(), CIccMpeCalculator::CIccMpeCalculator(), CIccMpeCalculator::CIccMpeCalculator(), CIccMpeCAM::CIccMpeCAM(), CIccMpeCLUT::CIccMpeCLUT(), CIccMpeCLUT::CIccMpeCLUT(), CIccMpeCurveSet::CIccMpeCurveSet(), CIccMpeCurveSet::CIccMpeCurveSet(), CIccMpeEAcs::CIccMpeEAcs(), CIccMpeEAcs::CIccMpeEAcs(), CIccMpeExtCLUT::CIccMpeExtCLUT(), CIccMpeMatrix::CIccMpeMatrix(), CIccMpeMatrix::CIccMpeMatrix(), CIccMpeSpectralCLUT::CIccMpeSpectralCLUT(), CIccMpeSpectralCLUT::CIccMpeSpectralCLUT(), CIccMpeSpectralMatrix::CIccMpeSpectralMatrix(), CIccMpeSpectralMatrix::CIccMpeSpectralMatrix(), CIccMpeSpectralObserver::CIccMpeSpectralObserver(), CIccMpeSpectralObserver::CIccMpeSpectralObserver(), CIccMpeTintArray::CIccMpeTintArray(), CIccMpeTintArray::CIccMpeTintArray(), CIccMpeToneMap::CIccMpeToneMap(), CIccMpeToneMap::CIccMpeToneMap(), CIccMultiProcessElement::CIccMultiProcessElement(), CIccMpeTintArray::Apply(), CIccMpeToneMap::Apply(), CIccMpeMatrix::Apply(), CIccMpeAcs::Begin(), CIccMpeTintArray::Begin(), CIccMpeToneMap::Begin(), CIccMpeMatrix::Begin(), CIccMpeEmissionMatrix::Begin(), CIccMpeInvEmissionMatrix::Begin(), CIccMpeEmissionCLUT::Begin(), CIccMpeReflectanceCLUT::Begin(), CIccMpeEmissionObserver::Begin(), CIccMpeReflectanceObserver::Begin(), CIccMpeToneMap::ClearToneFuncs(), CIccMpeSpectralCLUT::copyData(), CIccMpeSpectralMatrix::copyData(), CIccMpeSpectralObserver::copyData(), CIccMpeToneMap::CopyToneFuncs(), CIccMpeMatrix::Describe(), CIccMpeCalculator::Describe(), CIccMpeSpectralMatrix::Describe(), CIccMpeSpectralObserver::Describe(), CIccMpeTintArray::Describe(), CIccMpeToneMap::Describe(), CIccMpeXmlCalculator::Flatten(), CIccMpeToneMap::Insert(), CIccMultiProcessElement::NumOutputChannels(), CIccMpeInvEmissionMatrix::numVectors(), CIccMpeBAcs::operator=(), CIccMpeCalculator::operator=(), CIccMpeCLUT::operator=(), CIccMpeCurveSet::operator=(), CIccMpeEAcs::operator=(), CIccMpeMatrix::operator=(), CIccMpeTintArray::operator=(), CIccMpeToneMap::operator=(), CIccMpeXmlTintArray::ParseXml(), CIccMpeXmlToneMap::ParseXml(), ParseXml(), CIccMpeXmlCLUT::ParseXml(), CIccMpeXmlExtCLUT::ParseXml(), CIccMpeXmlBAcs::ParseXml(), CIccMpeXmlEAcs::ParseXml(), CIccMpeXmlJabToXYZ::ParseXml(), CIccMpeXmlXYZToJab::ParseXml(), CIccMpeXmlCalculator::ParseXml(), CIccMpeXmlEmissionCLUT::ParseXml(), CIccMpeXmlReflectanceCLUT::ParseXml(), CIccMpeAcs::Read(), CIccMpeTintArray::Read(), CIccMpeToneMap::Read(), CIccMpeMatrix::Read(), CIccMpeCLUT::Read(), CIccMpeExtCLUT::Read(), CIccMpeCAM::Read(), CIccMpeSpectralCLUT::Read(), CIccMpeCLUT::SetCLUT(), CIccMpeSpectralCLUT::SetData(), CIccMpeToneMap::SetNumOutputChannels(), CIccMpeCalculator::SetSize(), CIccMpeMatrix::SetSize(), CIccMpeSpectralMatrix::SetSize(), CIccMpeSpectralObserver::SetSize(), CIccMpeCurveSet::SetSize(), CIccMpeTintArray::SetVectorSize(), CIccMpeTintArray::Validate(), CIccMpeToneMap::Validate(), CIccMpeCAM::Validate(), CIccMpeSpectralMatrix::Validate(), CIccMpeSpectralObserver::Validate(), CIccMpeAcs::Write(), CIccMpeTintArray::Write(), CIccMpeToneMap::Write(), CIccMpeMatrix::Write(), CIccMpeCLUT::Write(), CIccMpeExtCLUT::Write(), CIccMpeCAM::Write(), CIccMpeCalculator::Write(), CIccMpeSpectralMatrix::Write(), CIccMpeSpectralCLUT::Write(), and CIccMpeSpectralObserver::Write().

◆ m_nReserved

icUInt32Number CIccMultiProcessElement::m_nReserved
inherited

Referenced by CIccMpeAcs::CIccMpeAcs(), CIccMpeBAcs::CIccMpeBAcs(), CIccMpeCalculator::CIccMpeCalculator(), CIccMpeCalculator::CIccMpeCalculator(), CIccMpeCAM::CIccMpeCAM(), CIccMpeCLUT::CIccMpeCLUT(), CIccMpeCLUT::CIccMpeCLUT(), CIccMpeCurveSet::CIccMpeCurveSet(), CIccMpeCurveSet::CIccMpeCurveSet(), CIccMpeEAcs::CIccMpeEAcs(), CIccMpeExtCLUT::CIccMpeExtCLUT(), CIccMpeMatrix::CIccMpeMatrix(), CIccMpeMatrix::CIccMpeMatrix(), CIccMpeSpectralCLUT::CIccMpeSpectralCLUT(), CIccMpeSpectralCLUT::CIccMpeSpectralCLUT(), CIccMpeSpectralMatrix::CIccMpeSpectralMatrix(), CIccMpeSpectralMatrix::CIccMpeSpectralMatrix(), CIccMpeSpectralObserver::CIccMpeSpectralObserver(), CIccMpeSpectralObserver::CIccMpeSpectralObserver(), CIccMpeTintArray::CIccMpeTintArray(), CIccMpeTintArray::CIccMpeTintArray(), CIccMpeToneMap::CIccMpeToneMap(), CIccMpeToneMap::CIccMpeToneMap(), CIccMultiProcessElement::CIccMultiProcessElement(), CIccMpeSpectralCLUT::copyData(), CIccMpeSpectralMatrix::copyData(), CIccMpeSpectralObserver::copyData(), CIccMpeBAcs::operator=(), CIccMpeCalculator::operator=(), CIccMpeCLUT::operator=(), CIccMpeCurveSet::operator=(), CIccMpeEAcs::operator=(), CIccMpeMatrix::operator=(), CIccMpeTintArray::operator=(), CIccMpeToneMap::operator=(), CIccTagXmlMultiProcessElement::ParseElement(), CIccMpeXmlCalculator::ParseImport(), CIccMpeAcs::Read(), CIccMpeCurveSet::Read(), CIccMpeTintArray::Read(), CIccMpeToneMap::Read(), CIccMpeMatrix::Read(), CIccMpeCLUT::Read(), CIccMpeExtCLUT::Read(), CIccMpeCAM::Read(), CIccMpeCalculator::Read(), CIccMpeSpectralMatrix::Read(), CIccMpeSpectralCLUT::Read(), CIccMpeSpectralObserver::Read(), CIccMpeXmlCurveSet::ToXml(), CIccMpeXmlTintArray::ToXml(), CIccMpeXmlToneMap::ToXml(), ToXml(), CIccMpeXmlCLUT::ToXml(), CIccMpeXmlExtCLUT::ToXml(), CIccMpeXmlBAcs::ToXml(), CIccMpeXmlEAcs::ToXml(), CIccMpeXmlJabToXYZ::ToXml(), CIccMpeXmlXYZToJab::ToXml(), CIccMpeXmlCalculator::ToXml(), CIccMpeXmlEmissionMatrix::ToXml(), CIccMpeXmlInvEmissionMatrix::ToXml(), CIccMpeXmlEmissionCLUT::ToXml(), CIccMpeXmlReflectanceCLUT::ToXml(), CIccMpeXmlEmissionObserver::ToXml(), CIccMpeXmlReflectanceObserver::ToXml(), CIccMultiProcessElement::Validate(), CIccMpeAcs::Write(), CIccMpeCurveSet::Write(), CIccMpeTintArray::Write(), CIccMpeToneMap::Write(), CIccMpeMatrix::Write(), CIccMpeCLUT::Write(), CIccMpeExtCLUT::Write(), CIccMpeCAM::Write(), CIccMpeCalculator::Write(), CIccMpeSpectralMatrix::Write(), CIccMpeSpectralCLUT::Write(), and CIccMpeSpectralObserver::Write().

◆ m_pConstants

◆ m_pMatrix

◆ m_size

◆ m_type

icMatrixElemType CIccMpeMatrix::m_type
protectedinherited

The documentation for this class was generated from the following files: