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

#include <IccPcc.h>

+ Inheritance diagram for CIccCombinedConnectionConditions:
+ Collaboration diagram for CIccCombinedConnectionConditions:

Public Member Functions

 CIccCombinedConnectionConditions (CIccProfile *pProfile, IIccProfileConnectionConditions *pAppliedPCC, bool bReflectance=false)
 
virtual ~CIccCombinedConnectionConditions ()
 
virtual CIccTagMultiProcessElementgetCustomToStandardPcc ()
 
icFloatNumbergetEmissiveObserver (const icSpectralRange &range, const icFloatNumber *pWhite, icFloatNumber *obsMatrix=NULL)
 
virtual void getLumIlluminantXYZ (icFloatNumber *pXYZLum)
 
virtual bool getMediaWhiteXYZ (icFloatNumber *pXYZ)
 
virtual void getNormIlluminantXYZ (icFloatNumber *pXYZ)
 
icFloatNumber getObserverIlluminantScaleFactor ()
 
icFloatNumber getObserverWhiteScaleFactor (const icFloatNumber *pWhite, const icSpectralRange &whiteRange)
 
icFloatNumber getPccCCT ()
 
icIlluminant getPccIlluminant ()
 
icStandardObserver getPccObserver ()
 
virtual const CIccTagSpectralViewingConditionsgetPccViewingConditions ()
 
CIccMatrixMathgetReflectanceObserver (const icSpectralRange &rangeRef)
 
virtual CIccTagMultiProcessElementgetStandardToCustomPcc ()
 
bool hasIlluminantSPD ()
 
bool isEquivalentPcc (IIccProfileConnectionConditions &IPCC)
 
bool isStandardPcc ()
 

Protected Attributes

bool m_bValidIllumXYZ
 
bool m_bValidMediaXYZ
 
icFloatNumber m_illuminantXYZ [3]
 
icFloatNumber m_illuminantXYZLum [3]
 
icFloatNumber m_mediaXYZ [3]
 
IIccProfileConnectionConditionsm_pPCC
 
CIccTagSpectralViewingConditionsm_pViewingConditions
 

Detailed Description

Type: Class

Purpose: Class used for defining combined connection conditions where the viewing conditions are the combined result of information from the profile and external connection conditions based on whether reflectance or emission is used.

Constructor & Destructor Documentation

◆ CIccCombinedConnectionConditions()

CIccCombinedConnectionConditions::CIccCombinedConnectionConditions ( CIccProfile pProfile,
IIccProfileConnectionConditions pAppliedPCC,
bool  bReflectance = false 
)
316{
317 if (pAppliedPCC) {
318 const CIccTagSpectralViewingConditions *pView = pAppliedPCC->getPccViewingConditions();
319 if (bReflectance) {
320 m_pPCC = pAppliedPCC;
322
329 m_bValidMediaXYZ = pProfile->calcMediaWhiteXYZ(m_mediaXYZ, pAppliedPCC);
330 }
331 else {
332 m_pPCC = pAppliedPCC;
334
335 icSpectralRange illumRange;
336 const icFloatNumber *illum = pView->getIlluminant(illumRange);
337
338 m_pViewingConditions->setIlluminant(pView->getStdIllumiant(), illumRange, illum, pView->getIlluminantCCT());
339
340 pProfile->calcNormIlluminantXYZ(m_illuminantXYZ, this);
341 pProfile->calcLumIlluminantXYZ(m_illuminantXYZLum, this);
342 m_bValidMediaXYZ = pProfile->calcMediaWhiteXYZ(m_mediaXYZ, this);
343 }
344 }
345 else {
346 m_pPCC = NULL;
348 m_bValidMediaXYZ = false;
349 }
350}
icFloat32Number Z
Definition icProfileHeader.h:1443
icFloat32Number Y
Definition icProfileHeader.h:1442
icFloat32Number X
Definition icProfileHeader.h:1441
Definition icProfileHeader.h:1466
float icFloatNumber
Definition IccDefs.h:101
virtual const CIccTagSpectralViewingConditions * getPccViewingConditions()=0
bool m_bValidMediaXYZ
Definition IccPcc.h:154
CIccTagSpectralViewingConditions * m_pViewingConditions
Definition IccPcc.h:149
icFloatNumber m_illuminantXYZLum[3]
Definition IccPcc.h:151
IIccProfileConnectionConditions * m_pPCC
Definition IccPcc.h:153
icFloatNumber m_mediaXYZ[3]
Definition IccPcc.h:152
icFloatNumber m_illuminantXYZ[3]
Definition IccPcc.h:150
Definition IccTagBasic.h:1692
icFloatNumber getIlluminantCCT() const
Definition IccTagBasic.h:1713
virtual CIccTag * NewCopy() const
Definition IccTagBasic.h:1697
icIlluminant getStdIllumiant() const
Definition IccTagBasic.h:1712
icFloatXYZNumber m_illuminantXYZ
Definition IccTagBasic.h:1723
const icFloatNumber * getIlluminant(icSpectralRange &illumRange) const
Definition IccTagBasic.cpp:11405
bool setIlluminant(icIlluminant illumId, const icSpectralRange &illumRange, const icFloatNumber *illum, icFloatNumber illumCCT=0.0f)
Definition IccTagBasic.cpp:11420

