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

#include <IccApplyBPC.h>

+ Inheritance diagram for CIccApplyBPC:
+ Collaboration diagram for CIccApplyBPC:

Public Member Functions

virtual bool CalcFactors (const CIccProfile *pProfile, const CIccXform *pXfm, icFloatNumber *Scale, icFloatNumber *Offset) const
 

Private Member Functions

bool calcBlackPoint (const CIccProfile *pProfile, const CIccXform *pXform, icFloatNumber *XYZb) const
 
bool calcDstBlackPoint (const CIccProfile *pProfile, const CIccXform *pXform, icFloatNumber *XYZb) const
 
icFloatNumber calcQuadraticVertex (icFloatNumber *x, icFloatNumber *y, int n) const
 
bool calcSrcBlackPoint (const CIccProfile *pProfile, const CIccXform *pXform, icFloatNumber *XYZb) const
 
icFloatNumber calcsum (icFloatNumber *x, icFloatNumber *y, int n, int j, int k) const
 
CIccCmm * getBlackXfm (icRenderingIntent nIntent, const CIccProfile *pProfile) const
 
void lab2pcs (icFloatNumber *pixel, const CIccProfile *pProfile) const
 
void pcs2lab (icFloatNumber *pixel, const CIccProfile *pProfile) const
 
bool pixelXfm (icFloatNumber *DstPixel, icFloatNumber *SrcPixel, icColorSpaceSignature SrcSpace, icRenderingIntent nIntent, const CIccProfile *pProfile) const
 

Detailed Description

Type: Class

Purpose: This is the hint for applying black point compensation. Also does the calculations to setup actual application of BPC.

Member Function Documentation

◆ calcBlackPoint()

bool CIccApplyBPC::calcBlackPoint ( const CIccProfile pProfile,
const CIccXform *  pXform,
icFloatNumber XYZb 
) const
private

Name: CIccApplyBPC::calcBlackPoint

Purpose: Calculates the black point of a profile

270{
271 if (pXform->IsInput()) { // profile used as input/source profile
272 return calcSrcBlackPoint(pProfile, pXform, XYZb);
273 }
274 else { // profile used as output profile
275 return calcDstBlackPoint(pProfile, pXform, XYZb);
276 }
277
278 return true;
279}
bool calcSrcBlackPoint(const CIccProfile *pProfile, const CIccXform *pXform, icFloatNumber *XYZb) const
Definition IccApplyBPC.cpp:290
bool calcDstBlackPoint(const CIccProfile *pProfile, const CIccXform *pXform, icFloatNumber *XYZb) const
Definition IccApplyBPC.cpp:379

References calcDstBlackPoint(), and calcSrcBlackPoint().

Referenced by CalcFactors().

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

◆ calcDstBlackPoint()

bool CIccApplyBPC::calcDstBlackPoint ( const CIccProfile pProfile,
const CIccXform *  pXform,
icFloatNumber XYZb 
) const
private

Name: CIccApplyBPC::calcDstBlackPoint

Purpose: Calculates the black point of a destination profile

