summaryrefslogtreecommitdiff
path: root/xicc/cam02ref.h
diff options
context:
space:
mode:
Diffstat (limited to 'xicc/cam02ref.h')
-rw-r--r--xicc/cam02ref.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/xicc/cam02ref.h b/xicc/cam02ref.h
index 29f7d2a..28c3fd3 100644
--- a/xicc/cam02ref.h
+++ b/xicc/cam02ref.h
@@ -22,6 +22,8 @@
/* with the ICC convention (not 100.0 as assumed by the CIECAM spec.) */
/* Note that all whites are assumed to be normalised (ie. Y = 1.0) */
+#define HHKR_MUL 0.25
+
#undef DIAG /* Print internal value diagnostics for each conversion */
/* ---------------------------------- */
@@ -122,7 +124,8 @@ double Lv /* Luminence of white in the Viewing/Scene/Image field (cd/m^2) */
static void cam02ref_free(cam02ref *s);
static int cam02ref_set_view(cam02ref *s, ViewingCondition Ev, double Wxyz[3],
- double Yb, double La, double Lv, double Yf, double Yg, double Gxyz[3], int hk);
+ double Yb, double La, double Lv, double Yf, double Yg, double Gxyz[3],
+ int hk, double hkscale);
static int cam02ref_XYZ_to_cam(cam02ref *s, double *Jab, double *xyz);
static int cam02ref_cam_to_XYZ(cam02ref *s, double XYZ[3], double Jab[3]);
@@ -160,7 +163,8 @@ double Lv, /* Luminence of white in the Viewing/Scene/Image field (cd/m^2) */
double Yf, /* Flare as a fraction of the reference white (Y range 0.0 .. 1.0) */
double Yg, /* Glare as a fraction of the adapting/surround (Y range 0.0 .. 1.0) */
double Gxyz[3], /* The Glare white coordinates (typically the Ambient color) */
-int hk /* Flag, NZ to use Helmholtz-Kohlraush effect */
+int hk, /* Flag, NZ to use Helmholtz-Kohlraush effect */
+double hkscale /* HK effect scaling factor */
) {
double tt;
@@ -185,6 +189,7 @@ int hk /* Flag, NZ to use Helmholtz-Kohlraush effect */
s->Gxyz[2] = Wxyz[2];
}
s->hk = hk;
+ s->hkscale = hkscale;
/* Compute the internal parameters by category */
switch(s->Ev) {
@@ -442,7 +447,7 @@ double XYZ[3]
/* Helmholtz-Kohlraush effect */
if (s->hk && J < 1.0) {
- double JJ, kk = C/300.0 * sin(DBL_PI * fabs(0.5 * (h - 90.0))/180.0);
+ double JJ, kk = s->hkscale * HHKR_MUL * C/300.0 * sin(DBL_PI * fabs(0.5 * (h - 90.0))/180.0);
if (kk > 0.9) /* Limit kk to a reasonable range */
kk = 0.9;
JJ = J + (1.0 - J) * kk;
@@ -508,7 +513,7 @@ double Jab[3]
/* Helmholtz-Kohlraush effect */
if (s->hk && J < 1.0) {
- double kk = C/300.0 * sin(DBL_PI * fabs(0.5 * (h - 90.0))/180.0);
+ double kk = s->hkscale * HHKR_MUL * C/300.0 * sin(DBL_PI * fabs(0.5 * (h - 90.0))/180.0);
if (kk > 0.9) /* Limit kk to a reasonable range */
kk = 0.9;
J = (J - kk)/(1.0 - kk);