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

#include <IccCAM.h>

+ Collaboration diagram for CIccCamConverter:

Public Member Functions

 CIccCamConverter ()
 
icFloatNumber GetParameter_C ()
 
icFloatNumber GetParameter_F ()
 
icFloatNumber GetParameter_La ()
 
icFloatNumber GetParameter_Nc ()
 
void GetParameter_WhitePoint (icFloatNumber *whitePoint)
 
icFloatNumber GetParameter_Yb ()
 
void JabToXYZ (const icFloatNumber *jab, icFloatNumber *xyz, int nbr)
 
CIccCamConverterNewCopy () const
 
CIccCamConverteroperator= (const CIccCamConverter &camcon)
 
void SetParameter_C (icFloatNumber c)
 
void SetParameter_F (icFloatNumber F)
 
void SetParameter_La (icFloatNumber La)
 
void SetParameter_Nc (icFloatNumber Nc)
 
void SetParameter_WhitePoint (icFloatNumber *whitePoint)
 
void SetParameter_Yb (icFloatNumber YB)
 
void XYZToJab (const icFloatNumber *xyz, icFloatNumber *jab, int nbr)
 
 ~CIccCamConverter ()
 

Private Member Functions

void ab2chDeg (icFloatNumber a, icFloatNumber b, icFloatNumber &c, icFloatNumber &h)
 
void CalcCoefficients ()
 
icFloatNumber F_Function (icFloatNumber x)
 
icFloatNumber H_Function (icFloatNumber x)
 
icFloatNumber H_FunctionInv (icFloatNumber y)
 
icFloatNumber Hyperbolic (icFloatNumber x)
 
icFloatNumber HyperbolicInv (icFloatNumber x)
 
icFloatNumber IccCam_e (icFloatNumber hue)
 
void Multiply_vect_by_mx (const icFloatNumber *in, icFloatNumber *out, icFloatNumber m[3][3])
 
void ReferenceConditions (icFloatNumber *rgb, icFloatNumber *rgbC)
 
void ReferenceConditionsInv (icFloatNumber *rgbC, icFloatNumber *rgb)
 

Private Attributes

icFloatNumber m_alfa
 
icFloatNumber m_AWhite
 
icFloatNumber m_c
 
icFloatNumber m_cc
 
icFloatNumber m_D
 
icFloatNumber m_exp
 
icFloatNumber m_F
 
icFloatNumber m_factor
 
icFloatNumber m_Fl
 
icFloatNumber m_La
 
icFloatNumber m_mFor [3][3]
 
icFloatNumber m_mInv [3][3]
 
icFloatNumber m_n
 
icFloatNumber m_Nbb
 
icFloatNumber m_Nc
 
icFloatNumber m_rgbWhite [3]
 
icFloatNumber m_WhitePoint [3]
 
icFloatNumber m_x0
 
icFloatNumber m_Yb
 
icFloatNumber m_z
 

Detailed Description

Definition at line 84 of file IccCAM.h.

Constructor & Destructor Documentation

◆ CIccCamConverter()

CIccCamConverter::CIccCamConverter ( )

Definition at line 302 of file IccCAM.cpp.

303{
304// for XYZwhite = D50, La = 500, Yb = 20, average surround
305
306 /* the initializations are based on values for an average surround */
307 m_La = (icFloatNumber) 500.0;
308 m_Yb = (icFloatNumber) 20.0;
309
310 m_WhitePoint[0] = icD50XYZ[0];
311 m_WhitePoint[1] = icD50XYZ[1];
312 m_WhitePoint[2] = icD50XYZ[2];
313
314 /* the initializations are based on values for an average surround */
315 m_c = (icFloatNumber) 0.69; /* impact surround */
316 m_Nc = (icFloatNumber) 1.00; /* chromatic induction factor */
317 m_F = (icFloatNumber) 1.00; /* degree of adaptation factor */
318
319 // ciecat02 = HPE
320 m_mFor[0][0] = 0.38970f; m_mFor[0][1] = 0.68898f; m_mFor[0][2] = -0.07868f;
321 m_mFor[1][0] = -0.22981f; m_mFor[1][1] = 1.18340f; m_mFor[1][2] = 0.04641f;
322 m_mFor[2][0] = 0.00000f; m_mFor[2][1] = 0.00000f; m_mFor[2][2] = 1.00000f;
323
324 m_mInv[0][0] = 1.910197f; m_mInv[0][1] = -1.1121240f; m_mInv[0][2] = 0.201908f;
325 m_mInv[1][0] = 0.370950f; m_mInv[1][1] = 0.6290540f; m_mInv[1][2] = 0.000008f;
326 m_mInv[2][0] = 0.000000f; m_mInv[2][1] = 0.0000000f; m_mInv[2][2] = 1.000000f;
327
328 /* precalculated values */
329// m_x0 = 0.25 / 255
330// m_alfa = 0.041747f;
331// m_exp = 0.396f;
332
333// m_x0 = 1 / 255
334// m_alfa = 0.089914f;
335// m_exp = 0.372f;
336
337// m_x0 = 4 / 255
338// m_alfa = 0.2307f;
339// m_exp = 0.3169f;
340
341 m_alfa = 0.2307f;
342 m_exp = 0.3169f;
343
345}
icFloatNumber icD50XYZ[3]
Definition IccUtil.cpp:782
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
icFloatNumber m_La
Definition IccCAM.h:89
icFloatNumber m_Yb
Definition IccCAM.h:90
icFloatNumber m_mInv[3][3]
Definition IccCAM.h:95
icFloatNumber m_Nc
Definition IccCAM.h:92
icFloatNumber m_alfa
Definition IccCAM.h:114
icFloatNumber m_mFor[3][3]
Definition IccCAM.h:94
icFloatNumber m_c
Definition IccCAM.h:91
void CalcCoefficients()
Definition IccCAM.cpp:250
icFloatNumber m_F
Definition IccCAM.h:93
icFloatNumber m_exp
Definition IccCAM.h:115
icFloatNumber m_WhitePoint[3]
Definition IccCAM.h:88

