IccMAX 2.1.27
Color Profile Tools
Loading...
Searching...
No Matches
CIccSampledCalculatorCurveXml Class Reference
+ Inheritance diagram for CIccSampledCalculatorCurveXml:
+ Collaboration diagram for CIccSampledCalculatorCurveXml:

Public Member Functions

 CIccSampledCalculatorCurveXml (icFloatNumber first=0, icFloatNumber last=0)
 
virtual icFloatNumber Apply (icFloatNumber v) const
 
virtual bool Begin (icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
 
virtual void Describe (std::string &sDescription, int nVerboseness=100)
 
virtual const icCharGetClassName () const
 
icUInt16Number GetExtensionType ()
 
virtual icUInt32Number GetRecommendedSize ()
 
virtual icUInt32Number GetSize ()
 
virtual icCurveElemSignature GetType () const
 
virtual CIccCurveSetCurveNewCopy () const
 
bool ParseXml (xmlNode *pNode, std::string &parseStr)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 
bool SetCalculator (CIccMpeCalculator *pCalc)
 
bool SetExtensionType (icUInt16Number nExtensionType)
 
void SetRange (icFloatNumber first=0.0f, icFloatNumber last=1.0f)
 
virtual bool SetRecommendedSize (icUInt32Number nSize)
 
virtual bool SetSize (icUInt32Number nSize, bool bZeroAlloc=true)
 
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 CIccCurveSetCurveCreate (icCurveElemSignature sig)
 

Protected Member Functions

icUInt16Number GetStorageType ()
 
bool SetStorageType (icUInt16Number nStorateType)
 

Protected Attributes

icUInt16Number m_extensionType
 
icFloatNumber m_firstEntry
 
icFloatNumber m_hiIntercept
 
icFloatNumber m_hiSlope
 
icFloatNumber m_last
 
icFloatNumber m_lastEntry
 
icFloatNumber m_loIntercept
 
icFloatNumber m_loSlope
 
icUInt32Number m_nCount
 
icUInt32Number m_nDesiredSize
 
icUInt32Number m_nReserved
 
icUInt16Number m_nReserved2
 
CIccMpeCalculatorm_pCalc
 
icFloatNumberm_pSamples
 
icFloatNumber m_range
 
icUInt16Number m_storageType
 

Detailed Description

Constructor & Destructor Documentation

◆ CIccSampledCalculatorCurveXml()

CIccSampledCalculatorCurveXml::CIccSampledCalculatorCurveXml ( icFloatNumber  first = 0,
icFloatNumber  last = 0 
)
inline
511: CIccSampledCalculatorCurve(first, last) {}
Definition IccMpeBasic.h:354

References CIccSampledCalculatorCurve::CIccSampledCalculatorCurve().

Referenced by ParseXmlCurve().

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

Member Function Documentation

◆ Apply()

icFloatNumber CIccSampledCalculatorCurve::Apply ( icFloatNumber  v) const
virtualinherited

Name: CIccSampledCalculatorCurve::Apply

Purpose:

Args:

Return:

Implements CIccCurveSetCurve.

2422{
2423 if (v < m_firstEntry) {
2424 return m_loSlope * v + m_loIntercept;;
2425 }
2426 else if (v > m_lastEntry) {
2427 return m_hiSlope * v + m_hiIntercept;
2428 }
2429
2430 icFloatNumber pos = (v - m_firstEntry) / m_range * m_last;
2431 icUInt32Number index = (icUInt32Number)pos;
2432 icFloatNumber remainder = pos - (icFloatNumber)index;
2433
2434 if (remainder == 0.0)
2435 return m_pSamples[index];
2436
2437 return (icFloatNumber)((1.0 - remainder)*m_pSamples[index] + remainder*m_pSamples[index + 1]);
2438}
unsigned long icUInt32Number
Definition icProfileHeader.h:262
float icFloatNumber
Definition IccDefs.h:101
icFloatNumber m_hiIntercept
Definition IccMpeBasic.h:409
icFloatNumber m_hiSlope
Definition IccMpeBasic.h:408
icFloatNumber m_firstEntry
Definition IccMpeBasic.h:400
icFloatNumber m_lastEntry
Definition IccMpeBasic.h:401
icFloatNumber m_last
Definition IccMpeBasic.h:404
icFloatNumber m_range
Definition IccMpeBasic.h:403
icFloatNumber m_loIntercept
Definition IccMpeBasic.h:407
icFloatNumber * m_pSamples
Definition IccMpeBasic.h:395
icFloatNumber m_loSlope
Definition IccMpeBasic.h:406

References CIccSampledCalculatorCurve::m_firstEntry, CIccSampledCalculatorCurve::m_hiIntercept, CIccSampledCalculatorCurve::m_hiSlope, CIccSampledCalculatorCurve::m_last, CIccSampledCalculatorCurve::m_lastEntry, CIccSampledCalculatorCurve::m_loIntercept, CIccSampledCalculatorCurve::m_loSlope, CIccSampledCalculatorCurve::m_pSamples, and CIccSampledCalculatorCurve::m_range.

◆ Begin()

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

Name: CIccSampledCalculatorCurve::Begin

Purpose:

Args:

Return:

Implements CIccCurveSetCurve.

2354{
2355 if (m_nDesiredSize < 2 || !m_pCalc || !m_pCalc->Begin(nInterp, pMPE))
2356 return false;
2357
2359 if (nSize < 2)
2360 nSize = 2;
2361 if (nSize > ICC_MAXCALCCURVESIZE)
2362 nSize = ICC_MAXCALCCURVESIZE;
2363
2364 SetSize(nSize);
2365
2367
2368 if (m_range == 0.0)
2369 return false;
2370
2371 m_last = (icFloatNumber)(m_nCount - 1);
2372 icFloatNumber stepSize = m_range / m_last;
2373
2374 //Use calculator element to populate lookup table
2375 CIccApplyMpe *pApply = m_pCalc->GetNewApply(NULL);
2376 for (icUInt32Number i = 0; i < m_nCount; i++) {
2377 icFloatNumber src, dst;
2379
2380 m_pCalc->Apply(pApply, &dst, &src);
2381 m_pSamples[i] = dst;
2382 }
2383
2384 if (pApply)
2385 delete pApply;
2386
2387 switch (m_extensionType) {
2389 m_loSlope = 0.0;
2391
2392 m_hiSlope = 0.0;
2394 break;
2395
2397 m_loSlope = (m_pSamples[1] - m_pSamples[0]) / stepSize;
2399
2400 m_hiSlope = (m_pSamples[m_nCount - 1] - m_pSamples[m_nCount - 2]) / stepSize;
2402 break;
2403
2404 default:
2405 return false;
2406 }
2407
2408 return true;
2409}
@ icExtendSingleSampledCurve
Definition icProfileHeader.h:1068
@ icClipSingleSampledCurve
Definition icProfileHeader.h:1067
#define ICC_MAXCALCCURVESIZE
Definition IccMpeBasic.h:344
icUInt32Number m_nDesiredSize
Definition IccMpeBasic.h:413
icUInt16Number m_extensionType
Definition IccMpeBasic.h:398
CIccMpeCalculator * m_pCalc
Definition IccMpeBasic.h:411
virtual bool Begin(icElemInterp nInterp, CIccTagMultiProcessElement *pMPE)
Definition IccMpeBasic.cpp:2353
icUInt32Number m_nCount
Definition IccMpeBasic.h:394
virtual bool SetSize(icUInt32Number nSize, bool bZeroAlloc=true)
Definition IccMpeBasic.cpp:2153
Definition IccTagMPE.h:203
virtual CIccApplyMpe * GetNewApply(CIccApplyTagMpe *pApplyTag)
Definition IccMpeCalc.cpp:4734
virtual void Apply(CIccApplyMpe *pApply, icFloatNumber *pDestPixel, const icFloatNumber *pSrcPixel) const
Definition IccMpeCalc.cpp:4782

References CIccMpeCalculator::Apply(), CIccMpeCalculator::Begin(), CIccMpeCalculator::GetNewApply(), icClipSingleSampledCurve, icExtendSingleSampledCurve, CIccSampledCalculatorCurve::m_extensionType, CIccSampledCalculatorCurve::m_firstEntry, CIccSampledCalculatorCurve::m_hiIntercept, CIccSampledCalculatorCurve::m_hiSlope, CIccSampledCalculatorCurve::m_last, CIccSampledCalculatorCurve::m_lastEntry, CIccSampledCalculatorCurve::m_loIntercept, CIccSampledCalculatorCurve::m_loSlope, CIccSampledCalculatorCurve::m_nCount, CIccSampledCalculatorCurve::m_nDesiredSize, CIccSampledCalculatorCurve::m_pCalc, CIccSampledCalculatorCurve::m_pSamples, CIccSampledCalculatorCurve::m_range, and CIccSampledCalculatorCurve::SetSize().

+ Here is the call graph for this function:

◆ Create()

CIccCurveSetCurve * CIccCurveSetCurve::Create ( icCurveElemSignature  sig)
staticinherited

Name: CIccCurveSetCurve::Create

Purpose:

Args:

Return:

2961{
2962 switch (sig) {
2964 return new CIccSegmentedCurve();
2966 return new CIccSingleSampledCurve();
2968 return new CIccSampledCalculatorCurve();
2969 default:
2970 return NULL;
2971 }
2972}
@ icSigSegmentedCurve
Definition icProfileHeader.h:1057
@ icSigSampledCalculatorCurve
Definition icProfileHeader.h:1059
@ icSigSingleSampledCurve
Definition icProfileHeader.h:1058
Definition IccMpeBasic.h:249
Definition IccMpeBasic.h:287

References CIccSampledCalculatorCurve::CIccSampledCalculatorCurve(), CIccSegmentedCurve::CIccSegmentedCurve(), CIccSingleSampledCurve::CIccSingleSampledCurve(), icSigSampledCalculatorCurve, icSigSegmentedCurve, and icSigSingleSampledCurve.

Referenced by CIccMpeCurveSet::Read(), and CIccMpeToneMap::Read().

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

◆ Describe()

void CIccSampledCalculatorCurve::Describe ( std::string &  sDescription,
int  nVerboseness = 100 
)
virtualinherited

Name: CIccSampledCalculatorCurve::Describe

Purpose:

Args:

Return:

Implements CIccCurveSetCurve.

2191{
2192 icChar buf[128];
2193
2194 if (!m_pCalc) {
2195 sDescription += "Empty Sampled Calculator Curve [";
2196 sprintf(buf, "%.8f, ", m_firstEntry);
2197 sDescription += buf;
2198
2199 sprintf(buf, "%.8f,", m_lastEntry);
2200 sDescription += buf;
2201
2202 sprintf(buf, "%d", m_nDesiredSize);
2203 sDescription += buf;
2204
2205 sprintf(buf, "]\r\n");
2206 sDescription += buf;
2207 }
2208 else {
2209 sDescription += "Sampled Calculator Curve [";
2210
2211 sprintf(buf, "%.8f, ", m_firstEntry);
2212 sDescription += buf;
2213
2214 sprintf(buf, "%.8f,", m_lastEntry);
2215 sDescription += buf;
2216
2217 sprintf(buf, "%d", m_nDesiredSize);
2218 sDescription += buf;
2219
2220 sprintf(buf, "]\r\n");
2221 sDescription += buf;
2222
2223 switch (m_extensionType) {
2225 sDescription += "Clip End Points\n";
2226 break;
2228 sDescription += "Extend End Points\n";
2229 break;
2230 default:
2231 sDescription += "Unknown extension handling\n";
2232 break;
2233 }
2234 m_pCalc->Describe(sDescription, nVerboseness);
2235 }
2236 sDescription += "\r\n";
2237}
char icChar
Definition IccDefs.h:110
virtual void Describe(std::string &sDescription, int nVerboseness)
Definition IccMpeCalc.cpp:4430

References CIccMpeCalculator::Describe(), icClipSingleSampledCurve, icExtendSingleSampledCurve, CIccSampledCalculatorCurve::m_extensionType, CIccSampledCalculatorCurve::m_firstEntry, CIccSampledCalculatorCurve::m_lastEntry, CIccSampledCalculatorCurve::m_nDesiredSize, and CIccSampledCalculatorCurve::m_pCalc.

+ Here is the call graph for this function:

◆ GetClassName()

virtual const icChar * CIccSampledCalculatorCurve::GetClassName ( ) const
inlinevirtualinherited

Implements CIccCurveSetCurve.

363{ return "CIccSampledCalculatorCurve"; }

◆ GetExtensionType()

icUInt16Number CIccSampledCalculatorCurve::GetExtensionType ( )
inlineinherited

◆ GetRecommendedSize()

virtual icUInt32Number CIccSampledCalculatorCurve::GetRecommendedSize ( )
inlinevirtualinherited

◆ GetSize()

virtual icUInt32Number CIccSampledCalculatorCurve::GetSize ( )
inlinevirtualinherited
373{ return m_nCount; }

References CIccSampledCalculatorCurve::m_nCount.

◆ GetStorageType()

icUInt16Number CIccSampledCalculatorCurve::GetStorageType ( )
inlineprotectedinherited
389{ return 0; }

◆ GetType()

virtual icCurveElemSignature CIccSampledCalculatorCurve::GetType ( ) const
inlinevirtualinherited

Implements CIccCurveSetCurve.

References icSigSampledCalculatorCurve.

Referenced by CIccSampledCalculatorCurve::Read(), and CIccSampledCalculatorCurve::Write().

+ Here is the caller graph for this function:

◆ NewCopy()

virtual CIccCurveSetCurve * CIccSampledCalculatorCurve::NewCopy ( ) const
inlinevirtualinherited

Implements CIccCurveSetCurve.

359{ return new CIccSampledCalculatorCurve(*this); }

References CIccSampledCalculatorCurve::CIccSampledCalculatorCurve().

+ Here is the call graph for this function:

◆ ParseXml()

bool CIccSampledCalculatorCurveXml::ParseXml ( xmlNode *  pNode,
std::string &  parseStr 
)
555{
556 xmlAttr *attr = icXmlFindAttr(pNode, "FirstEntry");
557
558 if (!attr) {
559 parseStr += "Bad FirstEntry in Sampled Calculator Curve\n";
560 return false;
561 }
562
564
565 attr = icXmlFindAttr(pNode, "LastEntry");
566
567 if (!attr) {
568 parseStr += "Bad LastEntry in Sampled Calculator Curve\n";
569 return false;
570 }
571
573
574 attr = icXmlFindAttr(pNode, "DesiredSize");
575
576 if (!attr) {
577 parseStr += "Bad DesiredSize in Sampled Calculator Curve\n";
578 return false;
579 }
580
582
583 xmlNode *pCalcNode = icXmlFindNode(pNode->children, "CalculatorElement");
584 if (pCalcNode) {
586
587 if (!pCalc->ParseXml(pCalcNode, parseStr)) {
588 parseStr += "Unable to parse calculator element in Sampled Calculator Curve\n";
589 return false;
590 }
591 m_pCalc = pCalc;
592 }
593 else {
594 parseStr += "Missing Calculator Element in Sampled Calculator Curve\n";
595 return false;
596 }
597
598 return true;
599}
xmlAttr * icXmlFindAttr(xmlNode *pNode, const char *szAttrName)
Definition IccUtilXml.cpp:669
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
Definition IccUtilXml.cpp:687
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault="")
Definition IccUtilXml.cpp:572
Definition IccMpeXml.h:302
virtual bool ParseXml(xmlNode *pNode, std::string &parseStr)
Definition IccMpeXml.cpp:3080

