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

Class: CIccMpeCalculator. More...

#include <IccMpeCalc.h>

+ Inheritance diagram for CIccMpeCalculator:
+ Collaboration diagram for CIccMpeCalculator:

Public Member Functions

virtual void Apply (CIccApplyMpe *pApply, icFloatNumber *pDestPixel, const icFloatNumber *pSrcPixel) const
 Name: CIccMpeCalculator::Apply.
 
virtual bool Begin (icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
 Name: CIccMpeCalculator::Begin.
 
 CIccMpeCalculator (const CIccMpeCalculator &curveSet)
 Name: CIccMpeCalculator::CIccMpeCalculator.
 
 CIccMpeCalculator (icUInt16Number nInputChannels=0, icUInt16Number nOutputChannels=0)
 Name: CIccMpeCalculator::CIccMpeCalculator.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccMpeCalculator::Describe.
 
virtual const icCharGetClassName () const
 
CIccMultiProcessElementGetElem (icSigCalcOp op, icUInt16Number index)
 Name: CIccMpeCalculator::GetSubApply.
 
virtual CIccApplyMpeGetNewApply (CIccApplyTagMpe *pApplyTag)
 Name: CIccMpeCalculator::Begin.
 
virtual icElemTypeSignature GetType () const
 
virtual bool IsLateBinding () const
 Name: CIccMpeCalculator::IsLateBinding.
 
virtual bool IsLateBindingReflectance () const
 Name: CIccMpeCalculator::IsLateBindingReflectance.
 
virtual CIccMpeCalculatorNewCopy () const
 
CIccMpeCalculatoroperator= (const CIccMpeCalculator &curveSet)
 Name: &CIccMpeCalculator::operator=.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccMpeCalculator::Read.
 
void Reset ()
 
icFuncParseStatus SetCalcFunc (const char *szFuncDef, std::string &sReport)
 Name: CIccMpeCalculator::SetCalcFunc.
 
icFuncParseStatus SetCalcFunc (icCalculatorFuncPtr newFunc)
 Name: CIccMpeCalculator::SetCalcFunc.
 
void SetSize (icUInt16Number nInputChannels, icUInt16Number nOutputChannels)
 Name: CIccMpeCalculator::SetSize.
 
bool SetSubElem (icUInt32Number idx, CIccMultiProcessElement *pElem)
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const
 Name: CIccMpeCalculator::Validate.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccMpeCalculator::Write.
 
virtual ~CIccMpeCalculator ()
 Name: CIccMpeCalculator::~CIccMpeCalculator.
 
- Public Member Functions inherited from CIccMultiProcessElement
 CIccMultiProcessElement ()
 
virtual icAcsSignature GetBAcsSig ()
 
virtual icAcsSignature GetEAcsSig ()
 
virtual IIccExtensionMpeGetExtension ()
 
virtual bool IsAcs ()
 
virtual bool IsSupported ()
 
virtual icUInt16Number NumInputChannels () const
 
virtual icUInt16Number NumOutputChannels () const
 
virtual ~CIccMultiProcessElement ()
 

Protected Member Functions

bool SetElem (icUInt32Number idx, CIccMultiProcessElement *pElem, icUInt32Number &count, CIccMultiProcessElement ***pArray)
 Name: CIccMpeCalculator::GetSubApply.
 

Protected Attributes

bool m_bNeedTempReset
 
icCalculatorFuncPtr m_calcFunc
 
icUInt32Number m_nSubElem
 
icUInt32Number m_nTempChannels
 
IIccCmmEnvVarLookupm_pCmmEnvVarLookup
 
CIccMultiProcessElement ** m_SubElem
 
- Protected Attributes inherited from CIccMultiProcessElement
icUInt16Number m_nInputChannels
 
icUInt16Number m_nOutputChannels
 

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
 

Detailed Description

Class: CIccMpeCalculator.

Purpose: The Calculator process element

Definition at line 446 of file IccMpeCalc.h.

Constructor & Destructor Documentation

◆ CIccMpeCalculator() [1/2]

CIccMpeCalculator::CIccMpeCalculator ( icUInt16Number nInputChannels = 0,
icUInt16Number nOutputChannels = 0 )

Name: CIccMpeCalculator::CIccMpeCalculator.

Purpose:

Args:

Return:

Definition at line 4200 of file IccMpeCalc.cpp.

4202{
4203 m_nReserved = 0;
4204 m_nInputChannels = nInputChannels;
4205 m_nOutputChannels = nOutputChannels;
4206 m_nTempChannels = 0;
4207 m_bNeedTempReset = true;
4208 m_nSubElem = 0;
4209 m_SubElem = NULL;
4210 m_calcFunc = NULL;
4211 m_pCmmEnvVarLookup = NULL;
4212}
icUInt32Number m_nTempChannels
Definition IccMpeCalc.h:485
icCalculatorFuncPtr m_calcFunc
Definition IccMpeCalc.h:491
IIccCmmEnvVarLookup * m_pCmmEnvVarLookup
Definition IccMpeCalc.h:493
icUInt32Number m_nSubElem
Definition IccMpeCalc.h:488
CIccMultiProcessElement ** m_SubElem
Definition IccMpeCalc.h:489
icUInt16Number m_nOutputChannels
Definition IccTagMPE.h:192
icUInt16Number m_nInputChannels
Definition IccTagMPE.h:191
icUInt32Number m_nReserved
Definition IccTagMPE.h:188

References m_bNeedTempReset, m_calcFunc, CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMultiProcessElement::m_nReserved, m_nSubElem, m_nTempChannels, m_pCmmEnvVarLookup, and m_SubElem.

◆ CIccMpeCalculator() [2/2]

CIccMpeCalculator::CIccMpeCalculator ( const CIccMpeCalculator & channelGen)

Name: CIccMpeCalculator::CIccMpeCalculator.

Purpose:

Args:

Return:

Definition at line 4224 of file IccMpeCalc.cpp.

4225{
4226 m_nReserved = channelGen.m_nReserved;
4227
4230 m_nTempChannels = channelGen.m_nTempChannels;
4231
4233
4234 m_nSubElem = channelGen.m_nSubElem;
4236
4238
4239 icCalculatorFuncPtr ptr = channelGen.m_calcFunc;
4240
4241 if (ptr)
4242 m_calcFunc = ptr->NewCopy();
4243 else
4244 m_calcFunc = NULL;
4245
4246 if (channelGen.m_nSubElem) {
4248
4250 if (m_SubElem) {
4251 for (i=0; i<m_nSubElem; i++) {
4252 if (channelGen.m_SubElem[i])
4253 m_SubElem[i] = channelGen.m_SubElem[i]->NewCopy();
4254 }
4255 }
4256 else {
4257 m_nSubElem = 0;
4258 m_SubElem = NULL;
4259 }
4260 }
4261 else {
4262 m_nSubElem = 0;
4263 m_SubElem = NULL;
4264 }
4265}
unsigned int icUInt32Number
Class: CIccCalculatorFunc.
Definition IccMpeCalc.h:364
virtual CIccCalculatorFunc * NewCopy() const
Definition IccMpeCalc.h:369
Class: CIccMultiProcessElement.
Definition IccTagMPE.h:146
virtual CIccMultiProcessElement * NewCopy() const =0

References m_bNeedTempReset, m_calcFunc, CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMultiProcessElement::m_nReserved, m_nSubElem, m_nTempChannels, m_pCmmEnvVarLookup, m_SubElem, CIccCalculatorFunc::NewCopy(), and CIccMultiProcessElement::NewCopy().

+ Here is the call graph for this function:

◆ ~CIccMpeCalculator()

CIccMpeCalculator::~CIccMpeCalculator ( )
virtual

Name: CIccMpeCalculator::~CIccMpeCalculator.

Purpose:

Args:

Return:

Definition at line 4328 of file IccMpeCalc.cpp.

4329{
4330 SetSize(0,0);
4331}
void SetSize(icUInt16Number nInputChannels, icUInt16Number nOutputChannels)
Name: CIccMpeCalculator::SetSize.

References SetSize().

+ Here is the call graph for this function:

Member Function Documentation

◆ Apply()

void CIccMpeCalculator::Apply ( CIccApplyMpe * pApply,
icFloatNumber * pDestPixel,
const icFloatNumber * pSrcPixel ) const
virtual

Name: CIccMpeCalculator::Apply.

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

Definition at line 4781 of file IccMpeCalc.cpp.

4782{
4783 CIccApplyMpeCalculator *pApplyCalc = (CIccApplyMpeCalculator*)pApply;
4784 icFloatNumber *pSrcTemp = pApplyCalc->m_temp;
4785 bool rv;
4786
4787 pApplyCalc->m_temp = pSrcTemp;
4788 pApplyCalc->m_input = pSrcPixel;
4789 pApplyCalc->m_output = pDestPixel;
4790
4791 if (m_bNeedTempReset) {
4792 memset(pSrcTemp, 0, m_nTempChannels*sizeof(icFloatNumber));
4793 }
4794
4795 if (g_pDebugger) {
4797 rv = m_calcFunc->Apply(pApplyCalc);
4798 if (!rv)
4799 g_pDebugger->Error("Calc Function Apply Terminated with an error!");
4800
4802 }
4803 else {
4804 rv = m_calcFunc->Apply(pApplyCalc);
4805 }
4806}
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
static IIccCalcDebugger * g_pDebugger
Class: CIccApplyMpeCalculator.
Definition IccMpeCalc.h:505
icFloatNumber * m_output
Definition IccMpeCalc.h:533
const icFloatNumber * m_input
Definition IccMpeCalc.h:532
icFloatNumber * m_temp
Definition IccMpeCalc.h:534
virtual bool Apply(CIccApplyMpeCalculator *pApply) const
Name: CIccCalculatorFunc::Apply.
virtual void EndApply()=0
virtual void Error(const char *msg)=0
virtual void BeginApply()=0

References CIccCalculatorFunc::Apply(), IIccCalcDebugger::BeginApply(), IIccCalcDebugger::EndApply(), IIccCalcDebugger::Error(), g_pDebugger, m_bNeedTempReset, m_calcFunc, CIccApplyMpeCalculator::m_input, m_nTempChannels, CIccApplyMpeCalculator::m_output, and CIccApplyMpeCalculator::m_temp.

+ Here is the call graph for this function:

◆ Begin()

bool CIccMpeCalculator::Begin ( icElemInterp nInterp,
CIccTagMultiProcessElement * pMPE )
virtual

Name: CIccMpeCalculator::Begin.

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

Definition at line 4686 of file IccMpeCalc.cpp.

4687{
4688 if (!m_calcFunc)
4689 return false;
4690
4692
4694
4695 if (m_nTempChannels>65536)
4696 return false;
4697
4698 if (m_nTempChannels) {
4699 icUInt8Number *tempUsage = (icUInt8Number *)calloc(m_nTempChannels, sizeof(icUInt8Number));
4700 if (tempUsage) {
4702 free(tempUsage);
4703 }
4704 else
4705 m_bNeedTempReset = true;
4706 }
4707 else {
4708 m_bNeedTempReset = false;
4709 }
4710
4711 if (!m_calcFunc->Begin(this, pMPE))
4712 return false;
4713
4715 for (n=0; n<m_nSubElem; n++) {
4716 if (m_SubElem[n] && !m_SubElem[n]->Begin(nInterp, pMPE))
4717 return false;
4718 }
4719
4720 return true;
4721}
virtual bool Begin(const CIccMpeCalculator *pChannelMux, CIccTagMultiProcessElement *pMPE)
Name: CIccCalculatorFunc::Begin.
icUInt32Number GetMaxTemp() const
Name: CIccCalculatorFunc::GetMaxTemp.
bool NeedTempReset(icUInt8Number *tempUsage, icUInt32Number nMaxTemp)
Name: CIccCalculatorFunc::NeedTempReset.
virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
Name: CIccMpeCalculator::Begin.
IIccCmmEnvVarLookup * GetCmmEnvLookup()
Definition IccTagMPE.h:405
unsigned char icUInt8Number
Number definitions.

References CIccCalculatorFunc::Begin(), Begin(), CIccTagMultiProcessElement::GetCmmEnvLookup(), CIccCalculatorFunc::GetMaxTemp(), m_bNeedTempReset, m_calcFunc, m_nSubElem, m_nTempChannels, m_pCmmEnvVarLookup, m_SubElem, and CIccCalculatorFunc::NeedTempReset().

Referenced by Begin().

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

◆ Describe()

void CIccMpeCalculator::Describe ( std::string & sDescription,
int nVerboseness )
virtual

Name: CIccMpeCalculator::Describe.

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

Definition at line 4429 of file IccMpeCalc.cpp.

4430{
4431 if (m_calcFunc) {
4432 icChar buf[81];
4433
4434 sprintf(buf, "BEGIN_CALC_ELEMENT %u %u\n", m_nInputChannels, m_nOutputChannels);
4435 sDescription += buf;
4436
4437 if (m_nSubElem && m_SubElem) {
4439 for (i=0; i<m_nSubElem; i++) {
4440 sprintf(buf, "BEGIN_SUBCALCELEM %u\n", i);
4441 sDescription += buf;
4442 m_SubElem[i]->Describe(sDescription, nVerboseness);
4443 sprintf(buf, "END_SUBCALCELEM %u\n\n", i);
4444 sDescription += buf;
4445 }
4446 }
4447
4448 if (m_calcFunc) {
4449 sDescription += "BEGIN_CALC_FUNCTION\n";
4450 m_calcFunc->Describe(sDescription, nVerboseness);
4451 sDescription += "END_CALC_FUNCTION\n";
4452 }
4453
4454 sprintf(buf, "END_CALC_ELEMENT\n");
4455 sDescription += buf;
4456
4457 }
4458}
char icChar
Definition IccDefs.h:109
virtual void Describe(std::string &sDescription, int nVerboseness=0, int nBlanks=0)
Name: CIccCalculatorFunc::Describe.
virtual void Describe(std::string &sDescription, int nVerboseness)=0

References CIccCalculatorFunc::Describe(), CIccMultiProcessElement::Describe(), m_calcFunc, CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, m_nSubElem, and m_SubElem.

+ Here is the call graph for this function:

◆ GetClassName()

virtual const icChar * CIccMpeCalculator::GetClassName ( ) const
inlinevirtual

Implements CIccMultiProcessElement.

Reimplemented in CIccMpeXmlCalculator.

Definition at line 464 of file IccMpeCalc.h.

464{ return "CIccMpeCalculator"; }

◆ GetElem()

CIccMultiProcessElement * CIccMpeCalculator::GetElem ( icSigCalcOp opsig,
icUInt16Number index )

Name: CIccMpeCalculator::GetSubApply.

Purpose:

Args:

Return:

Definition at line 4912 of file IccMpeCalc.cpp.

4913{
4914 if (m_SubElem && index<m_nSubElem) {
4915 CIccMultiProcessElement *pMpe = m_SubElem[index];
4916 if (opsig==icSigApplyElemOp)
4917 return pMpe;
4918
4919 if ((opsig==icSigApplyCurvesOp && pMpe->GetType() != icSigCurveSetElemType) ||
4920 (opsig==icSigApplyMatrixOp && pMpe->GetType() != icSigMatrixElemType) ||
4921 (opsig==icSigApplyCLutOp && !(pMpe->GetType() == icSigCLutElemType || pMpe->GetType() == icSigExtCLutElemType)) ||
4922 (opsig==icSigApplyTintOp && pMpe->GetType() != icSigTintArrayElemType) ||
4923 (opsig==icSigApplyToJabOp && pMpe->GetType() != icSigXYZToJabElemType) ||
4924 (opsig==icSigApplyFromJabOp && pMpe->GetType() != icSigJabToXYZElemType) ||
4925 (opsig==icSigApplyCalcOp && pMpe->GetType() != icSigCalculatorElemType))
4926 return NULL;
4927
4928 return pMpe;
4929 }
4930
4931 return NULL;
4932}
@ icSigApplyFromJabOp
Definition IccMpeCalc.h:134
@ icSigApplyCLutOp
Definition IccMpeCalc.h:131
@ icSigApplyCurvesOp
Definition IccMpeCalc.h:129
@ icSigApplyElemOp
Definition IccMpeCalc.h:136
@ icSigApplyToJabOp
Definition IccMpeCalc.h:133
@ icSigApplyTintOp
Definition IccMpeCalc.h:132
@ icSigApplyCalcOp
Definition IccMpeCalc.h:135
@ icSigApplyMatrixOp
Definition IccMpeCalc.h:130
virtual icElemTypeSignature GetType() const =0
@ icSigCurveSetElemType
@ icSigCLutElemType
@ icSigExtCLutElemType
@ icSigTintArrayElemType
@ icSigXYZToJabElemType
@ icSigJabToXYZElemType
@ icSigMatrixElemType
@ icSigCalculatorElemType

References CIccMultiProcessElement::GetType(), icSigApplyCalcOp, icSigApplyCLutOp, icSigApplyCurvesOp, icSigApplyElemOp, icSigApplyFromJabOp, icSigApplyMatrixOp, icSigApplyTintOp, icSigApplyToJabOp, icSigCalculatorElemType, icSigCLutElemType, icSigCurveSetElemType, icSigExtCLutElemType, icSigJabToXYZElemType, icSigMatrixElemType, icSigTintArrayElemType, icSigXYZToJabElemType, m_nSubElem, and m_SubElem.

Referenced by SIccCalcOp::ArgsPushed(), SIccCalcOp::ArgsUsed(), and SIccCalcOp::IsValidOp().

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

◆ GetNewApply()

CIccApplyMpe * CIccMpeCalculator::GetNewApply ( CIccApplyTagMpe * pApplyTag)
virtual

Name: CIccMpeCalculator::Begin.

Purpose:

Args:

Return:

Reimplemented from CIccMultiProcessElement.

Definition at line 4733 of file IccMpeCalc.cpp.

4734{
4735 CIccApplyTagMpe *pApplyTagEx = (CIccApplyTagMpe*)pApplyTag;
4736
4738
4739 if (!pApply)
4740 return NULL;
4741
4742 if (m_nTempChannels) {
4743 pApply->m_temp = (icFloatNumber*)malloc(m_nTempChannels*sizeof(icFloatNumber));
4744 }
4745 pApply->m_stack = new CIccFloatVector;
4746 pApply->m_scratch = new CIccFloatVector;
4747 pApply->m_scratch->resize(50);
4749
4751
4752 pApply->m_nSubElem = m_nSubElem;
4753 if(m_nSubElem) {
4754 pApply->m_SubElem = (CIccSubCalcApply **)calloc(m_nSubElem, sizeof(CIccSubCalcApply));
4755
4756 if (m_SubElem) {
4757 for (i=0; i<m_nSubElem; i++) {
4758 if (m_SubElem[i]) {
4759 pApply->m_SubElem[i] = new CIccSubCalcApply(m_SubElem[i]->GetNewApply(pApplyTag));
4760 }
4761 }
4762 }
4763 }
4764 else {
4765 m_SubElem=NULL;
4766 }
4767 return pApply;
4768}
std::vector< icFloatNumber > CIccFloatVector
Definition IccMpeCalc.h:263
icUInt32Number m_nSubElem
Definition IccMpeCalc.h:537
CIccSubCalcApply ** m_SubElem
Definition IccMpeCalc.h:538
CIccFloatVector * m_stack
Definition IccMpeCalc.h:528
CIccFloatVector * m_scratch
Definition IccMpeCalc.h:529
IIccCmmEnvVarLookup * m_pCmmEnvVarLookup
Definition IccMpeCalc.h:540
Class: CIccTagMultiProcessElement.
Definition IccTagMPE.h:321
virtual CIccApplyMpe * GetNewApply(CIccApplyTagMpe *pApplyTag)
Name: CIccMpeCalculator::Begin.

References GetNewApply(), CIccApplyMpeCalculator::m_nSubElem, m_nSubElem, m_nTempChannels, CIccApplyMpeCalculator::m_pCmmEnvVarLookup, m_pCmmEnvVarLookup, CIccApplyMpeCalculator::m_scratch, CIccApplyMpeCalculator::m_stack, CIccApplyMpeCalculator::m_SubElem, m_SubElem, and CIccApplyMpeCalculator::m_temp.

Referenced by GetNewApply().

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

◆ GetType()

virtual icElemTypeSignature CIccMpeCalculator::GetType ( ) const
inlinevirtual

Implements CIccMultiProcessElement.

Definition at line 463 of file IccMpeCalc.h.

463{ return icSigCalculatorElemType; }

References icSigCalculatorElemType.

Referenced by Validate(), and Write().

+ Here is the caller graph for this function:

◆ IsLateBinding()

bool CIccMpeCalculator::IsLateBinding ( ) const
virtual

Name: CIccMpeCalculator::IsLateBinding.

Purpose:

Args:

Return:

Reimplemented from CIccMultiProcessElement.

Definition at line 4863 of file IccMpeCalc.cpp.

4864{
4866
4867 if (m_SubElem) {
4868 for (i=0; i<m_nSubElem; i++) {
4869 if (m_SubElem[i] && m_SubElem[i]->IsLateBinding())
4870 return true;
4871 }
4872 }
4873
4874 return false;
4875}
virtual bool IsLateBinding() const
Name: CIccMpeCalculator::IsLateBinding.

References IsLateBinding(), m_nSubElem, and m_SubElem.

Referenced by IsLateBinding().

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

◆ IsLateBindingReflectance()

bool CIccMpeCalculator::IsLateBindingReflectance ( ) const
virtual

Name: CIccMpeCalculator::IsLateBindingReflectance.

Purpose:

Args:

Return:

Reimplemented from CIccMultiProcessElement.

Definition at line 4887 of file IccMpeCalc.cpp.

4888{
4890
4891 if (m_SubElem) {
4892 for (i=0; i<m_nSubElem; i++) {
4894 return true;
4895 }
4896 }
4897
4898 return false;
4899}
virtual bool IsLateBindingReflectance() const
Name: CIccMpeCalculator::IsLateBindingReflectance.

References IsLateBindingReflectance(), m_nSubElem, and m_SubElem.

Referenced by IsLateBindingReflectance().

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

◆ NewCopy()

virtual CIccMpeCalculator * CIccMpeCalculator::NewCopy ( ) const
inlinevirtual

Implements CIccMultiProcessElement.

Definition at line 452 of file IccMpeCalc.h.

452{ return new CIccMpeCalculator(*this);}
CIccMpeCalculator(icUInt16Number nInputChannels=0, icUInt16Number nOutputChannels=0)
Name: CIccMpeCalculator::CIccMpeCalculator.

Referenced by CIccSampledCalculatorCurve::CIccSampledCalculatorCurve(), and CIccSampledCalculatorCurve::operator=().

+ Here is the caller graph for this function:

◆ operator=()

CIccMpeCalculator & CIccMpeCalculator::operator= ( const CIccMpeCalculator & channelGen)

Name: &CIccMpeCalculator::operator=.

Purpose:

Args:

Return:

Definition at line 4277 of file IccMpeCalc.cpp.

4278{
4279 m_nReserved = channelGen.m_nReserved;
4280
4281 SetSize(0,0);
4282
4285
4287
4288 icCalculatorFuncPtr ptr = channelGen.m_calcFunc;
4289
4290 if (ptr)
4291 m_calcFunc = ptr->NewCopy();
4292 else
4293 m_calcFunc = NULL;
4294
4295 if (channelGen.m_nSubElem) {
4297
4299 if (m_SubElem) {
4300 for (i=0; i<m_nSubElem; i++) {
4301 if (channelGen.m_SubElem[i])
4302 m_SubElem[i] = channelGen.m_SubElem[i]->NewCopy();
4303 }
4304 }
4305 else {
4306 m_nSubElem = 0;
4307 m_SubElem = NULL;
4308 }
4309 }
4310 else {
4311 m_nSubElem = 0;
4312 m_SubElem = NULL;
4313 }
4314
4315 return *this;
4316}

References m_calcFunc, CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMultiProcessElement::m_nReserved, m_nSubElem, m_pCmmEnvVarLookup, m_SubElem, CIccCalculatorFunc::NewCopy(), CIccMultiProcessElement::NewCopy(), and SetSize().

+ Here is the call graph for this function:

◆ Read()

bool CIccMpeCalculator::Read ( icUInt32Number size,
CIccIO * pIO )
virtual

Name: CIccMpeCalculator::Read.

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

Definition at line 4473 of file IccMpeCalc.cpp.

4474{
4476
4477 icUInt32Number startPos = pIO->Tell();
4478
4479 icUInt32Number headerSize = sizeof(icTagTypeSignature) +
4480 sizeof(icUInt32Number) +
4481 sizeof(icUInt16Number) +
4482 sizeof(icUInt16Number) +
4483 sizeof(icUInt16Number) +
4484 sizeof(icUInt16Number) +
4485 sizeof(icUInt16Number) +
4486 sizeof(icUInt16Number);
4487
4488 if (headerSize > size)
4489 return false;
4490
4491 if (!pIO) {
4492 return false;
4493 }
4494
4495 icUInt16Number nInputChannels, nOutputChannels;
4496
4497 if (!pIO->Read32(&sig))
4498 return false;
4499
4500 if (!pIO->Read32(&m_nReserved))
4501 return false;
4502
4503 if (!pIO->Read16(&nInputChannels))
4504 return false;
4505
4506 if (!pIO->Read16(&nOutputChannels))
4507 return false;
4508
4509 SetSize(nInputChannels, nOutputChannels);
4510
4511 icUInt32Number nSubElem;
4512
4513 if (!pIO->Read32(&nSubElem))
4514 return false;
4515
4516 icUInt32Number nPos = nSubElem + 1;
4517
4518 if (headerSize + (icUInt64Number)nPos*sizeof(icPositionNumber) > size) {
4519 return false;
4520 }
4521
4522 icPositionNumber *pos, *posvals = (icPositionNumber*)malloc(nPos*sizeof(icPositionNumber));
4523 if (!posvals) {
4524 return false;
4525 }
4526
4527 icUInt32Number n = nPos * (sizeof(icPositionNumber)/sizeof(icUInt32Number));
4528 if (pIO->Read32(posvals, n)!=n) {
4529 free(posvals);
4530 return false;
4531 }
4532
4533 pos = &posvals[1];
4534 if (nSubElem) {
4535 icElemTypeSignature elemSig;
4536
4537 SetSubElem(nSubElem-1, NULL); //Initialize array
4538
4539 for (n=0; n<nSubElem; n++) {
4540 if (pos->offset + pos->size > size) {
4541 free(posvals);
4542 return false;
4543 }
4544 pIO->Seek(startPos + pos->offset, icSeekSet);
4545
4546 if (!pIO->Read32(&elemSig)) {
4547 free(posvals);
4548 return false;
4549 }
4550
4552 if (!pElem) {
4553 free(posvals);
4554 return false;
4555 }
4556
4557 pIO->Seek(startPos + pos->offset, icSeekSet);
4558 if (!pElem->Read(pos->size, pIO)) {
4559 free(posvals);
4560 return false;
4561 }
4563 pos++;
4564 }
4565 }
4566
4567 m_calcFunc = new CIccCalculatorFunc(this);
4568 pos = posvals;
4569
4570 if (!m_calcFunc || pos->offset + pos->size > size) {
4571 free(posvals);
4572 return false;
4573 }
4574
4575 pIO->Seek(startPos + pos->offset, icSeekSet);
4576
4577 if (!m_calcFunc->Read(pos->size, pIO)) {
4578 return false;
4579 }
4580 free(posvals);
4581
4582 pIO->Seek(startPos + size, icSeekSet);
4583
4584 return true;
4585}
icArraySignature sig
@ icSeekSet
Definition IccIO.h:83
icTagTypeSignature
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccCalculatorFunc::Read.
icInt32Number Read16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:114
virtual icInt32Number Tell()
Definition IccIO.h:133
virtual icInt32Number Seek(icInt32Number nOffset, icSeekVal pos)
Definition IccIO.h:132
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
Class: CIccMpeCalculator.
Definition IccMpeCalc.h:447
bool SetSubElem(icUInt32Number idx, CIccMultiProcessElement *pElem)
Definition IccMpeCalc.h:461
virtual bool Read(icUInt32Number size, CIccIO *pIO)=0
static CIccMultiProcessElement * Create(icElemTypeSignature sig)
Name: CIccMultiProcessElement::Create.
unsigned short icUInt16Number
icElemTypeSignature
Multi-Processing Element type signatures.
icUInt32Number icUInt64Number[2]
icUInt32Number offset
icUInt32Number size

References CIccMultiProcessElement::Create(), icSeekSet, m_calcFunc, CIccMultiProcessElement::m_nReserved, icPositionNumber::offset, CIccCalculatorFunc::Read(), CIccMultiProcessElement::Read(), CIccIO::Read16(), CIccIO::Read32(), CIccIO::Seek(), SetSize(), SetSubElem(), sig, icPositionNumber::size, and CIccIO::Tell().

+ Here is the call graph for this function:

◆ Reset()

void CIccMpeCalculator::Reset ( )
inline

Definition at line 455 of file IccMpeCalc.h.

455{ SetSize(0,0); }

◆ SetCalcFunc() [1/2]

icFuncParseStatus CIccMpeCalculator::SetCalcFunc ( const char * szFuncDef,
std::string & sReport )

Name: CIccMpeCalculator::SetCalcFunc.

Purpose:

Args:

Return:

Definition at line 4395 of file IccMpeCalc.cpp.

4396{
4397
4398 if (m_calcFunc) {
4399 delete m_calcFunc;
4400 m_calcFunc = NULL;
4401 }
4402
4403 CIccCalculatorFunc *pFunc = new CIccCalculatorFunc(this);
4404 icFuncParseStatus rv = pFunc->SetFunction(szFuncDef, sReport);
4405
4406 if (rv!=icFuncParseNoError) {
4407 delete pFunc;
4408 m_calcFunc = NULL;
4409
4410 return rv;
4411 }
4412
4413 m_calcFunc = pFunc;
4414
4415 return rv;
4416}
icFuncParseStatus
Definition IccMpeCalc.h:308
@ icFuncParseNoError
Definition IccMpeCalc.h:309
icFuncParseStatus SetFunction(const char *szFuncDef, std::string &sReport)
Name: CIccCalculatorFunc::SetFunction.

References icFuncParseNoError, m_calcFunc, and CIccCalculatorFunc::SetFunction().

+ Here is the call graph for this function:

◆ SetCalcFunc() [2/2]

icFuncParseStatus CIccMpeCalculator::SetCalcFunc ( icCalculatorFuncPtr newChannelFunc)

Name: CIccMpeCalculator::SetCalcFunc.

Purpose:

Args:

Return:

Definition at line 4375 of file IccMpeCalc.cpp.

4376{
4377 if (m_calcFunc) {
4378 delete m_calcFunc;
4379 }
4380 m_calcFunc = newChannelFunc;
4381
4382 return icFuncParseNoError;
4383}

References icFuncParseNoError, and m_calcFunc.

◆ SetElem()

bool CIccMpeCalculator::SetElem ( icUInt32Number idx,
CIccMultiProcessElement * pElem,
icUInt32Number & count,
CIccMultiProcessElement *** pArray )
protected

Name: CIccMpeCalculator::GetSubApply.

Purpose:

Args:

Return:

Definition at line 4945 of file IccMpeCalc.cpp.

4946{
4947 bool rv = true;
4948
4949 if (idx+1>count) {
4950 if (*pArray) {
4951 *pArray = (CIccMultiProcessElement**)icRealloc(*pArray, (idx+1)*sizeof(CIccMultiProcessElement*));
4952
4953 if (!(*pArray))
4954 return false;
4955
4957 for (i=count; i<=idx; i++) {
4958 (*pArray)[i] = NULL;
4959 }
4960 }
4961 else {
4962 *pArray = (CIccMultiProcessElement**)calloc(idx+1, sizeof(CIccMultiProcessElement*));
4963
4964 if (!(*pArray))
4965 return false;
4966 }
4967 count = idx+1;
4968 }
4969
4970 if ((*pArray)[idx]) {
4971 delete (*pArray)[idx];
4972 rv = false;
4973 }
4974
4975 (*pArray)[idx] = pElem;
4976
4977 return rv;
4978}
void * icRealloc(void *ptr, size_t size)
Name: icRealloc.
Definition IccUtil.cpp:111

References icRealloc().

+ Here is the call graph for this function:

◆ SetSize()

void CIccMpeCalculator::SetSize ( icUInt16Number nInputChannels,
icUInt16Number nOutputChannels )

Name: CIccMpeCalculator::SetSize.

Purpose:

Args:

Return:

Definition at line 4343 of file IccMpeCalc.cpp.

4344{
4345 if (m_calcFunc) {
4346 delete m_calcFunc;
4347 m_calcFunc = NULL;
4348 }
4350
4351 if (m_SubElem) {
4352 for (i=0; i<m_nSubElem; i++) {
4353 if (m_SubElem[i])
4354 delete m_SubElem[i];
4355 }
4356 free(m_SubElem);
4357 m_SubElem = NULL;
4358 m_nSubElem = 0;
4359 }
4360
4361 m_nInputChannels = nInputChannels;
4362 m_nOutputChannels = nOutputChannels;
4363}

References m_calcFunc, CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, m_nSubElem, and m_SubElem.

Referenced by operator=(), Read(), and ~CIccMpeCalculator().

+ Here is the caller graph for this function:

◆ SetSubElem()

bool CIccMpeCalculator::SetSubElem ( icUInt32Number idx,
CIccMultiProcessElement * pElem )
inline

Definition at line 461 of file IccMpeCalc.h.

461{ return SetElem(idx, pElem, m_nSubElem, &m_SubElem); }
bool SetElem(icUInt32Number idx, CIccMultiProcessElement *pElem, icUInt32Number &count, CIccMultiProcessElement ***pArray)
Name: CIccMpeCalculator::GetSubApply.

Referenced by Read().

+ Here is the caller graph for this function:

◆ Validate()

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

Name: CIccMpeCalculator::Validate.

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

Definition at line 4818 of file IccMpeCalc.cpp.

4819{
4820 std::string mpeSigPath = sigPath + icGetSigPath(GetType());
4821 icValidateStatus rv = CIccMultiProcessElement::Validate(sigPath, sReport, pMPE, pProfile);
4822
4824
4825 if (m_SubElem) {
4826 for (i=0; i<m_nSubElem; i++) {
4827 if (m_SubElem[i])
4828 rv = icMaxStatus(rv, m_SubElem[i]->Validate(mpeSigPath, sReport, pMPE, pProfile));
4829 }
4830 }
4831
4832 bool empty=false;
4833 if (m_calcFunc) {
4834 rv = icMaxStatus(rv, m_calcFunc->Validate(mpeSigPath, sReport, this, pProfile));
4835 }
4836 else
4837 empty = true;
4838
4839 if (empty) {
4840 CIccInfo Info;
4841 std::string sSigPathName = Info.GetSigPathName(sigPath);
4842
4843 sReport += icMsgValidateCriticalError;
4844 sReport += sSigPathName;
4845 sReport += " - Has an Empty Calculator Functions!\n";
4847 }
4848
4849 return rv;
4850}
icValidateStatus
Definition IccDefs.h:118
@ icValidateCriticalError
Definition IccDefs.h:122
icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Name: icMaxStatus.
Definition IccUtil.cpp:244
std::string icGetSigPath(icUInt32Number nSig)
Definition IccUtil.cpp:1191
const char * icMsgValidateCriticalError
Definition IccUtil.cpp:92
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccMpeCalculator *pChannelCalc=NULL, const CIccProfile *pProfile=NULL) const
Name: CIccCalculatorFunc::Validate.
Type: Class.
Definition IccUtil.h:303
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614
virtual icElemTypeSignature GetType() const
Definition IccMpeCalc.h:463
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const
Name: CIccMpeCalculator::Validate.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const =0
Name: CIccProcessElement::Validate.

