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

#include <IccMpeBasic.h>

+ Inheritance diagram for CIccMpeMatrix:
+ Collaboration diagram for CIccMpeMatrix:

Public Member Functions

 CIccMpeMatrix ()
 
 CIccMpeMatrix (const CIccMpeMatrix &ITPC)
 
virtual ~CIccMpeMatrix ()
 
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 icCharGetClassName () const
 
icFloatNumberGetConstants () const
 
virtual icAcsSignature GetEAcsSig ()
 
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
 
CIccMpeMatrixoperator= (const CIccMpeMatrix &ParamCurveTag)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 
bool SetSize (icUInt16Number nInputChannels, icUInt16Number nOutputChannels, bool bUseConstants=true)
 
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

Class: CIccMpeMatrix

Purpose: The Matrix element with constant offset

Constructor & Destructor Documentation

◆ CIccMpeMatrix() [1/2]

CIccMpeMatrix::CIccMpeMatrix ( )

Name: CIccMpeMatrix::CIccMpeMatrix

Purpose:

Args:

Return:

4854{
4855 m_nReserved = 0;
4857 m_size = 0;
4858 m_pMatrix = NULL;
4859 m_pConstants = NULL;
4860}
icUInt32Number m_size
Definition IccMpeBasic.h:630
icFloatNumber * m_pConstants
Definition IccMpeBasic.h:629
icFloatNumber * m_pMatrix
Definition IccMpeBasic.h:628
icUInt16Number m_nOutputChannels
Definition IccTagMPE.h:192
icUInt16Number m_nInputChannels
Definition IccTagMPE.h:191
icUInt32Number m_nReserved
Definition IccTagMPE.h:188

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

Referenced by CIccBasicMpeFactory::CreateElement().

+ Here is the caller graph for this function:

◆ CIccMpeMatrix() [2/2]

CIccMpeMatrix::CIccMpeMatrix ( const CIccMpeMatrix matrix)

Name: CIccMpeMatrix::CIccMpeMatrix

Purpose:

Args:

Return:

4874{
4875 m_nReserved = matrix.m_nReserved;
4876
4879
4880 m_size = matrix.m_size;
4881 if(matrix.m_pMatrix) {
4882 int num = m_size * sizeof(icFloatNumber);
4883 m_pMatrix = (icFloatNumber*)malloc(num);
4884 memcpy(m_pMatrix, matrix.m_pMatrix, num);
4885 }
4886 else
4887 m_pMatrix = NULL;
4888
4889 if (matrix.m_pConstants) {
4890 int num = m_nOutputChannels*sizeof(icFloatNumber);
4891 m_pConstants = (icFloatNumber*)malloc(num);
4892 memcpy(m_pConstants, matrix.m_pConstants, num);
4893 }
4894 else
4895 m_pConstants = NULL;
4896
4897 m_bApplyConstants = true;
4898}
float icFloatNumber
Definition IccDefs.h:101
bool m_bApplyConstants
Definition IccMpeBasic.h:632

References m_bApplyConstants, CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMultiProcessElement::m_nReserved, m_pConstants, m_pMatrix, and m_size.

Referenced by NewCopy().

+ Here is the caller graph for this function:

◆ ~CIccMpeMatrix()

CIccMpeMatrix::~CIccMpeMatrix ( )
virtual

Name: CIccMpeMatrix::~CIccMpeMatrix

Purpose:

Args:

Return:

4956{
4957 if (m_pMatrix)
4958 free(m_pMatrix);
4959
4960 if (m_pConstants)
4961 free(m_pConstants);
4962}

References m_pConstants, and m_pMatrix.

Member Function Documentation

◆ Apply()

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

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
icMatrixElemType m_type
Definition IccMpeBasic.h:631

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

◆ Begin()

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

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, m_bApplyConstants, CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, m_pConstants, and 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 
)
virtual

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, m_pConstants, and m_pMatrix.

◆ GetApplyConstants()

bool CIccMpeMatrix::GetApplyConstants ( ) const
inline
620{return m_bApplyConstants;}