380{
381 icRenderingIntent nIntent = pXform->GetIntent();
382 icFloatNumber Pixel[3];
383 icFloatNumber pcsPixel[3];
384
385 // check if the profile is lut based gray, rgb or cmyk
386 if (pProfile->IsTagPresent(icSigBToA0Tag) &&
387 (pProfile->m_Header.colorSpace==icSigGrayData || pProfile->m_Header.colorSpace==icSigRgbData || pProfile->m_Header.colorSpace==icSigCmykData))
388 { // do the complicated and lengthy black point estimation
389
390 // get the black transform
391 CIccCmm* pCmm = getBlackXfm(nIntent, pProfile);
392 if (!pCmm) {
393 return false;
394 }
395
396 // set the initial Lab
397 icFloatNumber iniLab[3] = {0.0, 0.0, 0.0};
398
399 // calculate minL
400 pcsPixel[0] = 0.0;
401 pcsPixel[1] = iniLab[1];
402 pcsPixel[2] = iniLab[2];
403 lab2pcs(pcsPixel, pProfile);
404 if (pCmm->Apply(Pixel, pcsPixel)!=icCmmStatOk) {
405 delete pCmm;
406 return false;
407 }
408 pcs2lab(Pixel, pProfile);
409 icFloatNumber MinL = Pixel[0];
410
411 // calculate MaxL
412 pcsPixel[0] = 100.0;
413 pcsPixel[1] = iniLab[1];
414 pcsPixel[2] = iniLab[2];
415 lab2pcs(pcsPixel, pProfile);
416 if (pCmm->Apply(Pixel, pcsPixel)!=icCmmStatOk) {
417 delete pCmm;
418 return false;
419 }
420 pcs2lab(Pixel, pProfile);
421 icFloatNumber MaxL = Pixel[0];
422
423 // check if quadratic estimation needs to be done
424 bool bStraightMidRange = false;
425
426 // if the intent is relative
427 if (nIntent==icRelativeColorimetric)
428 {
429 // calculate initial Lab as source black point
430 if (!calcSrcBlackPoint(pProfile, pXform, iniLab)) {
431 delete pCmm;
432 return false;
433 }
434
435 // convert the XYZ to lab
436 icXYZtoLab(iniLab);
437
438 // check mid range L* values
439 icFloatNumber lcnt=0.0, roundtripL;
440 bStraightMidRange = true;
441 while (lcnt<100.1)
442 {
443 pcsPixel[0] = icFloatNumber(lcnt);
444 pcsPixel[1] = iniLab[1];
445 pcsPixel[2] = iniLab[2];
446 lab2pcs(pcsPixel, pProfile);
447 if (pCmm->Apply(Pixel, pcsPixel)!=icCmmStatOk) {
448 delete pCmm;
449 return false;
450 }
451 pcs2lab(Pixel, pProfile);
452 roundtripL = Pixel[0];
453
454 if (roundtripL>(MinL + 0.2 * (MaxL - MinL))) {
455 if (fabs(roundtripL - lcnt)>4.0) {
456 bStraightMidRange = false;
457 break;
458 }
459 }
460
461 lcnt += 1.0;
462 }
463 }
464
465 // quadratic estimation is not needed
466 if (bStraightMidRange) { // initial Lab is the destination black point
467 XYZb[0] = iniLab[0];
468 XYZb[1] = iniLab[1];
469 XYZb[2] = iniLab[2];
470 icLabtoXYZ(XYZb);
471 delete pCmm;
472 return true;
473 }
474
475 // find the black point using the least squares error quadratic curve fitting
476
477 // calculate y values
478 icFloatNumber x[101], y[101];
479 icFloatNumber lo=0.03f, hi=0.25f;
480 int i, n;
481 if (nIntent==icRelativeColorimetric) {
482 lo = 0.1f;
483 hi = 0.5f;
484 }
485
486 for (i=0; i<101; i++) {
487 x[i] = icFloatNumber(i);
488 pcsPixel[0] = x[i];
489 pcsPixel[1] = iniLab[1];
490 pcsPixel[2] = iniLab[2];
491 lab2pcs(pcsPixel, pProfile);
492 if (pCmm->Apply(Pixel, pcsPixel)!=icCmmStatOk) {
493 delete pCmm;
494 return false;
495 }
496 pcs2lab(Pixel, pProfile);
497 y[i] = (Pixel[0] - MinL)/(MaxL - MinL);
498 }
499
500 // check for y values in the range and rearrange
501 n = 0;
502 for (i=0; i<101; i++) {
503 if (y[i]>=lo && y[i]<hi) {
504 x[n] = x[i];
505 y[n] = y[i];
506 n++;
507 }
508 }
509
510 if (!n) {
511 delete pCmm;
512 return false;
513 }
514
515 // fit and get the vertex of quadratic curve
516 XYZb[0] = calcQuadraticVertex(x, y, n);
517 if (XYZb[0]<0.0) { // clip to zero L* if the vertex is negative
518 XYZb[0] = 0.0;
519 }
520 XYZb[1] = iniLab[1];
521 XYZb[2] = iniLab[2];
522 icLabtoXYZ(XYZb);
523
524 delete pCmm;
525 }
526 else { // use the procedure for source black point
527 return calcSrcBlackPoint(pProfile, pXform, XYZb);
528 }
529
530 return true;
531}
@ icSigCmykData
Definition icProfileHeader.h:855
@ icSigRgbData
Definition icProfileHeader.h:851
@ icSigGrayData
Definition icProfileHeader.h:852
@ icSigBToA0Tag
Definition icProfileHeader.h:374
icRenderingIntent
Definition icProfileHeader.h:1142
@ icRelativeColorimetric
Definition icProfileHeader.h:1144
@ icCmmStatOk
Definition IccCmm.h:92
float icFloatNumber
Definition IccDefs.h:101
ICCPROFLIB_API void icXYZtoLab(icFloatNumber *Lab, const icFloatNumber *XYZ=NULL, const icFloatNumber *WhiteXYZ=NULL)
Definition IccUtil.cpp:846
ICCPROFLIB_API void icLabtoXYZ(icFloatNumber *XYZ, const icFloatNumber *Lab=NULL, const icFloatNumber *WhiteXYZ=NULL)
Definition IccUtil.cpp:830
void pcs2lab(icFloatNumber *pixel, const CIccProfile *pProfile) const
Definition IccApplyBPC.cpp:115
CIccCmm * getBlackXfm(icRenderingIntent nIntent, const CIccProfile *pProfile) const
Definition IccApplyBPC.cpp:580
void lab2pcs(icFloatNumber *pixel, const CIccProfile *pProfile) const
Definition IccApplyBPC.cpp:96
icFloatNumber calcQuadraticVertex(icFloatNumber *x, icFloatNumber *y, int n) const
Definition IccApplyBPC.cpp:162