References CIccTagSpectralViewingConditions::getIlluminant(), CIccTagSpectralViewingConditions::getIlluminantCCT(), IIccProfileConnectionConditions::getPccViewingConditions(), CIccTagSpectralViewingConditions::getStdIllumiant(), m_bValidMediaXYZ, m_illuminantXYZ, CIccTagSpectralViewingConditions::m_illuminantXYZ, m_illuminantXYZLum, m_mediaXYZ, m_pPCC, m_pViewingConditions, CIccTagSpectralViewingConditions::NewCopy(), CIccTagSpectralViewingConditions::setIlluminant(), icFloatXYZNumber::X, icFloatXYZNumber::Y, and icFloatXYZNumber::Z.

+ Here is the call graph for this function:

◆ ~CIccCombinedConnectionConditions()

CIccCombinedConnectionConditions::~CIccCombinedConnectionConditions ( )
virtual
353{
356}

References m_pViewingConditions.

Member Function Documentation

◆ getCustomToStandardPcc()

CIccTagMultiProcessElement * CIccCombinedConnectionConditions::getCustomToStandardPcc ( )
virtual

Implements IIccProfileConnectionConditions.

368{
369 if (m_pPCC)
371 return NULL;
372}
virtual CIccTagMultiProcessElement * getCustomToStandardPcc()=0

References IIccProfileConnectionConditions::getCustomToStandardPcc(), and m_pPCC.

+ Here is the call graph for this function:

◆ getEmissiveObserver()

icFloatNumber * IIccProfileConnectionConditions::getEmissiveObserver ( const icSpectralRange range,
const icFloatNumber pWhite,
icFloatNumber obsMatrix = NULL 
)
inherited
232{
234 if (!pView || !pWhite)
235 return NULL;
236
237 int i, n = range.steps, size = 3*n;
238 const icFloatNumber *fptr;
239 icFloatNumber *tptr;
240
241 icSpectralRange observerRange;
242 const icFloatNumber *observer = pView->getObserver(observerRange);
243
244 if (!obs)
245 obs = (icFloatNumber*)malloc(size*sizeof(icFloatNumber));
246
247 if (obs) {
248 CIccMatrixMath *mapRange=CIccMatrixMath::rangeMap(observerRange, range);
249
250 //Copy observer while adjusting to range
251 if (mapRange) {
252 fptr = &observer[0];
253 tptr = obs;
254 for (i = 0; i < 3; i++) {
255 mapRange->VectorMult(tptr, fptr);
256 fptr += observerRange.steps;
257 tptr += range.steps;
258 }
259 delete mapRange;
260 }
261 else {
262 memcpy(obs, observer, size*sizeof(icFloatNumber));
263 }
264
265 //Calculate scale constant
266 icFloatNumber k=0.0f;
267 fptr = &obs[range.steps]; //Using second color matching function
268 for (i=0; i<(int)range.steps; i++) {
269 k += fptr[i]*pWhite[i];
270 }
271
272 //Scale observer so application of observer against white results in 1.0.
273 for (i=0; i<size; i++) {
274 obs[i] = obs[i] / k;
275 }
276
277 CIccMatrixMath observerMtx(3,range.steps);
278 memcpy(observerMtx.entry(0), obs, size*sizeof(icFloatNumber));
279
280 icFloatNumber xyz[3];
281 observerMtx.VectorMult(xyz, pWhite);
282 }
283
284 return obs;
285}
icUInt16Number steps
Definition icProfileHeader.h:1469
Definition IccMatrixMath.h:94
static CIccMatrixMath * rangeMap(const icSpectralRange &from, const icSpectralRange &to)
Definition IccMatrixMath.cpp:409
virtual void VectorMult(icFloatNumber *pDst, const icFloatNumber *pSrc) const
Definition IccMatrixMath.cpp:154
const icFloatNumber * getObserver(icSpectralRange &observerRange) const
Definition IccTagBasic.cpp:11569