References CIccMpeXmlCalculator::CIccMpeXmlCalculator(), icXmlAttrValue(), icXmlFindAttr(), icXmlFindNode(), CIccSampledCalculatorCurve::m_firstEntry, CIccSampledCalculatorCurve::m_lastEntry, CIccSampledCalculatorCurve::m_nDesiredSize, CIccSampledCalculatorCurve::m_pCalc, and CIccMpeXmlCalculator::ParseXml().

Referenced by ParseXmlCurve().

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

◆ Read()

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

Name: CIccSampledCalculatorCurve::Read

Purpose:

Args:

Return:

Implements CIccCurveSetCurve.

2250{
2252
2253 icUInt32Number headerSize = sizeof(icTagTypeSignature) +
2254 sizeof(icUInt32Number) +
2255 sizeof(icUInt32Number) +
2256 sizeof(icFloat32Number) +
2257 sizeof(icFloat32Number) +
2258 sizeof(icUInt16Number) +
2259 sizeof(icUInt16Number);
2260
2261 if (headerSize >= size)
2262 return false;
2263
2264 if (!pIO) {
2265 return false;
2266 }
2267
2268 if (!pIO->Read32(&sig) || sig != GetType())
2269 return false;
2270
2271 if (!pIO->Read32(&m_nReserved))
2272 return false;
2273
2274 if (!pIO->Read32(&m_nDesiredSize))
2275 return false;
2276
2277 if (!pIO->ReadFloat32Float(&m_firstEntry))
2278 return false;
2279
2280 if (!pIO->ReadFloat32Float(&m_lastEntry))
2281 return false;
2282
2283 if (!pIO->Read16(&m_extensionType))
2284 return false;
2285
2286 if (!pIO->Read16(&m_nReserved2))
2287 return false;
2288
2290 return false;
2291
2292 if (!m_pCalc->Read(size - headerSize, pIO))
2293 return false;
2294
2295 return true;
2296}
float icFloat32Number
Definition icProfileHeader.h:313
unsigned short icUInt16Number
Definition icProfileHeader.h:256
icCurveSegSignature
Definition icProfileHeader.h:1045
@ icSigCalculatorElemType
Definition icProfileHeader.h:649
icTagTypeSignature
Definition icProfileHeader.h:526
icUInt32Number m_nReserved
Definition IccMpeBasic.h:391
icUInt16Number m_nReserved2
Definition IccMpeBasic.h:392
bool SetCalculator(CIccMpeCalculator *pCalc)
Definition IccMpeBasic.cpp:2103
virtual icCurveElemSignature GetType() const
Definition IccMpeBasic.h:362
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
static CIccMultiProcessElement * Create(icElemTypeSignature sig)
Definition IccTagMPE.cpp:131
Definition IccMpeCalc.h:447
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Definition IccMpeCalc.cpp:4474