References calcQuadraticVertex(), calcSrcBlackPoint(), icHeader::colorSpace, getBlackXfm(), icCmmStatOk, icLabtoXYZ(), icRelativeColorimetric, icSigBToA0Tag, icSigCmykData, icSigGrayData, icSigRgbData, icXYZtoLab(), lab2pcs(), and pcs2lab().

Referenced by calcBlackPoint().

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

◆ CalcFactors()

bool CIccApplyBPC::CalcFactors ( const CIccProfile pProfile,
const CIccXform *  pXform,
icFloatNumber Scale,
icFloatNumber Offset 
) const
virtual

Name: CIccApplyBPC::CalculateFactors

Purpose: This function does the suitable calculations to setup black point compensation.

Args: pXform = pointer to the Xform object that calls this function

Return: true = all calculations done false = an error occurred

214{
215 if (!pProfile || !pXform)
216 return false;
217
218 if (pXform->GetIntent()==icAbsoluteColorimetric) { // black point compensation not supported
219 return false;
220 }
221
222 switch (pProfile->m_Header.deviceClass)
223 { // These profile classes not supported
224 case icSigLinkClass:
226 //case icSigColorSpaceClass:
228 return false;
229 default:
230 break;
231 }
232
233 icFloatNumber XYZbp[3]; // storage for black point XYZ
234
235 // calculate the black point
236 if (!calcBlackPoint(pProfile, pXform, XYZbp)) {
237 return false;
238 }
239
240 // calculate the scale and offset
241 if (pXform->IsInput()) { // use PRM black as destination black
242 Scale[0] = (icFloatNumber)((1.0 - icPerceptualRefBlackY)/(1.0 - XYZbp[1]));
243 }
244 else { // use PRM black as source black
245 Scale[0] = (icFloatNumber)((1.0 - XYZbp[1])/(1.0 - icPerceptualRefBlackY));
246 }
247
248 Scale[1] = Scale[0];
249 Scale[2] = Scale[0];
250
251 Offset[0] = (icFloatNumber)((1.0 - Scale[0]) * icPerceptualRefWhiteX);
252 Offset[1] = (icFloatNumber)((1.0 - Scale[1]) * icPerceptualRefWhiteY);
253 Offset[2] = (icFloatNumber)((1.0 - Scale[2]) * icPerceptualRefWhiteZ);
254
255 icXyzToPcs(Offset);
256
257 return true;
258}
@ icSigAbstractClass
Definition icProfileHeader.h:956
@ icSigNamedColorClass
Definition icProfileHeader.h:958
@ icSigLinkClass
Definition icProfileHeader.h:955
@ icAbsoluteColorimetric
Definition icProfileHeader.h:1147
#define icPerceptualRefWhiteX
Definition IccCmm.h:143
#define icPerceptualRefBlackY
Definition IccCmm.h:140
#define icPerceptualRefWhiteZ
Definition IccCmm.h:145
#define icPerceptualRefWhiteY
Definition IccCmm.h:144
ICCPROFLIB_API void icXyzToPcs(icFloatNumber *XYZ)
Definition IccUtil.cpp:941
bool calcBlackPoint(const CIccProfile *pProfile, const CIccXform *pXform, icFloatNumber *XYZb) const
Definition IccApplyBPC.cpp:269