References CalcCoefficients(), icD50XYZ, m_alfa, m_c, m_exp, m_F, m_La, m_mFor, m_mInv, m_Nc, m_WhitePoint, and m_Yb.

Referenced by NewCopy().

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

◆ ~CIccCamConverter()

CIccCamConverter::~CIccCamConverter ( )

Definition at line 349 of file IccCAM.cpp.

350{
351}

Member Function Documentation

◆ ab2chDeg()

void CIccCamConverter::ab2chDeg ( icFloatNumber a,
icFloatNumber b,
icFloatNumber & c,
icFloatNumber & h )
private

Definition at line 291 of file IccCAM.cpp.

292{
293 c = sqrt(a*a + b*b);
294 h = (icFloatNumber)(atan2(b, a) * 180.0 / icPiNum);
295 while (h<0.0)
296 h+=360.0;
297}
#define icPiNum
Definition IccUtil.h:85

References icPiNum.

Referenced by JabToXYZ(), and XYZToJab().

+ Here is the caller graph for this function:

◆ CalcCoefficients()

void CIccCamConverter::CalcCoefficients ( )
private

Definition at line 250 of file IccCAM.cpp.

251{
252 icFloatNumber k, La5, rgbC[3], rgbP[3];
253
254 double epow = pow (2.7182818, (-((double)m_La + 42.0)/92.0) );
255 m_D = (icFloatNumber) (m_F *(1.0 - (epow/ 3.6)) );
256
257 k = 1.0f / (5.0f * m_La + 1.0f);
258 k = (icFloatNumber)(pow ((double)k, 4.0));
259 La5 = 5.0f * m_La;
260 m_Fl = (icFloatNumber)(0.2 * k * La5 + 0.1 * (1 - k) * (1 - k) * pow ((double)La5, 0.333333));
261
262 m_n = m_Yb / m_WhitePoint[1];
263
264 m_factor = (icFloatNumber) pow (1.64 - pow (0.29, (double) m_n), 0.73);
265
266 m_Nbb = (icFloatNumber)(0.725 / pow ((double)(m_n), 0.2));
267
268 m_z = (icFloatNumber)(1.48 + sqrt (m_n));
269
271
273
274 // because CIECAT02 == HPE
275 rgbP[0] = rgbC[0];
276 rgbP[1] = rgbC[1];
277 rgbP[2] = rgbC[2];
278
279 rgbP[0] = Hyperbolic (m_Fl * rgbP[0] / 100) + 0.1f;
280 rgbP[1] = Hyperbolic (m_Fl * rgbP[1] / 100) + 0.1f;
281 rgbP[2] = Hyperbolic (m_Fl * rgbP[2] / 100) + 0.1f;
282 m_AWhite = (icFloatNumber)((2.0 * rgbP[0] + rgbP[1] + rgbP[2] / 20.0 - 0.305) * m_Nbb);
283
284// m_x0 = (icFloatNumber) (m_Fl * 0.25 / 255.0);
285// m_x0 = (icFloatNumber) (m_Fl * 1.00 / 255.0)
286 m_x0 = (icFloatNumber) (m_Fl * 4.00 / 255.0);
288}
icFloatNumber F_Function(icFloatNumber x)
Definition IccCAM.cpp:115
icFloatNumber H_Function(icFloatNumber x)
Definition IccCAM.cpp:125
icFloatNumber m_D
Definition IccCAM.h:104
icFloatNumber m_cc
Definition IccCAM.h:113
void Multiply_vect_by_mx(const icFloatNumber *in, icFloatNumber *out, icFloatNumber m[3][3])
Definition IccCAM.cpp:81
icFloatNumber Hyperbolic(icFloatNumber x)
Definition IccCAM.cpp:149
icFloatNumber m_x0
Definition IccCAM.h:112
icFloatNumber m_Nbb
Definition IccCAM.h:107
icFloatNumber m_rgbWhite[3]
Definition IccCAM.h:103
icFloatNumber m_factor
Definition IccCAM.h:96
void ReferenceConditions(icFloatNumber *rgb, icFloatNumber *rgbC)
Definition IccCAM.cpp:93
icFloatNumber m_n
Definition IccCAM.h:106
icFloatNumber m_z
Definition IccCAM.h:108
icFloatNumber m_Fl
Definition IccCAM.h:105
icFloatNumber m_AWhite
Definition IccCAM.h:109