References m_bApplyConstants.

◆ 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 icChar * CIccMpeMatrix::GetClassName ( ) const
inlinevirtual

Implements CIccMultiProcessElement.

Reimplemented in CIccMpeXmlMatrix.

609{ return "CIccMpeMatrix"; }

◆ GetConstants()

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

References m_pConstants.

◆ GetEAcsSig()

virtual icAcsSignature CIccMultiProcessElement::GetEAcsSig ( )
inlinevirtualinherited

Reimplemented in CIccMpeEAcs.

179{ return icSigAcsZero; }

◆ GetExtension()

◆ GetMatrix()

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

References 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
inlinevirtual

Implements CIccMultiProcessElement.

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

References icSigMatrixElemType.

Referenced by Validate(), and 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
inlinevirtual

Implements CIccMultiProcessElement.

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

References CIccMpeMatrix().

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams().

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

◆ NumInputChannels()

◆ NumOutputChannels()

◆ operator=()

CIccMpeMatrix & CIccMpeMatrix::operator= ( const CIccMpeMatrix matrix)

Name: &CIccMpeMatrix::operator=

Purpose:

Args:

Return:

4911{
4912 m_nReserved = matrix.m_nReserved;
4913
4916
4917 if (m_pMatrix)
4918 free(m_pMatrix);
4919
4920 m_size = matrix.m_size;
4921 if (matrix.m_pMatrix) {
4922 int num = m_size * sizeof(icFloatNumber);
4923 m_pMatrix = (icFloatNumber*)malloc(num);
4924 memcpy(m_pMatrix, matrix.m_pMatrix, num);
4925 }
4926 else
4927 m_pMatrix = NULL;
4928
4929 if (m_pConstants)
4930 free(m_pConstants);
4931
4932 if (matrix.m_pConstants) {
4933 int num = m_nOutputChannels*sizeof(icFloatNumber);
4934 m_pConstants = (icFloatNumber*)malloc(num);
4935 memcpy(m_pConstants, matrix.m_pConstants, num);
4936 }
4937 else
4938 m_pConstants = NULL;
4939
4941
4942 return *this;
4943}

References m_bApplyConstants, CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMultiProcessElement::m_nReserved, m_pConstants, m_pMatrix, and m_size.

◆ Read()

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

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
unsigned short icUInt16Number
Definition icProfileHeader.h:256
long icInt32Number
Definition icProfileHeader.h:291
icElemTypeSignature
Definition icProfileHeader.h:641
unsigned long icUInt32Number
Definition icProfileHeader.h:262
bool SetSize(icUInt16Number nInputChannels, icUInt16Number nOutputChannels, bool bUseConstants=true)
Definition IccMpeBasic.cpp:4974
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

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

+ Here is the call graph for this function:

◆ SetSize()

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

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, m_pConstants, m_pMatrix, and m_size.

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

+ Here is the caller graph for this function:

◆ Validate()

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

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(), GetType(), icGetSigPath(), icMsgValidateCriticalError, icValidateCriticalError, m_pConstants, and CIccMultiProcessElement::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccMpeMatrix::Write ( CIccIO pIO)
virtual

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 GetType(), CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMultiProcessElement::m_nReserved, m_pConstants, m_pMatrix, m_size, CIccIO::Write16(), CIccIO::Write32(), and CIccIO::WriteFloat32Float().

+ Here is the call graph for this function:

Field Documentation

◆ m_bApplyConstants

bool CIccMpeMatrix::m_bApplyConstants
protected