References calcBlackPoint(), icHeader::deviceClass, icAbsoluteColorimetric, icSigAbstractClass, icSigLinkClass, icSigNamedColorClass, and icXyzToPcs().

+ Here is the call graph for this function:

◆ calcQuadraticVertex()

icFloatNumber CIccApplyBPC::calcQuadraticVertex ( icFloatNumber x,
icFloatNumber y,
int  n 
) const
private
163{
164 icFloatNumber vert = 0.0;
165
166 if (n>2) { // need at least three points to solve three linear equations
167 icFloatNumber s00, s10, s20, s30, s40, s01, s11, s21, denom;
168 s00 = calcsum(x, y, n, 0, 0);
169 s10 = calcsum(x, y, n, 1, 0);
170 s20 = calcsum(x, y, n, 2, 0);
171 s30 = calcsum(x, y, n, 3, 0);
172 s40 = calcsum(x, y, n, 4, 0);
173 s01 = calcsum(x, y, n, 0, 1);
174 s11 = calcsum(x, y, n, 1, 1);
175 s21 = calcsum(x, y, n, 2, 1);
176 denom = (icFloatNumber)(s00*s20*s40 - s10*s10*s40 - s00*s30*s30 + 2.0*s10*s20*s30 - s20*s20*s20);
177 if (fabs(denom)>0.0) {
178 // t and u are the coefficients of the quadratic equation y = tx^2 + ux + c
179 // the three equations with 3 unknowns can be written as
180 // [s40 s30 s20][t] [s21]
181 // [s30 s20 s10][u] = [s11]
182 // [s20 s10 s00][c] [s01]
183 icFloatNumber t = (s01*s10*s30 - s11*s00*s30 - s01*s20*s20 + s11*s10*s20 + s21*s00*s20 - s21*s10*s10)/denom;
184
185 icFloatNumber u = (s11*s00*s40 - s01*s10*s40 + s01*s20*s30 - s21*s00*s30 - s11*s20*s20 + s21*s10*s20)/denom;
186
187 icFloatNumber c = (s01*s20*s40 - s11*s10*s40 - s01*s30*s30 + s11*s20*s30 + s21*s10*s30 - s21*s20*s20)/denom;
188
189 // vertex is (-u + sqrt(u^2 - 4tc))/2t
190 vert = (icFloatNumber)((-1.0 * u + sqrt(u*u - 4*t*c)) / (2.0 * t));
191 }
192 }
193
194 return vert;
195}
icFloatNumber calcsum(icFloatNumber *x, icFloatNumber *y, int n, int j, int k) const
Definition IccApplyBPC.cpp:134

References calcsum().

Referenced by calcDstBlackPoint().

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

◆ calcSrcBlackPoint()

bool CIccApplyBPC::calcSrcBlackPoint ( const CIccProfile pProfile,
const CIccXform *  pXform,
icFloatNumber XYZb 
) const
private