References F_Function(), H_Function(), Hyperbolic(), m_alfa, m_AWhite, m_cc, m_D, m_F, m_factor, m_Fl, m_La, m_mFor, m_n, m_Nbb, m_rgbWhite, m_WhitePoint, m_x0, m_Yb, m_z, Multiply_vect_by_mx(), and ReferenceConditions().

Referenced by CIccCamConverter(), SetParameter_C(), SetParameter_F(), SetParameter_La(), SetParameter_Nc(), SetParameter_WhitePoint(), and SetParameter_Yb().

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

◆ F_Function()

icFloatNumber CIccCamConverter::F_Function ( icFloatNumber x)
private

Definition at line 115 of file IccCAM.cpp.

116{
118 y = (icFloatNumber) (400.0 * pow ((double)x, 0.42) / (27.13 + pow ((double)x, 0.42)));
119 return y;
120}

Referenced by CalcCoefficients(), Hyperbolic(), and HyperbolicInv().

+ Here is the caller graph for this function:

◆ GetParameter_C()

icFloatNumber CIccCamConverter::GetParameter_C ( )

Definition at line 446 of file IccCAM.cpp.

447{
448 return m_c;
449}

References m_c.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccMpeCAM::Describe(), icXmlDumpColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Write().

+ Here is the caller graph for this function:

◆ GetParameter_F()

icFloatNumber CIccCamConverter::GetParameter_F ( )

Definition at line 462 of file IccCAM.cpp.

463{
464 return m_F;
465}

References m_F.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccMpeCAM::Describe(), icXmlDumpColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Write().

+ Here is the caller graph for this function:

◆ GetParameter_La()

icFloatNumber CIccCamConverter::GetParameter_La ( )

Definition at line 430 of file IccCAM.cpp.

431{
432 return m_La;
433}

References m_La.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccMpeCAM::Describe(), icXmlDumpColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Write().

+ Here is the caller graph for this function:

◆ GetParameter_Nc()

icFloatNumber CIccCamConverter::GetParameter_Nc ( )

Definition at line 454 of file IccCAM.cpp.

455{
456 return m_Nc;
457}

References m_Nc.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccMpeCAM::Describe(), icXmlDumpColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Write().

+ Here is the caller graph for this function:

◆ GetParameter_WhitePoint()

void CIccCamConverter::GetParameter_WhitePoint ( icFloatNumber * whitePoint)

Definition at line 420 of file IccCAM.cpp.

421{
422 whitePoint[0] = m_WhitePoint[0];
423 whitePoint[1] = m_WhitePoint[1];
424 whitePoint[2] = m_WhitePoint[2];
425}

References m_WhitePoint.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccMpeCAM::Describe(), icXmlDumpColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Write().

+ Here is the caller graph for this function:

◆ GetParameter_Yb()

icFloatNumber CIccCamConverter::GetParameter_Yb ( )

Definition at line 438 of file IccCAM.cpp.

439{
440 return m_Yb;
441}

References m_Yb.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccMpeCAM::Describe(), icXmlDumpColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Write().

+ Here is the caller graph for this function:

◆ H_Function()

icFloatNumber CIccCamConverter::H_Function ( icFloatNumber x)
private

Definition at line 125 of file IccCAM.cpp.

126{
128
129 y = (icFloatNumber) (400.0 * pow ((double)x, (double)m_exp) / (27.13 + pow ((double)x, (double)m_exp)));
130
131 return y;
132}

References m_exp.

Referenced by CalcCoefficients(), Hyperbolic(), and HyperbolicInv().

+ Here is the caller graph for this function:

◆ H_FunctionInv()

icFloatNumber CIccCamConverter::H_FunctionInv ( icFloatNumber y)
private