References CIccMultiProcessElement::Create(), CIccSampledCalculatorCurve::GetType(), icSigCalculatorElemType, CIccSampledCalculatorCurve::m_extensionType, CIccSampledCalculatorCurve::m_firstEntry, CIccSampledCalculatorCurve::m_lastEntry, CIccSampledCalculatorCurve::m_nDesiredSize, CIccSampledCalculatorCurve::m_nReserved, CIccSampledCalculatorCurve::m_nReserved2, CIccSampledCalculatorCurve::m_pCalc, CIccMpeCalculator::Read(), CIccIO::Read16(), CIccIO::Read32(), CIccIO::ReadFloat32Float(), and CIccSampledCalculatorCurve::SetCalculator().

+ Here is the call graph for this function:

◆ SetCalculator()

bool CIccSampledCalculatorCurve::SetCalculator ( CIccMpeCalculator pCalc)
inherited

Name: CIccSampledCalculatorCurve::SetCalculator Purpose: Sets calculator associated with the curve

Args: nSize = desired number of elements in lut (must be >= 2).

Return: true if calculator element is valid for curve, false otherwise

2104{
2105 if (m_pCalc)
2106 delete m_pCalc;
2107
2108 m_pCalc = pCalc;
2109
2110 return true;
2111}

References CIccSampledCalculatorCurve::m_pCalc.