Name: CIccApplyBPC::calcSrcBlackPoint

Purpose: Calculates the black point of a source profile

291{
292 icFloatNumber Pixel[16];
293 if ((pProfile->m_Header.colorSpace == icSigCmykData) && (pProfile->m_Header.deviceClass == icSigOutputClass)) {
294
295 // calculate intermediate CMYK
296 XYZb[0] = XYZb[1] = XYZb[2] = 0.0;
297
298 // convert the Lab of 0,0,0 to relevant PCS
299 lab2pcs(XYZb, pProfile);
300
301 //convert the PCS value to CMYK
302 if (!pixelXfm(Pixel, XYZb, pProfile->m_Header.pcs, icPerceptual, pProfile)) {
303 return false;
304 }
305 }
306 else {
307 switch (pProfile->m_Header.colorSpace) {
308 case icSigRgbData:
309 Pixel[0] = 0.0;
310 Pixel[1] = 0.0;
311 Pixel[2] = 0.0;
312 break;
313
314 case icSigGrayData:
315 Pixel[0] = 0.0;
316 break;
317
318 case icSigCmykData:
319 case icSigCmyData:
320 case icSig2colorData:
321 case icSig3colorData:
322 case icSig4colorData:
323 case icSig5colorData:
324 case icSig6colorData:
325 case icSig7colorData:
326 case icSig8colorData:
327 case icSig9colorData:
328 case icSig10colorData:
329 case icSig11colorData:
330 case icSig12colorData:
331 case icSig13colorData:
332 case icSig14colorData:
333 case icSig15colorData:
334 {
335 icUInt32Number nSamples = icGetSpaceSamples(pProfile->m_Header.colorSpace);
336 for (icUInt32Number i=0; i<nSamples; i++) {
337 Pixel[i] = 1.0;
338 }
339 }
340 break;
341
342 default:
343 return false;
344 }
345 }
346
347 // convert the device value to PCS
348 if (!pixelXfm(XYZb, Pixel, pProfile->m_Header.colorSpace, pXform->GetIntent(), pProfile)) {
349 return false;
350 }
351
352 // convert PCS to Lab
353 pcs2lab(XYZb, pProfile);
354
355 // set a* b* to zero for cmyk profiles
356 if (pProfile->m_Header.colorSpace == icSigCmykData) {
357 XYZb[1] = XYZb[2] = 0.0;
358 }
359
360 // clip L* to 50
361 if (XYZb[0]>50.0) {
362 XYZb[0] = 50.0;
363 }
364
365 // convert Lab to XYZ
366 icLabtoXYZ(XYZb);
367 return true;
368}
@ icSigOutputClass
Definition icProfileHeader.h:954
@ icSig14colorData
Definition icProfileHeader.h:871
@ icSig2colorData
Definition icProfileHeader.h:859
@ icSig8colorData
Definition icProfileHeader.h:865
@ icSig10colorData
Definition icProfileHeader.h:867
@ icSig7colorData
Definition icProfileHeader.h:864
@ icSig9colorData
Definition icProfileHeader.h:866
@ icSig13colorData
Definition icProfileHeader.h:870
@ icSig6colorData
Definition icProfileHeader.h:863
@ icSig4colorData
Definition icProfileHeader.h:861
@ icSig12colorData
Definition icProfileHeader.h:869
@ icSig11colorData
Definition icProfileHeader.h:868
@ icSigCmyData
Definition icProfileHeader.h:856
@ icSig15colorData
Definition icProfileHeader.h:872
@ icSig3colorData
Definition icProfileHeader.h:860
@ icSig5colorData
Definition icProfileHeader.h:862
unsigned long icUInt32Number
Definition icProfileHeader.h:262
@ icPerceptual
Definition icProfileHeader.h:1143
ICCPROFLIB_API icUInt32Number icGetSpaceSamples(icColorSpaceSignature sig)
Definition IccUtil.cpp:1303
bool pixelXfm(icFloatNumber *DstPixel, icFloatNumber *SrcPixel, icColorSpaceSignature SrcSpace, icRenderingIntent nIntent, const CIccProfile *pProfile) const
Definition IccApplyBPC.cpp:542