Definition at line 137 of file IccCAM.cpp.

138{
140
141 x = (icFloatNumber) (pow (27.13*y / (400.0-y), 1.0/m_exp));
142
143 return x;
144}

References m_exp.

Referenced by HyperbolicInv().

+ Here is the caller graph for this function:

◆ Hyperbolic()

icFloatNumber CIccCamConverter::Hyperbolic ( icFloatNumber x)
private

Definition at line 149 of file IccCAM.cpp.

150{
152
153 if (x < 0)
154 {
155 if (-x <= m_x0)
156 {
157 y = m_cc * x;
158 }
159 else
160 {
161 y = - ((1 + m_alfa) * H_Function (-x) / H_Function (m_Fl) - m_alfa) * F_Function (m_Fl);
162 }
163 }
164 else
165 {
166 if (x <= m_x0)
167 {
168 y = m_cc * x;
169 }
170 else
171 {
172 y = ((1 + m_alfa) * H_Function (x) / H_Function (m_Fl) - m_alfa) * F_Function (m_Fl);
173 }
174 }
175
176 return y;
177}

References F_Function(), H_Function(), m_alfa, m_cc, m_Fl, and m_x0.

Referenced by CalcCoefficients(), and XYZToJab().

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

◆ HyperbolicInv()

icFloatNumber CIccCamConverter::HyperbolicInv ( icFloatNumber x)
private

Definition at line 182 of file IccCAM.cpp.

183{
184 icFloatNumber x, h_y;
185
186 if (y < 0)
187 {
188 if (-y <= (m_cc * m_x0))
189 {
190 x = y / m_cc;
191 }
192 else
193 {
194 h_y = (- y / F_Function (m_Fl) + m_alfa) / (1 + m_alfa) * H_Function (m_Fl);
195 x = - H_FunctionInv (h_y);
196 }
197 }
198 else
199 {
200 if (y <= (m_cc * m_x0))
201 {
202 x = y / m_cc;
203 }
204 else
205 {
206 h_y = (y / F_Function (m_Fl) + m_alfa) / (1 + m_alfa) * H_Function (m_Fl);
207 x = H_FunctionInv (h_y);
208 }
209 }
210
211 return x;
212}
icFloatNumber H_FunctionInv(icFloatNumber y)
Definition IccCAM.cpp:137

References F_Function(), H_Function(), H_FunctionInv(), m_alfa, m_cc, m_Fl, and m_x0.

Referenced by JabToXYZ().

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

◆ IccCam_e()

icFloatNumber CIccCamConverter::IccCam_e ( icFloatNumber hue)
private

Definition at line 217 of file IccCAM.cpp.

218{
219 int i, j;
220 icFloatNumber offset;
221 double hdef[4] = {20.14, 90.00, 164.25, 237.53};
222 double edef[4] = {0.8, 0.7, 1.0, 1.2};
223
224 for (i = 0; i < 4; i++)
225 if (hue < hdef[i])
226 break;
227
228 j = i - 1;
229 if (i == 0)
230 j = 3;
231 else if (i == 4)
232 i = 0;
233
234 if (i == 0)
235 {
236 offset = 360.0;
237
238 if (hue <= hdef[0])
239 hue += 360.0;
240 }
241 else
242 offset = 0;
243
244 return (icFloatNumber)(edef[j] + (edef[i] - edef[j]) * (hue - hdef[j]) / (offset + hdef[i] - hdef[j]));
245}

◆ JabToXYZ()

void CIccCamConverter::JabToXYZ ( const icFloatNumber * jab,
icFloatNumber * xyz,
int nbr )

Definition at line 528 of file IccCAM.cpp.