Referenced by CIccSampledCalculatorCurve::Read().

+ Here is the caller graph for this function:

◆ SetExtensionType()

bool CIccSampledCalculatorCurve::SetExtensionType ( icUInt16Number  nExtensionType)
inherited

Name: CIccSampledCalculatorCurve::SetExtensionType

Purpose: Sets extension type of the single sampled curve

Args: nExtensionType is type of extension to use

Return: true if valid extension type, false otherwise

2078{
2079 m_extensionType = nExtensionType;
2080
2081 switch (nExtensionType) {
2084 return true;
2085 }
2086 return false;
2087}

References icClipSingleSampledCurve, icExtendSingleSampledCurve, and CIccSampledCalculatorCurve::m_extensionType.

◆ SetRange()

void CIccSampledCalculatorCurve::SetRange ( icFloatNumber  first = 0.0f,
icFloatNumber  last = 1.0f 
)
inherited

Name: CIccSampledCalculatorCurve::SetRange

Purpose: Sets range of sampled lookup table.

Args: first = first entry input position last = last entry input position

2052{
2053 if (first < last) {
2054 m_firstEntry = first;
2055 m_lastEntry = last;
2056 }
2057 else {
2058 m_firstEntry = last;
2059 m_lastEntry = first;
2060 }
2061}