References icHeader::colorSpace, icHeader::deviceClass, icGetSpaceSamples(), icLabtoXYZ(), icPerceptual, icSig10colorData, icSig11colorData, icSig12colorData, icSig13colorData, icSig14colorData, icSig15colorData, icSig2colorData, icSig3colorData, icSig4colorData, icSig5colorData, icSig6colorData, icSig7colorData, icSig8colorData, icSig9colorData, icSigCmyData, icSigCmykData, icSigGrayData, icSigOutputClass, icSigRgbData, lab2pcs(), icHeader::pcs, pcs2lab(), and pixelXfm().

Referenced by calcBlackPoint(), and calcDstBlackPoint().

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

◆ calcsum()

icFloatNumber CIccApplyBPC::calcsum ( icFloatNumber x,
icFloatNumber y,
int  n,
int  j,
int  k 
) const
private
135{
136 icFloatNumber dSum = 0.0;
137
138 int i;
139 if (j && k) {
140 for (i=0; i<n; i++) {
141 dSum += (icFloatNumber)(pow(x[i], j)*pow(y[i], k));
142 }
143 }
144 else if (j) {
145 for (i=0; i<n; i++) {
146 dSum += (icFloatNumber)pow(x[i], j);
147 }
148 }
149 else if (k) {
150 for (i=0; i<n; i++) {
151 dSum += (icFloatNumber)pow(y[i], k);
152 }
153 }
154 else {
155 dSum = icFloatNumber(n);
156 }
157
158 return dSum;
159}

Referenced by calcQuadraticVertex().

+ Here is the caller graph for this function:

◆ getBlackXfm()

CIccCmm * CIccApplyBPC::getBlackXfm ( icRenderingIntent  nIntent,
const CIccProfile pProfile 
) const
private

Name: CIccApplyBPC::blackXfm

Purpose: PCS -> PCS round trip transform, always uses relative intent on the device -> pcs transform

581{
582 // create the cmm object
583 CIccCmm* pCmm = new CIccCmm(pProfile->m_Header.pcs, icSigUnknownData, false);
584 if (!pCmm) return NULL;
585
586 // first create a copy of the profile because the copy will be owned by the cmm
587 CIccProfile* pICC1 = new CIccProfile(*pProfile);
588 if (!pICC1) {
589 delete pCmm;
590 return NULL;
591 }
592
593 // add the xform
594 if (pCmm->AddXform(pICC1, nIntent, icInterpTetrahedral, NULL, icXformLutColor, pICC1->m_Header.version >= icVersionNumberV5 ? false : true)!=icCmmStatOk) {
595 delete pICC1;
596 delete pCmm;
597 return NULL;
598 }
599
600 // create another copy of the profile because the copy will be owned by the cmm
601 CIccProfile* pICC2 = new CIccProfile(*pProfile);
602 if (!pICC2) {
603 delete pCmm;
604 return NULL;
605 }
606
607 // add the xform
608 if (pCmm->AddXform(pICC2, icRelativeColorimetric, icInterpTetrahedral, NULL, icXformLutColor, pICC2->m_Header.version >= icVersionNumberV5 ? false : true)!=icCmmStatOk) { // uses the relative intent on the device to Lab side
609 delete pICC2;
610 delete pCmm;
611 return NULL;
612 }
613
614 // get the cmm ready to do transforms
615 if (pCmm->Begin()!=icCmmStatOk) {
616 delete pCmm;
617 return NULL;
618 }
619
620 return pCmm;
621}
#define icSigUnknownData
Definition icProfileHeader.h:903
#define icVersionNumberV5
Definition icProfileHeader.h:193
@ icXformLutColor
Definition IccCmm.h:126
@ icInterpTetrahedral
Definition IccCmm.h:115
class ICCPROFLIB_API CIccProfile
Definition IccPcc.h:80
#define true
Definition IccConvertUTF.cpp:57

