Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
CIccMpeXmlMatrix Class Reference

#include <IccMpeXml.h>

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

Public Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from CIccMultiProcessElement
static CIccMultiProcessElementCreate (icElemTypeSignature sig)
 Name: CIccMultiProcessElement::Create.
 
- Public Attributes inherited from CIccMultiProcessElement
icUInt32Number m_nReserved
 
- Protected Attributes inherited from CIccMpeMatrix
bool m_bApplyConstants
 
icFloatNumberm_pConstants
 
icFloatNumberm_pMatrix
 
icUInt32Number m_size
 
icMatrixElemType m_type
 
- Protected Attributes inherited from CIccMultiProcessElement
icUInt16Number m_nInputChannels
 
icUInt16Number m_nOutputChannels
 

Detailed Description

Definition at line 166 of file IccMpeXml.h.

Constructor & Destructor Documentation

◆ ~CIccMpeXmlMatrix()

virtual CIccMpeXmlMatrix::~CIccMpeXmlMatrix ( )
inlinevirtual

Definition at line 169 of file IccMpeXml.h.

169{}

Member Function Documentation

◆ GetClassName()

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

Reimplemented from CIccMpeMatrix.

Definition at line 171 of file IccMpeXml.h.

171{ return "CIccMpeXmlMatrix"; }

◆ GetExtension()

virtual IIccExtensionMpe * CIccMpeXmlMatrix::GetExtension ( )
inlinevirtual

Reimplemented from CIccMultiProcessElement.

Definition at line 173 of file IccMpeXml.h.

173{ return this; }

◆ ParseXml()

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

Implements CIccMpeXml.

Definition at line 1231 of file IccMpeXml.cpp.

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

References IccGetDefaultMatrixInverter(), icXmlAttrValue(), icXmlFindNode(), IIccMatrixInverter::Invert(), CIccXmlArrayType< T, Tsig >::ParseArray(), and stricmp.

+ Here is the call graph for this function:

◆ ToXml()

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

Implements CIccMpeXml.

Definition at line 1178 of file IccMpeXml.cpp.

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

References icNotZero, and icXmlFloatFmt.


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