531{
532 int i;
533 icFloatNumber rgb[3], rgbP[3], rgbC[3];
534 icFloatNumber lc, lh, lhr, et, p1, p2, p4, p5, p3, numerator;
535 icFloatNumber value, a, b, cotan, tanValue;
536 double exp = 1.0 / 0.9;
537 double A, ratio, C, t;
538 const icFloatNumber* h_jab;
539 icFloatNumber* h_xyz;
540
541 h_jab = jab;
542 h_xyz = xyz;
543
544 for (i=0;i<nbr;i++)
545 {
546 if (h_jab[0] < 1.0e-5)
547 {
548 rgbP[0] = 0.1f;
549 rgbP[1] = 0.1f;
550 rgbP[2] = 0.1f;
551 }
552 else
553 {
554 C = sqrt (h_jab[1] * h_jab[1] + h_jab[2] * h_jab[2]);
555
556 ratio = C / (sqrt (h_jab[0]/100.0) * m_factor);
557 t = pow (ratio, exp);
558 A = m_AWhite * pow (h_jab[0]/100.0, 1.0/(m_c*m_z));
559
560 p2 = (icFloatNumber) ((A / m_Nbb + 0.305f) * 460.0 / 1403.0);
561
562 if (t < 1.0e-5)
563 {
564 rgbP[0] = p2;
565 rgbP[1] = p2;
566 rgbP[2] = p2;
567 }
568 else
569 {
570 ab2chDeg (h_jab[1], h_jab[2], lc, lh);
571 lhr = lh * (icFloatNumber)icPiNum / 180.0f;
572
573 et = (icFloatNumber)((cos ((double)lhr + 2.0) + 3.8) / 4.0);
574
575 p1 = (icFloatNumber)((50000.0f / 13.0f) * m_Nc * m_Nbb * et / t);
576 p3 = 21.0f / 20.0f;
577
578 numerator = p2 * (2.0f + p3);
579
580 if ((lh <= 45) || (lh >= 315) || ((lh > 135) && (lh < 225))) /* |a| > |b| */
581 {
582 tanValue = (icFloatNumber)(tan ((double)lhr));
583
584 if ((lh > 90) && (lh < 270))
585 value = (icFloatNumber)(- pow (1 + pow ((double)tanValue, 2.0), 0.5));
586 else
587 value = (icFloatNumber)(pow (1 + pow ((double)tanValue, 2.0), 0.5));
588
589 p5 = (icFloatNumber)(p1 * value);
590
591 a = (icFloatNumber)(numerator / (p5 + (2.0f+p3)*(220.0f/1403.0f) - (27.0f/1403.0f - p3*(6300.0f/1403.0f)) * tanValue));
592 b = a * tanValue;
593 }
594 else /* |b| > |a| */
595 {
596 if (fabs (lh - 90) < 1.0e-5)
597 cotan = 0.0f;
598 else if (fabs (lh - 270) < 1.0e-5)
599 cotan = 0.0f;
600 else
601 cotan = (icFloatNumber)(1 / tan ((double)lhr));
602
603 if (lh > 180)
604 value = (icFloatNumber)(- pow (1 + pow ((double)cotan , 2.0), 0.5));
605 else
606 value = (icFloatNumber)(pow (1 + pow ((double)cotan, 2.0), 0.5));
607
608 p4 = (icFloatNumber)(p1 * value);
609
610 b = (icFloatNumber)(numerator / (p4 + (2.0f+p3)*(220.0f/1403.0f) * cotan - 27.0f/1403.0f + p3*(6300.0f/1403.0f)));
611 a = b * cotan;
612 }
613
614 rgbP[0] = (icFloatNumber)(p2 + ( 451.0 * a + 288.0 * b) / 1403.0);
615 rgbP[1] = (icFloatNumber)(p2 + (-891.0 * a - 261.0 * b) / 1403.0);
616 rgbP[2] = (icFloatNumber)(p2 + (-220.0 * a - 6300.0 * b) / 1403.0);
617 }
618 }
619
620 if (rgbP[0] < 0) rgbP[0] = 0.0f;
621 if (rgbP[1] < 0) rgbP[1] = 0.0f;
622 if (rgbP[2] < 0) rgbP[2] = 0.0f;
623
624 rgbC[0] = 100 * HyperbolicInv (rgbP[0] - 0.1f) / m_Fl;
625 rgbC[1] = 100 * HyperbolicInv (rgbP[1] - 0.1f) / m_Fl;
626 rgbC[2] = 100 * HyperbolicInv (rgbP[2] - 0.1f) / m_Fl;
627
628 ReferenceConditionsInv (rgbC, rgb);
629 Multiply_vect_by_mx (rgb, h_xyz, m_mInv);
630
631 h_jab += 3;
632 h_xyz += 3;
633 }
634}
void ab2chDeg(icFloatNumber a, icFloatNumber b, icFloatNumber &c, icFloatNumber &h)
Definition IccCAM.cpp:291
icFloatNumber HyperbolicInv(icFloatNumber x)
Definition IccCAM.cpp:182
void ReferenceConditionsInv(icFloatNumber *rgbC, icFloatNumber *rgb)
Definition IccCAM.cpp:104

References ab2chDeg(), HyperbolicInv(), icPiNum, m_AWhite, m_c, m_factor, m_Fl, m_mInv, m_Nbb, m_Nc, m_z, Multiply_vect_by_mx(), and ReferenceConditionsInv().

Referenced by CIccMpeJabToXYZ::Apply().

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

◆ Multiply_vect_by_mx()

void CIccCamConverter::Multiply_vect_by_mx ( const icFloatNumber * in,
icFloatNumber * out,
icFloatNumber m[3][3] )
private

Definition at line 81 of file IccCAM.cpp.

