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

#include <IccPrmg.h>

+ Collaboration diagram for CIccPRMG:

Public Member Functions

 CIccPRMG ()
 
icStatusCMM EvaluateProfile (CIccProfile *pProfile, icRenderingIntent nIntent=((icRenderingIntent) 0x3f3f3f3f), icXformInterp nInterp=icInterpLinear, bool buseMpeTags=true)
 
icStatusCMM EvaluateProfile (const icChar *szProfilePath, icRenderingIntent nIntent=((icRenderingIntent) 0x3f3f3f3f), icXformInterp nInterp=icInterpLinear, bool buseMpeTags=true)
 
icFloatNumber GetChroma (icFloatNumber L, icFloatNumber h)
 
bool InGamut (icFloatNumber *Lab)
 
bool InGamut (icFloatNumber L, icFloatNumber c, icFloatNumber h)
 

Public Attributes

bool m_bPrmgImplied
 
icUInt32Number m_nDE1
 
icUInt32Number m_nDE10
 
icUInt32Number m_nDE2
 
icUInt32Number m_nDE3
 
icUInt32Number m_nDE5
 
icUInt32Number m_nTotal
 

Detailed Description

Definition at line 81 of file IccPrmg.h.

Constructor & Destructor Documentation

◆ CIccPRMG()

CIccPRMG::CIccPRMG ( )

Definition at line 132 of file IccPrmg.cpp.

133{
135 m_bPrmgImplied = false;
136}
icUInt32Number m_nTotal
Definition IccPrmg.h:96
icUInt32Number m_nDE2
Definition IccPrmg.h:96
icUInt32Number m_nDE1
Definition IccPrmg.h:96
icUInt32Number m_nDE3
Definition IccPrmg.h:96
icUInt32Number m_nDE5
Definition IccPrmg.h:96
bool m_bPrmgImplied
Definition IccPrmg.h:98
icUInt32Number m_nDE10
Definition IccPrmg.h:96

Member Function Documentation

◆ EvaluateProfile() [1/2]

icStatusCMM CIccPRMG::EvaluateProfile ( CIccProfile * pProfile,
icRenderingIntent nIntent = ((icRenderingIntent) 0x3f3f3f3f),
icXformInterp nInterp = icInterpLinear,
bool buseMpeTags = true )

Definition at line 203 of file IccPrmg.cpp.