References CIccInfo::GetSigPathName(), GetType(), icGetSigPath(), icMaxStatus(), icMsgValidateCriticalError, icValidateCriticalError, m_calcFunc, m_nSubElem, m_SubElem, CIccCalculatorFunc::Validate(), Validate(), and CIccMultiProcessElement::Validate().

Referenced by Validate().

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

◆ Write()

bool CIccMpeCalculator::Write ( CIccIO * pIO)
virtual

Name: CIccMpeCalculator::Write.

Purpose:

Args:

Return:

Implements CIccMultiProcessElement.

Definition at line 4597 of file IccMpeCalc.cpp.

4598{
4600
4601 if (!pIO)
4602 return false;
4603
4604 icUInt32Number elemStart = pIO->Tell();
4605
4606 if (!pIO->Write32(&sig))
4607 return false;
4608
4609 if (!pIO->Write32(&m_nReserved))
4610 return false;
4611
4612 if (!pIO->Write16(&m_nInputChannels))
4613 return false;
4614
4615 if (!pIO->Write16(&m_nOutputChannels))
4616 return false;
4617
4618 if (!pIO->Write32(&m_nSubElem))
4619 return false;
4620
4621 icUInt32Number nPos = m_nSubElem + 1;
4622
4623 icPositionNumber *pos, *posvals = (icPositionNumber*)calloc(nPos, sizeof(icPositionNumber));
4624 if (!posvals) {
4625 return false;
4626 }
4627 icUInt32Number nPositionStart = pIO->Tell();
4628
4629 icUInt32Number n, np = nPos * (sizeof(icPositionNumber)/sizeof(icUInt32Number));
4630 if (pIO->Write32(posvals, np)!=np) {
4631 free(posvals);
4632 return false;
4633 }
4634
4635 if (m_calcFunc) {
4636 posvals[0].offset = pIO->Tell()-elemStart;
4637 if (!m_calcFunc->Write(pIO)) {
4638 free(posvals);
4639 return false;
4640 }
4641 posvals[0].size = pIO->Tell()-elemStart - posvals[nPos-1].offset;
4642 pIO->Align32();
4643 }
4644
4645 pos = &posvals[1];
4646
4647 if (m_nSubElem) {
4648 for(n=0; n<m_nSubElem; n++) {
4649 if (m_SubElem[n]) {
4650 pos->offset = pIO->Tell()-elemStart;
4651 if (!m_SubElem[n]->Write(pIO)) {
4652 free(posvals);
4653 return false;
4654 }
4655 pos->size = pIO->Tell()-elemStart - pos->offset;
4656 pIO->Align32();
4657 }
4658 pos++;
4659 }
4660 }
4661 icUInt32Number endPos = pIO->Tell();
4662
4663 pIO->Seek(nPositionStart, icSeekSet);
4664
4665 if (pIO->Write32(posvals, np)!=np) {
4666 free(posvals);
4667 return false;
4668 }
4669 free(posvals);
4670
4671 pIO->Seek(endPos, icSeekSet);
4672
4673 return true;
4674}
virtual bool Write(CIccIO *pIO)
Name: CIccCalculatorFunc::Write.
icInt32Number Write16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:122
bool Align32()
Write operation to make sure that filelength is evenly divisible by 4.
Definition IccIO.cpp:341
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152
virtual bool Write(CIccIO *pIO)
Name: CIccMpeCalculator::Write.

