From c0b89ac5bfb90835ef01573267020e42d4fe070c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 23 Aug 2015 12:17:05 +0200 Subject: Imported Upstream version 1.8.0 --- profile/3dap5k.sp | 0 profile/CIE_C.sp | 0 profile/D50_0.0.sp | 0 profile/D50_0.1.sp | 0 profile/D50_0.3.sp | 0 profile/D50_0.5.sp | 0 profile/D50_0.7.sp | 0 profile/D50_1.0.sp | 0 profile/D50_1.2.sp | 0 profile/D50_1.5.sp | 0 profile/D50_1.7.sp | 0 profile/D50_2.0.sp | 0 profile/D50_2.5.sp | 0 profile/D50_3.0.sp | 0 profile/F1.sp | 0 profile/F5.sp | 0 profile/F8.sp | 0 profile/GTIPlus.sp | 0 profile/Jamfile | 0 profile/License.txt | 0 profile/Office.sp | 0 profile/Readme.txt | 0 profile/Trulux.sp | 0 profile/TruluxPlus.sp | 0 profile/afiles | 0 profile/applycal.c | 0 profile/cb2ti3.c | 0 profile/colprof.c | 121 ++++++++++++++++++++------------- profile/colverify.c | 180 +++++++++++++++++++++++++++++++++---------------- profile/example.sp | 0 profile/example121.sp | 0 profile/invprofcheck.c | 116 ++++++++++++++++++++++++++++--- profile/kodak2ti3.c | 10 +-- profile/ls2ti3.c | 0 profile/mppcheck.c | 17 +++-- profile/mppprof.c | 35 +++++----- profile/printcal.c | 18 +++-- profile/prof.h | 1 + profile/profcheck.c | 111 ++++++++++++++++++------------ profile/profin.c | 28 +++++--- profile/profout.c | 3 + profile/simpprof.c | 0 profile/splitti3.c | 16 ++--- profile/txt2ti3.c | 36 +++++----- 44 files changed, 463 insertions(+), 229 deletions(-) mode change 100644 => 100755 profile/3dap5k.sp mode change 100644 => 100755 profile/CIE_C.sp mode change 100644 => 100755 profile/D50_0.0.sp mode change 100644 => 100755 profile/D50_0.1.sp mode change 100644 => 100755 profile/D50_0.3.sp mode change 100644 => 100755 profile/D50_0.5.sp mode change 100644 => 100755 profile/D50_0.7.sp mode change 100644 => 100755 profile/D50_1.0.sp mode change 100644 => 100755 profile/D50_1.2.sp mode change 100644 => 100755 profile/D50_1.5.sp mode change 100644 => 100755 profile/D50_1.7.sp mode change 100644 => 100755 profile/D50_2.0.sp mode change 100644 => 100755 profile/D50_2.5.sp mode change 100644 => 100755 profile/D50_3.0.sp mode change 100644 => 100755 profile/F1.sp mode change 100644 => 100755 profile/F5.sp mode change 100644 => 100755 profile/F8.sp mode change 100644 => 100755 profile/GTIPlus.sp mode change 100644 => 100755 profile/Jamfile mode change 100644 => 100755 profile/License.txt mode change 100644 => 100755 profile/Office.sp mode change 100644 => 100755 profile/Readme.txt mode change 100644 => 100755 profile/Trulux.sp mode change 100644 => 100755 profile/TruluxPlus.sp mode change 100644 => 100755 profile/afiles mode change 100644 => 100755 profile/applycal.c mode change 100644 => 100755 profile/cb2ti3.c mode change 100644 => 100755 profile/colprof.c mode change 100644 => 100755 profile/colverify.c mode change 100644 => 100755 profile/example.sp mode change 100644 => 100755 profile/example121.sp mode change 100644 => 100755 profile/invprofcheck.c mode change 100644 => 100755 profile/kodak2ti3.c mode change 100644 => 100755 profile/ls2ti3.c mode change 100644 => 100755 profile/mppcheck.c mode change 100644 => 100755 profile/mppprof.c mode change 100644 => 100755 profile/printcal.c mode change 100644 => 100755 profile/prof.h mode change 100644 => 100755 profile/profcheck.c mode change 100644 => 100755 profile/profin.c mode change 100644 => 100755 profile/profout.c mode change 100644 => 100755 profile/simpprof.c mode change 100644 => 100755 profile/splitti3.c mode change 100644 => 100755 profile/txt2ti3.c (limited to 'profile') diff --git a/profile/3dap5k.sp b/profile/3dap5k.sp old mode 100644 new mode 100755 diff --git a/profile/CIE_C.sp b/profile/CIE_C.sp old mode 100644 new mode 100755 diff --git a/profile/D50_0.0.sp b/profile/D50_0.0.sp old mode 100644 new mode 100755 diff --git a/profile/D50_0.1.sp b/profile/D50_0.1.sp old mode 100644 new mode 100755 diff --git a/profile/D50_0.3.sp b/profile/D50_0.3.sp old mode 100644 new mode 100755 diff --git a/profile/D50_0.5.sp b/profile/D50_0.5.sp old mode 100644 new mode 100755 diff --git a/profile/D50_0.7.sp b/profile/D50_0.7.sp old mode 100644 new mode 100755 diff --git a/profile/D50_1.0.sp b/profile/D50_1.0.sp old mode 100644 new mode 100755 diff --git a/profile/D50_1.2.sp b/profile/D50_1.2.sp old mode 100644 new mode 100755 diff --git a/profile/D50_1.5.sp b/profile/D50_1.5.sp old mode 100644 new mode 100755 diff --git a/profile/D50_1.7.sp b/profile/D50_1.7.sp old mode 100644 new mode 100755 diff --git a/profile/D50_2.0.sp b/profile/D50_2.0.sp old mode 100644 new mode 100755 diff --git a/profile/D50_2.5.sp b/profile/D50_2.5.sp old mode 100644 new mode 100755 diff --git a/profile/D50_3.0.sp b/profile/D50_3.0.sp old mode 100644 new mode 100755 diff --git a/profile/F1.sp b/profile/F1.sp old mode 100644 new mode 100755 diff --git a/profile/F5.sp b/profile/F5.sp old mode 100644 new mode 100755 diff --git a/profile/F8.sp b/profile/F8.sp old mode 100644 new mode 100755 diff --git a/profile/GTIPlus.sp b/profile/GTIPlus.sp old mode 100644 new mode 100755 diff --git a/profile/Jamfile b/profile/Jamfile old mode 100644 new mode 100755 diff --git a/profile/License.txt b/profile/License.txt old mode 100644 new mode 100755 diff --git a/profile/Office.sp b/profile/Office.sp old mode 100644 new mode 100755 diff --git a/profile/Readme.txt b/profile/Readme.txt old mode 100644 new mode 100755 diff --git a/profile/Trulux.sp b/profile/Trulux.sp old mode 100644 new mode 100755 diff --git a/profile/TruluxPlus.sp b/profile/TruluxPlus.sp old mode 100644 new mode 100755 diff --git a/profile/afiles b/profile/afiles old mode 100644 new mode 100755 diff --git a/profile/applycal.c b/profile/applycal.c old mode 100644 new mode 100755 diff --git a/profile/cb2ti3.c b/profile/cb2ti3.c old mode 100644 new mode 100755 diff --git a/profile/colprof.c b/profile/colprof.c old mode 100644 new mode 100755 index 1e73cdf..ced168b --- 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 old mode 100644 new mode 100755 index e84fa6a..40165a0 --- 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 old mode 100644 new mode 100755 diff --git a/profile/example121.sp b/profile/example121.sp old mode 100644 new mode 100755 diff --git a/profile/invprofcheck.c b/profile/invprofcheck.c old mode 100644 new mode 100755 index 8cb9f34..5cb1101 --- 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 */ @@ -392,6 +424,74 @@ main( printf("-> %f %f %f\n",pcsout[0], pcsout[1], pcsout[2]); } + 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); } } diff --git a/profile/kodak2ti3.c b/profile/kodak2ti3.c old mode 100644 new mode 100755 index 53278e1..b510719 --- 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 old mode 100644 new mode 100755 diff --git a/profile/mppcheck.c b/profile/mppcheck.c old mode 100644 new mode 100755 index 0fcfbb7..6615a84 --- 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 old mode 100644 new mode 100755 index 74d3a71..41fe2fc --- 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 old mode 100644 new mode 100755 index 38ceb9b..9bbcb41 --- 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 old mode 100644 new mode 100755 index 098c03f..013fbd6 --- 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 old mode 100644 new mode 100755 index 32cddad..8c2fc60 --- 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 old mode 100644 new mode 100755 index 98cad65..4db596c --- 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 old mode 100644 new mode 100755 index 790ffa4..1a6f4ae --- 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 old mode 100644 new mode 100755 diff --git a/profile/splitti3.c b/profile/splitti3.c old mode 100644 new mode 100755 index a48c6fa..eb92938 --- 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 old mode 100644 new mode 100755 index c1d9ed0..28f5071 --- 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); } } -- cgit v1.2.3