◆ 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(), 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(), Apply(), CIccMpeAcs::Begin(), CIccMpeCurveSet::Begin(), Begin(), CIccMpeCLUT::Begin(), CIccMpeEmissionMatrix::Begin(), CIccMpeInvEmissionMatrix::Begin(), CIccMpeEmissionCLUT::Begin(), CIccMpeReflectanceCLUT::Begin(), CIccMpeEmissionObserver::Begin(), CIccMpeReflectanceObserver::Begin(), CIccMpeSpectralCLUT::copyData(), CIccMpeSpectralMatrix::copyData(), CIccMpeSpectralObserver::copyData(), CIccMpeCurveSet::Describe(), Describe(), CIccMpeCalculator::Describe(), CIccMpeSpectralMatrix::Describe(), CIccMpeSpectralObserver::Describe(), CIccMpeXmlCalculator::Flatten(), CIccMultiProcessElement::NumInputChannels(), CIccMpeEmissionMatrix::numVectors(), CIccMpeBAcs::operator=(), CIccMpeCalculator::operator=(), CIccMpeCLUT::operator=(), CIccMpeCurveSet::operator=(), CIccMpeEAcs::operator=(), operator=(), CIccMpeTintArray::operator=(), CIccMpeToneMap::operator=(), CIccMpeXmlTintArray::ParseXml(), CIccMpeXmlToneMap::ParseXml(), CIccMpeXmlMatrix::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(), Read(), CIccMpeCLUT::Read(), CIccMpeExtCLUT::Read(), CIccMpeCAM::Read(), CIccMpeSpectralCLUT::Read(), CIccMpeCLUT::SetCLUT(), CIccMpeCurveSet::SetCurve(), CIccMpeSpectralCLUT::SetData(), CIccMpeCalculator::SetSize(), 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(), 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(), 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(), Apply(), CIccMpeAcs::Begin(), CIccMpeTintArray::Begin(), CIccMpeToneMap::Begin(), Begin(), CIccMpeEmissionMatrix::Begin(), CIccMpeInvEmissionMatrix::Begin(), CIccMpeEmissionCLUT::Begin(), CIccMpeReflectanceCLUT::Begin(), CIccMpeEmissionObserver::Begin(), CIccMpeReflectanceObserver::Begin(), CIccMpeToneMap::ClearToneFuncs(), CIccMpeSpectralCLUT::copyData(), CIccMpeSpectralMatrix::copyData(), CIccMpeSpectralObserver::copyData(), CIccMpeToneMap::CopyToneFuncs(), 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=(), operator=(), CIccMpeTintArray::operator=(), CIccMpeToneMap::operator=(), CIccMpeXmlTintArray::ParseXml(), CIccMpeXmlToneMap::ParseXml(), CIccMpeXmlMatrix::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(), Read(), CIccMpeCLUT::Read(), CIccMpeExtCLUT::Read(), CIccMpeCAM::Read(), CIccMpeSpectralCLUT::Read(), CIccMpeCLUT::SetCLUT(), CIccMpeSpectralCLUT::SetData(), CIccMpeToneMap::SetNumOutputChannels(), CIccMpeCalculator::SetSize(), 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(), 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(), 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=(), operator=(), CIccMpeTintArray::operator=(), CIccMpeToneMap::operator=(), CIccTagXmlMultiProcessElement::ParseElement(), CIccMpeXmlCalculator::ParseImport(), CIccMpeAcs::Read(), CIccMpeCurveSet::Read(), CIccMpeTintArray::Read(), CIccMpeToneMap::Read(), Read(), CIccMpeCLUT::Read(), CIccMpeExtCLUT::Read(), CIccMpeCAM::Read(), CIccMpeCalculator::Read(), CIccMpeSpectralMatrix::Read(), CIccMpeSpectralCLUT::Read(), CIccMpeSpectralObserver::Read(), CIccMpeXmlCurveSet::ToXml(), CIccMpeXmlTintArray::ToXml(), CIccMpeXmlToneMap::ToXml(), CIccMpeXmlMatrix::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(), Write(), CIccMpeCLUT::Write(), CIccMpeExtCLUT::Write(), CIccMpeCAM::Write(), CIccMpeCalculator::Write(), CIccMpeSpectralMatrix::Write(), CIccMpeSpectralCLUT::Write(), and CIccMpeSpectralObserver::Write().

◆ m_pConstants

◆ m_pMatrix

◆ m_size

icUInt32Number CIccMpeMatrix::m_size
protected

◆ m_type

icMatrixElemType CIccMpeMatrix::m_type
protected

Referenced by Apply(), and Begin().


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