84{
85 out[0] = m[0][0] * in[0] + m[0][1] * in[1] + m[0][2] * in[2];
86 out[1] = m[1][0] * in[0] + m[1][1] * in[1] + m[1][2] * in[2];
87 out[2] = m[2][0] * in[0] + m[2][1] * in[1] + m[2][2] * in[2];
88}

Referenced by CalcCoefficients(), JabToXYZ(), and XYZToJab().

+ Here is the caller graph for this function:

◆ NewCopy()

CIccCamConverter * CIccCamConverter::NewCopy ( ) const

Definition at line 354 of file IccCAM.cpp.

355{
357 *rv = *this;
358 return rv;
359}

References CIccCamConverter().

+ Here is the call graph for this function:

◆ operator=()

CIccCamConverter & CIccCamConverter::operator= ( const CIccCamConverter & camcon)

Definition at line 636 of file IccCAM.cpp.

637{
638 memcpy(&m_WhitePoint, &camcon.m_WhitePoint, sizeof(m_WhitePoint));
639 m_La=camcon.m_La; /* Absolute luminance of adapting field in cd/m^2 */
640 m_Yb=camcon.m_Yb; /* relative luminance of background in cd/m^2 */
641 m_c=camcon.m_c; /* impact surround */
642 m_Nc=camcon.m_Nc; /* chromatic induction factor */
643 m_F=camcon.m_F; /* degree of adaptation factor */
644 memcpy(&m_mFor, &camcon.m_mFor, sizeof(m_mFor));
645 memcpy(&m_mInv, &camcon.m_mInv, sizeof(m_mInv));
646 m_factor=camcon.m_factor;
647
648 //Additional non-provided parameters
649 //Yw is relative luminance of adapting field in cd/m^2
650 //LW is absolute luminance of the reference white in cd/m^2
651
652 // parameters precalculations
653 memcpy(m_rgbWhite, camcon.m_rgbWhite, sizeof(m_rgbWhite));
654 m_D=camcon.m_D;
655 m_Fl=camcon.m_Fl;
656 m_n=camcon.m_n;
657 m_Nbb=camcon.m_Nbb;
658 m_z=camcon.m_z;
659 m_AWhite=camcon.m_AWhite;
660
661 // parameters for corrected hyperbolic function
662 m_x0=camcon.m_x0;
663 m_cc=camcon.m_cc;
664 m_alfa=camcon.m_alfa;
665 m_exp=camcon.m_exp;
666
667 return *this;
668}

References m_alfa, m_AWhite, m_c, m_cc, m_D, m_exp, m_F, m_factor, m_Fl, m_La, m_mFor, m_mInv, m_n, m_Nbb, m_Nc, m_rgbWhite, m_WhitePoint, m_x0, m_Yb, and m_z.

◆ ReferenceConditions()

void CIccCamConverter::ReferenceConditions ( icFloatNumber * rgb,
icFloatNumber * rgbC )
private

Definition at line 93 of file IccCAM.cpp.

95{
96 rgbC[0] = (icFloatNumber)((m_D * m_WhitePoint[1] / m_rgbWhite[0] + 1.0 - m_D) * rgb[0]);
97 rgbC[1] = (icFloatNumber)((m_D * m_WhitePoint[1] / m_rgbWhite[1] + 1.0 - m_D) * rgb[1]);
98 rgbC[2] = (icFloatNumber)((m_D * m_WhitePoint[1] / m_rgbWhite[2] + 1.0 - m_D) * rgb[2]);
99}

References m_D, m_rgbWhite, and m_WhitePoint.

Referenced by CalcCoefficients(), and XYZToJab().

+ Here is the caller graph for this function:

◆ ReferenceConditionsInv()

void CIccCamConverter::ReferenceConditionsInv ( icFloatNumber * rgbC,
icFloatNumber * rgb )
private

Definition at line 104 of file IccCAM.cpp.

106{
107 rgb[0] = (icFloatNumber)(rgbC[0] / (m_D * m_WhitePoint[1] / m_rgbWhite[0] + 1.0 - m_D));
108 rgb[1] = (icFloatNumber)(rgbC[1] / (m_D * m_WhitePoint[1] / m_rgbWhite[1] + 1.0 - m_D));
109 rgb[2] = (icFloatNumber)(rgbC[2] / (m_D * m_WhitePoint[1] / m_rgbWhite[2] + 1.0 - m_D));
110}

References m_D, m_rgbWhite, and m_WhitePoint.

Referenced by JabToXYZ().

+ Here is the caller graph for this function:

◆ SetParameter_C()

void CIccCamConverter::SetParameter_C ( icFloatNumber c)

Definition at line 393 of file IccCAM.cpp.

394{
395 m_c = c;
397}