References CIccMatrixMath::CIccMatrixMath(), CIccMatrixMath::entry(), CIccTagSpectralViewingConditions::getObserver(), IIccProfileConnectionConditions::getPccViewingConditions(), CIccMatrixMath::rangeMap(), icSpectralRange::steps, and CIccMatrixMath::VectorMult().

Referenced by CIccMpeEmissionMatrix::Begin(), CIccMpeInvEmissionMatrix::Begin(), CIccMpeEmissionCLUT::Begin(), CIccMpeReflectanceCLUT::Begin(), CIccMpeEmissionObserver::Begin(), and CIccMpeReflectanceObserver::Begin().

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

◆ getLumIlluminantXYZ()

void CIccCombinedConnectionConditions::getLumIlluminantXYZ ( icFloatNumber pXYZLum)
virtual

Implements IIccProfileConnectionConditions.

387{
388 memcpy(pXYZLum, m_illuminantXYZLum, 3 * sizeof(icFloatNumber));
389}

References m_illuminantXYZLum.

◆ getMediaWhiteXYZ()

bool CIccCombinedConnectionConditions::getMediaWhiteXYZ ( icFloatNumber pXYZ)
virtual

Implements IIccProfileConnectionConditions.

392{
394 memcpy(pXYZ, m_mediaXYZ, 3*sizeof(icFloatNumber));
395 return m_bValidMediaXYZ;
396 }
397 return false;
398}

References m_bValidMediaXYZ, m_mediaXYZ, m_pPCC, and m_pViewingConditions.

◆ getNormIlluminantXYZ()

void CIccCombinedConnectionConditions::getNormIlluminantXYZ ( icFloatNumber pXYZ)
virtual

Implements IIccProfileConnectionConditions.

382{
383 memcpy(pXYZ, m_illuminantXYZ, 3*sizeof(icFloatNumber));
384}

References m_illuminantXYZ.

◆ getObserverIlluminantScaleFactor()

icFloatNumber IIccProfileConnectionConditions::getObserverIlluminantScaleFactor ( )
inherited
163{
165 if (!pView)
166 return 1.0;
167
168 icSpectralRange illumRange;
169 const icFloatNumber *illum = pView->getIlluminant(illumRange);
170
171 icSpectralRange obsRange;
172 const icFloatNumber *obs = pView->getObserver(obsRange);
173
174 int i, n = illumRange.steps;
175 CIccMatrixMath *mapRange=CIccMatrixMath::rangeMap(obsRange, illumRange);
176 icFloatNumber rv=0;
177
178 if (mapRange) {
179 icFloatNumber *Ycmf = new icFloatNumber[illumRange.steps];
180 mapRange->VectorMult(Ycmf, &obs[obsRange.steps]);
181 delete mapRange;
182
183 for (i=0; i<n; i++) {
184 rv += Ycmf[i]*illum[i];
185 }
186 delete [] Ycmf;
187 }
188 else {
189 const icFloatNumber *Ycmf = &obs[obsRange.steps];
190
191 for (i=0; i<n; i++) {
192 rv += Ycmf[i]*illum[i];
193 }
194 }
195 return rv;
196}

References CIccTagSpectralViewingConditions::getIlluminant(), CIccTagSpectralViewingConditions::getObserver(), IIccProfileConnectionConditions::getPccViewingConditions(), CIccMatrixMath::rangeMap(), icSpectralRange::steps, and CIccMatrixMath::VectorMult().

+ Here is the call graph for this function:

◆ getObserverWhiteScaleFactor()

icFloatNumber IIccProfileConnectionConditions::getObserverWhiteScaleFactor ( const icFloatNumber pWhite,
const icSpectralRange whiteRange 
)
inherited
199{
201 if (!pView)
202 return 1.0;
203
204 icSpectralRange obsRange;
205 const icFloatNumber *obs = pView->getObserver(obsRange);
206
207 int i, n = whiteRange.steps;
208 CIccMatrixMath *mapRange=CIccMatrixMath::rangeMap(obsRange, whiteRange);
209 icFloatNumber rv=0;
210
211 if (mapRange) {
212 icFloatNumber *Ycmf = new icFloatNumber[whiteRange.steps];
213 mapRange->VectorMult(Ycmf, &obs[obsRange.steps]);
214 delete mapRange;
215
216 for (i=0; i<n; i++) {
217 rv += Ycmf[i]*pWhite[i];
218 }
219 delete [] Ycmf;
220 }
221 else {
222 const icFloatNumber *Ycmf = &obs[obsRange.steps];
223
224 for (i=0; i<n; i++) {
225 rv += Ycmf[i]*pWhite[i];
226 }
227 }
228 return rv;
229}

