summaryrefslogtreecommitdiff
path: root/gamut
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-09-01 15:43:52 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-09-01 15:43:52 +0200
commitc07d0c2d2f6f7b0eb6e92cc6204bf05037957e82 (patch)
tree41791cbe367cf023b98043fee56f9346b2592b49 /gamut
parentd7f89e6fe63b8697fab5a901cfce457b375638b3 (diff)
Imported Upstream version 1.6.3upstream/1.6.3
Diffstat (limited to 'gamut')
-rw-r--r--gamut/gammap.c43
-rw-r--r--gamut/gammap.h2
-rw-r--r--gamut/gamut.c20
-rw-r--r--gamut/gamut.h2
-rw-r--r--gamut/maptest.c3
-rw-r--r--gamut/nearsmth.c1
6 files changed, 33 insertions, 38 deletions
diff --git a/gamut/gammap.c b/gamut/gammap.c
index a9bef1e..d463755 100644
--- a/gamut/gammap.c
+++ b/gamut/gammap.c
@@ -26,9 +26,10 @@
* proportionality. Ideally there should be an intent that matches
* this, that can be selected for the colorimetric table (or perhaps be default).
*
- * It might be good to offer the black mapping method as an option (gmm_BPmap),
+ * It might be good to offer the black mapping method as an option (icx_BPmap),
* as well as offering different profile (xicc/xlut.c) black point options
* (neutral, K hue max density, CMY max density, any max density).
+ * Perhaps print RGB & CMY should default to neutral black, rather than 0,0,0 ??
*
* The gamut mapping code here and the near smooth code don't actually mesh
* very well. For instance, the black point bend approach in < V1.3.4
@@ -448,11 +449,6 @@ gammap *new_gammap(
double *mx, /* for rspl grid. */
char *diagname /* If non-NULL, write a gamut mapping diagnostic WRL */
) {
- gmm_BPmap bph = gmm_bendBP; /* Prefered algorithm */
-// gmm_BPmap bph = gmm_clipBP; /* Alternatives tried */
-// gmm_BPmap bph = gmm_BPadpt;
-// gmm_BPmap bph = gmm_noBPadpt;
-
gammap *s; /* This */
gamut *scl_gam; /* Source colorspace gamut with rotation and L mapping applied */
gamut *sil_gam; /* Source image gamut with rotation and L mapping applied */
@@ -499,12 +495,6 @@ gammap *new_gammap(
printf("Gamut map resolution: %d\n",mapres);
if (si_gam != NULL)
printf("Image gamut supplied\n");
- switch(bph) {
- case gmm_clipBP: printf("Neutral axis no-adapt extend and clip\n"); break;
- case gmm_BPadpt: printf("Neutral axis fully adapt\n"); break;
- case gmm_bendBP: printf("Neutral axis no-adapt extend and bend\n"); break;
- case gmm_noBPadpt: printf("Neutral axis no-adapt\n"); break;
- }
}
/* Allocate the object */
@@ -729,8 +719,8 @@ gammap *new_gammap(
}
/* Now decide the detail of the white and black alignment */
- if (bph == gmm_BPadpt || bph == gmm_bendBP) { /* Adapt to destination white and black */
-
+ if (gmi->bph == gmm_BPadpt || gmi->bph == gmm_bendBP) {
+ /* Adapt to destination white and black */
/* Use the fully adapted white and black points */
for (j = 0; j < 3; j++) {
@@ -738,7 +728,7 @@ gammap *new_gammap(
dr_cs_bp[j] = fabp[j];
}
- if (bph == gmm_bendBP) {
+ if (gmi->bph == gmm_bendBP) {
/* Extend the half adapted (white = dst, black = src) black point */
/* to the same L as the target (dst), to use as the initial (bent) black point */
@@ -768,7 +758,7 @@ gammap *new_gammap(
dr_cs_wp[0], dr_cs_wp[1], dr_cs_wp[2], dr_cs_bp[0], dr_cs_bp[1], dr_cs_bp[2]);
}
#endif
- if (bph == gmm_clipBP) {
+ if (gmi->bph == gmm_clipBP) {
/* Extend the target black point to accomodate the */
/* bent or clipped destination space L* range */
@@ -1114,31 +1104,12 @@ glumknf = 1.0;
{
/* We want to rotate and then map L independently of everything else, */
- /* so transform source csape & image gamuts through the rotation and L mapping */
+ /* so transform source cs & image gamuts through the rotation and L mapping */
/* before we create the surface 3D mapping from them */
/* Create L mapped versions of rotated src colorspace white/black points */
-#ifdef NEVER
- co cp;
- double t;
- int i;
-
- cp.p[0] = sr_cs_wp[0];
- s->grey->interp(s->grey, &cp);
-
- t = (cp.v[0] - sr_cs_bp[0])/(sr_cs_wp[0] - sr_cs_bp[0]);
- for (j = 0; j < 3; j++)
- sl_cs_wp[j] = sr_cs_bp[j] + t * (sr_cs_wp[j] - sr_cs_bp[j]);
-
- cp.p[0] = sr_cs_bp[0];
- s->grey->interp(s->grey, &cp);
- t = (cp.v[0] - sr_cs_wp[0])/(sr_cs_bp[0] - sr_cs_wp[0]);
- for (j = 0; j < 3; j++)
- sl_cs_bp[j] = sr_cs_wp[j] + t * (sr_cs_bp[j] - sr_cs_wp[j]);
-#else
dopartialmap1(s, sl_cs_wp, s_cs_wp);
dopartialmap1(s, sl_cs_bp, s_cs_bp);
-#endif
#ifdef VERBOSE
if (verb) {
diff --git a/gamut/gammap.h b/gamut/gammap.h
index b59e821..3bc1c8c 100644
--- a/gamut/gammap.h
+++ b/gamut/gammap.h
@@ -39,6 +39,7 @@ struct _gammap {
}; typedef struct _gammap gammap;
+#ifdef NEVER
/* Method of black point adaptation */
typedef enum {
gmm_BPadpt = 0, /* Adapt source black point to destination */
@@ -46,6 +47,7 @@ typedef enum {
gmm_bendBP = 2, /* Don't adapt black point, bend it to dest. at end */
gmm_clipBP = 3 /* Don't adapt black point, clip it to dest. at end */
} gmm_BPmap;
+#endif
/* Creator */
gammap *new_gammap(
diff --git a/gamut/gamut.c b/gamut/gamut.c
index 052b8d8..09a5110 100644
--- a/gamut/gamut.c
+++ b/gamut/gamut.c
@@ -136,6 +136,7 @@
static void triangulate(gamut *s);
static void del_gamut(gamut *s);
static gvert *expand_gamut(gamut *s, double in[3]);
+static void set_cs_bp_kp_ovrd(gamut *s, double *bk, double *kp);
static double getsres(gamut *s);
static int getisjab(gamut *s);
static int getisrast(gamut *s);
@@ -175,6 +176,7 @@ static int intersect(gamut *s, gamut *s1, gamut *s2);
static int compdstgamut(gamut *s, gamut *img, gamut *src, gamut *dst, int docomp, int doexp,
gamut *nedst, void (*cvect)(void *cntx, double *vec, double *pos), void *cntx);
static int vect_intersect(gamut *s, double *rvp, double *ip, double *p1, double *p2, gtri *t);
+static void compgawb(gamut *s);
/* in isecvol.c: */
extern double isect_volume(gamut *s1, gamut *s2);
@@ -632,6 +634,7 @@ int isRast /* Flag indicating Raster rather than colorspace */
/* Setup methods */
s->del = del_gamut;
s->expand = expand_gamut;
+ s->set_cs_bp_kp_ovrd = set_cs_bp_kp_ovrd;
s->getsres = getsres;
s->getisjab = getisjab;
s->getisrast = getisrast;
@@ -2892,6 +2895,23 @@ gamut *s
}
/* ===================================================== */
+/* Special override code (To support BT.1886 modification */
+/* ===================================================== */
+
+/* Override cs black points */
+static void set_cs_bp_kp_ovrd(gamut *s, double *bp, double *kp) {
+ if (bp != NULL) {
+ icmCpy3(s->cs_bp, bp);
+ }
+ if (kp != NULL) {
+ icmCpy3(s->cs_kp, kp);
+ }
+
+ /* recompute the gamut white/black available */
+ compgawb(s);
+}
+
+/* ===================================================== */
/* Code that makes use of the triangulation */
/* ===================================================== */
diff --git a/gamut/gamut.h b/gamut/gamut.h
index 8f9f00e..8f4645c 100644
--- a/gamut/gamut.h
+++ b/gamut/gamut.h
@@ -257,6 +257,8 @@ struct _gamut {
gvert *(*expand)(struct _gamut *s, double in[3]); /* Expand the gamut surface */
+ void (*set_cs_bp_kp_ovrd)(struct _gamut *s, double *bk, double *kp); /* Override cs black points */
+
int (*getisjab)(struct _gamut *s); /* Return the isJab flag value */
int (*getisrast)(struct _gamut *s); /* Return the isRast flag value */
diff --git a/gamut/maptest.c b/gamut/maptest.c
index 1c595b6..5fe5c42 100644
--- a/gamut/maptest.c
+++ b/gamut/maptest.c
@@ -164,7 +164,7 @@ main(int argc, char *argv[]) {
/* - - - - - - - - - - - - - - - - - - - */
/* Create the gamut mapping */
- gmi.usecas = 0;
+ gmi.usecas = 1; /* Abs. L*a*b* */
gmi.usemap = 1;
gmi.greymf = 1.0; /* Gray axis hue matching factor, 0.0 - 1.0 */
gmi.glumwcpf = 1.0; /* Grey axis luminance white compression factor, 0.0 - 1.0 */
@@ -172,6 +172,7 @@ main(int argc, char *argv[]) {
gmi.glumbcpf = 1.0; /* Grey axis luminance black compression factor, 0.0 - 1.0 */
gmi.glumbexf = 1.0; /* Grey axis luminance black expansion factor, 0.0 - 1.0 */
gmi.glumknf = 0.7; /* Gray axis luminance knee factor, 0.0 - 1.0 */
+ gmi.bph = gmm_bendBP; /* Extend and bend */
gmi.gamcpf = 1.0; /* Gamut compression factor, 0.0 - 1.0 */
if (sat)
gmi.gamexf = 1.0; /* Gamut expansion factor, 0.0 - 1.0 */
diff --git a/gamut/nearsmth.c b/gamut/nearsmth.c
index 1f48f20..a13442d 100644
--- a/gamut/nearsmth.c
+++ b/gamut/nearsmth.c
@@ -3200,7 +3200,6 @@ datao map_oh
//if (PFCOND) printf("~1 neutral axis point = %f %f %f\n", napoint[0], napoint[1], napoint[2]);
/* Compute a normalized available depth from distance */
/* to closest to neautral axis point */
- if (maxt > 1.0) /* Compression */
if ((mint > 1e-8 && maxt > -1e-8) /* G. & V. Compression */
|| ((mint < -1e-8 && maxt > -1e-8) /* G. Exp & V. comp. */
&& (fabs(mint) < (fabs(maxt) - 1e-8))))