References CIccProfile, icCmmStatOk, icInterpTetrahedral, icRelativeColorimetric, icXformLutColor, icHeader::pcs, and icHeader::version.

Referenced by calcDstBlackPoint().

+ Here is the caller graph for this function:

◆ lab2pcs()

void CIccApplyBPC::lab2pcs ( icFloatNumber pixel,
const CIccProfile pProfile 
) const
private
97{
98 switch (pProfile->m_Header.pcs)
99 {
100 case icSigLabData:
101 icLabToPcs(pixel);
102 break;
103
104 case icSigXYZData:
105 icLabtoXYZ(pixel);
106 icXyzToPcs(pixel);
107 break;
108
109 default:
110 break;
111 }
112}
@ icSigLabData
Definition icProfileHeader.h:847
@ icSigXYZData
Definition icProfileHeader.h:846
ICCPROFLIB_API void icLabToPcs(icFloatNumber *Lab)
Definition IccUtil.cpp:927

References icLabToPcs(), icLabtoXYZ(), icSigLabData, icSigXYZData, icXyzToPcs(), and icHeader::pcs.

Referenced by calcDstBlackPoint(), and calcSrcBlackPoint().

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

◆ pcs2lab()

void CIccApplyBPC::pcs2lab ( icFloatNumber pixel,
const CIccProfile pProfile 
) const
private
116{
117 switch (pProfile->m_Header.pcs)
118 {
119 case icSigLabData:
120 icLabFromPcs(pixel);
121 break;
122
123 case icSigXYZData:
124 icXyzFromPcs(pixel);
125 icXYZtoLab(pixel);
126 break;
127
128 default:
129 break;
130 }
131}
ICCPROFLIB_API void icXyzFromPcs(icFloatNumber *XYZ)
Here are some conversion routines to convert to regular XYZ encoding.
Definition IccUtil.cpp:934
ICCPROFLIB_API void icLabFromPcs(icFloatNumber *Lab)
Here are some conversion routines to convert to regular Lab encoding.
Definition IccUtil.cpp:919

References icLabFromPcs(), icSigLabData, icSigXYZData, icXyzFromPcs(), icXYZtoLab(), and icHeader::pcs.

Referenced by calcDstBlackPoint(), and calcSrcBlackPoint().

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

◆ pixelXfm()

bool CIccApplyBPC::pixelXfm ( icFloatNumber DstPixel,
icFloatNumber SrcPixel,
icColorSpaceSignature  SrcSpace,
icRenderingIntent  nIntent,
const CIccProfile pProfile 
) const
private

Name: CIccApplyBPC::pixelXfm

Purpose: Applies the specified transform to the source pixel

544{
545 // create the cmm object
546 CIccCmm cmm(SrcSpace, icSigUnknownData, !IsSpacePCS(SrcSpace));
547
548 // first create a copy of the profile because the copy will be owned by the cmm
549 CIccProfile* pICC = new CIccProfile(*pProfile);
550 if (!pICC) return false;
551
552 // add the xform
553 if (cmm.AddXform(pICC, nIntent, icInterpTetrahedral, NULL, icXformLutColorimetric, pICC->m_Header.version >= icVersionNumberV5 ? false : true)!=icCmmStatOk) {
554 delete pICC;
555 return false;
556 }
557
558 // get the cmm ready to do transforms
559 if (cmm.Begin()!=icCmmStatOk) {
560 return false;
561 }
562
563 // Apply the pixel
564 if (cmm.Apply(DstPixel, SrcPixel)!=icCmmStatOk) {
565 return false;
566 }
567
568 return true;
569}
@ icXformLutColorimetric
Definition IccCmm.h:135
#define IsSpacePCS(x)
Definition IccApplyBPC.cpp:74

References CIccProfile, icCmmStatOk, icInterpTetrahedral, icXformLutColorimetric, and icHeader::version.

Referenced by calcSrcBlackPoint().

+ Here is the caller graph for this function:

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