References CIccIO::Align32(), GetType(), icSeekSet, m_calcFunc, CIccMultiProcessElement::m_nInputChannels, CIccMultiProcessElement::m_nOutputChannels, CIccMultiProcessElement::m_nReserved, m_nSubElem, m_SubElem, icPositionNumber::offset, CIccIO::Seek(), sig, icPositionNumber::size, CIccIO::Tell(), CIccCalculatorFunc::Write(), Write(), CIccIO::Write16(), and CIccIO::Write32().

Referenced by Write().

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

Member Data Documentation

◆ m_bNeedTempReset

bool CIccMpeCalculator::m_bNeedTempReset
protected

Definition at line 486 of file IccMpeCalc.h.

Referenced by Apply(), Begin(), CIccMpeCalculator(), and CIccMpeCalculator().

◆ m_calcFunc

icCalculatorFuncPtr CIccMpeCalculator::m_calcFunc
protected

◆ m_nSubElem

◆ m_nTempChannels

icUInt32Number CIccMpeCalculator::m_nTempChannels
protected

Definition at line 485 of file IccMpeCalc.h.

Referenced by Apply(), Begin(), CIccMpeCalculator(), CIccMpeCalculator(), and GetNewApply().

◆ m_pCmmEnvVarLookup

IIccCmmEnvVarLookup* CIccMpeCalculator::m_pCmmEnvVarLookup
protected

Definition at line 493 of file IccMpeCalc.h.

Referenced by Begin(), CIccMpeCalculator(), CIccMpeCalculator(), GetNewApply(), and operator=().

◆ m_SubElem


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