205{
206 if (!pProfile)
207 {
209 }
210
211 if (pProfile->m_Header.deviceClass!=icSigInputClass &&
212 pProfile->m_Header.deviceClass!=icSigDisplayClass &&
213 pProfile->m_Header.deviceClass!=icSigOutputClass &&
214 pProfile->m_Header.deviceClass!=icSigColorSpaceClass)
215 {
217 }
218
219 m_bPrmgImplied = false;
220 if (nIntent==icPerceptual || nIntent==icSaturation) {
222 CIccTag *pSigTag = pProfile->FindTag(rigSig);
223
224 if (pSigTag && pSigTag->GetType()==icSigSignatureType) {
225 CIccTagSignature *pSig = (CIccTagSignature*)pSigTag;
226
228 m_bPrmgImplied = true;
229 }
230 }
231
232 CIccCmm Lab2Dev2Lab(icSigLabData, icSigLabData, false);
233
234 icStatusCMM result = Lab2Dev2Lab.AddXform(*pProfile, nIntent, nInterp, NULL, icXformLutColorimetric, buseMpeTags);
235 if (result != icCmmStatOk) {
236 return result;
237 }
238
239 result = Lab2Dev2Lab.AddXform(*pProfile, nIntent, nInterp, NULL, icXformLutColorimetric, buseMpeTags);
240 if (result != icCmmStatOk) {
241 return result;
242 }
243
244 result = Lab2Dev2Lab.Begin();
245 if (result != icCmmStatOk) {
246 return result;
247 }
248 icFloatNumber pcs[3], Lab1[3], Lab2[3], dE;
249
251
252 for (pcs[0]=0.0; pcs[0]<=1.0; pcs[0] += (icFloatNumber)0.01) {
253 for (pcs[1]=0.0; pcs[1]<=1.0; pcs[1] += (icFloatNumber)0.01) {
254 for (pcs[2]=0.0; pcs[2]<=1.0; pcs[2] += (icFloatNumber)0.01) {
255 memcpy(Lab1, pcs, 3*sizeof(icFloatNumber));
256 icLabFromPcs(Lab1);
257 if (InGamut(Lab1)) {
258 Lab2Dev2Lab.Apply(Lab2, pcs);
259 icLabFromPcs(Lab2);
260
261 dE = icDeltaE(Lab1, Lab2);
262 m_nTotal++;
263
264 if (dE<=1.0) {
265 m_nDE1++;
266 m_nDE2++;
267 m_nDE3++;
268 m_nDE5++;
269 m_nDE10++;
270 }
271 else if (dE<=2.0) {
272 m_nDE2++;
273 m_nDE3++;
274 m_nDE5++;
275 m_nDE10++;
276 }
277 else if (dE<=3.0) {
278 m_nDE3++;
279 m_nDE5++;
280 m_nDE10++;
281 }
282 else if (dE<=5.0) {
283 m_nDE5++;
284 m_nDE10++;
285 }
286 else if (dE<=10.0) {
287 m_nDE10++;
288 }
289 }
290 }
291 }
292 }
293
294 return icCmmStatOk;
295}
@ icXformLutColorimetric
Definition IccCmm.h:135
icStatusCMM
CMM return status values.
Definition IccCmm.h:90
@ icCmmStatInvalidProfile
Definition IccCmm.h:95
@ icCmmStatCantOpenProfile
Definition IccCmm.h:93
@ icCmmStatOk
Definition IccCmm.h:92
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
void icLabFromPcs(icFloatNumber *Lab)
Floating point encoding of Lab in PCS is in range 0.0 to 1.0.
Definition IccUtil.cpp:919
icFloatNumber icDeltaE(const icFloatNumber *lab1, const icFloatNumber *lab2)
Definition IccUtil.cpp:527
unsigned int icUInt32Number
bool InGamut(icFloatNumber *Lab)
Definition IccPrmg.cpp:195
Class: CIccTag.
virtual icTagTypeSignature GetType() const
Function: GetType()
Class: CIccTagSignature.
icUInt32Number GetValue() const
@ icSigDisplayClass
@ icSigOutputClass
@ icSigInputClass
@ icSigColorSpaceClass
@ icSigLabData
@ icSigSignatureType
@ icSigPerceptualReferenceMediumGamut
icTagSignature
public tags and sizes
@ icSigPerceptualRenderingIntentGamutTag
@ icPerceptual
@ icSaturation

References CIccTag::GetType(), CIccTagSignature::GetValue(), icCmmStatCantOpenProfile, icCmmStatInvalidProfile, icCmmStatOk, icDeltaE(), icLabFromPcs(), icPerceptual, icSaturation, icSigColorSpaceClass, icSigDisplayClass, icSigInputClass, icSigLabData, icSigOutputClass, icSigPerceptualReferenceMediumGamut, icSigPerceptualRenderingIntentGamutTag, icSigSignatureType, and icXformLutColorimetric.

Referenced by AnalyzeRoundTrip(), and main().

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

◆ EvaluateProfile() [2/2]

icStatusCMM CIccPRMG::EvaluateProfile ( const icChar * szProfilePath,
icRenderingIntent nIntent = ((icRenderingIntent) 0x3f3f3f3f),
icXformInterp nInterp = icInterpLinear,
bool buseMpeTags = true )

Definition at line 297 of file IccPrmg.cpp.

299{
300 CIccProfile *pProfile = ReadIccProfile(szProfilePath);
301
302 if (!pProfile)
304
305 icStatusCMM result = EvaluateProfile(pProfile, nIntent, nInterp, buseMpeTags);
306
307 delete pProfile;
308
309 return result;
310}
CIccProfile * ReadIccProfile(const icChar *szFilename, bool bUseSubProfile)
Name: ReadIccProfile.
icStatusCMM EvaluateProfile(CIccProfile *pProfile, icRenderingIntent nIntent=((icRenderingIntent) 0x3f3f3f3f), icXformInterp nInterp=icInterpLinear, bool buseMpeTags=true)
Definition IccPrmg.cpp:203

References icCmmStatCantOpenProfile, and ReadIccProfile().

+ Here is the call graph for this function:

◆ GetChroma()

icFloatNumber CIccPRMG::GetChroma ( icFloatNumber L,
icFloatNumber h )

Definition at line 138 of file IccPrmg.cpp.