References CalcCoefficients(), and m_c.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccDefaultEncProfileConverter::ConvertFromParams(), icXmlParseColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Read().

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

◆ SetParameter_F()

void CIccCamConverter::SetParameter_F ( icFloatNumber F)

Definition at line 411 of file IccCAM.cpp.

412{
413 m_F = F;
415}
#define F(x, y, z)
Definition IccMD5.cpp:64

References CalcCoefficients(), F, and m_F.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccDefaultEncProfileConverter::ConvertFromParams(), icXmlParseColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Read().

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

◆ SetParameter_La()

void CIccCamConverter::SetParameter_La ( icFloatNumber La)

Definition at line 375 of file IccCAM.cpp.

376{
377 m_La = La;
379}

References CalcCoefficients(), and m_La.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccDefaultEncProfileConverter::ConvertFromParams(), icXmlParseColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Read().

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

◆ SetParameter_Nc()

void CIccCamConverter::SetParameter_Nc ( icFloatNumber Nc)

Definition at line 402 of file IccCAM.cpp.

403{
404 m_Nc = Nc;
406}

References CalcCoefficients(), and m_Nc.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccDefaultEncProfileConverter::ConvertFromParams(), icXmlParseColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Read().

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

◆ SetParameter_WhitePoint()

void CIccCamConverter::SetParameter_WhitePoint ( icFloatNumber * whitePoint)

Definition at line 364 of file IccCAM.cpp.

365{
366 m_WhitePoint[0] = whitePoint[0];
367 m_WhitePoint[1] = whitePoint[1];
368 m_WhitePoint[2] = whitePoint[2];
370}

References CalcCoefficients(), and m_WhitePoint.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccDefaultEncProfileConverter::ConvertFromParams(), icXmlParseColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Read().

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

◆ SetParameter_Yb()

void CIccCamConverter::SetParameter_Yb ( icFloatNumber YB)

Definition at line 384 of file IccCAM.cpp.

385{
386 m_Yb = Yb;
388}

References CalcCoefficients(), and m_Yb.

Referenced by CIccMpeJabToXYZ::CIccMpeJabToXYZ(), CIccMpeXYZToJab::CIccMpeXYZToJab(), CIccDefaultEncProfileConverter::ConvertFromParams(), icXmlParseColorAppearanceParams(), CIccMpeJabToXYZ::operator=(), CIccMpeXYZToJab::operator=(), and CIccMpeCAM::Read().

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

◆ XYZToJab()

void CIccCamConverter::XYZToJab ( const icFloatNumber * xyz,
icFloatNumber * jab,
int nbr )

Definition at line 470 of file IccCAM.cpp.

473{
474 int k;
475 icFloatNumber rgb[3], rgbC[3], rgbP[3];
476 icFloatNumber la, lb, lc, lchroma, lh, lhr, A, J, et, t, C, ac, bc;
477 const icFloatNumber* h_xyz;
478 icFloatNumber* h_jab;
479
480 h_xyz = xyz;
481 h_jab = jab;
482
483 for (k=0;k<nbr;k++)
484 {
485 Multiply_vect_by_mx (h_xyz, rgb, m_mFor);
486
487 // clipping to the HPE triangle
488 if (rgb[0] < 0) rgb[0] = 0.0f;
489 if (rgb[1] < 0) rgb[1] = 0.0f;
490 if (rgb[2] < 0) rgb[2] = 0.0f;
491
492 ReferenceConditions (rgb, rgbC);
493
494 rgbP[0] = Hyperbolic (m_Fl * rgbC[0] / 100) + 0.1f;
495 rgbP[1] = Hyperbolic (m_Fl * rgbC[1] / 100) + 0.1f;
496 rgbP[2] = Hyperbolic (m_Fl * rgbC[2] / 100) + 0.1f;
497
498 la = (icFloatNumber)(rgbP[0] - 12.0 * rgbP[1] / 11.0 + rgbP[2] / 11.0);
499 lb = (icFloatNumber)((rgbP[0] + rgbP[1] - 2.0 * rgbP[2] ) / 9.0);
500 lchroma = (icFloatNumber)(sqrt (la * la + lb * lb));
501
502 ab2chDeg (la, lb, lc, lh);
503 lhr = lh * (icFloatNumber)icPiNum / 180.0f;
504
505 A = (icFloatNumber)((2.0 * rgbP[0] + rgbP[1] + rgbP[2] / 20.0 - 0.305) * m_Nbb);
506
507 J = (icFloatNumber)(100.0 * pow (A / m_AWhite, m_c * m_z));
508
509 et = (icFloatNumber)((cos(lhr + 2.0) + 3.8) / 4.0);
510 t = (icFloatNumber)(50.0 * lchroma * 100 * et * 10.0/13.0 * m_Nc * m_Nbb / (rgbP[0]+rgbP[1]+21.0/20.0*rgbP[2]));
511 C = (icFloatNumber)(pow((double)t, 0.9) * sqrt ((double)(J/100.0)) * m_factor);
512
513 ac = (icFloatNumber)(C * cos(lhr));
514 bc = (icFloatNumber)(C * sin(lhr));
515
516 h_jab[0] = J;
517 h_jab[1] = ac;
518 h_jab[2] = bc;
519
520 h_xyz += 3;
521 h_jab += 3;
522 }
523}