References CIccTagSpectralViewingConditions::getObserver(), IIccProfileConnectionConditions::getPccViewingConditions(), CIccMatrixMath::rangeMap(), icSpectralRange::steps, and CIccMatrixMath::VectorMult().

+ Here is the call graph for this function:

◆ getPccCCT()

icFloatNumber IIccProfileConnectionConditions::getPccCCT ( )
inherited
122{
124 if (!pCond)
125 return 0.0f;
126
127 return pCond->getIlluminantCCT();
128}

References CIccTagSpectralViewingConditions::getIlluminantCCT(), and IIccProfileConnectionConditions::getPccViewingConditions().

Referenced by IIccProfileConnectionConditions::isEquivalentPcc().

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

◆ getPccIlluminant()

icIlluminant IIccProfileConnectionConditions::getPccIlluminant ( )
inherited
113{
115 if (!pCond)
116 return icIlluminantD50;
117
118 return pCond->getStdIllumiant();
119}
@ icIlluminantD50
Definition icProfileHeader.h:1192

References IIccProfileConnectionConditions::getPccViewingConditions(), CIccTagSpectralViewingConditions::getStdIllumiant(), and icIlluminantD50.

Referenced by IIccProfileConnectionConditions::isEquivalentPcc(), and IIccProfileConnectionConditions::isStandardPcc().

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

◆ getPccObserver()

icStandardObserver IIccProfileConnectionConditions::getPccObserver ( )
inherited
131{
133 if (!pCond)
135
136 return pCond->getStdObserver();
137}
@ icStdObs1931TwoDegrees
Definition icProfileHeader.h:1177
icStandardObserver getStdObserver() const
Definition IccTagBasic.h:1714

References IIccProfileConnectionConditions::getPccViewingConditions(), CIccTagSpectralViewingConditions::getStdObserver(), and icStdObs1931TwoDegrees.

Referenced by IIccProfileConnectionConditions::isEquivalentPcc(), and IIccProfileConnectionConditions::isStandardPcc().

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

◆ getPccViewingConditions()

const CIccTagSpectralViewingConditions * CIccCombinedConnectionConditions::getPccViewingConditions ( )
virtual

Implements IIccProfileConnectionConditions.

359{
362 if (m_pPCC)
364 return NULL;
365}

References IIccProfileConnectionConditions::getPccViewingConditions(), m_pPCC, and m_pViewingConditions.

+ Here is the call graph for this function:

◆ getReflectanceObserver()

CIccMatrixMath * IIccProfileConnectionConditions::getReflectanceObserver ( const icSpectralRange rangeRef)
inherited
288{
289 CIccMatrixMath *pAdjust=NULL, *pMtx;
291
292 icSpectralRange illumRange;
293 const icFloatNumber *illum = pView->getIlluminant(illumRange);
294
295 pMtx = CIccMatrixMath::rangeMap(rangeRef, illumRange);
296 if (pMtx)
297 pAdjust = pMtx;
298
299 pMtx = pView->getObserverMatrix(illumRange);
300
301 if (pAdjust) {
302 pMtx = pAdjust->Mult(pMtx);
303 delete pAdjust;
304 }
305 pAdjust = pMtx;
306
307 pAdjust->VectorScale(illum);
308 pAdjust->Scale(1.0f / pAdjust->RowSum(1));
309
310 return pAdjust;
311}
icFloatNumber RowSum(icUInt16Number nRow) const
Definition IccMatrixMath.cpp:297
void VectorScale(const icFloatNumber *vec)
Definition IccMatrixMath.cpp:238
CIccMatrixMath * Mult(const CIccMatrixMath *matrix) const
Definition IccMatrixMath.cpp:202
void Scale(icFloatNumber v)
Definition IccMatrixMath.cpp:257
CIccMatrixMath * getObserverMatrix(const icSpectralRange &newRange) const
Definition IccTagBasic.cpp:11320

References CIccTagSpectralViewingConditions::getIlluminant(), CIccTagSpectralViewingConditions::getObserverMatrix(), IIccProfileConnectionConditions::getPccViewingConditions(), CIccMatrixMath::Mult(), CIccMatrixMath::rangeMap(), CIccMatrixMath::RowSum(), CIccMatrixMath::Scale(), and CIccMatrixMath::VectorScale().

+ Here is the call graph for this function:

◆ getStandardToCustomPcc()

