summaryrefslogtreecommitdiff
path: root/profile
diff options
context:
space:
mode:
Diffstat (limited to 'profile')
-rwxr-xr-x[-rw-r--r--]profile/3dap5k.sp0
-rwxr-xr-x[-rw-r--r--]profile/CIE_C.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_0.0.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_0.1.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_0.3.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_0.5.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_0.7.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_1.0.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_1.2.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_1.5.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_1.7.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_2.0.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_2.5.sp0
-rwxr-xr-x[-rw-r--r--]profile/D50_3.0.sp0
-rwxr-xr-x[-rw-r--r--]profile/F1.sp0
-rwxr-xr-x[-rw-r--r--]profile/F5.sp0
-rwxr-xr-x[-rw-r--r--]profile/F8.sp0
-rwxr-xr-x[-rw-r--r--]profile/GTIPlus.sp0
-rwxr-xr-x[-rw-r--r--]profile/Jamfile0
-rwxr-xr-x[-rw-r--r--]profile/License.txt0
-rwxr-xr-x[-rw-r--r--]profile/Office.sp0
-rwxr-xr-x[-rw-r--r--]profile/Readme.txt0
-rwxr-xr-x[-rw-r--r--]profile/Trulux.sp0
-rwxr-xr-x[-rw-r--r--]profile/TruluxPlus.sp0
-rwxr-xr-x[-rw-r--r--]profile/afiles0
-rwxr-xr-x[-rw-r--r--]profile/applycal.c0
-rwxr-xr-x[-rw-r--r--]profile/cb2ti3.c0
-rwxr-xr-x[-rw-r--r--]profile/colprof.c121
-rwxr-xr-x[-rw-r--r--]profile/colverify.c180
-rwxr-xr-x[-rw-r--r--]profile/example.sp0
-rwxr-xr-x[-rw-r--r--]profile/example121.sp0
-rwxr-xr-x[-rw-r--r--]profile/invprofcheck.c116
-rwxr-xr-x[-rw-r--r--]profile/kodak2ti3.c10
-rwxr-xr-x[-rw-r--r--]profile/ls2ti3.c0
-rwxr-xr-x[-rw-r--r--]profile/mppcheck.c17
-rwxr-xr-x[-rw-r--r--]profile/mppprof.c35
-rwxr-xr-x[-rw-r--r--]profile/printcal.c18
-rwxr-xr-x[-rw-r--r--]profile/prof.h1
-rwxr-xr-x[-rw-r--r--]profile/profcheck.c111
-rwxr-xr-x[-rw-r--r--]profile/profin.c28
-rwxr-xr-x[-rw-r--r--]profile/profout.c3
-rwxr-xr-x[-rw-r--r--]profile/simpprof.c0
-rwxr-xr-x[-rw-r--r--]profile/splitti3.c16
-rwxr-xr-x[-rw-r--r--]profile/txt2ti3.c36
44 files changed, 463 insertions, 229 deletions
diff --git a/profile/3dap5k.sp b/profile/3dap5k.sp
index cfbc67d..cfbc67d 100644..100755
--- a/profile/3dap5k.sp
+++ b/profile/3dap5k.sp
diff --git a/profile/CIE_C.sp b/profile/CIE_C.sp
index 8b771fe..8b771fe 100644..100755
--- a/profile/CIE_C.sp
+++ b/profile/CIE_C.sp
diff --git a/profile/D50_0.0.sp b/profile/D50_0.0.sp
index 8904fca..8904fca 100644..100755
--- a/profile/D50_0.0.sp
+++ b/profile/D50_0.0.sp
diff --git a/profile/D50_0.1.sp b/profile/D50_0.1.sp
index ad747fb..ad747fb 100644..100755
--- a/profile/D50_0.1.sp
+++ b/profile/D50_0.1.sp
diff --git a/profile/D50_0.3.sp b/profile/D50_0.3.sp
index 1a64a27..1a64a27 100644..100755
--- a/profile/D50_0.3.sp
+++ b/profile/D50_0.3.sp
diff --git a/profile/D50_0.5.sp b/profile/D50_0.5.sp
index 367d0d3..367d0d3 100644..100755
--- a/profile/D50_0.5.sp
+++ b/profile/D50_0.5.sp
diff --git a/profile/D50_0.7.sp b/profile/D50_0.7.sp
index 2e0b2e8..2e0b2e8 100644..100755
--- a/profile/D50_0.7.sp
+++ b/profile/D50_0.7.sp
diff --git a/profile/D50_1.0.sp b/profile/D50_1.0.sp
index d74e76a..d74e76a 100644..100755
--- a/profile/D50_1.0.sp
+++ b/profile/D50_1.0.sp
diff --git a/profile/D50_1.2.sp b/profile/D50_1.2.sp
index 180d650..180d650 100644..100755
--- a/profile/D50_1.2.sp
+++ b/profile/D50_1.2.sp
diff --git a/profile/D50_1.5.sp b/profile/D50_1.5.sp
index 786e292..786e292 100644..100755
--- a/profile/D50_1.5.sp
+++ b/profile/D50_1.5.sp
diff --git a/profile/D50_1.7.sp b/profile/D50_1.7.sp
index ba8dc6b..ba8dc6b 100644..100755
--- a/profile/D50_1.7.sp
+++ b/profile/D50_1.7.sp
diff --git a/profile/D50_2.0.sp b/profile/D50_2.0.sp
index efa0214..efa0214 100644..100755
--- a/profile/D50_2.0.sp
+++ b/profile/D50_2.0.sp
diff --git a/profile/D50_2.5.sp b/profile/D50_2.5.sp
index 8057f14..8057f14 100644..100755
--- a/profile/D50_2.5.sp
+++ b/profile/D50_2.5.sp
diff --git a/profile/D50_3.0.sp b/profile/D50_3.0.sp
index e68d891..e68d891 100644..100755
--- a/profile/D50_3.0.sp
+++ b/profile/D50_3.0.sp
diff --git a/profile/F1.sp b/profile/F1.sp
index 908cd72..908cd72 100644..100755
--- a/profile/F1.sp
+++ b/profile/F1.sp
diff --git a/profile/F5.sp b/profile/F5.sp
index 4959a50..4959a50 100644..100755
--- a/profile/F5.sp
+++ b/profile/F5.sp
diff --git a/profile/F8.sp b/profile/F8.sp
index f1e7beb..f1e7beb 100644..100755
--- a/profile/F8.sp
+++ b/profile/F8.sp
diff --git a/profile/GTIPlus.sp b/profile/GTIPlus.sp
index 4c4c164..4c4c164 100644..100755
--- a/profile/GTIPlus.sp
+++ b/profile/GTIPlus.sp
diff --git a/profile/Jamfile b/profile/Jamfile
index 0c857a8..0c857a8 100644..100755
--- a/profile/Jamfile
+++ b/profile/Jamfile
diff --git a/profile/License.txt b/profile/License.txt
index a871fcf..a871fcf 100644..100755
--- a/profile/License.txt
+++ b/profile/License.txt
diff --git a/profile/Office.sp b/profile/Office.sp
index 290d310..290d310 100644..100755
--- a/profile/Office.sp
+++ b/profile/Office.sp
diff --git a/profile/Readme.txt b/profile/Readme.txt
index 5fc569a..5fc569a 100644..100755
--- a/profile/Readme.txt
+++ b/profile/Readme.txt
diff --git a/profile/Trulux.sp b/profile/Trulux.sp
index fc5bb0f..fc5bb0f 100644..100755
--- a/profile/Trulux.sp
+++ b/profile/Trulux.sp
diff --git a/profile/TruluxPlus.sp b/profile/TruluxPlus.sp
index 0fd9c39..0fd9c39 100644..100755
--- a/profile/TruluxPlus.sp
+++ b/profile/TruluxPlus.sp
diff --git a/profile/afiles b/profile/afiles
index 2d91df7..2d91df7 100644..100755
--- a/profile/afiles
+++ b/profile/afiles
diff --git a/profile/applycal.c b/profile/applycal.c
index 17187db..17187db 100644..100755
--- a/profile/applycal.c
+++ b/profile/applycal.c
diff --git a/profile/cb2ti3.c b/profile/cb2ti3.c
index 4fc7866..4fc7866 100644..100755
--- a/profile/cb2ti3.c
+++ b/profile/cb2ti3.c
diff --git a/profile/colprof.c b/profile/colprof.c
index 1e73cdf..ced168b 100644..100755
--- a/profile/colprof.c
+++ b/profile/colprof.c
@@ -204,9 +204,9 @@ int main(int argc, char *argv[]) {
icxIllumeType tillum = icxIT_none; /* Target/simulated instrument illuminant */
xspect cust_tillum; /* Custom target/simulated illumination spectrum */
/* xspect will use illum/cust_illum if tillum == none */
- icxIllumeType illum = icxIT_D50; /* Spectral defaults */
+ icxIllumeType illum = icxIT_none; /* Spectral illuminant (defaults to D50) */
xspect cust_illum; /* Custom illumination spectrum */
- icxObserverType observ = icxOT_CIE_1931_2; /* The classic observer */
+ icxObserverType observ = icxOT_none; /* Observer (defaults to 1931 2 degree) */
char ipname[MAXNAMEL+1] = ""; /* Input icc profile - enables gamut map */
char sgname[MAXNAMEL+1] = ""; /* Image source gamut name */
char absstring[3 * MAXNAMEL +1]; /* Storage for absnames */
@@ -223,7 +223,7 @@ int main(int argc, char *argv[]) {
char inname[MAXNAMEL+1] = ""; /* Input cgats file base name */
char outname[MAXNAMEL+1] = ""; /* Output cgats file base name */
cgats *icg; /* input cgats structure */
- int ti; /* Temporary CGATs index */
+ int dti, ti; /* Device type index, Temporary CGATs index */
prof_atype ptype = prof_default; /* Default for each type of device */
int mtxtoo = 0; /* NZ if matrix tags should be created for Display XYZ cLUT */
icmICCVersion iccver = icmVersionDefault; /* ICC profile version to create */
@@ -290,29 +290,29 @@ int main(int argc, char *argv[]) {
/* Manufacturer description string */
else if (argv[fa][1] == 'A') {
- fa = nfa;
if (na == NULL) usage("Expect argument to manufacturer description flag -A");
+ fa = nfa;
xpi.deviceMfgDesc = na;
}
/* Model description string */
else if (argv[fa][1] == 'M') {
- fa = nfa;
if (na == NULL) usage("Expect argument to model description flag -M");
+ fa = nfa;
xpi.modelDesc = na;
}
/* Profile Description */
else if (argv[fa][1] == 'D') {
- fa = nfa;
if (na == NULL) usage("Expect argument to profile description flag -D");
+ fa = nfa;
xpi.profDesc = na;
}
/* Copyright string */
else if (argv[fa][1] == 'C') {
- fa = nfa;
if (na == NULL) usage("Expect argument to copyright flag -C");
+ fa = nfa;
xpi.copyright = na;
}
@@ -320,8 +320,8 @@ int main(int argc, char *argv[]) {
else if (argv[fa][1] == 'Z') {
int i, j;
- fa = nfa;
if (na == NULL) usage("Expect argument to attribute flag -Z");
+ fa = nfa;
for (j = i = 0; j == 0; i++) {
switch(na[i]) {
@@ -371,9 +371,9 @@ int main(int argc, char *argv[]) {
/* Quality */
else if (argv[fa][1] == 'q') {
- fa = nfa;
// if (na == NULL) usage("Expect argument to quality flag -q");
if (na == NULL) usage("Expect argument to speed flag -q");
+ fa = nfa;
switch (na[0]) {
case 'f': /* Fast */
case 'l':
@@ -434,10 +434,10 @@ int main(int argc, char *argv[]) {
/* Disable input or output luts */
else if (argv[fa][1] == 'n') {
- fa = nfa;
if (na == NULL) { /* Backwards compatible */
nooluts = 1;
} else {
+ fa = nfa;
if (na[0] == 'i')
noisluts = 1;
else if (na[0] == 'p')
@@ -466,8 +466,8 @@ int main(int argc, char *argv[]) {
}
}
else if (argv[fa][1] == 'U') {
- fa = nfa;
if (na == NULL) usage("Expected argument to input white point scale flag -U");
+ fa = nfa;
iwpscale = atof(na);
if (iwpscale < 0.0 || iwpscale > 200.0)
usage("Argument '%s' to flag -U out of range",na);
@@ -492,21 +492,21 @@ int main(int argc, char *argv[]) {
/* Degree of dark region emphasis */
else if (argv[fa][1] == 'V') {
if (na == NULL) usage(0,"Expected argument to dark emphasis flag -V");
+ fa = nfa;
demph = atof(na);
if (demph < 1.0 || demph > 3.0)
usage("Dark weighting argument %f to '-V' is out of range",demph);
- fa = nfa;
}
/* Inking rule */
else if (argv[fa][1] == 'k'
|| argv[fa][1] == 'K') {
- fa = nfa;
- if (na == NULL) usage("Expect argument to inking flag -k");
if (argv[fa][1] == 'k')
locus = 0; /* Use K value target */
else
locus = 1; /* Use K locus target */
+ if (na == NULL) usage("Expect argument to inking flag -k");
+ fa = nfa;
switch (na[0]) {
case 'z':
case 'Z':
@@ -554,22 +554,22 @@ int main(int argc, char *argv[]) {
/* Total Ink Limit */
else if (argv[fa][1] == 'l') {
- fa = nfa;
if (na == NULL) usage("Expected argument to total ink limit flag -l");
+ fa = nfa;
tlimit = atoi(na);
}
/* Black Ink Limit */
else if (argv[fa][1] == 'L') {
- fa = nfa;
if (na == NULL) usage("Expected argument to black ink limit flag -L");
+ fa = nfa;
klimit = atoi(na);
}
/* Algorithm type */
else if (argv[fa][1] == 'a') {
- fa = nfa;
if (na == NULL) usage("Expect argument to algorithm flag -a");
+ fa = nfa;
switch (na[0]) {
case 'l':
case 'L':
@@ -602,8 +602,8 @@ int main(int argc, char *argv[]) {
}
/* Profile version */
else if (argv[fa][1] == 'I') {
- fa = nfa;
if (na == NULL) usage("Expect argument to version flag -I");
+ fa = nfa;
switch (na[0]) {
case '4':
iccver = icmVersion4_1;
@@ -616,38 +616,30 @@ int main(int argc, char *argv[]) {
/* FWA compensation */
else if (argv[fa][1] == 'f') {
fwacomp = 1;
+ spec = 1; /* Have to use spectral data */
if (na != NULL) { /* Argument is present - target/simulated instr. illum. */
fa = nfa;
if (strcmp(na, "A") == 0
|| strcmp(na, "M0") == 0) {
- spec = 1;
tillum = icxIT_A;
} else if (strcmp(na, "C") == 0) {
- spec = 1;
tillum = icxIT_C;
} else if (strcmp(na, "D50") == 0
|| strcmp(na, "M1") == 0) {
- spec = 1;
tillum = icxIT_D50;
} else if (strcmp(na, "D50M2") == 0
|| strcmp(na, "M2") == 0) {
- spec = 1;
tillum = icxIT_D50M2;
} else if (strcmp(na, "D65") == 0) {
- spec = 1;
tillum = icxIT_D65;
} else if (strcmp(na, "F5") == 0) {
- spec = 1;
tillum = icxIT_F5;
} else if (strcmp(na, "F8") == 0) {
- spec = 1;
tillum = icxIT_F8;
} else if (strcmp(na, "F10") == 0) {
- spec = 1;
tillum = icxIT_F10;
} else { /* Assume it's a filename */
- spec = 1;
tillum = icxIT_custom;
if (read_xspect(&cust_tillum, na) != 0)
usage("Failed to read custom target illuminant spectrum in file '%s'",na);
@@ -657,8 +649,8 @@ int main(int argc, char *argv[]) {
/* Spectral Illuminant type */
else if (argv[fa][1] == 'i') {
- fa = nfa;
if (na == NULL) usage("Expect argument to illuminant flag -i");
+ fa = nfa;
if (strcmp(na, "A") == 0) {
spec = 1;
illum = icxIT_A;
@@ -693,8 +685,8 @@ int main(int argc, char *argv[]) {
/* Spectral Observer type */
else if (argv[fa][1] == 'o') {
- fa = nfa;
if (na == NULL) usage("Expect argument to observer flag -o");
+ fa = nfa;
if (strcmp(na, "1931_2") == 0) { /* Classic 2 degree */
spec = 1;
observ = icxOT_CIE_1931_2;
@@ -717,8 +709,8 @@ int main(int argc, char *argv[]) {
/* Average Deviation percentage */
else if (argv[fa][1] == 'r') {
- fa = nfa;
if (na == NULL) usage("Expected argument to average deviation flag -r");
+ fa = nfa;
if (na[0] == 's') { /* (relative, for verification) */
smooth = atof(na+1);
if (smooth < 0.0)
@@ -742,7 +734,6 @@ int main(int argc, char *argv[]) {
sepsat = 1;
if (na == NULL)
usage("Unrecognised argument to source gamut flag -%c",argv[fa][1]);
-
fa = nfa;
strncpy(ipname,na,MAXNAMEL); ipname[MAXNAMEL] = '\000';
}
@@ -778,8 +769,8 @@ int main(int argc, char *argv[]) {
/* Perceptual Mapping intent override */
else if (argv[fa][1] == 't') {
- fa = nfa;
if (na == NULL) usage("Expect argument to perceptul intent override flag -t");
+ fa = nfa;
if (xicc_enum_gmapintent(&pgmi, icxNoGMIntent, na) == icxIllegalGMIntent)
usage("Unrecognised intent '%s' to perceptual override flag -t",na);
pgmi_set = 1;
@@ -787,8 +778,8 @@ int main(int argc, char *argv[]) {
/* Saturation Mapping intent override */
else if (argv[fa][1] == 'T') {
- fa = nfa;
if (na == NULL) usage("Expect argument to saturation intent override flag -T");
+ fa = nfa;
if (xicc_enum_gmapintent(&sgmi, icxNoGMIntent, na) == icxIllegalGMIntent)
usage("Unrecognised intent '%s' to saturation override flag -T",na);
sgmi_set = 1;
@@ -805,8 +796,8 @@ int main(int argc, char *argv[]) {
vc = &ovc_p;
}
- fa = nfa;
if (na == NULL) usage("Viewing conditions flag (-%c) needs an argument",argv[fa][1]);
+ fa = nfa;
if (na[1] != ':') {
if (vc == &ivc_p) {
if ((ivc_e = xicc_enum_viewcond(NULL, NULL, -2, na, 1, NULL)) == -999)
@@ -874,8 +865,8 @@ int main(int argc, char *argv[]) {
/* Output file name */
else if (argv[fa][1] == 'O') {
- fa = nfa;
if (na == NULL) usage("Output filename override (-O) needs an argument");
+ fa = nfa;
strncpy(outname,na,MAXNAMEL); outname[MAXNAMEL] = '\000';
}
@@ -888,13 +879,20 @@ int main(int argc, char *argv[]) {
/* Get the file name argument */
if (fa >= argc || argv[fa][0] == '-') usage("Missing input .ti3 and output ICC basename");
strncpy(baname,argv[fa++],MAXNAMEL-4); baname[MAXNAMEL-4] = '\000';
- if (xpi.profDesc == NULL)
- xpi.profDesc = baname; /* Default description */
- strcpy(inname,baname);
+ if (xpi.profDesc == NULL) {
+ char *cp;
+ if ((cp = strrchr(baname, '/')) == NULL
+ && (cp = strrchr(baname, '\\')) == NULL)
+ cp = baname;
+ else
+ cp++;
+ xpi.profDesc = cp; /* Default description = file name of base path */
+ }
+ strcpy(inname, baname);
strcat(inname,".ti3");
if (outname[0] == '\000') { /* If not overridden */
- strcpy(outname,baname);
- strcat(outname,ICC_FILE_EXT);
+ strcpy(outname, baname);
+ strcat(outname, ICC_FILE_EXT);
}
/* Issue some errors & warnings for strange combinations */
@@ -936,6 +934,31 @@ int main(int argc, char *argv[]) {
if (icg->ntables < 1)
error ("Input file doesn't contain at least one table");
+ /* Read the device/profile type tag */
+ if ((dti = icg->find_kword(icg, 0, "DEVICE_CLASS")) < 0)
+ error ("Input file doesn't contain keyword DEVICE_CLASS");
+
+ /* Issue some errors & warnings for strange combinations for profile type */
+
+ /* Reflective options when not a reflective profile type */
+ if (strcmp(icg->t[0].kdata[dti],"DISPLAY") == 0
+ || strcmp(icg->t[0].kdata[dti],"EMISINPUT") == 0) {
+ if (illum != icxIT_none)
+ warning("-i illuminant ignored for emissive reference type");
+ if (fwacomp != icxIT_none)
+ warning("-f FWA compensation ignored for emissive reference type");
+
+ fwacomp = 0;
+ tillum = icxIT_none;
+ }
+
+ /* Set defaults */
+ if (illum == icxIT_none)
+ illum = icxIT_D50;
+
+ if (observ = icxOT_none)
+ observ = icxOT_CIE_1931_2;
+
/* See if CIE is actually available - some sources of .TI3 don't provide it */
if (!spec
&& icg->find_field(icg, 0, "LAB_L") < 0
@@ -970,11 +993,8 @@ int main(int argc, char *argv[]) {
}
}
- /* read the device class, and call function to create profile. */
- if ((ti = icg->find_kword(icg, 0, "DEVICE_CLASS")) < 0)
- error ("Input file doesn't contain keyword DEVICE_CLASS");
-
- if (strcmp(icg->t[0].kdata[ti],"OUTPUT") == 0) {
+ /* check the device class, and call function to create profile. */
+ if (strcmp(icg->t[0].kdata[dti],"OUTPUT") == 0) { /* i.e. printer */
icxInk ink; /* Ink parameters */
// if (bpo[1] >= 0.0)
@@ -1100,7 +1120,11 @@ int main(int argc, char *argv[]) {
sepsat, &ivc_p, &ovc_p, ivc_e, ovc_e,
&pgmi, &sgmi, &xpi);
- } else if (strcmp(icg->t[0].kdata[ti],"INPUT") == 0) {
+ /* Scanner, Camera with reflective target, or Camera with emissive target */
+ } else if (strcmp(icg->t[0].kdata[dti],"INPUT") == 0
+ || strcmp(icg->t[0].kdata[dti],"EMISINPUT") == 0) {
+
+ int emis = strcmp(icg->t[0].kdata[dti],"EMISINPUT") == 0;
// if (bpo[1] >= 0.0)
// error("-B option not valid for input profile");
@@ -1113,10 +1137,11 @@ int main(int argc, char *argv[]) {
make_input_icc(ptype, iccver, verb, iquality, oquality, noisluts, noipluts, nooluts, nocied,
verify, autowpsc, clipovwp, iwpscale, doinb2a, doinextrap, clipprims,
- inname, outname, icg, spec, illum, &cust_illum, observ,
+ inname, outname, icg, emis, spec, illum, &cust_illum, observ,
smooth, avgdev, &xpi);
- } else if (strcmp(icg->t[0].kdata[ti],"DISPLAY") == 0) {
+ /* Display or Projector */
+ } else if (strcmp(icg->t[0].kdata[dti],"DISPLAY") == 0) {
if (autowpsc)
error ("Input auto WP scale mode isn't applicable to an output device");
diff --git a/profile/colverify.c b/profile/colverify.c
index e84fa6a..40165a0 100644..100755
--- a/profile/colverify.c
+++ b/profile/colverify.c
@@ -20,6 +20,9 @@
/*
* TTBD:
+ *
+ * We're no warning about setting illuminant or FWA for emissive spectral data,
+ * they are just ignored.
*/
#define DEBUG
@@ -56,7 +59,7 @@ void
usage(void) {
fprintf(stderr,"Verify CIE values, Version %s\n",ARGYLL_VERSION_STR);
fprintf(stderr,"Author: Graeme W. Gill, licensed under the AGPL Version 3\n");
- fprintf(stderr,"usage: verify [-options] target.ti3 measured.ti3\n");
+ fprintf(stderr,"usage: colverify [-options] target.ti3 measured.ti3\n");
fprintf(stderr," -v [n] Verbose mode, n >= 2 print each value\n");
fprintf(stderr," -n Normalise each files reading to its white Y\n");
fprintf(stderr," -N Normalise each files reading to its white XYZ\n");
@@ -65,9 +68,9 @@ usage(void) {
fprintf(stderr," -D Use D50 100.0 as L*a*b* white reference\n");
fprintf(stderr," -c Show CIE94 delta E values\n");
fprintf(stderr," -k Show CIEDE2000 delta E values\n");
- fprintf(stderr," -h Plot a histogram of delta E's\n");
+ fprintf(stderr," -h [hist.txt] Plot a histogram of delta E's [Optionaly save points to .txt]\n");
fprintf(stderr," -s Sort patch values by error\n");
- fprintf(stderr," -w create PCS %s vector visualisation (measured%s)\n",vrml_format(), vrml_ext());
+ fprintf(stderr," -w create PCS %s vector visualisation (measured%s)\n",vrml_format(),vrml_ext());
fprintf(stderr," -W create PCS %s marker visualisation (measured%s)\n",vrml_format(),vrml_ext());
fprintf(stderr," -d create Device RGB %s marker visualisation (measured%s)\n",vrml_format(),vrml_ext());
// fprintf(stderr," -d y create Device YCbCr %s marker visualisation (measured%s)\n",vrml_format(),vrml_ext());
@@ -118,6 +121,7 @@ int main(int argc, char *argv[])
int dovrml = 0; /* 1 = PCS vector, 2 = PCS marker, 3 = RGB, 4 - YCbCr */
int doaxes = 0;
int dohisto = 0; /* Plot histogram of delta E's */
+ char histoname[MAXNAMEL+1] = "\000"; /* Optional file to save histogram points to */
int dosort = 0;
char ccmxname[MAXNAMEL+1] = "\000"; /* Colorimeter Correction Matrix name */
ccmx *cmx = NULL; /* Colorimeter Correction Matrix */
@@ -129,6 +133,7 @@ int main(int argc, char *argv[])
struct {
char name[MAXNAMEL+1]; /* Patch filename */
+ int isemis; /* nz if emsissive spectral reference data */
int isdisp; /* nz if display */
int isdnormed; /* Has display data been normalised to 100 ? */
int isrgb; /* Is RGB device space ? */
@@ -145,9 +150,9 @@ int main(int argc, char *argv[])
int spec = 0; /* Use spectral data flag */
icxIllumeType tillum = icxIT_none; /* Target/simulated instrument illuminant */
xspect cust_tillum, *tillump = NULL; /* Custom target/simulated illumination spectrum */
- icxIllumeType illum = icxIT_D50; /* Spectral defaults */
+ icxIllumeType illum = icxIT_none; /* Spectral defaults to D50 */
xspect cust_illum; /* Custom illumination spectrum */
- icxObserverType observ = icxOT_CIE_1931_2;
+ icxObserverType observ = icxOT_none; /* Defaults to 1931 2 degree */
icmXYZNumber labw = icmD50; /* The Lab white reference */
@@ -186,8 +191,8 @@ int main(int argc, char *argv[])
verb = 1;
if (na != NULL && na[0] >= '0' && na[0] <= '9') {
- verb = atoi(na);
fa = nfa;
+ verb = atoi(na);
}
}
@@ -244,9 +249,15 @@ int main(int argc, char *argv[])
}
/* Plot histogram */
- else if (argv[fa][1] == 'h')
+ else if (argv[fa][1] == 'h') {
dohisto = 1;
+ if (na != NULL) { /* Argument is present - file to save points to */
+ fa = nfa;
+ strncpy(histoname,na,MAXNAMEL); histoname[MAXNAMEL] = '\000';
+ }
+ }
+
/* Sort */
else if (argv[fa][1] == 's')
dosort = 1;
@@ -295,8 +306,8 @@ int main(int argc, char *argv[])
/* Spectral to CIE Illuminant type */
else if (argv[fa][1] == 'i') {
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
if (strcmp(na, "A") == 0) {
spec = 1;
illum = icxIT_A;
@@ -331,8 +342,8 @@ int main(int argc, char *argv[])
/* Spectral Observer type */
else if (argv[fa][1] == 'o') {
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
if (strcmp(na, "1931_2") == 0) { /* Classic 2 degree */
spec = 1;
observ = icxOT_CIE_1931_2;
@@ -354,15 +365,15 @@ int main(int argc, char *argv[])
/* Gamut limit profile for first file */
else if (argv[fa][1] == 'L') {
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
strncpy(gprofname,na,MAXNAMEL-1); gprofname[MAXNAMEL-1] = '\000';
}
/* Colorimeter Correction Matrix for second file */
else if (argv[fa][1] == 'X') {
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
strncpy(ccmxname,na,MAXNAMEL-1); ccmxname[MAXNAMEL-1] = '\000';
} else
@@ -438,6 +449,7 @@ int main(int argc, char *argv[])
int sldx = -1; /* Sample location index, < 0 if invalid */
int xix, yix, zix;
int rgbix[3]; /* RGB field indexes (if rgb ) */
+ int dti; /* Device type index */
/* Open CIE target values */
cgf = new_cgats(); /* Create a CGATS structure */
@@ -451,46 +463,26 @@ int main(int argc, char *argv[])
if (cgf->ntables < 1)
error ("Input file '%s' doesn't contain at least one table",cg[n].name);
- /* Check if the file is suitable */
- if (!spec
- && cgf->find_field(cgf, 0, "LAB_L") < 0
- && cgf->find_field(cgf, 0, "XYZ_X") < 0) {
-
- if (cgf->find_kword(cgf, 0, "SPECTRAL_BANDS") < 0)
- error ("Neither CIE nor spectral data found in file '%s'",cg[n].name);
-
- /* Switch to using spectral information */
- if (verb)
- printf("No CIE data found, switching to spectral with standard observer & D50 for file '%s'\n",cg[n].name);
- spec = 1;
- illum = icxIT_D50;
- observ = icxOT_CIE_1931_2;
- }
- if (spec && cgf->find_kword(cgf, 0, "SPECTRAL_BANDS") < 0)
- error ("No spectral data data found in file '%s' when spectral expected",cg[n].name);
-
- if (!spec && cgf->find_field(cgf, 0, "LAB_L") >= 0)
- isLab = 1;
-
- cg[n].nig = cg[n].npat = cgf->t[0].nsets; /* Number of patches */
-
+ if ((dti = cgf->find_kword(cgf, 0, "DEVICE_CLASS")) < 0)
+ warning("Input file '%s' doesn't contain keyword DEVICE_CLASS",cg[n].name);
+
/* Figure out what sort of device it is */
{
int ti;
+ cg[n].isemis = 0;
cg[n].isdisp = 0;
cg[n].isdnormed = 0;
cg[n].w[0] = cg[n].w[1] = cg[n].w[2] = 0.0;
- if ((ti = cgf->find_kword(cgf, 0, "DEVICE_CLASS")) < 0) {
- warning("Input file '%s' doesn't contain keyword DEVICE_CLASS",cg[n].name);
-
- } else {
- if (strcmp(cgf->t[0].kdata[ti],"DISPLAY") == 0) {
+ if (dti >= 0) {
+ if (strcmp(cgf->t[0].kdata[dti],"DISPLAY") == 0) {
+ cg[n].isemis = 1;
cg[n].isdisp = 1;
cg[n].isdnormed = 1; /* Assume display type is normalised to 100 */
- illum = icxIT_none; /* Displays are assumed to be self luminous */
- /* ?? What if two files are different ?? */
+
+ } else if (strcmp(cgf->t[0].kdata[dti],"EMISINPUT") == 0) {
+ cg[n].isemis = 1;
}
if (cg[n].isdisp) {
@@ -512,6 +504,27 @@ int main(int argc, char *argv[])
}
}
+ /* Check if the file is suitable */
+ if (!spec
+ && cgf->find_field(cgf, 0, "LAB_L") < 0
+ && cgf->find_field(cgf, 0, "XYZ_X") < 0) {
+
+ if (cgf->find_kword(cgf, 0, "SPECTRAL_BANDS") < 0)
+ error ("Neither CIE nor spectral data found in file '%s'",cg[n].name);
+
+ /* Switch to using spectral information */
+ if (verb)
+ printf("No CIE data found, switching to spectral with standard observer & D50 for file '%s'\n",cg[n].name);
+ spec = 1;
+ }
+ if (spec && cgf->find_kword(cgf, 0, "SPECTRAL_BANDS") < 0)
+ error ("No spectral data data found in file '%s' when spectral expected",cg[n].name);
+
+ if (!spec && cgf->find_field(cgf, 0, "LAB_L") >= 0)
+ isLab = 1;
+
+ cg[n].nig = cg[n].npat = cgf->t[0].nsets; /* Number of patches */
+
/* See if it has RGB device space (for -d option) */
if ((rgbix[0] = cgf->find_field(cgf, 0, "RGB_R")) >= 0
&& cgf->t[0].ftype[rgbix[0]] == r_t
@@ -559,29 +572,29 @@ int main(int argc, char *argv[])
if ((xix = cgf->find_field(cgf, 0, "LAB_L")) < 0)
error("Input file '%s' doesn't contain field LAB_L",cg[n].name);
if (cgf->t[0].ftype[xix] != r_t)
- error("Field LAB_L is wrong type");
+ error("Field LAB_L is wrong type - expect float");
if ((yix = cgf->find_field(cgf, 0, "LAB_A")) < 0)
error("Input file '%s' doesn't contain field LAB_A",cg[n].name);
if (cgf->t[0].ftype[yix] != r_t)
- error("Field LAB_A is wrong type");
+ error("Field LAB_A is wrong type - expect float");
if ((zix = cgf->find_field(cgf, 0, "LAB_B")) < 0)
error("Input file '%s' doesn't contain field LAB_B",cg[n].name);
if (cgf->t[0].ftype[zix] != r_t)
- error("Field LAB_B is wrong type");
+ error("Field LAB_B is wrong type - expect float");
} else { /* Expect XYZ */
if ((xix = cgf->find_field(cgf, 0, "XYZ_X")) < 0)
error("Input file '%s' doesn't contain field XYZ_X",cg[n].name);
if (cgf->t[0].ftype[xix] != r_t)
- error("Field XYZ_X is wrong type");
+ error("Field XYZ_X is wrong type - expect float");
if ((yix = cgf->find_field(cgf, 0, "XYZ_Y")) < 0)
error("Input file '%s' doesn't contain field XYZ_Y",cg[n].name);
if (cgf->t[0].ftype[yix] != r_t)
- error("Field XYZ_Y is wrong type");
+ error("Field XYZ_Y is wrong type - expect float");
if ((zix = cgf->find_field(cgf, 0, "XYZ_Z")) < 0)
error("Input file '%s' doesn't contain field XYZ_Z",cg[n].name);
if (cgf->t[0].ftype[zix] != r_t)
- error("Field XYZ_Z is wrong type");
+ error("Field XYZ_Z is wrong type - expect float");
}
for (i = 0; i < cg[n].npat; i++) {
@@ -639,6 +652,14 @@ int main(int argc, char *argv[])
int spi[XSPECT_MAX_BANDS]; /* CGATS indexes for each wavelength */
xsp2cie *sp2cie; /* Spectral conversion object */
+ /* Copies of global values: */
+ int l_fwacomp = fwacomp;
+ int l_spec = spec;
+ icxIllumeType l_tillum = tillum;
+ xspect *l_tillump = tillump;
+ icxIllumeType l_illum = illum;
+ icxObserverType l_observ = observ;
+
if ((ii = cgf->find_kword(cgf, 0, "SPECTRAL_BANDS")) < 0)
error ("Input file doesn't contain keyword SPECTRAL_BANDS");
sp.spec_n = atoi(cgf->t[0].kdata[ii]);
@@ -665,14 +686,35 @@ int main(int argc, char *argv[])
if ((spi[j] = cgf->find_field(cgf, 0, buf)) < 0)
error("Input file doesn't contain field %s",buf);
+
+ if (cgf->t[0].ftype[spi[j]] != r_t)
+ error("Field %s is wrong type - expect float",buf);
}
/* Create a spectral conversion object */
- if ((sp2cie = new_xsp2cie(illum, illum == icxIT_none ? NULL : &cust_illum,
- observ, NULL, icSigXYZData, icxClamp)) == NULL)
+ if (cg[n].isemis) {
+ if (l_illum != icxIT_none)
+ warning("-i illuminant ignored for emissive reference type");
+ if (l_fwacomp)
+ warning("-f FWA ignored for emissive reference type");
+ l_illum = icxIT_none; /* Make emissive conversion */
+ l_tillum = icxIT_none;
+ l_fwacomp = 0;
+ } else {
+ /* Set default */
+ if (l_illum == icxIT_none)
+ l_illum = icxIT_D50;
+ }
+
+ /* Set default */
+ if (l_observ = icxOT_none)
+ l_observ = icxOT_CIE_1931_2;
+
+ if ((sp2cie = new_xsp2cie(l_illum, l_illum == icxIT_none ? NULL : &cust_illum,
+ l_observ, NULL, icSigXYZData, icxClamp)) == NULL)
error("Creation of spectral conversion object failed");
- if (fwacomp) {
+ if (l_fwacomp) {
int ti;
xspect mwsp; /* Medium spectrum */
instType itype; /* Spectral instrument type */
@@ -709,16 +751,16 @@ int main(int argc, char *argv[])
}
/* If we are setting a specific simulated instrument illuminant */
- if (tillum != icxIT_none) {
- tillump = &cust_tillum;
- if (tillum != icxIT_custom) {
- if (standardIlluminant(tillump, tillum, 0.0)) {
+ if (l_tillum != icxIT_none) {
+ l_tillump = &cust_tillum;
+ if (l_tillum != icxIT_custom) {
+ if (standardIlluminant(l_tillump, l_tillum, 0.0)) {
error("simulated inst. illum. not recognised");
}
}
}
- if (sp2cie->set_fwa(sp2cie, &insp, tillump, &mwsp))
+ if (sp2cie->set_fwa(sp2cie, &insp, l_tillump, &mwsp))
error ("Set FWA on sp2cie failed");
if (verb) {
@@ -762,8 +804,7 @@ int main(int argc, char *argv[])
}
sp2cie->del(sp2cie); /* Done with this */
-
- } /* End of reading in CGATs file */
+ } /* End of reading in CGATs file spectral data */
/* Locate the patch with maximum Y, a possible white patch */
@@ -974,8 +1015,10 @@ int main(int argc, char *argv[])
if (dohisto) {
double demax = -1e6, demin = 1e6;
int maxbins = 50; /* Maximum bins */
- int minbins = 20; /* Target minimum bins (depends on distribution) */
- int mincount = 10; /* Minimum number of points in a bin */
+// int minbins = 20; /* Target minimum bins (depends on distribution) */
+// int mincount = 10; /* Minimum number of points in a bin */
+ int minbins = 10; /* Target minimum bins (depends on distribution) */
+ int mincount = 5; /* Minimum number of points in a bin */
double mbwidth;
int nbins = 0;
hbin *bins = NULL;
@@ -1001,9 +1044,11 @@ int main(int argc, char *argv[])
/* Bin width that gives maxbins */
mbwidth = demax / maxbins;
+#ifdef NEVER
/* Reduce mincount if needed to get minbins */
if (cg[0].npat/minbins < mincount)
mincount = cg[0].npat/minbins;
+#endif
if ((bins = (hbin *)calloc(maxbins, sizeof(hbin))) == NULL)
error("malloc of histogram bins failed");
@@ -1068,6 +1113,23 @@ int main(int argc, char *argv[])
y[i] = 0.0;
do_plot(x, y, NULL, NULL, nbins+1);
+ /* Save points to a file ? */
+ if (histoname[0] != '\000') {
+ FILE *fp;
+
+ if ((fp = fopen(histoname, "w")) == NULL)
+ error("Opening '%s' for writing failed",histoname);
+
+ fprintf(fp, "%s\t%s\n\n",cg[0].name, cg[1].name);
+
+ for (i = 0; i < nbins; i++) {
+ fprintf(fp, "%f\t%f\n",0.5 * (bins[i].min + bins[i].max), bins[i].val);
+ }
+
+ if (fclose(fp) != 0)
+ error("Closing '%s' failed",histoname);
+ }
+
free(y);
free(x);
free(bins);
diff --git a/profile/example.sp b/profile/example.sp
index 08d836e..08d836e 100644..100755
--- a/profile/example.sp
+++ b/profile/example.sp
diff --git a/profile/example121.sp b/profile/example121.sp
index d139c38..d139c38 100644..100755
--- a/profile/example121.sp
+++ b/profile/example121.sp
diff --git a/profile/invprofcheck.c b/profile/invprofcheck.c
index 8cb9f34..5cb1101 100644..100755
--- a/profile/invprofcheck.c
+++ b/profile/invprofcheck.c
@@ -89,9 +89,12 @@ void usage(void) {
fprintf(stderr," -v [level] verbosity level (default 1), 2 to print each DE\n");
fprintf(stderr," -l limit set total ink limit (estimate by default)\n");
fprintf(stderr," -L klimit set black channel ink limit (estimate by default)\n");
+ fprintf(stderr," -i intent a = absolute, r = relative colorimetric (def.)\n");
+ fprintf(stderr," p = perceptual, s = saturation\n");
fprintf(stderr," -h high res test (%d)\n",HTRES);
fprintf(stderr," -u Ultra high res test (%d)\n",UHTRES);
fprintf(stderr," -R res Specific grid resolution\n");
+ fprintf(stderr," -I Do bwd to fwd check\n");
fprintf(stderr," -c Show CIE94 delta E values\n");
fprintf(stderr," -k Show CIEDE2000 delta E values\n");
fprintf(stderr," -w create %s visualisation (profile%s)\n",vrml_format(),vrml_ext());
@@ -124,9 +127,11 @@ main(
icmFile *rd_fp;
icc *icco;
int rv = 0;
+ int inv = 0;
int tres = TRES;
double tlimit = -1.0;
double klimit = -1.0;
+ icRenderingIntent intent = icRelativeColorimetric; /* Default */
vrml *wrl = NULL;
error_program = "invprofcheck";
@@ -165,8 +170,8 @@ main(
/* Resolution */
else if (argv[fa][1] == 'h' || argv[fa][1] == 'H') {
tres = HTRES;
-
}
+
/* Resolution */
else if (argv[fa][1] == 'u' || argv[fa][1] == 'U') {
tres = UHTRES;
@@ -175,18 +180,23 @@ main(
/* Resolution */
else if (argv[fa][1] == 'R') {
int res;
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
res = atoi(na);
if (res < 2 || res > 500)
usage();
tres = res;
}
+ /* Inverse */
+ else if (argv[fa][1] == 'I') {
+ inv = 1;
+ }
+
else if (argv[fa][1] == 'l') {
int limit;
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
limit = atoi(na);
if (limit < 1)
limit = 1;
@@ -195,14 +205,36 @@ main(
else if (argv[fa][1] == 'L') {
int limit;
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
limit = atoi(na);
if (limit < 1)
limit = 1;
klimit = limit/100.0;
}
+ /* Intent */
+ else if (argv[fa][1] == 'i') {
+ if (na == NULL) usage();
+ fa = nfa;
+ switch (na[0]) {
+ case 'p':
+ intent = icPerceptual;
+ break;
+ case 'r':
+ intent = icRelativeColorimetric;
+ break;
+ case 's':
+ intent = icSaturation;
+ break;
+ case 'a':
+ intent = icAbsoluteColorimetric;
+ break;
+ default:
+ usage();
+ }
+ }
+
/* VRML/X3D */
else if (argv[fa][1] == 'w' || argv[fa][1] == 'W')
dovrml = 1;
@@ -235,7 +267,6 @@ main(
if (fa >= argc || argv[fa][0] == '-') usage();
strncpy(in_name,argv[fa++],MAXNAMEL); in_name[MAXNAMEL] = '\000';
-
strncpy(out_name,in_name,MAXNAMEL-4); out_name[MAXNAMEL-4] = '\000';
if ((xl = strrchr(out_name, '.')) == NULL) /* Figure where extention is */
xl = out_name + strlen(out_name);
@@ -265,7 +296,7 @@ main(
double nsamps = 0.0;
/* Get a Device to PCS conversion object */
- if ((luo1 = icco->get_luobj(icco, icmFwd, icRelativeColorimetric, icSigLabData, icmLuOrdNorm)) == NULL) {
+ if ((luo1 = icco->get_luobj(icco, icmFwd, intent, icSigLabData, icmLuOrdNorm)) == NULL) {
if ((luo1 = icco->get_luobj(icco, icmFwd, icmDefaultIntent, icSigLabData, icmLuOrdNorm)) == NULL)
error ("%d, %s",icco->errc, icco->err);
}
@@ -273,7 +304,7 @@ main(
luo1->spaces(luo1, &ins, &inn, &outs, &outn, NULL, NULL, NULL, NULL, NULL);
/* Get a PCS to Device conversion object */
- if ((luo2 = icco->get_luobj(icco, icmBwd, icRelativeColorimetric, icSigLabData, icmLuOrdNorm)) == NULL) {
+ if ((luo2 = icco->get_luobj(icco, icmBwd, intent, icSigLabData, icmLuOrdNorm)) == NULL) {
if ((luo2 = icco->get_luobj(icco, icmBwd, icmDefaultIntent, icSigLabData, icmLuOrdNorm)) == NULL)
error ("%d, %s",icco->errc, icco->err);
}
@@ -309,7 +340,8 @@ main(
printf("Input black ink limit assumed is %3.1f%%\n",100.0 * klimit);
}
- {
+ /* Device -> PCS -> Device */
+ if (!inv) {
double dev[MAX_CHAN], cdev[MAX_CHAN], pcsin[3], devout[MAX_CHAN], pcsout[3];
DCOUNT(co, inn, 0, 0, tres); /* Multi-D counter */
@@ -394,6 +426,74 @@ main(
DC_INC(co);
}
+
+ /* PCS -> Device -> PCS */
+ } else {
+ double dev[MAX_CHAN], cdev[MAX_CHAN], pcsin[3], devout[MAX_CHAN], pcsout[3];
+ DCOUNT(co, 3, 0, 0, tres); /* Multi-D counter */
+
+ /* Go through the chosen Lab grid */
+ DC_INIT(co)
+ for (; !DC_DONE(co);) {
+ int n, rv1, rv2;
+ double sum;
+ double de;
+
+ pcsin[0] = 100.0 * co[0]/(tres-1.0);
+ pcsin[1] = (127.0 * 2.0 * co[1]/(tres-1.0)) - 127.0;
+ pcsin[2] = (127.0 * 2.0 * co[2]/(tres-1.0)) - 127.0;
+
+ /* PCS -> Device */
+ if ((rv2 = luo2->lookup(luo2, devout, pcsin)) > 1)
+ error ("%d, %s",icco->errc,icco->err);
+
+ /* Device to PCS */
+ if ((rv2 = luo1->lookup(luo1, pcsout, devout)) > 1)
+ error ("%d, %s",icco->errc,icco->err);
+
+ /* Delta E */
+ if (dovrml) {
+// if (fabs(pcsin[0] - 5.0) < 0.1 && dovrml) {
+ int ix[2];
+
+ /* Add the verticies */
+ ix[0] = wrl->add_vertex(wrl, 0, pcsin);
+ ix[1] = wrl->add_vertex(wrl, 0, pcsout);
+
+ /* Add the line */
+ if (dodecol) { /* Lines with color determined by length */
+ double rgb[3];
+ DE2RGB(rgb, icmNorm33(pcsin, pcsout));
+ wrl->add_col_line(wrl, 0, ix, rgb);
+
+ } else { /* Natural color */
+ wrl->add_line(wrl, 0, ix);
+ }
+ }
+
+ /* Check the result */
+ if (cie2k)
+ de = icmCIE2K(pcsout, pcsin);
+ else if (cie94)
+ de = icmCIE94(pcsout, pcsin);
+ else
+ de = icmLabDE(pcsout, pcsin);
+
+ aerr += de;
+ rerr += de * de;
+ if (de > merr)
+ merr = de;
+ nsamps++;
+
+ if (verb > 1) {
+ printf("[%f] %f %f %f -> ",de, pcsin[0], pcsin[1], pcsin[2]);
+ for (n = 0; n < inn; n++)
+ printf("%f ",devout[n]);
+ printf("-> %f %f %f\n",pcsout[0], pcsout[1], pcsout[2]);
+ }
+
+ DC_INC(co);
+ }
}
if (dovrml) {
wrl->make_lines_vc(wrl, 0, 0.0);
diff --git a/profile/kodak2ti3.c b/profile/kodak2ti3.c
index 53278e1..b510719 100644..100755
--- a/profile/kodak2ti3.c
+++ b/profile/kodak2ti3.c
@@ -104,21 +104,21 @@ int main(int argc, char *argv[])
if (argv[fa][1] == '?')
usage();
- else if (argv[fa][1] == 'l' || argv[fa][1] == 'L') {
- fa = nfa;
+ else if (argv[fa][1] == 'l') {
if (na == NULL) usage();
+ fa = nfa;
limit = atoi(na);
if (limit < 1)
limit = 1;
}
- else if (argv[fa][1] == 'r' || argv[fa][1] == 'r') {
- fa = nfa;
+ else if (argv[fa][1] == 'r') {
if (na == NULL) usage();
+ fa = nfa;
strcpy(tarname, na);
}
- else if (argv[fa][1] == 'v' || argv[fa][1] == 'V')
+ else if (argv[fa][1] == 'v')
verb = 1;
else
usage();
diff --git a/profile/ls2ti3.c b/profile/ls2ti3.c
index 3330e16..3330e16 100644..100755
--- a/profile/ls2ti3.c
+++ b/profile/ls2ti3.c
diff --git a/profile/mppcheck.c b/profile/mppcheck.c
index 0fcfbb7..6615a84 100644..100755
--- a/profile/mppcheck.c
+++ b/profile/mppcheck.c
@@ -291,7 +291,7 @@ int main(int argc, char *argv[])
if ((ii = icg->find_field(icg, 0, fname)) < 0)
error ("Input file doesn't contain field %s",fname);
if (icg->t[0].ftype[ii] != r_t)
- error ("Field %s is wrong type",fname);
+ error ("Field %s is wrong type - expect float",fname);
chix[j] = ii;
}
@@ -302,15 +302,15 @@ int main(int argc, char *argv[])
if ((Xi = icg->find_field(icg, 0, "LAB_L")) < 0)
error("Input file doesn't contain field LAB_L");
if (icg->t[0].ftype[Xi] != r_t)
- error("Field LAB_L is wrong type");
+ error("Field LAB_L is wrong type - expect float");
if ((Yi = icg->find_field(icg, 0, "LAB_A")) < 0)
error("Input file doesn't contain field LAB_A");
if (icg->t[0].ftype[Yi] != r_t)
- error("Field LAB_A is wrong type");
+ error("Field LAB_A is wrong type - expect float");
if ((Zi = icg->find_field(icg, 0, "LAB_B")) < 0)
error("Input file doesn't contain field LAB_B");
if (icg->t[0].ftype[Zi] != r_t)
- error("Field LAB_B is wrong type");
+ error("Field LAB_B is wrong type - expect float");
} else { /* Expect XYZ */
if (verb)
@@ -318,15 +318,15 @@ int main(int argc, char *argv[])
if ((Xi = icg->find_field(icg, 0, "XYZ_X")) < 0)
error("Input file doesn't contain field XYZ_X");
if (icg->t[0].ftype[Xi] != r_t)
- error("Field XYZ_X is wrong type");
+ error("Field XYZ_X is wrong type - expect float");
if ((Yi = icg->find_field(icg, 0, "XYZ_Y")) < 0)
error("Input file doesn't contain field XYZ_Y");
if (icg->t[0].ftype[Yi] != r_t)
- error("Field XYZ_Y is wrong type");
+ error("Field XYZ_Y is wrong type - expect float");
if ((Zi = icg->find_field(icg, 0, "XYZ_Z")) < 0)
error("Input file doesn't contain field XYZ_Z");
if (icg->t[0].ftype[Zi] != r_t)
- error("Field XYZ_Z is wrong type");
+ error("Field XYZ_Z is wrong type - expect float");
}
/* If we need the spectral information, find the fields */
@@ -354,6 +354,9 @@ int main(int argc, char *argv[])
if ((spi[j] = icg->find_field(icg, 0, buf)) < 0)
error("Input file doesn't contain field %s",buf);
+
+ if (icg->t[0].ftype[spi[j]] != r_t)
+ error("Field %s is wrong type - expect float",buf);
}
/* Record spectral parameters */
diff --git a/profile/mppprof.c b/profile/mppprof.c
index 74d3a71..41fe2fc 100644..100755
--- a/profile/mppprof.c
+++ b/profile/mppprof.c
@@ -133,36 +133,36 @@ int main(int argc, char *argv[])
if (argv[fa][1] == '?')
usage();
- else if (argv[fa][1] == 'v' || argv[fa][1] == 'V') {
- fa = nfa;
+ else if (argv[fa][1] == 'v') {
if (na == NULL) {
verb = 1;
} else {
+ fa = nfa;
verb = atoi(na);
}
}
/* Ink Limit */
else if (argv[fa][1] == 'l') {
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
limit = atof(na);
}
/* Verify model against input points */
- else if (argv[fa][1] == 'y' || argv[fa][1] == 'Y') {
- fa = nfa;
+ else if (argv[fa][1] == 'y') {
if (na == NULL) {
verify = 1;
} else {
+ fa = nfa;
verify = atoi(na);
}
}
/* Quality */
- else if (argv[fa][1] == 'q' || argv[fa][1] == 'Q') {
- fa = nfa;
+ else if (argv[fa][1] == 'q') {
if (na == NULL) usage();
+ fa = nfa;
switch (na[0]) {
case 'v': /* Very fast */
case 'V':
@@ -192,11 +192,11 @@ int main(int argc, char *argv[])
}
/* Output spectral model */
- else if (argv[fa][1] == 's' || argv[fa][1] == 'S')
+ else if (argv[fa][1] == 's')
ospec = 1;
/* Output mixing model */
- else if (argv[fa][1] == 'm' || argv[fa][1] == 'M')
+ else if (argv[fa][1] == 'm')
omix = 1;
/* Output Lab values rather than XYZ */
@@ -412,7 +412,7 @@ make_output_mpp(
if ((ii = icg->find_field(icg, 0, fname)) < 0)
error ("Input file doesn't contain field %s",fname);
if (icg->t[0].ftype[ii] != r_t)
- error ("Field %s is wrong type",fname);
+ error ("Field %s is wrong type - expect float",fname);
chix[j] = ii;
}
@@ -423,15 +423,15 @@ make_output_mpp(
if ((Xi = icg->find_field(icg, 0, "LAB_L")) < 0)
error("Input file doesn't contain field LAB_L");
if (icg->t[0].ftype[Xi] != r_t)
- error("Field LAB_L is wrong type");
+ error("Field LAB_L is wrong type - expect float");
if ((Yi = icg->find_field(icg, 0, "LAB_A")) < 0)
error("Input file doesn't contain field LAB_A");
if (icg->t[0].ftype[Yi] != r_t)
- error("Field LAB_A is wrong type");
+ error("Field LAB_A is wrong type - expect float");
if ((Zi = icg->find_field(icg, 0, "LAB_B")) < 0)
error("Input file doesn't contain field LAB_B");
if (icg->t[0].ftype[Zi] != r_t)
- error("Field LAB_B is wrong type");
+ error("Field LAB_B is wrong type - expect float");
} else { /* Expect XYZ */
if (verb)
@@ -439,15 +439,15 @@ make_output_mpp(
if ((Xi = icg->find_field(icg, 0, "XYZ_X")) < 0)
error("Input file doesn't contain field XYZ_X");
if (icg->t[0].ftype[Xi] != r_t)
- error("Field XYZ_X is wrong type");
+ error("Field XYZ_X is wrong type - expect float");
if ((Yi = icg->find_field(icg, 0, "XYZ_Y")) < 0)
error("Input file doesn't contain field XYZ_Y");
if (icg->t[0].ftype[Yi] != r_t)
- error("Field XYZ_Y is wrong type");
+ error("Field XYZ_Y is wrong type - expect float");
if ((Zi = icg->find_field(icg, 0, "XYZ_Z")) < 0)
error("Input file doesn't contain field XYZ_Z");
if (icg->t[0].ftype[Zi] != r_t)
- error("Field XYZ_Z is wrong type");
+ error("Field XYZ_Z is wrong type - expect float");
}
/* If we need the spectral information, find the fields */
@@ -475,6 +475,9 @@ make_output_mpp(
if ((spi[j] = icg->find_field(icg, 0, buf)) < 0)
error("Input file doesn't contain field %s",buf);
+
+ if (icg->t[0].ftype[spi[j]] != r_t)
+ error("Field %s is wrong type - expect float",buf);
}
}
diff --git a/profile/printcal.c b/profile/printcal.c
index 38ceb9b..9bbcb41 100644..100755
--- a/profile/printcal.c
+++ b/profile/printcal.c
@@ -641,7 +641,7 @@ int main(int argc, char *argv[]) {
#endif // NEVER
/* Process the arguments */
- mfa = 2; /* Minimum final arguments */
+ mfa = 1; /* Minimum final arguments */
for(fa = 1;fa < argc;fa++) {
nfa = fa; /* skip to nfa if next argument is used */
@@ -683,6 +683,7 @@ int main(int argc, char *argv[]) {
recal = 0;
verify = 0;
imitate = 0;
+ mfa = 1;
}
else if (argv[fa][1] == 'r') {
@@ -690,6 +691,7 @@ int main(int argc, char *argv[]) {
recal = 1; /* Recalibrate */
verify = 0;
imitate = 0;
+ mfa = 2;
}
else if (argv[fa][1] == 'e') {
@@ -697,6 +699,7 @@ int main(int argc, char *argv[]) {
recal = 0;
verify = 1; /* Verify */
imitate = 0;
+ mfa = 2;
}
else if (argv[fa][1] == 'I') {
@@ -704,6 +707,7 @@ int main(int argc, char *argv[]) {
recal = 0;
verify = 0;
imitate = 1; /* Imitation target */
+ mfa = 1;
}
else if (argv[fa][1] == 'd')
@@ -714,36 +718,36 @@ int main(int argc, char *argv[]) {
/* Smoothing modfider */
else if (argv[fa][1] == 's') {
- fa = nfa;
if (na == NULL) usage("Expect argument to smoothing flag -s");
+ fa = nfa;
xsmooth = atof(na);
}
/* Manufacturer description string */
else if (argv[fa][1] == 'A') {
- fa = nfa;
if (na == NULL) usage("Expect argument to manufacturer description flag -A");
+ fa = nfa;
xpi.deviceMfgDesc = na;
}
/* Model description string */
else if (argv[fa][1] == 'M') {
- fa = nfa;
if (na == NULL) usage("Expect argument to model description flag -M");
+ fa = nfa;
xpi.modelDesc = na;
}
/* Profile Description */
else if (argv[fa][1] == 'D') {
- fa = nfa;
if (na == NULL) usage("Expect argument to profile description flag -D");
+ fa = nfa;
xpi.profDesc = na;
}
/* Copyright string */
else if (argv[fa][1] == 'C') {
- fa = nfa;
if (na == NULL) usage("Expect argument to copyright flag -C");
+ fa = nfa;
xpi.copyright = na;
}
@@ -755,9 +759,9 @@ int main(int argc, char *argv[]) {
char fch = argv[fa][1];
int chan = -1;
double val = -1.0;
- fa = nfa;
if (na == NULL)
usage("Expect channel flag after flag -%c",argv[fa][1]);
+ fa = nfa;
switch (na[0]) {
case 'c': case 'r': case '0':
chan = 0;
diff --git a/profile/prof.h b/profile/prof.h
index 098c03f..013fbd6 100644..100755
--- a/profile/prof.h
+++ b/profile/prof.h
@@ -100,6 +100,7 @@ void make_input_icc(
char *in_name, /* input .ti3 file name */
char *file_name, /* output icc name */
cgats *icg, /* input cgats structure */
+ int emis, /* emissive reference data */
int spec, /* Use spectral data flag */
icxIllumeType illum, /* Spectral illuminant */
xspect *cust_illum, /* Possible custom illumination */
diff --git a/profile/profcheck.c b/profile/profcheck.c
index 32cddad..8c2fc60 100644..100755
--- a/profile/profcheck.c
+++ b/profile/profcheck.c
@@ -122,14 +122,15 @@ int main(int argc, char *argv[])
vrml *wrl = NULL;
int fwacomp = 0; /* FWA compensation */
+ int isemis = 0; /* nz if this has emissive reference data */
int isdisp = 0; /* nz if this is a display device, 0 if output */
int isdnormed = 0; /* Has display data been normalised to 100 ? */
int spec = 0; /* Use spectral data flag */
icxIllumeType tillum = icxIT_none; /* Target/simulated instrument illuminant */
xspect cust_tillum, *tillump = NULL; /* Custom target/simulated illumination spectrum */
- icxIllumeType illum = icxIT_D50; /* Spectral defaults */
+ icxIllumeType illum = icxIT_none; /* Spectral defaults */
xspect cust_illum; /* Custom illumination spectrum */
- icxObserverType observ = icxOT_CIE_1931_2;
+ icxObserverType observ = icxOT_none;
int sortbyde = 0; /* Sort by delta E */
@@ -224,8 +225,8 @@ int main(int argc, char *argv[])
/* Create a pruned .ti3 */
else if (argv[fa][1] == 'P') {
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
prune = atof(na);
if (prune <= 0.0)
usage();
@@ -235,8 +236,8 @@ int main(int argc, char *argv[])
else if (argv[fa][1] == 'd') {
char *tp, buf[200];
int ndv;
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
ddevv = 1;
strcpy(buf, na);
@@ -302,8 +303,8 @@ int main(int argc, char *argv[])
}
/* Spectral Illuminant type */
else if (argv[fa][1] == 'i') {
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
if (strcmp(na, "A") == 0) {
spec = 1;
illum = icxIT_A;
@@ -338,8 +339,8 @@ int main(int argc, char *argv[])
/* Spectral Observer type */
else if (argv[fa][1] == 'o') {
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
if (strcmp(na, "1931_2") == 0) { /* Classic 2 degree */
spec = 1;
observ = icxOT_CIE_1931_2;
@@ -361,8 +362,8 @@ int main(int argc, char *argv[])
/* Intent (only applies to ICC profile) */
else if (argv[fa][1] == 'I') {
- fa = nfa;
if (na == NULL) usage();
+ fa = nfa;
switch (na[0]) {
case 'r':
intent = icRelativeColorimetric;
@@ -408,22 +409,6 @@ int main(int argc, char *argv[])
if (icg->ntables < 1)
error ("Input file '%s' doesn't contain at least one table",ti3name);
- /* See if CIE is actually available - some sources of .TI3 don't provide it */
- if (!spec
- && icg->find_field(icg, 0, "LAB_L") < 0
- && icg->find_field(icg, 0, "XYZ_X") < 0) {
-
- if (icg->find_kword(icg, 0, "SPECTRAL_BANDS") < 0)
- error ("Neither CIE nor spectral data found in file '%s'",ti3name);
-
- /* Switch to using spectral information */
- if (verb)
- printf("No CIE data found, switching to spectral with standard observer & D50\n");
- spec = 1;
- illum = icxIT_D50;
- observ = icxOT_CIE_1931_2;
- }
-
/* Figure out what sort of device it is */
{
int ti;
@@ -431,7 +416,11 @@ int main(int argc, char *argv[])
if ((ti = icg->find_kword(icg, 0, "DEVICE_CLASS")) < 0)
error ("Input file '%s' doesn't contain keyword DEVICE_CLASS",ti3name);
- if (strcmp(icg->t[0].kdata[ti],"DISPLAY") == 0) {
+ if (strcmp(icg->t[0].kdata[ti],"EMISINPUT") == 0) {
+ isemis = 1;
+
+ } else if (strcmp(icg->t[0].kdata[ti],"DISPLAY") == 0) {
+ isemis = 1;
isdisp = 1;
}
@@ -444,6 +433,38 @@ int main(int argc, char *argv[])
}
}
+ if (isemis && illum != icxIT_none)
+ warning("-i illuminant ignored for emissive reference type");
+
+ if (isemis & fwacomp) {
+ warning("-f FWA compensation ignored for emissive reference type");
+ fwacomp = 0;
+ tillum = icxIT_none;
+ }
+
+ /* Set defaults */
+ if (illum == icxIT_none)
+ illum = icxIT_D50;
+
+ if (observ = icxOT_none)
+ observ = icxOT_CIE_1931_2;
+
+ /* See if CIE is actually available - some sources of .TI3 don't provide it */
+ if (!spec
+ && icg->find_field(icg, 0, "LAB_L") < 0
+ && icg->find_field(icg, 0, "XYZ_X") < 0) {
+
+ if (icg->find_kword(icg, 0, "SPECTRAL_BANDS") < 0)
+ error ("Neither CIE nor spectral data found in file '%s'",ti3name);
+
+ /* Switch to using spectral information */
+ if (verb)
+ printf("No CIE data found, switching to spectral with standard observer & D50\n");
+ spec = 1;
+ illum = icxIT_D50;
+ observ = icxOT_CIE_1931_2;
+ }
+
/* Figure out what sort of device colorspace it is */
{
int ti;
@@ -569,12 +590,12 @@ int main(int argc, char *argv[])
if ((ci = icg->find_field(icg, 0, "GRAY_W")) < 0)
error("Input file doesn't contain field GRAY_W");
if (icg->t[0].ftype[ci] != r_t)
- error("Field GRAY_W is wrong type - corrupted file ?");
+ error("Field GRAY_W is wrong type - expect float");
} else {
if ((ci = icg->find_field(icg, 0, "GRAY_K")) < 0)
error("Input file doesn't contain field GRAY_K");
if (icg->t[0].ftype[ci] != r_t)
- error("Field GRAY_K is wrong type - corrupted file ?");
+ error("Field GRAY_K is wrong type - expect float");
}
mi = yi = ki = ci;
@@ -582,15 +603,15 @@ int main(int argc, char *argv[])
if ((ci = icg->find_field(icg, 0, "RGB_R")) < 0)
error("Input file '%s' doesn't contain field RGB_R",ti3name);
if (icg->t[0].ftype[ci] != r_t)
- error("Input file '%s' field RGB_R is wrong type",ti3name);
+ error("Input file '%s' field RGB_R is wrong type - expect float",ti3name);
if ((mi = icg->find_field(icg, 0, "RGB_G")) < 0)
error("Input file '%s' doesn't contain field RGB_G",ti3name);
if (icg->t[0].ftype[mi] != r_t)
- error("Input file '%s' field RGB_G is wrong type",ti3name);
+ error("Input file '%s' field RGB_G is wrong type - expect float",ti3name);
if ((yi = icg->find_field(icg, 0, "RGB_B")) < 0)
error("Input file '%s' doesn't contain field RGB_B",ti3name);
if (icg->t[0].ftype[yi] != r_t)
- error("Input file '%s' field RGB_B is wrong type",ti3name);
+ error("Input file '%s' field RGB_B is wrong type - expect float",ti3name);
ki = yi;
} else if (devspace == icSigCmyData) {
@@ -598,11 +619,11 @@ int main(int argc, char *argv[])
if ((ci = icg->find_field(icg, 0, "CMY_C")) < 0)
error("Input file '%s' doesn't contain field CMY_C",ti3name);
if (icg->t[0].ftype[ci] != r_t)
- error("Input file '%s' field CMY_C is wrong type",ti3name);
+ error("Input file '%s' field CMY_C is wrong type - expect float",ti3name);
if ((mi = icg->find_field(icg, 0, "CMY_M")) < 0)
error("Input file '%s' doesn't contain field CMY_M",ti3name);
if (icg->t[0].ftype[mi] != r_t)
- error("Input file '%s' field CMY_M is wrong type",ti3name);
+ error("Input file '%s' field CMY_M is wrong type - expect float",ti3name);
if ((yi = icg->find_field(icg, 0, "CMY_Y")) < 0)
error("Input file '%s' doesn't contain field CMY_Y",ti3name);
ki = yi;
@@ -611,19 +632,19 @@ int main(int argc, char *argv[])
if ((ci = icg->find_field(icg, 0, "CMYK_C")) < 0)
error("Input file '%s' doesn't contain field CMYK_C",ti3name);
if (icg->t[0].ftype[ci] != r_t)
- error("Input file '%s' field CMYK_C is wrong type",ti3name);
+ error("Input file '%s' field CMYK_C is wrong type - expect float",ti3name);
if ((mi = icg->find_field(icg, 0, "CMYK_M")) < 0)
error("Input file '%s' doesn't contain field CMYK_M",ti3name);
if (icg->t[0].ftype[mi] != r_t)
- error("Input file '%s' field CMYK_M is wrong type",ti3name);
+ error("Input file '%s' field CMYK_M is wrong type - expect float",ti3name);
if ((yi = icg->find_field(icg, 0, "CMYK_Y")) < 0)
error("Input file '%s' doesn't contain field CMYK_Y",ti3name);
if (icg->t[0].ftype[yi] != r_t)
- error("Input file '%s' field CMYK_Y is wrong type",ti3name);
+ error("Input file '%s' field CMYK_Y is wrong type - expect float",ti3name);
if ((ki = icg->find_field(icg, 0, "CMYK_K")) < 0)
error("Input file '%s' doesn't contain field CMYK_K",ti3name);
if (icg->t[0].ftype[ki] != r_t)
- error("Input file '%s' field CMYK_K is wrong type",ti3name);
+ error("Input file '%s' field CMYK_K is wrong type - expect float",ti3name);
}
if (spec == 0) { /* Using instrument tristimulous value */
@@ -632,29 +653,29 @@ int main(int argc, char *argv[])
if ((Xi = icg->find_field(icg, 0, "LAB_L")) < 0)
error("Input file '%s' doesn't contain field LAB_L",ti3name);
if (icg->t[0].ftype[Xi] != r_t)
- error("Input file '%s' field LAB_L is wrong type",ti3name);
+ error("Input file '%s' field LAB_L is wrong type - expect float",ti3name);
if ((Yi = icg->find_field(icg, 0, "LAB_A")) < 0)
error("Input '%s' file doesn't contain field LAB_A",ti3name);
if (icg->t[0].ftype[Yi] != r_t)
- error("Input file '%s' field LAB_A is wrong type",ti3name);
+ error("Input file '%s' field LAB_A is wrong type - expect float",ti3name);
if ((Zi = icg->find_field(icg, 0, "LAB_B")) < 0)
error("Input file '%s' doesn't contain field LAB_B",ti3name);
if (icg->t[0].ftype[Zi] != r_t)
- error("Input file '%s' field LAB_B is wrong type",ti3name);
+ error("Input file '%s' field LAB_B is wrong type - expect float",ti3name);
} else { /* Expect XYZ */
if ((Xi = icg->find_field(icg, 0, "XYZ_X")) < 0)
error("Input file '%s' doesn't contain field XYZ_X",ti3name);
if (icg->t[0].ftype[Xi] != r_t)
- error("Input file '%s' field XYZ_X is wrong type",ti3name);
+ error("Input file '%s' field XYZ_X is wrong type - expect float",ti3name);
if ((Yi = icg->find_field(icg, 0, "XYZ_Y")) < 0)
error("Input file '%s' doesn't contain field XYZ_Y",ti3name);
if (icg->t[0].ftype[Yi] != r_t)
- error("Input file '%s' field XYZ_Y is wrong type",ti3name);
+ error("Input file '%s' field XYZ_Y is wrong type - expect float",ti3name);
if ((Zi = icg->find_field(icg, 0, "XYZ_Z")) < 0)
error("Input file '%s' doesn't contain field XYZ_Z",ti3name);
if (icg->t[0].ftype[Zi] != r_t)
- error("Input file '%s' field XYZ_Z is wrong type",ti3name);
+ error("Input file '%s' field XYZ_Z is wrong type - expect float",ti3name);
}
for (i = 0; i < npat; i++) {
@@ -719,10 +740,14 @@ int main(int argc, char *argv[])
if ((spi[j] = icg->find_field(icg, 0, buf)) < 0)
error("Input file '%s' doesn't contain field %s",ti3name,buf);
+
+ if (icg->t[0].ftype[spi[j]] != r_t)
+ error("Field %s is wrong type - expect float",buf);
}
- if (isdisp) {
- illum = icxIT_none; /* Displays are assumed to be self luminous */
+ if (isemis) {
+ illum = icxIT_none; /* Emissive data has no illuminant */
+ fwacomp = 0;
}
/* Create a spectral conversion object */
diff --git a/profile/profin.c b/profile/profin.c
index 98cad65..4db596c 100644..100755
--- a/profile/profin.c
+++ b/profile/profin.c
@@ -270,6 +270,7 @@ make_input_icc(
char *in_name, /* input .ti3 file name */
char *file_name, /* output icc name */
cgats *icg, /* input cgats structure */
+ int emis, /* emissive reference data */
int spec, /* Use spectral data flag */
icxIllumeType illum, /* Spectral illuminant */
xspect *cust_illum, /* Possible custom illumination */
@@ -678,15 +679,15 @@ make_input_icc(
if ((ri = icg->find_field(icg, 0, "RGB_R")) < 0)
error ("Input file doesn't contain field RGB_R");
if (icg->t[0].ftype[ri] != r_t)
- error ("Field RGB_R is wrong type - corrupted file ?");
+ error ("Field RGB_R is wrong type - expect float");
if ((gi = icg->find_field(icg, 0, "RGB_G")) < 0)
error ("Input file doesn't contain field RGB_G");
if (icg->t[0].ftype[gi] != r_t)
- error ("Field RGB_G is wrong type - corrupted file ?");
+ error ("Field RGB_G is wrong type - expect float");
if ((bi = icg->find_field(icg, 0, "RGB_B")) < 0)
error ("Input file doesn't contain field RGB_B");
if (icg->t[0].ftype[bi] != r_t)
- error ("Field RGB_B is wrong type - corrupted file ?");
+ error ("Field RGB_B is wrong type - expect float");
if (spec == 0) { /* Using instrument tristimulous value */
@@ -694,28 +695,28 @@ make_input_icc(
if ((Xi = icg->find_field(icg, 0, "LAB_L")) < 0)
error ("Input file doesn't contain field LAB_L");
if (icg->t[0].ftype[Xi] != r_t)
- error ("Field LAB_L is wrong type - corrupted file ?");
+ error ("Field LAB_L is wrong type - expect float");
if ((Yi = icg->find_field(icg, 0, "LAB_A")) < 0)
error ("Input file doesn't contain field LAB_A");
if (icg->t[0].ftype[Yi] != r_t)
- error ("Field LAB_A is wrong type - corrupted file ?");
+ error ("Field LAB_A is wrong type - expect float");
if ((Zi = icg->find_field(icg, 0, "LAB_B")) < 0)
error ("Input file doesn't contain field LAB_B");
if (icg->t[0].ftype[Zi] != r_t)
- error ("Field LAB_B is wrong type - corrupted file ?");
+ error ("Field LAB_B is wrong type - expect float");
} else {
if ((Xi = icg->find_field(icg, 0, "XYZ_X")) < 0)
error ("Input file doesn't contain field XYZ_X");
if (icg->t[0].ftype[Xi] != r_t)
- error ("Field XYZ_X is wrong type - corrupted file ?");
+ error ("Field XYZ_X is wrong type - expect float");
if ((Yi = icg->find_field(icg, 0, "XYZ_Y")) < 0)
error ("Input file doesn't contain field XYZ_Y");
if (icg->t[0].ftype[Yi] != r_t)
- error ("Field XYZ_Y is wrong type - corrupted file ?");
+ error ("Field XYZ_Y is wrong type - expect float");
if ((Zi = icg->find_field(icg, 0, "XYZ_Z")) < 0)
error ("Input file doesn't contain field XYZ_Z");
if (icg->t[0].ftype[Zi] != r_t)
- error ("Field XYZ_Z is wrong type - corrupted file ?");
+ error ("Field XYZ_Z is wrong type - expect float");
}
for (i = 0; i < npat; i++) {
@@ -773,9 +774,16 @@ make_input_icc(
if ((spi[j] = icg->find_field(icg, 0, buf)) < 0)
error("Input file doesn't contain field %s",buf);
+
+ if (icg->t[0].ftype[spi[j]] != r_t)
+ error("Field %s is wrong type - expect float",buf);
}
/* Create a spectral conversion object */
+ if (emis) {
+ illum = icxIT_none;
+ cust_illum = NULL;
+ }
if ((sp2cie = new_xsp2cie(illum, cust_illum, observ, NULL,
wantLab ? icSigLabData : icSigXYZData, icxClamp)) == NULL)
error("Creation of spectral conversion object failed");
@@ -788,7 +796,7 @@ make_input_icc(
if (tpat[i].p[0] > 1.0
|| tpat[i].p[1] > 1.0
|| tpat[i].p[2] > 1.0) {
- error("Device value field exceeds 100.0!");
+ error("Patch %d device value field exceeds 100.0!",i+1);
}
/* Read the spectral values for this patch */
diff --git a/profile/profout.c b/profile/profout.c
index 790ffa4..1a6f4ae 100644..100755
--- a/profile/profout.c
+++ b/profile/profout.c
@@ -1720,6 +1720,9 @@ make_output_icc(
if ((spi[j] = icg->find_field(icg, 0, buf)) < 0)
error("Input file doesn't contain field %s",buf);
+
+ if (icg->t[0].ftype[spi[j]] != r_t)
+ error("Field %s is wrong type - expect float",buf);
}
if (isdisp) {
diff --git a/profile/simpprof.c b/profile/simpprof.c
index 61128ff..61128ff 100644..100755
--- a/profile/simpprof.c
+++ b/profile/simpprof.c
diff --git a/profile/splitti3.c b/profile/splitti3.c
index a48c6fa..eb92938 100644..100755
--- a/profile/splitti3.c
+++ b/profile/splitti3.c
@@ -110,28 +110,28 @@ int main(int argc, char *argv[]) {
if (argv[fa][1] == '?') {
usage();
- } else if (argv[fa][1] == 'v' || argv[fa][1] == 'V') {
+ } else if (argv[fa][1] == 'v') {
verb = 1;
- } else if (argv[fa][1] == 'n' || argv[fa][1] == 'N') {
- fa = nfa;
+ } else if (argv[fa][1] == 'n') {
if (na == NULL) usage();
+ fa = nfa;
numb = atoi(na);
if (numb < 0) usage();
- } else if (argv[fa][1] == 'p' || argv[fa][1] == 'P') {
- fa = nfa;
+ } else if (argv[fa][1] == 'p') {
if (na == NULL) usage();
+ fa = nfa;
prop = atoi(na);
if (prop < 0) usage();
prop = prop / 100.0;
- } else if (argv[fa][1] == 'w' || argv[fa][1] == 'W') {
+ } else if (argv[fa][1] == 'w') {
dow = 1;
- } else if (argv[fa][1] == 'r' || argv[fa][1] == 'R') {
- fa = nfa;
+ } else if (argv[fa][1] == 'r') {
if (na == NULL) usage();
+ fa = nfa;
seed = atoi(na);
doseed = 1;
}
diff --git a/profile/txt2ti3.c b/profile/txt2ti3.c
index c1d9ed0..28f5071 100644..100755
--- a/profile/txt2ti3.c
+++ b/profile/txt2ti3.c
@@ -72,11 +72,11 @@ int main(int argc, char *argv[])
int out2 = 0; /* Create dumy .ti2 file output */
int disp = 0; /* nz if this is a display device */
int inp = 0; /* nz if this is an input device */
- static char devname[200] = { 0 }; /* Input CMYK/Device .txt file (may be null) */
- static char ciename[200] = { 0 }; /* Input CIE .txt file (may be null) */
- static char specname[200] = { 0 }; /* Input Device / Spectral .txt file */
- static char outname[200] = { 0 }; /* Output cgats .ti3 file base name */
- static char outname2[200] = { 0 }; /* Output cgats .ti2 file base name */
+ static char devname[MAXNAMEL+1] = { 0 }; /* Input CMYK/Device .txt file (may be null) */
+ static char ciename[MAXNAMEL+1] = { 0 }; /* Input CIE .txt file (may be null) */
+ static char specname[MAXNAMEL+1] = { 0 }; /* Input Device / Spectral .txt file */
+ static char outname[MAXNAMEL+9] = { 0 }; /* Output cgats .ti3 file base name */
+ static char outname2[MAXNAMEL+9] = { 0 }; /* Output cgats .ti2 file base name */
cgats *cmy = NULL; /* Input RGB/CMYK reference file */
int f_id1 = -1, f_c, f_m, f_y, f_k = 0; /* Field indexes */
double dev_scale = 1.0; /* Device value scaling */
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
cgats *spec = NULL; /* Input spectral readings (NULL if none) */
double spec_scale = 1.0; /* Spectral value scaling */
int f_id3 = 0; /* Field indexes */
- int spi[100]; /* CGATS indexes for each wavelength */
+ int spi[XSPECT_MAX_BANDS]; /* CGATS indexes for each wavelength */
cgats *ocg; /* output cgats structure for .ti3 */
cgats *ocg2; /* output cgats structure for .ti2 */
time_t clk = time(0);
@@ -127,9 +127,9 @@ int main(int argc, char *argv[])
else if (argv[fa][1] == '2')
out2 = 1;
- else if (argv[fa][1] == 'l' || argv[fa][1] == 'L') {
- fa = nfa;
+ else if (argv[fa][1] == 'l') {
if (na == NULL) usage("No ink limit parameter");
+ fa = nfa;
tlimit = atoi(na);
if (tlimit < 1)
tlimit = -1;
@@ -143,7 +143,7 @@ int main(int argc, char *argv[])
disp = 0;
inp = 1;
- } else if (argv[fa][1] == 'v' || argv[fa][1] == 'V')
+ } else if (argv[fa][1] == 'v')
verb = 1;
else
usage("Unknown flag");
@@ -239,39 +239,39 @@ int main(int argc, char *argv[])
error("Input file '%s' doesn't contain field RGB_R",devname);
}
if (cmy->t[0].ftype[f_c] != r_t)
- error("Field RGB_R from file '%s' is wrong type",devname);
+ error("Field RGB_R from file '%s' is wrong type - expect float",devname);
if ((f_m = cmy->find_field(cmy, 0, "RGB_G")) < 0)
error("Input file '%s' doesn't contain field RGB_G",devname);
if (cmy->t[0].ftype[f_m] != r_t)
- error("Field RGB_G from file '%s' is wrong type",devname);
+ error("Field RGB_G from file '%s' is wrong type - expect float",devname);
if ((f_y = cmy->find_field(cmy, 0, "RGB_B")) < 0)
error("Input file '%s' doesn't contain field RGB_B",devname);
if (cmy->t[0].ftype[f_y] != r_t)
- error("Field RGB_B from file '%s' is wrong type",devname);
+ error("Field RGB_B from file '%s' is wrong type - expect float",devname);
} else if (ndchan == 4) {
if ((f_c = cmy->find_field(cmy, 0, "CMYK_C")) < 0) {
error("Input file '%s' doesn't contain field CMYK_C",devname);
}
if (cmy->t[0].ftype[f_c] != r_t)
- error("Field CMYK_C from file '%s' is wrong type",devname);
+ error("Field CMYK_C from file '%s' is wrong type - expect float",devname);
if ((f_m = cmy->find_field(cmy, 0, "CMYK_M")) < 0)
error("Input file '%s' doesn't contain field CMYK_M",devname);
if (cmy->t[0].ftype[f_m] != r_t)
- error("Field CMYK_M from file '%s' is wrong type",devname);
+ error("Field CMYK_M from file '%s' is wrong type - expect float",devname);
if ((f_y = cmy->find_field(cmy, 0, "CMYK_Y")) < 0)
error("Input file '%s' doesn't contain field CMYK_Y",devname);
if (cmy->t[0].ftype[f_y] != r_t)
- error("Field CMYK_Y from file '%s' is wrong type",devname);
+ error("Field CMYK_Y from file '%s' is wrong type - expect float",devname);
if ((f_k = cmy->find_field(cmy, 0, "CMYK_K")) < 0)
error("Input file '%s' doesn't contain field CMYK_Y",devname);
if (cmy->t[0].ftype[f_k] != r_t)
- error("Field CMYK_K from file '%s' is wrong type",devname);
+ error("Field CMYK_K from file '%s' is wrong type - expect float",devname);
}
if (verb && ndchan > 0) printf("Read device values\n");
@@ -351,7 +351,7 @@ int main(int argc, char *argv[])
error("Input file '%s' doesn't contain field XYZ_Y",fields[islab][i], ciename);
if (ncie->t[0].ftype[f_cie[i]] != r_t)
- error("Field %s from file '%s' is wrong type",fields[islab][i], ciename);
+ error("Field %s from file '%s' is wrong type - expect float",fields[islab][i], ciename);
}
if (verb) printf("Found CIE values\n");
@@ -447,7 +447,7 @@ int main(int argc, char *argv[])
error("Failed to find spectral band %d nm in file '%s'\n",specmin + 10 * j,specname);
} else {
if (spec->t[0].ftype[spi[j]] != r_t)
- error("Field '%s' from file '%s' is wrong type",spec->t[0].fsym[spi[j]], specname);
+ error("Field '%s' from file '%s' is wrong type - expect float",spec->t[0].fsym[spi[j]], specname);
}
}