139{
140 if (L < 3.5 || L > 100.0)
141 return -1;
142
143 int nHIndex, nLIndex;
144 icFloatNumber dHFraction, dLFraction;
145
146 // Normalize h to the range [0, 360)
147 while (h < 0.0)
148 h += 360.0;
149 while (h >= 360.0)
150 h -= 360.0;
151
152 nHIndex = (int)(h / 10.0);
153 dHFraction = (h - nHIndex * 10.0f) / 10.0f;
154
155 if (L < 5) {
156 nLIndex = 0;
157 dLFraction = (L - 3.5f) / (5.0f - 3.5f);
158 } else if (L == 100.0) {
159 nLIndex = 19; // Assuming 19 is a safe index, adapt if necessary
160 dLFraction = 1.0;
161 } else {
162 nLIndex = (int)((L - 5.0) / 5.0) + 1;
163 dLFraction = (L - nLIndex * 5.0f) / 5.0f;
164 }
165
166 // Determine the bounds of the icPRMG_Chroma array (replace with actual bounds)
167 const int maxHIndex = sizeof(icPRMG_Chroma) / sizeof(icPRMG_Chroma[0]) - 1;
168 const int maxLIndex = sizeof(icPRMG_Chroma[0]) / sizeof(icPRMG_Chroma[0][0]) - 1;
169
170 // Clamp indices to prevent out-of-bounds access
171 nHIndex = icClamp(nHIndex, 0, maxHIndex - 1);
172 nLIndex = icClamp(nLIndex, 0, maxLIndex - 1);
173
174 icFloatNumber dInvLFraction = 1.0f - dLFraction;
175
176 // Interpolate chroma values safely
177 icFloatNumber ch1 = icPRMG_Chroma[nHIndex][nLIndex] * dInvLFraction
178 + icPRMG_Chroma[nHIndex][nLIndex+1] * dLFraction;
179 icFloatNumber ch2 = icPRMG_Chroma[nHIndex+1][nLIndex] * dInvLFraction
180 + icPRMG_Chroma[nHIndex+1][nLIndex+1] * dLFraction;
181
182 return ch1 * (1.0f - dHFraction) + ch2 * dHFraction;
183}
static icFloatNumber icPRMG_Chroma[37][20]
Definition IccPrmg.cpp:83
static int icClamp(int val, int minVal, int maxVal)
Definition IccPrmg.cpp:123

References icClamp(), and icPRMG_Chroma.

+ Here is the call graph for this function:

◆ InGamut() [1/2]

bool CIccPRMG::InGamut ( icFloatNumber * Lab)

Definition at line 195 of file IccPrmg.cpp.

196{
197 icFloatNumber Lch[3];
198
199 icLab2Lch(Lch, Lab);
200 return InGamut(Lch[0], Lch[1], Lch[2]);
201}
void icLab2Lch(icFloatNumber *Lch, icFloatNumber *Lab)
Definition IccUtil.cpp:881

References icLab2Lch().

+ Here is the call graph for this function:

◆ InGamut() [2/2]

bool CIccPRMG::InGamut ( icFloatNumber L,
icFloatNumber c,
icFloatNumber h )

Definition at line 185 of file IccPrmg.cpp.

186{
187 icFloatNumber dChroma = GetChroma(L, h);
188
189 if (dChroma<0.0 || c>dChroma)
190 return false;
191
192 return true;
193}
icFloatNumber GetChroma(icFloatNumber L, icFloatNumber h)
Definition IccPrmg.cpp:138

Member Data Documentation

◆ m_bPrmgImplied

bool CIccPRMG::m_bPrmgImplied

Definition at line 98 of file IccPrmg.h.

Referenced by AnalyzeRoundTrip(), and main().

◆ m_nDE1

icUInt32Number CIccPRMG::m_nDE1

Definition at line 96 of file IccPrmg.h.

Referenced by AnalyzeRoundTrip(), and main().

◆ m_nDE10

icUInt32Number CIccPRMG::m_nDE10

Definition at line 96 of file IccPrmg.h.

Referenced by AnalyzeRoundTrip(), and main().

◆ m_nDE2

icUInt32Number CIccPRMG::m_nDE2

Definition at line 96 of file IccPrmg.h.

Referenced by AnalyzeRoundTrip(), and main().

◆ m_nDE3

icUInt32Number CIccPRMG::m_nDE3

Definition at line 96 of file IccPrmg.h.

Referenced by AnalyzeRoundTrip(), and main().

◆ m_nDE5

icUInt32Number CIccPRMG::m_nDE5

Definition at line 96 of file IccPrmg.h.

Referenced by AnalyzeRoundTrip(), and main().

◆ m_nTotal

icUInt32Number CIccPRMG::m_nTotal

Definition at line 96 of file IccPrmg.h.

Referenced by AnalyzeRoundTrip(), and main().


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