CIccTagMultiProcessElement * CIccCombinedConnectionConditions::getStandardToCustomPcc ( )
virtual

Implements IIccProfileConnectionConditions.

375{
376 if (m_pPCC)
378 return NULL;
379}
virtual CIccTagMultiProcessElement * getStandardToCustomPcc()=0

References IIccProfileConnectionConditions::getStandardToCustomPcc(), and m_pPCC.

+ Here is the call graph for this function:

◆ hasIlluminantSPD()

bool IIccProfileConnectionConditions::hasIlluminantSPD ( )
inherited
148{
150 if (!pCond)
151 return false;
152
153 icSpectralRange illumRange;
154 const icFloatNumber *illum = pCond->getIlluminant(illumRange);
155
156 if (!illumRange.steps || !illum)
157 return false;
158
159 return true;
160}

References CIccTagSpectralViewingConditions::getIlluminant(), IIccProfileConnectionConditions::getPccViewingConditions(), and icSpectralRange::steps.

Referenced by IIccProfileConnectionConditions::isEquivalentPcc().

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

◆ isEquivalentPcc()

bool IIccProfileConnectionConditions::isEquivalentPcc ( IIccProfileConnectionConditions IPCC)
inherited
80{
83
84 if (illum!=IPCC.getPccIlluminant() || obs!= IPCC.getPccObserver())
85 return false;
86
87 if ((illum==icIlluminantDaylight || illum==icIlluminantBlackBody) && getPccCCT()!=IPCC.getPccCCT())
88 return false;
89
90 if (illum==icIlluminantUnknown)
91 return false;
92
93 if (obs==icStdObsCustom) {
94 if (!hasIlluminantSPD() && !IPCC.hasIlluminantSPD()) {
95 icFloatNumber XYZ1[3], XYZ2[3];
96 getNormIlluminantXYZ(&XYZ1[0]);
97 IPCC.getNormIlluminantXYZ(&XYZ2[0]);
98
99 if (XYZ1[0]!=XYZ2[0] ||
100 XYZ1[1]!=XYZ2[1] ||
101 XYZ1[2]!=XYZ2[2])
102 return false;
103 }
104 else {
105 return false;
106 }
107 }
108
109 return true;
110}
icIlluminant
Definition icProfileHeader.h:1190
@ icIlluminantDaylight
Definition icProfileHeader.h:1203
@ icIlluminantBlackBody
Definition icProfileHeader.h:1202
@ icIlluminantUnknown
Definition icProfileHeader.h:1191
#define icStdObsCustom
Definition icProfileHeader.h:1181
icStandardObserver
Definition icProfileHeader.h:1175
icIlluminant getPccIlluminant()
Definition IccPcc.cpp:112
virtual void getNormIlluminantXYZ(icFloatNumber *pXYZ)=0
icStandardObserver getPccObserver()
Definition IccPcc.cpp:130
bool hasIlluminantSPD()
Definition IccPcc.cpp:147
icFloatNumber getPccCCT()
Definition IccPcc.cpp:121

References IIccProfileConnectionConditions::getNormIlluminantXYZ(), IIccProfileConnectionConditions::getPccCCT(), IIccProfileConnectionConditions::getPccIlluminant(), IIccProfileConnectionConditions::getPccObserver(), IIccProfileConnectionConditions::hasIlluminantSPD(), icIlluminantBlackBody, icIlluminantDaylight, and icIlluminantUnknown.

+ Here is the call graph for this function:

◆ isStandardPcc()

bool IIccProfileConnectionConditions::isStandardPcc ( )
inherited
140{
142 return true;
143
144 return false;
145}

References IIccProfileConnectionConditions::getPccIlluminant(), IIccProfileConnectionConditions::getPccObserver(), icIlluminantD50, and icStdObs1931TwoDegrees.

+ Here is the call graph for this function:

Field Documentation

◆ m_bValidIllumXYZ

bool CIccCombinedConnectionConditions::m_bValidIllumXYZ
protected

◆ m_bValidMediaXYZ

bool CIccCombinedConnectionConditions::m_bValidMediaXYZ
protected

◆ m_illuminantXYZ

icFloatNumber CIccCombinedConnectionConditions::m_illuminantXYZ[3]
protected

◆ m_illuminantXYZLum

icFloatNumber CIccCombinedConnectionConditions::m_illuminantXYZLum[3]
protected

◆ m_mediaXYZ

icFloatNumber CIccCombinedConnectionConditions::m_mediaXYZ[3]
protected

◆ m_pPCC

◆ m_pViewingConditions


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