References ab2chDeg(), Hyperbolic(), icPiNum, m_AWhite, m_c, m_factor, m_Fl, m_mFor, m_Nbb, m_Nc, m_z, Multiply_vect_by_mx(), and ReferenceConditions().

Referenced by CIccMpeXYZToJab::Apply().

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

Member Data Documentation

◆ m_alfa

icFloatNumber CIccCamConverter::m_alfa
private

Definition at line 114 of file IccCAM.h.

Referenced by CalcCoefficients(), CIccCamConverter(), Hyperbolic(), HyperbolicInv(), and operator=().

◆ m_AWhite

icFloatNumber CIccCamConverter::m_AWhite
private

Definition at line 109 of file IccCAM.h.

Referenced by CalcCoefficients(), JabToXYZ(), operator=(), and XYZToJab().

◆ m_c

icFloatNumber CIccCamConverter::m_c
private

Definition at line 91 of file IccCAM.h.

Referenced by CIccCamConverter(), GetParameter_C(), JabToXYZ(), operator=(), SetParameter_C(), and XYZToJab().

◆ m_cc

icFloatNumber CIccCamConverter::m_cc
private

Definition at line 113 of file IccCAM.h.

Referenced by CalcCoefficients(), Hyperbolic(), HyperbolicInv(), and operator=().

◆ m_D

icFloatNumber CIccCamConverter::m_D
private

Definition at line 104 of file IccCAM.h.

Referenced by CalcCoefficients(), operator=(), ReferenceConditions(), and ReferenceConditionsInv().

◆ m_exp

icFloatNumber CIccCamConverter::m_exp
private

Definition at line 115 of file IccCAM.h.

Referenced by CIccCamConverter(), H_Function(), H_FunctionInv(), and operator=().

◆ m_F

icFloatNumber CIccCamConverter::m_F
private

◆ m_factor

icFloatNumber CIccCamConverter::m_factor
private

Definition at line 96 of file IccCAM.h.

Referenced by CalcCoefficients(), JabToXYZ(), operator=(), and XYZToJab().

◆ m_Fl

icFloatNumber CIccCamConverter::m_Fl
private

Definition at line 105 of file IccCAM.h.

Referenced by CalcCoefficients(), Hyperbolic(), HyperbolicInv(), JabToXYZ(), operator=(), and XYZToJab().

◆ m_La

icFloatNumber CIccCamConverter::m_La
private

◆ m_mFor

icFloatNumber CIccCamConverter::m_mFor[3][3]
private

Definition at line 94 of file IccCAM.h.

Referenced by CalcCoefficients(), CIccCamConverter(), operator=(), and XYZToJab().

◆ m_mInv

icFloatNumber CIccCamConverter::m_mInv[3][3]
private

Definition at line 95 of file IccCAM.h.

Referenced by CIccCamConverter(), JabToXYZ(), and operator=().

◆ m_n

icFloatNumber CIccCamConverter::m_n
private

Definition at line 106 of file IccCAM.h.

Referenced by CalcCoefficients(), and operator=().

◆ m_Nbb

icFloatNumber CIccCamConverter::m_Nbb
private

Definition at line 107 of file IccCAM.h.

Referenced by CalcCoefficients(), JabToXYZ(), operator=(), and XYZToJab().

◆ m_Nc

icFloatNumber CIccCamConverter::m_Nc
private

◆ m_rgbWhite

icFloatNumber CIccCamConverter::m_rgbWhite[3]
private

Definition at line 103 of file IccCAM.h.

Referenced by CalcCoefficients(), operator=(), ReferenceConditions(), and ReferenceConditionsInv().

◆ m_WhitePoint

◆ m_x0

icFloatNumber CIccCamConverter::m_x0
private

Definition at line 112 of file IccCAM.h.

Referenced by CalcCoefficients(), Hyperbolic(), HyperbolicInv(), and operator=().

◆ m_Yb

icFloatNumber CIccCamConverter::m_Yb
private

◆ m_z

icFloatNumber CIccCamConverter::m_z
private

Definition at line 108 of file IccCAM.h.

Referenced by CalcCoefficients(), JabToXYZ(), operator=(), and XYZToJab().


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