References CIccSampledCalculatorCurve::m_firstEntry, and CIccSampledCalculatorCurve::m_lastEntry.

◆ SetRecommendedSize()

bool CIccSampledCalculatorCurve::SetRecommendedSize ( icUInt32Number  nSize)
virtualinherited

Name: CIccSampledCalculatorCurve::SetRecommendedSize

Purpose: Sets size of sampled lookup table. Previous data (if exists) is lost.

Args: nSize = desired number of elements in lut (must be >= 2).

Return: true if amount is valid.

2128{
2129 if (nSize < 2) {
2130 return false;
2131 }
2132
2133 m_nDesiredSize = nSize;
2134
2135 return true;
2136}

References CIccSampledCalculatorCurve::m_nDesiredSize.

◆ SetSize()

bool CIccSampledCalculatorCurve::SetSize ( icUInt32Number  nCount,
bool  bZeroAlloc = true 
)
virtualinherited

Name: CIccSampledCalculatorCurve::SetSize

Purpose: Sets size of sampled lookup table. Previous data (if exists) is lost.

Args: nCount = number of elements in lut (must be >= 2). bZeroAlloc = flag to decide if memory should be set to zero.

Return: true if allocation successful.

2154{
2155 if (nCount<2) {
2156 if (m_pSamples)
2157 free(m_pSamples);
2158 m_pSamples = NULL;
2159 m_nCount = nCount;
2160 return nCount == 0;
2161 }
2162
2163 if (m_pSamples) {
2164 free(m_pSamples);
2165 }
2166
2167 if (bZeroAlloc)
2168 m_pSamples = (icFloatNumber*)calloc(nCount, sizeof(icFloatNumber));
2169 else
2170 m_pSamples = (icFloatNumber*)malloc(nCount * sizeof(icFloatNumber));
2171
2172 if (m_pSamples)
2173 m_nCount = nCount;
2174 else
2175 m_nCount = 0;
2176
2177 return (m_pSamples != NULL);
2178}

References CIccSampledCalculatorCurve::m_nCount, and CIccSampledCalculatorCurve::m_pSamples.

Referenced by CIccSampledCalculatorCurve::Begin().

+ Here is the caller graph for this function:

◆ SetStorageType()

bool CIccSampledCalculatorCurve::SetStorageType ( icUInt16Number  nStorateType)
inlineprotectedinherited
388{ return false; }

◆ ToXml()

bool CIccSampledCalculatorCurveXml::ToXml ( std::string &  xml,
std::string  blanks 
)
518{
519 char line[256];
520
521 xml += blanks;
522 sprintf(line, "<SampledCalculatorCurve FirstEntry=\"" icXmlFloatFmt "\"", m_firstEntry);
523 xml += line;
524
525 sprintf(line, " LastEntry=\"" icXmlFloatFmt "\"", m_lastEntry);
526 xml += line;
527
528 sprintf(line, " ExtensionType=\"%u\"", m_extensionType);
529 xml += line;
530
531 sprintf(line, " DesiredSize=\"%u\">\n", m_nDesiredSize);
532 xml += line;
533
534 if (m_nReserved2) {
535 sprintf(line, " Reservered2=\"%u\">\n", m_nReserved2);
536 xml += line;
537 }
538
539 if (m_pCalc && !strcmp(m_pCalc->GetClassName(), "CIccMpeXmlCalculator")) {
541 if (!pXmlCalc->ToXml(xml, blanks + " "))
542 return false;
543 }
544 else {
545 return false;
546 }
547
548 xml += blanks + "</SampledCalculatorCurve>\n";
549
550 return true;
551}
#define icXmlFloatFmt
Definition IccXmlConfig.h:75
virtual const icChar * GetClassName() const
Definition IccMpeCalc.h:464
virtual bool ToXml(std::string &xml, std::string blanks="")
Definition IccMpeXml.cpp:2265

References CIccMpeCalculator::GetClassName(), CIccSampledCalculatorCurve::m_extensionType, CIccSampledCalculatorCurve::m_firstEntry, CIccSampledCalculatorCurve::m_lastEntry, CIccSampledCalculatorCurve::m_nDesiredSize, CIccSampledCalculatorCurve::m_nReserved2, CIccSampledCalculatorCurve::m_pCalc, and CIccMpeXmlCalculator::ToXml().

Referenced by ToXmlCurve().

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

◆ Validate()

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

Name: CIccSampledCalculatorCurve::Validate

Purpose:

Args:

Return:

Implements CIccCurveSetCurve.

2451{
2452 CIccInfo Info;
2453 std::string sSigPathName = Info.GetSigPathName(sigPath);
2454
2456 if (m_nReserved || m_nReserved2) {
2457 sReport += icMsgValidateWarning;
2458 sReport += sSigPathName;
2459 sReport += " sampled calculator curve has non zero reserved data.\r\n";
2460 rv = icValidateWarning;
2461 }
2462
2464 sReport += icMsgValidateCriticalError;
2465 sReport += sSigPathName;
2466 sReport += " sampled calculator curve has unknown extension type\r\n";
2468 }
2469
2470 if (m_nDesiredSize < 2) {
2471 sReport += icMsgValidateWarning;
2472 sReport += sSigPathName;
2473 sReport += " sampled calculator curve has too few desired sample points.\r\n";
2475 }
2476
2477 if (m_lastEntry - m_firstEntry <= 0.0) {
2478 sReport += icMsgValidateWarning;
2479 sReport += sSigPathName;
2480 sReport += " sampled calculator curve has an invalid sample range.\n";
2482 }
2483
2484 if (pProfile && pProfile->m_Header.version < icVersionNumberV5_1) {
2485 sReport += icMsgValidateWarning;
2486 sReport += sSigPathName;
2487 sReport += " sampled calculator curve is not supported by version of profile.\n";
2489 }
2490
2491 if (!m_pCalc) {
2492 sReport += icMsgValidateCriticalError;
2493 sReport += sSigPathName;
2494 sReport += " sampled calculator curve has no calculator element\r\n";
2496 }
2497 else {
2498 icValidateStatus stat = m_pCalc->Validate(sSigPathName, sReport, pMPE, pProfile);
2499
2500 rv = icMaxStatus(rv, stat);
2501 }
2502
2503 return rv;
2504}
#define icMaxSingleSampledCurveType
Definition icProfileHeader.h:1071
#define icVersionNumberV5_1
Definition icProfileHeader.h:194
icValidateStatus
Definition IccDefs.h:119
@ icValidateOK
Definition IccDefs.h:120
@ icValidateWarning
Definition IccDefs.h:121
@ icValidateCriticalError
Definition IccDefs.h:123
ICCPROFLIB_API const char * icMsgValidateWarning
Definition IccUtil.cpp:90
ICCPROFLIB_API const char * icMsgValidateCriticalError
Definition IccUtil.cpp:92
ICCPROFLIB_API icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Definition IccUtil.cpp:244
Definition IccUtil.h:303
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccTagMultiProcessElement *pMPE=NULL, const CIccProfile *pProfile=NULL) const
Definition IccMpeCalc.cpp:4819

References CIccInfo::GetSigPathName(), icMaxStatus(), icMsgValidateCriticalError, icMsgValidateWarning, icValidateCriticalError, icValidateOK, icValidateWarning, CIccSampledCalculatorCurve::m_extensionType, CIccSampledCalculatorCurve::m_firstEntry, CIccSampledCalculatorCurve::m_lastEntry, CIccSampledCalculatorCurve::m_nDesiredSize, CIccSampledCalculatorCurve::m_nReserved, CIccSampledCalculatorCurve::m_nReserved2, CIccSampledCalculatorCurve::m_pCalc, CIccMpeCalculator::Validate(), and icHeader::version.

+ Here is the call graph for this function:

◆ Write()

bool CIccSampledCalculatorCurve::Write ( CIccIO pIO)
virtualinherited

Name: CIccSampledCalculatorCurve::Write

Purpose:

Args:

Return:

Implements CIccCurveSetCurve.

2309{
2311
2312 if (!pIO)
2313 return false;
2314
2315 if (!pIO->Write32(&sig))
2316 return false;
2317
2318 if (!pIO->Write32(&m_nReserved))
2319 return false;
2320
2321 if (!pIO->Write32(&m_nDesiredSize))
2322 return false;
2323
2324 if (!pIO->WriteFloat32Float(&m_firstEntry))
2325 return false;
2326
2327 if (!pIO->WriteFloat32Float(&m_lastEntry))
2328 return false;
2329
2330 if (!pIO->Write16(&m_extensionType))
2331 return false;
2332
2333 if (!pIO->Write16(&m_nReserved2))
2334 return false;
2335
2336 if (m_pCalc && m_pCalc->Write(pIO)) {
2337 return true;
2338 }
2339
2340 return false;
2341}
icCurveElemSignature
Definition icProfileHeader.h:1056
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
virtual bool Write(CIccIO *pIO)
Definition IccMpeCalc.cpp:4598

References CIccSampledCalculatorCurve::GetType(), CIccSampledCalculatorCurve::m_extensionType, CIccSampledCalculatorCurve::m_firstEntry, CIccSampledCalculatorCurve::m_lastEntry, CIccSampledCalculatorCurve::m_nDesiredSize, CIccSampledCalculatorCurve::m_nReserved, CIccSampledCalculatorCurve::m_nReserved2, CIccSampledCalculatorCurve::m_pCalc, CIccMpeCalculator::Write(), CIccIO::Write16(), CIccIO::Write32(), and CIccIO::WriteFloat32Float().

+ Here is the call graph for this function:

Field Documentation

◆ m_extensionType

◆ m_firstEntry

◆ m_hiIntercept

◆ m_hiSlope

◆ m_last

icFloatNumber CIccSampledCalculatorCurve::m_last
protectedinherited

◆ m_lastEntry

◆ m_loIntercept

◆ m_loSlope

◆ m_nCount

◆ m_nDesiredSize

◆ m_nReserved

◆ m_nReserved2

◆ m_pCalc

◆ m_pSamples

◆ m_range

icFloatNumber CIccSampledCalculatorCurve::m_range
protectedinherited

◆ m_storageType

icUInt16Number CIccSampledCalculatorCurve::m_storageType
protectedinherited

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