From a0442ed58dee48a521ea053083ea967894507898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 11 Jul 2018 22:19:56 +0200 Subject: New upstream version 2.0.1+repack --- spectro/ccxxmake.c | 16 ++--- spectro/chartread.c | 15 +++-- spectro/colorhug.c | 12 +++- spectro/conv.c | 3 + spectro/dispcal.c | 32 ++++++---- spectro/dispread.c | 10 +-- spectro/dispsup.c | 46 +++++++------- spectro/dispsup.h | 18 +++--- spectro/disptechs.c | 2 +- spectro/dispwin.c | 4 ++ spectro/ex1.c | 2 +- spectro/i1d3.c | 6 +- spectro/i1d3.h | 20 +++--- spectro/i1pro_imp.c | 171 +++++++++++++++++++++++++++++++++++++-------------- spectro/i1pro_imp.h | 37 ++++++++++- spectro/icoms.c | 10 +++ spectro/icoms.h | 3 + spectro/icoms_nt.c | 11 ++++ spectro/illumread.c | 6 +- spectro/inst.c | 59 ++++++++++++------ spectro/inst.h | 6 +- spectro/instappsup.c | 30 ++++++++- spectro/instappsup.h | 5 +- spectro/instlib.ksh | 1 + spectro/kleink10.c | 21 +++++-- spectro/linear.cal | 2 +- spectro/munki_imp.c | 4 +- spectro/sa_conv.h | 4 ++ spectro/spec2cie.c | 129 +++++++++++++++++++++++++------------- spectro/specbos.c | 64 +++++++++++++------ spectro/specbos.h | 4 +- spectro/spotread.c | 100 ++++++++++++++++++++---------- spectro/spyd2.c | 2 +- spectro/ss.c | 5 +- spectro/ss_imp.c | 34 ++++++---- spectro/strange.cal | 2 +- spectro/vtpglut.c | 10 +++ spectro/xrga.c | 15 ++--- 38 files changed, 639 insertions(+), 282 deletions(-) (limited to 'spectro') diff --git a/spectro/ccxxmake.c b/spectro/ccxxmake.c index 4d8c057..a982107 100755 --- a/spectro/ccxxmake.c +++ b/spectro/ccxxmake.c @@ -228,8 +228,8 @@ int main(int argc, char *argv[]) { int comno = COMPORT; /* COM port used */ flow_control fc = fc_nc; /* Default flow control */ int highres = 0; /* High res mode if available */ - int dtype = 0; /* Display kind, 0 = default, 1 = CRT, 2 = LCD, etc */ - int sdtype = -1; /* Spectro display kind, -1 = use dtype */ + int ditype = 0; /* Display kind selector, 0 = default */ + int sditype = -1; /* Spectro display kind, -1 = use ditype */ int refrmode = -1; /* Refresh mode */ double refrate = 0.0; /* 0.0 = default, > 0.0 = override refresh rate */ int cbid = 0; /* Calibration base display mode ID */ @@ -411,7 +411,9 @@ int main(int argc, char *argv[]) { } else if (argv[fa][1] == 'y') { fa = nfa; if (na == NULL) usage(0,"Parameter expected after -y"); - dtype = na[0]; + ditype = na[0]; + if (ditype == '_' && na[1] != '\000') + ditype = ditype << 8 | na[1]; /* For ccss, set a default */ if (na[0] == 'r') { @@ -424,7 +426,7 @@ int main(int argc, char *argv[]) { } else if (argv[fa][1] == 'z') { fa = nfa; if (na == NULL) usage(0,"Parameter expected after -z"); - sdtype = na[0]; + sditype = na[0]; /* Test patch offset and size */ } else if (argv[fa][1] == 'P') { @@ -884,7 +886,7 @@ int main(int argc, char *argv[]) { } /* Create a spectral conversion object */ - if ((sp2cie = new_xsp2cie(icxIT_none, NULL, obType, custObserver, icSigXYZData, icxClamp)) == NULL) + if ((sp2cie = new_xsp2cie(icxIT_none, 0.0, NULL, obType, custObserver, icSigXYZData, icxClamp)) == NULL) error("Creation of spectral conversion object failed"); for (i = 0; i < npat; i++) { @@ -1260,7 +1262,7 @@ int main(int argc, char *argv[]) { /* Should we use current cal rather than native ??? */ if ((dr = new_disprd(&errc, icmps->get_path(icmps, comno), - fc, dtype, sdtype, 1, tele, nadaptive, + fc, ditype, sditype, 1, tele, nadaptive, noinitcal, 0, highres, refrate, 3, NULL, NULL, NULL, 0, disp, 0, fullscreen, override, webdisp, ccid, @@ -1318,7 +1320,7 @@ int main(int argc, char *argv[]) { if (spec) { /* Create a spectral conversion object */ - if ((sp2cie = new_xsp2cie(icxIT_none, NULL, obType, custObserver, icSigXYZData, icxClamp)) == NULL) + if ((sp2cie = new_xsp2cie(icxIT_none, 0.0, NULL, obType, custObserver, icSigXYZData, icxClamp)) == NULL) error("Creation of spectral conversion object failed"); } for (i = 0; i < npat; i++) { /* For all grid points */ diff --git a/spectro/chartread.c b/spectro/chartread.c index 6a9db39..14ee129 100755 --- a/spectro/chartread.c +++ b/spectro/chartread.c @@ -256,7 +256,7 @@ int trans, /* Use transmission mode */ int emis, /* Use emissive mode */ int displ, /* 1 = Use display emissive mode, 2 = display bright rel. */ /* 3 = display white rel. */ -int dtype, /* Display type selection charater */ +int ditype, /* Display type selection charater */ inst_opt_filter fe, /* Optional filter */ xcalstd scalstd, /* X-Rite calibration standard to set */ xcalstd *ucalstd, /* X-Rite calibration standard actually used */ @@ -398,11 +398,11 @@ a1log *log /* verb, debug & error log */ } /* Set display type or calibration mode */ - if (dtype != 0) { + if (ditype != 0) { if (cap2 & inst2_disptype) { int ix; - if ((ix = inst_get_disptype_index(it, dtype, 0)) < 0) { + if ((ix = inst_get_disptype_index(it, ditype, 0)) < 0) { printf("Setting display type ix %d failed\n",ix); it->del(it); return -1; @@ -2188,7 +2188,7 @@ int main(int argc, char *argv[]) { int emis = 0; /* Use emissive mode */ int displ = 0; /* 1 = Use display emissive mode, 2 = display bright rel. */ /* 3 = display white rel. */ - int dtype = 0; /* Display type selection charater */ + int ditype = 0; /* Display type selection charater(s) */ inst_opt_filter fe = inst_opt_filter_unknown; int pbypatch = 0; /* Read patch by patch */ int disbidi = 0; /* Disable bi-directional strip recognition */ @@ -2383,7 +2383,10 @@ int main(int argc, char *argv[]) { } else if (argv[fa][1] == 'y') { fa = nfa; if (na == NULL) usage(); - dtype = na[0]; + ditype = na[0]; + if (ditype == '_' && na[1] != '\000') + ditype = ditype << 8 | na[1]; + /* Request patch by patch measurement */ } else if (argv[fa][1] == 'p') { @@ -2998,7 +3001,7 @@ int main(int argc, char *argv[]) { /* Read all of the strips in */ if (read_strips(itype, scols, &atype, npat, totpa, stipa, pis, paix, saix, ixord, rstart, rand, hex, ipath, fc, plen, glen, tlen, - trans, emis, displ, dtype, fe, scalstd, &ucalstd, nocal, disbidi, highres, + trans, emis, displ, ditype, fe, scalstd, &ucalstd, nocal, disbidi, highres, ccxxname, obType, custObserver, scan_tol, pbypatch, xtern, spectral, uvmode, accurate_expd, emit_warnings, doplot, g_log) == 0) { diff --git a/spectro/colorhug.c b/spectro/colorhug.c index aa8ba21..e09362c 100755 --- a/spectro/colorhug.c +++ b/spectro/colorhug.c @@ -435,6 +435,7 @@ static inst_code colorhug_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { int se; colorhug *p = (colorhug *) pp; + icomuflags usbflags = icomuf_none; a1logd(p->log, 2, "colorhug_init_coms: About to init coms\n"); @@ -444,7 +445,7 @@ colorhug_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { a1logd(p->log, 3, "colorhug_init_coms: About to init HID\n"); /* Set config, interface */ - if ((se = p->icom->set_hid_port(p->icom, icomuf_none, 0, NULL)) != ICOM_OK) { + if ((se = p->icom->set_hid_port(p->icom, usbflags, 0, NULL)) != ICOM_OK) { a1logd(p->log, 1, "colorhug_init_coms: set_hid_port failed ICOM err 0x%x\n",se); return colorhug_interp_code((inst *)p, icoms2colorhug_err(se)); } @@ -453,9 +454,16 @@ colorhug_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { a1logd(p->log, 3, "colorhug_init_coms: About to init USB\n"); +#if defined(UNIX_X11) + usbflags |= icomuf_detach; + /* Some Linux drivers can't open the device a second time, so */ + /* use the reset on close workaround. */ + usbflags |= icomuf_reset_before_close; +#endif + /* Set config, interface, write end point, read end point */ // ~~ does Linux need icomuf_reset_before_close ? Why ? - if ((se = p->icom->set_usb_port(p->icom, 1, 0x00, 0x00, icomuf_detach, 0, NULL)) + if ((se = p->icom->set_usb_port(p->icom, 1, 0x00, 0x00, usbflags, 0, NULL)) != ICOM_OK) { a1logd(p->log, 1, "colorhug_init_coms: set_usb_port failed ICOM err 0x%x\n",se); return colorhug_interp_code((inst *)p, icoms2colorhug_err(se)); diff --git a/spectro/conv.c b/spectro/conv.c index a728566..92556ec 100755 --- a/spectro/conv.c +++ b/spectro/conv.c @@ -697,6 +697,9 @@ static int delayed_beep(void *pp) { # endif #else /* UNIX */ /* Linux is pretty lame in this regard... */ + /* Maybe we could write an 8Khz 8 bit sample to /dev/dsp, or /dev/audio ? */ + /* The ALSA system is the modern way for audio output. */ + /* Also check out what sox does: */ fprintf(stdout, "\a"); fflush(stdout); #endif return 0; diff --git a/spectro/dispcal.c b/spectro/dispcal.c index a4798af..10f333b 100755 --- a/spectro/dispcal.c +++ b/spectro/dispcal.c @@ -1684,7 +1684,7 @@ int main(int argc, char *argv[]) { icompaths *icmps = NULL; icompath *ipath = NULL; flow_control fc = fc_nc; /* Default flow control */ - int dtype = 0; /* Display type selection charater */ + int ditype = 0; /* Display type selection charater(s) */ int tele = 0; /* nz if telephoto mode */ int nocal = 0; /* Disable auto calibration */ int noplace = 0; /* Disable initial user placement check */ @@ -2121,7 +2121,9 @@ int main(int argc, char *argv[]) { } else if (argv[fa][1] == 'y') { fa = nfa; if (na == NULL) usage(0,"Parameter expected after -y"); - dtype = na[0]; + ditype = na[0]; + if (ditype == '_' && na[1] != '\000') + ditype = ditype << 8 | na[1]; /* Daylight color temperature */ } else if (argv[fa][1] == 't' || argv[fa][1] == 'T') { @@ -2342,7 +2344,7 @@ int main(int argc, char *argv[]) { } if (docalib) { - if ((rv = disprd_calibration(ipath, fc, dtype, -1, 0, tele, nadaptive, nocal, disp, + if ((rv = disprd_calibration(ipath, fc, ditype, -1, 0, tele, nadaptive, nocal, disp, webdisp, ccid, #ifdef NT madvrdisp, @@ -2384,7 +2386,7 @@ int main(int argc, char *argv[]) { native = 0; /* But measure current calibrated & CM response for verify or report calibrated */ /* Get ready to do some readings */ - if ((dr = new_disprd(&errc, ipath, fc, dtype, -1, 0, tele, nadaptive, nocal, noplace, + if ((dr = new_disprd(&errc, ipath, fc, ditype, -1, 0, tele, nadaptive, nocal, noplace, highres, refrate, native, &noramdac, &nocm, NULL, 0, disp, out_tvenc, fullscreen, override, webdisp, ccid, #ifdef NT @@ -2677,14 +2679,15 @@ int main(int argc, char *argv[]) { /* Read in the setup, user and model values */ - if (dtype == 0) { /* If the use hasn't set anything */ + if (ditype == 0) { /* If the use hasn't set anything */ if ((fi = icg->find_kword(icg, 0, "DEVICE_TYPE")) >= 0) { if (strcmp(icg->t[0].kdata[fi], "CRT") == 0) - dtype = 'c'; + ditype = 'c'; else if (strcmp(icg->t[0].kdata[fi], "LCD") == 0) - dtype = 'l'; - else - dtype = icg->t[0].kdata[fi][0]; + ditype = 'l'; + else { + ditype = icg->t[0].kdata[fi][0]; // Hmm. not handling '_' ... + } } } //printf("~1 dealt with device type\n"); @@ -3024,8 +3027,8 @@ int main(int argc, char *argv[]) { if (out_tvenc) printf("Using TV encoding range of (16-235)/255\n"); - if (dtype > 0) - printf("Display type is '%c'\n",dtype); + if (ditype > 0) + printf("Display type is '%s'\n",inst_distr(ditype)); if (doupdate) { if (x.nat) @@ -5269,8 +5272,11 @@ int main(int argc, char *argv[]) { ocg->add_kword(ocg, 0, "TV_OUTPUT_ENCODING",out_tvenc ? "YES" : "NO", NULL); /* Put the target parameters in the CGATS file too */ - if (dtype != 0) { - sprintf(buf,"%c",dtype); + if (ditype != 0) { + if ((ditype & ~0xff) != 0) + sprintf(buf,"%c%c",((ditype >> 8) & 0xff), ditype & 0xff); + else + sprintf(buf,"%c",ditype); ocg->add_kword(ocg, 0, "DEVICE_TYPE", buf, NULL); } diff --git a/spectro/dispread.c b/spectro/dispread.c index 5e332cc..baa042e 100755 --- a/spectro/dispread.c +++ b/spectro/dispread.c @@ -242,7 +242,7 @@ int main(int argc, char *argv[]) { int nadaptive = 0; /* Use non-adaptive mode if available */ int bdrift = 0; /* Flag, nz for black drift compensation */ int wdrift = 0; /* Flag, nz for white drift compensation */ - int dtype = 0; /* Display type selection charater */ + int ditype = 0; /* Display type selection charater(s) */ int tele = 0; /* NZ if telephoto mode */ int noautocal = 0; /* Disable auto calibration */ int noplace = 0; /* Disable user instrument placement */ @@ -426,7 +426,9 @@ int main(int argc, char *argv[]) { } else if (argv[fa][1] == 'y') { fa = nfa; if (na == NULL) usage(0,"Parameter expected after -y"); - dtype = na[0]; + ditype = na[0]; + if (ditype == '_' && na[1] != '\000') + ditype = ditype << 8 | na[1]; /* Calibration file */ } else if (argv[fa][1] == 'k' @@ -701,7 +703,7 @@ int main(int argc, char *argv[]) { } if (docalib) { - if ((rv = disprd_calibration(ipath, fc, dtype, -1, 0, tele, nadaptive, noautocal, + if ((rv = disprd_calibration(ipath, fc, ditype, -1, 0, tele, nadaptive, noautocal, disp, webdisp, ccid, #ifdef NT madvrdisp, @@ -919,7 +921,7 @@ int main(int argc, char *argv[]) { cal[0][0] = -1.0; /* Not used */ } - if ((dr = new_disprd(&errc, ipath, fc, dtype, -1, 0, tele, nadaptive, noautocal, noplace, + if ((dr = new_disprd(&errc, ipath, fc, ditype, -1, 0, tele, nadaptive, noautocal, noplace, highres, refrate, native, &noramdac, &nocm, cal, ncal, disp, out_tvenc, fullscreen, override, webdisp, ccid, #ifdef NT diff --git a/spectro/dispsup.c b/spectro/dispsup.c index 21e847f..bbb4151 100755 --- a/spectro/dispsup.c +++ b/spectro/dispsup.c @@ -205,9 +205,9 @@ inst_code setup_display_calibrate( int disprd_calibration( icompath *ipath, /* Instrument path to open, &icomFakeDevice == fake */ flow_control fc, /* Serial flow control */ -int dtype, /* Display type selection character */ -int sdtype, /* Spectro dtype, use dtype if -1 */ -int docbid, /* NZ to only allow cbid dtypes */ +int ditype, /* Display type selection character(s) */ +int sditype, /* Spectro ditype, use ditype if -1 */ +int docbid, /* NZ to only allow cbid ditypes */ int tele, /* NZ for tele mode, falls back to spot mode */ int nadaptive, /* NZ for non-adaptive mode */ int noinitcal, /* NZ to disable initial instrument calibration */ @@ -326,16 +326,17 @@ a1log *log /* Verb, debug & error log */ p->capabilities(p, &cap, &cap2, &cap3); /* If this is a spectral instrument, and a different */ - /* spectral inst. dtype is supplied, then use it */ - if (IMODETST(cap, inst_mode_spectral) && sdtype >= 0) - dtype = sdtype; + /* spectral inst. ditype is supplied, then use it */ + if (IMODETST(cap, inst_mode_spectral) && sditype >= 0) + ditype = sditype; /* Set the display type or calibration mode */ - if (dtype != 0) { /* Given selection character */ + if (ditype != 0) { /* Given selection character */ if (cap2 & inst2_disptype) { int ix; - if ((ix = inst_get_disptype_index(p, dtype, docbid)) < 0) { - a1logd(log,1,"Display type selection '%c' is not valid for instrument\n",dtype); + if ((ix = inst_get_disptype_index(p, ditype, docbid)) < 0) { + a1logd(log,1,"Display type selection '%s' is not valid for instrument\n", + inst_distr(ditype)); p->del(p); return -1; } @@ -2156,7 +2157,7 @@ static int config_inst_displ(disprd *p) { inst2_capability cap2; inst3_capability cap3; inst_mode mode = 0; - int dtype = p->dtype; + int ditype = p->ditype; int rv; p->it->capabilities(p->it, &cap, &cap2, &cap3); @@ -2229,16 +2230,17 @@ static int config_inst_displ(disprd *p) { } /* If this is a spectral instrument, and a different */ - /* spectral inst. dtype is supplied, then use it */ - if (IMODETST(cap, inst_mode_spectral) && p->sdtype >= 0) - dtype = p->sdtype; + /* spectral inst. ditype is supplied, then use it */ + if (IMODETST(cap, inst_mode_spectral) && p->sditype >= 0) + ditype = p->sditype; /* Set the display type or calibration mode */ - if (dtype != 0) { + if (ditype != 0) { if (cap2 & inst2_disptype) { int ix; - if ((ix = inst_get_disptype_index(p->it, dtype, p->docbid)) < 0) { - a1logd(p->log,1,"Display type selection '%c' is not valid for instrument\n",dtype); + if ((ix = inst_get_disptype_index(p->it, ditype, p->docbid)) < 0) { + a1logd(p->log,1,"Display type selection '%s' is not valid for instrument\n", + inst_distr(ditype)); if (p->docbid) return 16; return 15; @@ -2356,9 +2358,9 @@ disprd *new_disprd( int *errc, /* Error code. May be NULL (could use log for this instead?) */ icompath *ipath, /* Instrument path to open, &icomFakeDevice == fake */ flow_control fc, /* Flow control */ -int dtype, /* Display type selection character */ -int sdtype, /* Spectro dtype, use dtype if -1 */ -int docbid, /* NZ to only allow cbid dtypes */ +int ditype, /* Display type selection character(s) */ +int sditype, /* Spectro ditype, use ditype if -1 */ +int docbid, /* NZ to only allow cbid ditypes */ int tele, /* NZ for tele mode. Falls back to display mode */ int nadaptive, /* NZ for non-adaptive mode */ int noinitcal, /* No initial instrument calibration */ @@ -2436,8 +2438,8 @@ a1log *log /* Verb, debug & error log */ p->custObserver = custObserver; p->bdrift = bdrift; p->wdrift = wdrift; - p->dtype = dtype; - p->sdtype = sdtype; + p->ditype = ditype; + p->sditype = sditype; p->docbid = docbid; p->refrmode = -1; /* Unknown */ p->cbid = 0; /* Unknown */ @@ -2568,7 +2570,7 @@ a1log *log /* Verb, debug & error log */ /* Create a spectral conversion object if needed */ if (p->spectral && p->obType != icxOT_none) { - if ((p->sp2cie = new_xsp2cie(icxIT_none, NULL, p->obType, custObserver, icSigXYZData, icxNoClamp)) + if ((p->sp2cie = new_xsp2cie(icxIT_none, 0.0, NULL, p->obType, custObserver, icSigXYZData, icxNoClamp)) == NULL) { a1logd(log,1,"new_disprd failed because creation of spectral conversion object failed\n"); p->del(p); diff --git a/spectro/dispsup.h b/spectro/dispsup.h index 07a66e2..3687979 100755 --- a/spectro/dispsup.h +++ b/spectro/dispsup.h @@ -49,9 +49,9 @@ inst_code setup_display_calibrate( int disprd_calibration( icompath *ipath, /* Instrument path to open, &icomFakeDevice == fake */ flow_control fc, /* Serial flow control */ -int dtype, /* Display type, 0 = unknown, 1 = CRT, 2 = LCD */ -int sdtype, /* Spectro dtype, use dtype if -1 */ -int docbid, /* NZ to only allow cbid dtypes */ +int ditype, /* Display type selection character(s) */ +int sditype, /* Spectro ditype, use ditype if -1 */ +int docbid, /* NZ to only allow cbid ditypes */ int tele, /* NZ for tele mode */ int nadaptive, /* NZ for non-adaptive mode */ int noinitcal, /* NZ to disable initial instrument calibration */ @@ -116,9 +116,9 @@ struct _disprd { baud_rate br; flow_control fc; inst *it; /* Instrument */ - int dtype; /* Display type, 0 = unknown, 1 = CRT, 2 = LCD */ - int sdtype; /* Spectro dtype */ - int docbid; /* NZ to only allow cbid dtypes */ + int ditype; /* Display type selection character(s) */ + int sditype; /* Spectro ditype */ + int docbid; /* NZ to only allow cbid ditypes */ int refrmode; /* Refresh display mode, -1 if unknow, 0 = if no, 1 if yes */ int cbid; /* The current Calibration Base display mode ID, 0 if unknown */ int tele; /* NZ for tele mode */ @@ -229,9 +229,9 @@ disprd *new_disprd( int *errc, /* Error code. May be NULL */ icompath *ipath, /* Instrument path to open, &icomFakeDevice == fake */ flow_control fc, /* Serial flow control */ -int dtype, /* Display type, 0 = unknown, 1 = CRT, 2 = LCD */ -int sdtype, /* Spectro dtype, use dtype if -1 */ -int docbid, /* NZ to only allow cbid dtypes */ +int ditype, /* Display type selection character(s) */ +int sditype, /* Spectro ditype, use ditype if -1 */ +int docbid, /* NZ to only allow cbid ditypes */ int tele, /* NZ for tele mode */ int nadaptive, /* NZ for non-adaptive mode */ int noinitcal, /* No initial instrument calibration */ diff --git a/spectro/disptechs.c b/spectro/disptechs.c index bade777..dc38480 100755 --- a/spectro/disptechs.c +++ b/spectro/disptechs.c @@ -330,7 +330,7 @@ static disptech_info disptech_info_array[] = { }; -static int unknown_ix = -1; +static int unknown_ix = -1; /* Set to actual index by find_unknown() */ static void find_unknown() { int i; diff --git a/spectro/dispwin.c b/spectro/dispwin.c index 7761db1..9261592 100755 --- a/spectro/dispwin.c +++ b/spectro/dispwin.c @@ -1754,6 +1754,8 @@ static char *cur_profile(dispwin *p) { /* Return a CMProfileRef/ColorSyncProfileRef for the */ /* displays profile. Return NULL on error */ +/* Could use CGDisplayCopyColorSpace() instead of */ +/* cur_profile_url/ColorSyncProfileCreateWithURL for 10.5 + ? */ static void *cur_colorsync_ref(dispwin *p) { void *cspr = NULL; @@ -3853,6 +3855,8 @@ static void create_my_win(void *cntx) { #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 /* Get the ColorSync profile for this display */ + /* Could use CGDisplayCopyColorSpace() instead of */ + /* cur_colorsync_ref() code for 10.5 + ? */ if ((cspr = cur_colorsync_ref(p)) == NULL) { debugr2((errout,"cur_colorsync_ref failed\n")); diff --git a/spectro/ex1.c b/spectro/ex1.c index 929af3d..ee417dd 100755 --- a/spectro/ex1.c +++ b/spectro/ex1.c @@ -382,7 +382,7 @@ ex1_init_inst(inst *pp) { } #endif /* NEVER */ - p->conv = new_xsp2cie(icxIT_none, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, icxNoClamp); + p->conv = new_xsp2cie(icxIT_none, 0.0, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, icxNoClamp); if (p->conv == NULL) return EX1_INT_CIECONVFAIL; diff --git a/spectro/i1d3.c b/spectro/i1d3.c index 7e5c396..c822324 100755 --- a/spectro/i1d3.c +++ b/spectro/i1d3.c @@ -2205,7 +2205,7 @@ i1d3_comp_calmat( sampRGB = dmatrix(0, nsamp-1, 0, 3-1); /* Compute XYZ of the sample array */ - if ((conv = new_xsp2cie(icxIT_none, NULL, obType, custObserver, icSigXYZData, icxClamp)) == NULL) + if ((conv = new_xsp2cie(icxIT_none, 0.0, NULL, obType, custObserver, icSigXYZData, icxClamp)) == NULL) return i1d3_interp_code((inst *)p, I1D3_INT_CIECONVFAIL); for (i = 0; i < nsamp; i++) { conv->convert(conv, sampXYZ[i], &samples[i]); @@ -2213,7 +2213,7 @@ i1d3_comp_calmat( conv->del(conv); /* Compute sensor RGB of the sample array */ - if ((conv = new_xsp2cie(icxIT_none, NULL, icxOT_custom, RGBcmfs, icSigXYZData, icxClamp)) == NULL) { + if ((conv = new_xsp2cie(icxIT_none, 0.0, NULL, icxOT_custom, RGBcmfs, icSigXYZData, icxClamp)) == NULL) { free_dmatrix(sampXYZ, 0, nsamp-1, 0, 3-1); free_dmatrix(sampRGB, 0, nsamp-1, 0, 3-1); return i1d3_interp_code((inst *)p, I1D3_INT_CIECONVFAIL); @@ -2880,7 +2880,7 @@ double mtx[3][3] i1d3 *p = (i1d3 *)pp; inst_code ev = inst_ok; - a1logd(p->log, 4, "i1d3_col_cor_mat%s\n",mtx == NULL ? " (noop)": ""); + a1logd(p->log, 4, "i1d3_col_cor_mat%s dtech %d cbid %d\n",mtx == NULL ? " (noop)": "",dtech,cbid); if (!p->gotcoms) return inst_no_coms; diff --git a/spectro/i1d3.h b/spectro/i1d3.h index 6152a00..c8f72df 100755 --- a/spectro/i1d3.h +++ b/spectro/i1d3.h @@ -81,16 +81,20 @@ /* Sub-type of instrument */ typedef enum { - i1d3_disppro = 0, /* i1 DisplayPro */ - i1d3_munkdisp = 1, /* ColorMunki Display */ - i1d3_oem = 2, /* Generic OEM */ - i1d3_nec_ssp = 3, /* NEC SpectraSensor Pro */ - i1d3_quato_sh3 = 4, /* Quato Silver Haze 3 */ - i1d3_hp_dreamc = 5, /* HP DreameColor */ - i1d3_sc_c6 = 6, /* SpectraCal C6 */ - i1d3_wacom_dc = 7 /* Wacom DC */ + i1d3_disppro = 0, /* i1 DisplayPro */ + i1d3_munkdisp = 1, /* ColorMunki Display */ + i1d3_oem = 2, /* Generic OEM */ + i1d3_nec_ssp = 3, /* NEC SpectraSensor Pro */ + i1d3_quato_sh3 = 4, /* Quato Silver Haze 3 */ + i1d3_hp_dreamc = 5, /* HP DreameColor */ + i1d3_sc_c6 = 6, /* SpectraCal C6 */ + i1d3_wacom_dc = 7, /* Wacom DC */ } i1d3_dtype; +/* Generic OEM aliases: + i1d3_viewsonic_xri1 +*/ + /* Measurement mode */ typedef enum { i1d3_adaptive = 0, /* Frequency over fixed period then adaptive period measurement (def) */ diff --git a/spectro/i1pro_imp.c b/spectro/i1pro_imp.c index 03f0a0d..cd870fa 100755 --- a/spectro/i1pro_imp.c +++ b/spectro/i1pro_imp.c @@ -582,25 +582,33 @@ i1pro_code i1pro_imp_init(i1pro *p) { /* Information about the instrument */ - if ((ip = m->data->get_ints(m->data, &count, key_serno)) == NULL || count < 1) + if ((ip = m->data->get_ints(m->data, &count, key_serno)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_serno\n"); return I1PRO_HW_CALIBINFO; + } m->serno = ip[0]; a1logd(p->log,2,"Serial number = %d\n",m->serno); sprintf(m->sserno,"%ud",m->serno); - if ((ip = m->data->get_ints(m->data, &count, key_dom)) == NULL || count < 1) + if ((ip = m->data->get_ints(m->data, &count, key_dom)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_dom\n"); return I1PRO_HW_CALIBINFO; + } m->dom = ip[0]; a1logd(p->log,2, "Date of manufactur = %d-%d-%d\n", m->dom/1000000, (m->dom/10000) % 100, m->dom % 10000); - if ((ip = m->data->get_ints(m->data, &count, key_cpldrev)) == NULL || count < 1) + if ((ip = m->data->get_ints(m->data, &count, key_cpldrev)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_cpldrev\n"); return I1PRO_HW_CALIBINFO; + } m->cpldrev = ip[0]; a1logd(p->log,2,"CPLD rev = %d\n",m->cpldrev); - if ((ip = m->data->get_ints(m->data, &count, key_capabilities)) == NULL || count < 1) + if ((ip = m->data->get_ints(m->data, &count, key_capabilities)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_capabilities\n"); return I1PRO_HW_CALIBINFO; + } m->capabilities = ip[0]; if (m->capabilities & 0x6000) /* Has ambient */ m->capabilities2 |= I1PRO_CAP2_AMBIENT; /* Mimic in capabilities2 */ @@ -608,8 +616,10 @@ i1pro_code i1pro_imp_init(i1pro *p) { if (m->capabilities & 0x6000) a1logd(p->log,2," Can read ambient\n"); - if ((ip = m->data->get_ints(m->data, &count, key_physfilt)) == NULL || count < 1) + if ((ip = m->data->get_ints(m->data, &count, key_physfilt)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_physfilt\n"); return I1PRO_HW_CALIBINFO; + } m->physfilt = ip[0]; if (m->physfilt == 0x82) m->capabilities2 |= I1PRO_CAP2_UV_FILT; /* Mimic in cap 2 */ @@ -639,10 +649,14 @@ i1pro_code i1pro_imp_init(i1pro *p) { if (m->nsen > NSEN_MAX) /* Static allocation assumed */ return I1PRO_HW_UNEX_SPECPARMS; } - if (m->data->get_ints(m->data, &m->nwav[0], key_mtx_index) == 0) + if (m->data->get_ints(m->data, &m->nwav[0], key_mtx_index) == 0) { + a1logd(p->log,7,"Missing key_mtx_index\n"); return I1PRO_HW_CALIBINFO; - if (m->nwav[0] != 36) + } + if (m->nwav[0] != 36) { + a1logd(p->log,7,"key_mtx_index != 36 elements\n"); return I1PRO_HW_CALIBINFO; + } m->wl_short[0] = 380.0; /* Normal res. range */ m->wl_long[0] = 730.0; @@ -651,18 +665,24 @@ i1pro_code i1pro_imp_init(i1pro *p) { m->wl_long[1] = HIGHRES_LONG; m->nwav[1] = (int)((m->wl_long[1]-m->wl_short[1])/HIGHRES_WIDTH + 0.5) + 1; - if ((dp = m->data->get_doubles(m->data, &count, key_hg_factor)) == NULL || count < 1) + if ((dp = m->data->get_doubles(m->data, &count, key_hg_factor)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_hg_factor\n"); return I1PRO_HW_CALIBINFO; + } m->highgain = dp[0]; a1logd(p->log,2,"High gain = %.10f\n",m->highgain); if ((m->lin0 = m->data->get_doubles(m->data, &m->nlin0, key_ng_lin)) == NULL - || m->nlin0 < 1) + || m->nlin0 < 1) { + a1logd(p->log,7,"Missing key_ng_lin\n"); return I1PRO_HW_CALIBINFO; + } if ((m->lin1 = m->data->get_doubles(m->data, &m->nlin1, key_hg_lin)) == NULL - || m->nlin1 < 1) + || m->nlin1 < 1) { + a1logd(p->log,7,"Missing key_hg_lin\n"); return I1PRO_HW_CALIBINFO; + } if (p->log->debug >= 2) { char oline[200] = { '\000' }, *bp = oline; @@ -681,8 +701,10 @@ i1pro_code i1pro_imp_init(i1pro *p) { a1logd(p->log,2,oline); } - if ((dp = m->data->get_doubles(m->data, &count, key_min_int_time)) == NULL || count < 1) + if ((dp = m->data->get_doubles(m->data, &count, key_min_int_time)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_min_int_time\n"); return I1PRO_HW_CALIBINFO; + } m->min_int_time = dp[0]; /* And then override it */ @@ -695,62 +717,84 @@ i1pro_code i1pro_imp_init(i1pro *p) { m->min_int_time = 0.00884; /* == 1 sub clock */ } - if ((dp = m->data->get_doubles(m->data, &count, key_max_int_time)) == NULL || count < 1) + if ((dp = m->data->get_doubles(m->data, &count, key_max_int_time)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_max_int_time\n"); return I1PRO_HW_CALIBINFO; + } m->max_int_time = dp[0]; if ((m->mtx_o.index = m->data->get_ints(m->data, &count, key_mtx_index)) == NULL - || count != m->nwav[0]) + || count != m->nwav[0]) { + a1logd(p->log,7,"Missing key_mtx_index\n"); return I1PRO_HW_CALIBINFO; + } if ((m->mtx_o.nocoef = m->data->get_ints(m->data, &count, key_mtx_nocoef)) == NULL - || count != m->nwav[0]) + || count != m->nwav[0]) { + a1logd(p->log,7,"Missing key_mtx_nocoef\n"); return I1PRO_HW_CALIBINFO; + } for (xcount = i = 0; i < m->nwav[0]; i++) /* Count number expected in matrix coeffs */ xcount += m->mtx_o.nocoef[i]; if ((m->mtx_o.coef = m->data->get_doubles(m->data, &count, key_mtx_coef)) == NULL - || count != xcount) + || count != xcount) { + a1logd(p->log,7,"Missing key_mtx_coef\n"); return I1PRO_HW_CALIBINFO; + } if ((m->white_ref[0] = m->data->get_doubles(m->data, &count, key_white_ref)) == NULL - || count != m->nwav[0]) { - if (p->dtype != instI1Monitor) + || count != m->nwav[0]) { + if (p->dtype != instI1Monitor) { + a1logd(p->log,7,"Missing key_white_ref\n"); return I1PRO_HW_CALIBINFO; + } m->white_ref[0] = NULL; } if ((m->emis_coef[0] = m->data->get_doubles(m->data, &count, key_emis_coef)) == NULL - || count != m->nwav[0]) + || count != m->nwav[0]) { + a1logd(p->log,7,"Missing key_emis_coef\n"); return I1PRO_HW_CALIBINFO; + } if ((m->amb_coef[0] = m->data->get_doubles(m->data, &count, key_amb_coef)) == NULL - || count != m->nwav[0]) { + || count != m->nwav[0]) { if (p->dtype != instI1Monitor - && m->capabilities & 0x6000) /* Expect ambient calibration */ + && m->capabilities & 0x6000) { /* Expect ambient calibration */ + a1logd(p->log,7,"Missing key_amb_coef\n"); return I1PRO_HW_CALIBINFO; + } m->amb_coef[0] = NULL; } /* Default to original EEProm raw to wav filters values*/ m->mtx[0][0] = m->mtx_o; /* Std res reflective */ m->mtx[0][1] = m->mtx_o; /* Std res emissive */ - if ((ip = m->data->get_ints(m->data, &count, key_sens_target)) == NULL || count < 1) + if ((ip = m->data->get_ints(m->data, &count, key_sens_target)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_sens_target\n"); return I1PRO_HW_CALIBINFO; + } m->sens_target = ip[0]; - if ((ip = m->data->get_ints(m->data, &count, key_sens_dark)) == NULL || count < 1) + if ((ip = m->data->get_ints(m->data, &count, key_sens_dark)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_sens_dark\n"); return I1PRO_HW_CALIBINFO; + } m->sens_dark = ip[0]; - if ((ip = m->data->get_ints(m->data, &count, key_ng_sens_sat)) == NULL || count < 1) + if ((ip = m->data->get_ints(m->data, &count, key_ng_sens_sat)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_ng_sens_sat\n"); return I1PRO_HW_CALIBINFO; + } m->sens_sat0 = ip[0]; - if ((ip = m->data->get_ints(m->data, &count, key_hg_sens_sat)) == NULL || count < 1) + if ((ip = m->data->get_ints(m->data, &count, key_hg_sens_sat)) == NULL || count < 1) { + a1logd(p->log,7,"Missing key_hg_sens_sat\n"); return I1PRO_HW_CALIBINFO; + } m->sens_sat1 = ip[0]; a1logd(p->log,2,"sens_target %d, sens_dark %d, sens_sat0 %d, sens_sat1 %d\n", @@ -809,8 +853,10 @@ i1pro_code i1pro_imp_init(i1pro *p) { /* Capability bits */ if ((ip = m->data->get_ints(m->data, &count, key2_capabilities)) == NULL - || count != 1) + || count != 1) { + a1logd(p->log,7,"Missing key2_capabilities\n"); return I1PRO_HW_CALIBINFO; + } m->capabilities2 = *ip; if (p->log->debug >= 2) { a1logd(p->log,2,"Capabilities2 flag = 0x%x\n",m->capabilities2); @@ -831,64 +877,94 @@ i1pro_code i1pro_imp_init(i1pro *p) { if (m->capabilities2 & I1PRO_CAP2_WL_LED) { /* wavelength LED calibration integration time (0.56660) */ if ((dp = m->data->get_doubles(m->data, &count, key2_wlcal_intt)) == NULL - || count != 1) + || count != 1) { + a1logd(p->log,7,"Missing key2_wlcal_intt\n"); return I1PRO_HW_CALIBINFO; + } m->wl_cal_inttime = *dp; /* Wavelength calibration minimum level */ if ((ip = m->data->get_ints(m->data, &count, key2_wlcal_minlev)) == NULL - || count != 1) + || count != 1) { + a1logd(p->log,7,"Missing key2_wlcal_minlev\n"); return I1PRO_HW_CALIBINFO; + } /* Normalize it to 1.0 seconds (ie. 500/0.56660) */ m->wl_cal_min_level = (double)(*ip) / m->wl_cal_inttime; /* wavelength LED measurement expected FWHM in nm */ if ((dp = m->data->get_doubles(m->data, &count, key2_wlcal_fwhm)) == NULL - || count != 1) + || count != 1) { + a1logd(p->log,7,"Missing key2_wlcal_fwhm\n"); return I1PRO_HW_CALIBINFO; + } m->wl_cal_fwhm = *dp; /* wavelength LED measurement FWHM tollerance in nm */ if ((dp = m->data->get_doubles(m->data, &count, key2_wlcal_fwhm_tol)) == NULL - || count != 1) + || count != 1) { + a1logd(p->log,7,"Missing key2_wlcal_fwhm_tol\n"); return I1PRO_HW_CALIBINFO; + } m->wl_cal_fwhm_tol = *dp; /* wavelength LED reference spectrum */ - if ((m->wl_led_spec = m->data->get_doubles(m->data, &m->wl_led_count, key2_wlcal_spec)) == NULL) + if ((m->wl_led_spec = m->data->get_doubles(m->data, &m->wl_led_count, + key2_wlcal_spec)) == NULL) { + a1logd(p->log,7,"Missing key2_wlcal_spec\n"); return I1PRO_HW_CALIBINFO; + } /* wavelength LED spectraum reference offset */ if ((ip = m->data->get_ints(m->data, &count, key2_wlcal_ooff)) == NULL - || count != 1) + || count != 1) { + a1logd(p->log,7,"Missing key2_wlcal_ooff\n"); return I1PRO_HW_CALIBINFO; + } m->wl_led_ref_off = *ip; /* Hmm. this is odd, but it doesn't work correctly otherwise... */ m->wl_led_ref_off--; /* wavelength calibration maximum error */ if ((dp = m->data->get_doubles(m->data, &count, key2_wlcal_max)) == NULL - || count != 1) + || count != 1) { + a1logd(p->log,7,"Missing key2_wlcal_max\n"); return I1PRO_HW_CALIBINFO; + } m->wl_err_max = *dp; } - /* CCD bin to wavelength polinomial */ - if ((m->wlpoly1 = m->data->get_doubles(m->data, &count, key2_wlpoly_1)) == NULL || count != 4) + /* CCD bin to wavelength polinomial (Emission) */ + if ((m->wlpoly2 = m->data->get_doubles(m->data, &count, key2_wlpoly_2)) == NULL + || count != 4) { + a1logd(p->log,7,"Missing key2_wlpoly_2\n"); return I1PRO_HW_CALIBINFO; + } - if ((m->wlpoly2 = m->data->get_doubles(m->data, &count, key2_wlpoly_2)) == NULL || count != 4) - return I1PRO_HW_CALIBINFO; + /* CCD bin to wavelength polinomial (Reflection) */ + if ((m->wlpoly1 = m->data->get_doubles(m->data, &count, key2_wlpoly_1)) == NULL || count != 4) { + /* Hmm. no key2_wlpoly_1. This seems to be the case for */ + /* some stripped down OEM instruments. Use key2_wlpoly_2 instead */ + if ((m->wlpoly2 = m->data->get_doubles(m->data, &count, key2_wlpoly_2)) == NULL + || count != 4) { + a1logd(p->log,7,"Missing key2_wlpoly_1 and key2_wlpoly_2\n"); + return I1PRO_HW_CALIBINFO; + } + } /* Stray light compensation. Note that 16 bit numbers are signed. */ if ((sip = m->data->get_shorts(m->data, &count, key2_straylight)) == NULL - || count != (36 * 36)) + || count != (36 * 36)) { + a1logd(p->log,7,"Missing key2_straylight\n"); return I1PRO_HW_CALIBINFO; + } /* stray light scale factor */ if ((dp = m->data->get_doubles(m->data, &count, key2_straylight_scale)) == NULL - || count != 1) + || count != 1) { + a1logd(p->log,7,"Missing key2_straylight_scale\n"); return I1PRO_HW_CALIBINFO; + } /* Convert from ints to floats */ m->straylight[0] = dmatrixz(0, 35, 0, 35); @@ -1060,6 +1136,7 @@ i1pro_code i1pro_imp_init(i1pro *p) { s->scan = 1; s->adaptive = 1; s->inttime = m->min_int_time; /* Maximize scan rate */ + /* (see i1pro_imp_calibrate() too) */ s->dark_int_time = s->inttime; if (m->fwrev >= 301) /* (We're not using scan targoscale though) */ s->targoscale = 0.25; @@ -1127,6 +1204,7 @@ i1pro_code i1pro_imp_init(i1pro *p) { s->scan = 1; s->adaptive = 1; /* ???? */ s->inttime = m->min_int_time; /* Maximize scan rate */ + /* (see i1pro_imp_calibrate() too) */ s->lamptime = 0.0; s->dark_int_time = s->inttime; if (m->fwrev >= 301) @@ -1223,6 +1301,7 @@ i1pro_code i1pro_imp_init(i1pro *p) { s->scan = 1; s->adaptive = 0; s->inttime = m->min_int_time; /* Maximize scan rate */ + /* (see i1pro_imp_calibrate() too) */ s->dark_int_time = s->inttime; if (m->fwrev >= 301) /* (We're not using scan targoscale though) */ s->targoscale = 0.25; @@ -10175,9 +10254,9 @@ i1pro_code i1pro_conv2XYZ( double sms; /* Weighting */ if (s->emiss) - conv = new_xsp2cie(icxIT_none, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, (icxClamping)clamp); + conv = new_xsp2cie(icxIT_none, 0.0, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, (icxClamping)clamp); else - conv = new_xsp2cie(icxIT_D50, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, (icxClamping)clamp); + conv = new_xsp2cie(icxIT_D50, 0.0, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, (icxClamping)clamp); if (conv == NULL) return I1PRO_INT_CIECONVFAIL; @@ -10325,16 +10404,16 @@ i1pro_code i1pro_check_white_reference1( /* And check them against tolerance for the illuminant. */ if (m->physfilt == 0x82) { /* UV filter */ - a1logd(p->log,2,"Checking white reference (UV): 0.0 < avg01 %f < 0.05, 1.2 < avg2227 %f < 1.76\n",avg01,avg2227); - if (0.0 < avg01 && avg01 < 0.05 - && 1.2 < avg2227 && avg2227 < 1.76) { + a1logd(p->log,2,"Checking white reference (UV): 0.0 <= avg01 %f <= 0.05, 1.2 <= avg2227 %f <= 1.76\n",avg01,avg2227); + if (0.0 <= avg01 && avg01 <= 0.05 + && 1.2 <= avg2227 && avg2227 <= 1.76) { return I1PRO_OK; } } else { /* No filter */ - a1logd(p->log,2,"Checking white reference: 0.11 < avg01 %f < 0.22, 1.35 < avg2227 %f < 1.6\n",avg01,avg2227); - if (0.11 < avg01 && avg01 < 0.22 - && 1.35 < avg2227 && avg2227 < 1.6) { + a1logd(p->log,2,"Checking white reference: 0.11 <= avg01 %f <= 0.22, 1.35 <= avg2227 %f <= 1.6\n",avg01,avg2227); + if (0.11 <= avg01 && avg01 <= 0.22 + && 1.35 <= avg2227 && avg2227 <= 1.6) { return I1PRO_OK; } } diff --git a/spectro/i1pro_imp.h b/spectro/i1pro_imp.h index 582cc98..00cf52d 100755 --- a/spectro/i1pro_imp.h +++ b/spectro/i1pro_imp.h @@ -248,7 +248,7 @@ struct _i1proimp { /* 0x81 == emission only ?? */ /* 0x82 == UV filter */ int capabilities2; /* Rev E capabilities - set #defines above */ - /* Also set for RevA-D */ + /* Also set for RevA-D to simplify capability testing */ /* Underlying calibration information */ int nsen; /* Raw + extra sample bands read = 128 for i1pro, 136 for Rev E */ @@ -1290,14 +1290,45 @@ typedef enum { key2_wlcal_max = 0x2f46, /* double, wavelength calibration error limit, ie. 5.0 */ - key2_wlpoly_1 = 0x2f62, /* double[4], CCD bin to wavelength polinomial #1 (normal) */ - key2_wlpoly_2 = 0x2f63, /* double[4], CCD bin to wavelength polinomial #2 ??? */ + key2_wlpoly_1 = 0x2f62, /* double[4], CCD bin to wavelength polinomial #1 (reflective ?) */ + key2_wlpoly_2 = 0x2f63, /* double[4], CCD bin to wavelength polinomial #2 (emissive ?) */ key2_straylight = 0x2f58, /* int16[36][6] signed stray light values */ key2_straylight_scale = 0x2f59 /* double stray light scale factor */ } i1key; +/* + +Missing keys for Stripped down OEM i1pro2 (Capabilities2 flag = 0x30) +i.e. missing Ambient, WL Led, UV Led, Zebra ruller, + has indicator Leds, UV filter. + +Table entry 34 is Key 0x0bba, type 3 addr 0x1c4c, size 4 Unkn + +Table entry 5 is Key 0x2eea, type 3 addr 0x2218, size 4 Unkn +Table entry 6 is Key 0x2eeb, type 3 addr 0x221c, size 4 key2_sens_target +Table entry 9 is Key 0x2ef5, type 4 addr 0x2228, size 4 Unkn +Table entry 10 is Key 0x2ef6, type 4 addr 0x222c, size 4 Unkn +Table entry 11 is Key 0x2ef9, type 4 addr 0x2230, size 4 key2_uvcal_intt +Table entry 12 is Key 0x2efa, type 4 addr 0x2234, size 4 key2_wlcal_intt +Table entry 13 is Key 0x2efe, type 3 addr 0x2238, size 4 key2_wlcal_minlev +Table entry 14 is Key 0x2eff, type 3 addr 0x223c, size 4 Unkn +Table entry 21 is Key 0x2f44, type 4 addr 0x2258, size 200 key2_wlcal_spec +Table entry 22 is Key 0x2f45, type 3 addr 0x2320, size 4 key2_wlcal_ooff +Table entry 23 is Key 0x2f46, type 4 addr 0x2324, size 4 key2_wlcal_max +Table entry 24 is Key 0x2f4e, type 4 addr 0x2328, size 4 key2_wlcal_fwhm +Table entry 25 is Key 0x2f4f, type 4 addr 0x232c, size 4 key2_wlcal_fwhm_tol +Table entry 26 is Key 0x2f50, type 4 addr 0x2330, size 4 Unkn +Table entry 29 is Key 0x2f62, type 4 addr 0x2d58, size 16 key2_wlpoly_1 +Table entry 31 is Key 0x2f6c, type 4 addr 0x2d78, size 8 Unkn +Table entry 32 is Key 0x2f6d, type 4 addr 0x2d80, size 4 Unkn +Table entry 33 is Key 0x2f6e, type 4 addr 0x2d84, size 4 Unkn +Table entry 34 is Key 0x2f76, type 4 addr 0x2d88, size 72 Unkn +Table entry 35 is Key 0x2f77, type 4 addr 0x2dd0, size 72 Unkn + +*/ + /* Data type */ typedef enum { diff --git a/spectro/icoms.c b/spectro/icoms.c index 875f3b6..08ddd92 100755 --- a/spectro/icoms.c +++ b/spectro/icoms.c @@ -760,8 +760,12 @@ int frbw /* nz to Flush Read Before Write */ int debug = p->log->debug; int bread; + p->ser_clearerr(p); + if (debug < 8) p->log->debug = 0; + /* (Could use tcflush() or ioctl(TCFLSH) on *nix, */ + /* except these don't work on USB serial ports!) */ for (;;) { bread = 0; p->read(p, tbuf, 500, &bread, NULL, 500, 0.02); @@ -813,6 +817,11 @@ double tout /* Timeout for write and then read (i.e. max = 2 x tout) */ return icoms_write_read_ex(p, wbuf, nwch, rbuf, bsize, bread, tc, ntc, tout, 0); } +/* Default NOP implementation - Serial open or set_methods may override */ +static void icoms_ser_clearerr(icoms *p) { + return; +} + /* Optional callback to client from device */ /* Default implementation is a NOOP */ static int icoms_interrupt(icoms *p, @@ -907,6 +916,7 @@ icoms *new_icoms( p->read = NULL; p->write_read = icoms_write_read; p->write_read_ex = icoms_write_read_ex; + p->ser_clearerr = icoms_ser_clearerr; /* Default NOP implementation */ p->interrupt = icoms_interrupt; p->del = icoms_del; diff --git a/spectro/icoms.h b/spectro/icoms.h index 4e18b62..74af2ee 100755 --- a/spectro/icoms.h +++ b/spectro/icoms.h @@ -515,6 +515,9 @@ struct _icoms { double tout, /* Timeout in seconds */ int frbw); /* nz to Flush Read Before Write */ + /* For serial device, clear any errors */ + void (*ser_clearerr)(struct _icoms *p); + /* For a USB device, do a control message */ /* return icom error */ int (*usb_control)(struct _icoms *p, diff --git a/spectro/icoms_nt.c b/spectro/icoms_nt.c index 39ff6f0..7ac074b 100755 --- a/spectro/icoms_nt.c +++ b/spectro/icoms_nt.c @@ -163,6 +163,16 @@ void serial_close_port(icoms *p) { } } +/* Clear any serial errors */ +static void nt_ser_clearerr(icoms *p) { + DWORD errs; + + if (!ClearCommError(p->phandle, &errs,NULL)) + error("nt_ser_clearerr: failed, and Clear error failed"); + + return; +} + /* -------------------------------------------------------------------- */ #ifndef CBR_230400 @@ -428,6 +438,7 @@ int delayms) { /* Delay after open in msec */ p->write = icoms_ser_write; p->read = icoms_ser_read; + p->ser_clearerr = nt_ser_clearerr; } a1logd(p->log, 8, "icoms_set_ser_port: port characteristics set ok\n"); diff --git a/spectro/illumread.c b/spectro/illumread.c index 28ecbca..aee546c 100755 --- a/spectro/illumread.c +++ b/spectro/illumread.c @@ -1063,14 +1063,14 @@ int main(int argc, char *argv[]) bf.r_sp = &r_sp; bf.p_sp = &p_sp; - if ((bf.pap = new_xsp2cie(icxIT_custom, &i_sp, icxOT_CIE_1931_2, NULL, icSigLabData, icxClamp)) == NULL) + if ((bf.pap = new_xsp2cie(icxIT_custom, 0.0, &i_sp, icxOT_CIE_1931_2, NULL, icSigLabData, icxClamp)) == NULL) error("new_xsp2cie pap failed"); if (bf.pap->set_fwa(bf.pap, &insp, NULL, &p_sp) != 0) error ("Setting FWA compensation failed"); /* Setup the equal energy to Lab conversion */ - if ((bf.ref = new_xsp2cie(icxIT_E, NULL, icxOT_CIE_1931_2, NULL, icSigLabData, icxClamp)) == NULL) + if ((bf.ref = new_xsp2cie(icxIT_E, 0.0, NULL, icxOT_CIE_1931_2, NULL, icSigLabData, icxClamp)) == NULL) error("new_xsp2cie ref failed"); /* Estimate an initial gain match */ @@ -1154,7 +1154,7 @@ int main(int argc, char *argv[]) xspect cpdsp; /* FWA corrected calculated daylight paper reflectance */ /* Setup the referencec comversion */ - if ((cf.ref = new_xsp2cie(icxIT_E, NULL, icxOT_CIE_1931_2, NULL, icSigLabData, icxClamp)) == NULL) + if ((cf.ref = new_xsp2cie(icxIT_E, 0.0, NULL, icxOT_CIE_1931_2, NULL, icSigLabData, icxClamp)) == NULL) error("new_xsp2cie ref failed"); cf.ill = bf.ill; diff --git a/spectro/inst.c b/spectro/inst.c index 07ace6e..7f1368a 100755 --- a/spectro/inst.c +++ b/spectro/inst.c @@ -41,11 +41,11 @@ #ifndef SALONEINSTLIB #include "copyright.h" #include "aconfig.h" +#include "rand.h" #else #include "sa_config.h" #endif /* !SALONEINSTLIB */ #include "numsup.h" -#include "rand.h" #include "cgats.h" #include "xspect.h" #include "conv.h" @@ -881,6 +881,12 @@ static inst_disptypesel *expand_dlist(inst_disptypesel *list, int nlist, int *na than any aliases that come after it, and the aliases as more important than the fallback list, so we need to do three passes through all the selections. + + If we run out of single letter selectors (i.e. K10), + then we switch to the two letter prefixed selector "_X". + + NOTE that we assume that we cannot exaust the single letter + selectors via hard coded, ccmx or ccss calibrations. */ /* Create the display type list */ @@ -892,8 +898,8 @@ int doccss, /* Add installed ccss files */ int doccmx /* Add matching installed ccmx files */ ) { inst_disptypesel *list = NULL; - int i, j, k, nlist = 0, nalist = 0; - char usels[256]; /* Used selectors */ + int i, j, k, k2, nlist = 0, nalist = 0; + char usels[256]; /* Used selectors 1 */ static char *asels = "123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; int fail = 0; @@ -902,8 +908,9 @@ int doccmx /* Add matching installed ccmx files */ *pdtlist = NULL; *pndtlist = 0; - for (i = 0; i < 256; i++) - usels[i] = ((char)-1); + for (j = 0; j < 256; j++) + usels[j] = ((char)-1); + k2 = 0; /* Single letter selector */ k = 0; /* Next selector index */ /* First create a list of calibrations and their desired selectors: */ @@ -1031,26 +1038,42 @@ int doccmx /* Add matching installed ccmx files */ /* Set remaining from fallback */ for (i = 0; i < nlist; i++) { - disptechs_set_sel(2, i, list[i].sel, list[i].isel, usels, &k, asels); - if (list[i].sel[0] == '\000') - fail = 1; + if (k2 == 0) { /* Single letter selector */ + disptechs_set_sel(2, i, list[i].sel, list[i].isel, usels, &k, asels); + if (list[i].sel[0] == '\000') { /* Switch to two letter */ + for (j = 0; j < 256; j++) + usels[j] = ((char)-1); + k2 = 1; /* Two letter selector */ + k = 0; /* Next selector index */ + } + } + if (k2 == 1) { /* Two letter selector */ + list[i].sel[0] = '_'; + disptechs_set_sel(2, i, &list[i].sel[1], list[i].isel, usels, &k, asels); + if (list[i].sel[0] == '\000') { /* Ran out of two letter selectors! */ + fail = 1; + break; + } + } } /* Any calibrations that failed to find a character will be left as a nul string */ /* Add alternate selectors if they are free. */ - for (;;) { - int more = 0; - for (i = 0; i < nlist; i++) { - /* Add unused secondaries */ - disptechs_set_sel(3, i, list[i].sel, list[i].isel, usels, &k, asels); - - if (list[i].isel[0] != '\000') { /* Still more secondaries available */ - more = 1; + if (k2 == 0) { /* If not run out of 1 letter selectors */ + for (;;) { + int more = 0; + for (i = 0; i < nlist; i++) { + /* Add unused secondaries */ + disptechs_set_sel(3, i, list[i].sel, list[i].isel, usels, &k, asels); + + if (list[i].isel[0] != '\000') { /* Still more secondaries available */ + more = 1; + } } + if (!more) + break; } - if (!more) - break; } if (pndtlist != NULL) diff --git a/spectro/inst.h b/spectro/inst.h index 04e02d6..601f7b3 100755 --- a/spectro/inst.h +++ b/spectro/inst.h @@ -43,8 +43,8 @@ and agreed to support. */ -#include "dev.h" /* Base device class */ #include "insttypes.h" /* libinst Includes this functionality */ +#include "dev.h" /* Base device class */ #include "disptechs.h" /* libinst Includes this functionality */ #include "icoms.h" /* libinst Includes this functionality */ #include "conv.h" @@ -69,6 +69,10 @@ #ifdef NEVER /* Declared in xicc/xspect.h */ +// ~~~ should add absorbance mode - +// i.e. modified transmissive mode where units are +// log10(incident/transmitted) = Beer-Lambert Law + /* Type of measurement result */ typedef enum { /* XYZ units, Spectral units */ inst_mrt_none = 0, /* Not set */ diff --git a/spectro/instappsup.c b/spectro/instappsup.c index 6c3dd68..0cb5798 100755 --- a/spectro/instappsup.c +++ b/spectro/instappsup.c @@ -479,6 +479,7 @@ inst2_capability inst_show_disptype_options(FILE *fp, char *oline, icompaths *ic if (docbib && sels[j].cbid == 0) continue; /* Skip non cbid type */ + /* Break up selector chars/pairs with '|' */ m = pstart; for (k = 0; k < (INST_DTYPE_SEL_LEN-1); k++) { if (sels[j].sel[k] == '\000') @@ -486,6 +487,8 @@ inst2_capability inst_show_disptype_options(FILE *fp, char *oline, icompaths *ic if (m > pstart) buf[m++] = '|'; buf[m++] = sels[j].sel[k]; + if (sels[j].sel[k] == '_') + buf[m++] = sels[j].sel[++k]; } while (m < (olen+1)) /* Indent it by 1 */ buf[m++] = ' '; @@ -534,8 +537,9 @@ inst2_capability inst_show_disptype_options(FILE *fp, char *oline, icompaths *ic /* A helper function to turn a -y flag into a selection index */ /* If docbib is nz, then only allow base calibration display types */ +/* c will be 16 bits ('_' + 'X') if a 2 char selector */ /* Return -1 on error */ -int inst_get_disptype_index(inst *it, int c, int docbib) { +int inst_get_disptype_index(inst *it, int ditype, int docbib) { inst2_capability cap; int j, k; @@ -555,7 +559,14 @@ int inst_get_disptype_index(inst *it, int c, int docbib) { for (k = 0; k < (INST_DTYPE_SEL_LEN-1); k++) { if (sels[j].sel[k] == '\000') break; - if (sels[j].sel[k] == c) { + if (sels[j].sel[k] == '_') { /* 2 char selector */ + k++; + if (sels[j].sel[k-1] == (0xff & (ditype >> 8)) + && sels[j].sel[k] == (0xff & ditype)) { + return j; + } + } + if (sels[j].sel[k] == ditype) { return j; } } @@ -564,6 +575,21 @@ int inst_get_disptype_index(inst *it, int c, int docbib) { return -1; } +/* Return a static string of the ditype flag char(s) */ +char *inst_distr(int ditype) { + static char buf[5]; + + if ((ditype >> 8) & 0xff) { + buf[0] = (ditype >> 8) & 0xff; + buf[1] = ditype & 0xff; + buf[2] = '\000'; + } else { + buf[0] = ditype; + buf[1] = '\000'; + } + + return buf; +} /* ================================================================= */ diff --git a/spectro/instappsup.h b/spectro/instappsup.h index 8da4325..c5b95fc 100755 --- a/spectro/instappsup.h +++ b/spectro/instappsup.h @@ -91,7 +91,10 @@ inst2_capability inst_show_disptype_options(FILE *fp, char *oline, icompaths *ic /* A helper function to turn a -y flag into a list index */ /* If docbib is nz, then only allow base calibration display types */ /* Return 0 on error */ -int inst_get_disptype_index(inst *it, int c, int docbib); +int inst_get_disptype_index(inst *it, int ditype, int docbib); + +/* Return a static string of the ditype flag char(s) */ +char *inst_distr(int ditype); #ifdef __cplusplus } diff --git a/spectro/instlib.ksh b/spectro/instlib.ksh index 8b0303f..47243e4 100755 --- a/spectro/instlib.ksh +++ b/spectro/instlib.ksh @@ -57,6 +57,7 @@ SPECTRO_FILES=" hidio.h hidio.c icoms.h + dev.h inst.h inst.c insttypes.c diff --git a/spectro/kleink10.c b/spectro/kleink10.c index d169156..6b057ff 100755 --- a/spectro/kleink10.c +++ b/spectro/kleink10.c @@ -2,7 +2,7 @@ /* * Argyll Color Correction System * - * JETI kleink10 1211/1201 related functions + * Klein K10 related functions * * Author: Graeme W. Gill * Date: 29/4/2014 @@ -68,6 +68,7 @@ #undef PLOT_REFRESH /* [und] Plot refresh rate measurement info */ #undef PLOT_UPDELAY /* [und] Plot update delay measurement info */ +#undef TEST_FAKE_CALIBS /* Fake having a full calibration set (98 calibs) */ #undef TEST_BAUD_CHANGE /* Torture test baud rate change on non high speed K10 */ static inst_disptypesel k10_disptypesel[98]; @@ -216,7 +217,7 @@ int nd /* nz to disable debug messages */ strncpy((char *)cmd, (char *)in, 2); cmd[2] = '\000'; - if ((se = p->icom->write_read(p->icom, in, 0, out, bsize, &bread, NULL, nchar, to)) + if ((se = p->icom->write_read_ex(p->icom, in, 0, out, bsize, &bread, NULL, nchar, to, 1)) != ICOM_OK) { rv = icoms2k10_err(se); @@ -331,7 +332,7 @@ struct _kleink10 *p, baud_rate br ) { int se, rv = K10_OK; - if ((se = p->icom->set_ser_port(p->icom, fc_HardwareDTR, br, parity_none, + if ((se = p->icom->set_ser_port(p->icom, fc_None, br, parity_none, stop_1, length_8)) != ICOM_OK) { rv = icoms2k10_err(se); } else { @@ -388,7 +389,7 @@ k10_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { } a1logd(p->log, 5, "k10_init_coms: Trying %s baud, %d msec to go\n", baud_rate_to_str(brt[i]), etime- msec_time()); - if ((se = p->icom->set_ser_port(p->icom, fc_HardwareDTR, brt[i], parity_none, + if ((se = p->icom->set_ser_port(p->icom, fc_None, brt[i], parity_none, stop_1, length_8)) != ICOM_OK) { amutex_unlock(p->lock); a1logd(p->log, 5, "k10_init_coms: set_ser_port failed with 0x%x\n",se); @@ -872,8 +873,16 @@ kleink10 *p) { name[j] = buf[i + j]; if (((unsigned char *)name)[0] == 0xff) { +#ifdef TEST_FAKE_CALIBS + #pragma message("!!!!!!!!!!!!!!! Klein K10 TEST_FULL_CALIB set !!!!!!!!!!!!!!!!!!!") + sprintf(name, "Fake_%d",ix); +#else + //printf("Cal %d is 0xff - skipping\n",ix); continue; +#endif } + + /* Remove trailing spaces */ for (j = 19; j >= 0; j--) { if (name[j] != ' ') { name[j+1] = '\000'; @@ -881,7 +890,7 @@ kleink10 *p) { } } -// printf("Adding Cal %d is '%s'\n",ix,name); + // printf("Adding Cal %d is '%s'\n",ix,name); /* Add it to the list */ memset((void *)&k10_disptypesel[n], 0, sizeof(inst_disptypesel)); @@ -974,7 +983,7 @@ int usefast /* If nz use fast rate is possible */ #ifdef HIGH_SPEED /* This isn't reliable, because there is no way to ensure that */ /* the T1 command has been sent before we change the baud rate, */ - /* anf if we wait too long will will loose the measurements. */ + /* and if we wait too long we will loose the measurements. */ if (usefast && strcmp(p->firm_ver, "v01.09fh") > 0) { isnew = 1; /* We can use faster T1 command */ rate = 384; diff --git a/spectro/linear.cal b/spectro/linear.cal index 1dafbde..64b2392 100755 --- a/spectro/linear.cal +++ b/spectro/linear.cal @@ -2,7 +2,7 @@ CAL DESCRIPTOR "Argyll Device Calibration Curves" ORIGINATOR "Argyll synthcal" -CREATED "Fri Nov 17 01:11:11 2017" +CREATED "Mon Jul 09 03:30:52 2018" DEVICE_CLASS "DISPLAY" COLOR_REP "RGB" diff --git a/spectro/munki_imp.c b/spectro/munki_imp.c index d8690e8..f95140b 100755 --- a/spectro/munki_imp.c +++ b/spectro/munki_imp.c @@ -7886,9 +7886,9 @@ munki_code munki_conv2XYZ( double sms; /* Weighting */ if (s->emiss) - conv = new_xsp2cie(icxIT_none, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, (icxClamping)clamp); + conv = new_xsp2cie(icxIT_none, 0.0, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, (icxClamping)clamp); else - conv = new_xsp2cie(icxIT_D50, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, (icxClamping)clamp); + conv = new_xsp2cie(icxIT_D50, 0.0, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, (icxClamping)clamp); if (conv == NULL) return MUNKI_INT_CIECONVFAIL; diff --git a/spectro/sa_conv.h b/spectro/sa_conv.h index 0f7e635..0d4718d 100755 --- a/spectro/sa_conv.h +++ b/spectro/sa_conv.h @@ -191,6 +191,10 @@ void sa_Yxy2XYZ(double *out, double *in); #define icmLab2XYZ sa_Lab2XYZ #define icmYxy2XYZ sa_Yxy2XYZ +/* Lpt isn't used by instlib, so dummy it out */ +#define icmXYZ2Lpt sa_XYZ2Lab +#define icmLpt2XYZ sa_Lab2XYZ + /* A helper object that computes MD5 checksums */ struct _sa_MD5 { /* Private: */ diff --git a/spectro/spec2cie.c b/spectro/spec2cie.c index 6c56e67..fd40c51 100755 --- a/spectro/spec2cie.c +++ b/spectro/spec2cie.c @@ -53,7 +53,7 @@ This is intended for conversion of reflective measurements to XYZ - there is no illuminant for emissive values. - L*a*b* is always D50. + L*a*b* is always D50, since it is intended for ICC profile construction. */ @@ -133,10 +133,10 @@ main(int argc, char *argv[]) int ci, mi, yi, ki; /* Indexes of device values */ int fwacomp = 0; /* FWA compensation */ int doplot = 0; /* Plot each patches spectrum */ - char* illum_str = "D50"; icxIllumeType tillum = icxIT_none; /* Target/simulated instrument illuminant, if set. */ xspect cust_tillum, *tillump = NULL; /* Custom target/simulated illumination spectrum */ /* if tillum == icxIT_custom */ + char* illum_str = "D50"; icxIllumeType illum = icxIT_none; /* CIE calc. illuminant spectrum, and FWA inst. */ /* illuminant if tillum not set. */ xspect cust_illum; /* Custom CIE illumination spectrum if illum == icxIT_custom */ @@ -149,6 +149,8 @@ main(int argc, char *argv[]) icxObserverType obType = icxOT_none; xspect custObserver[3]; /* Custom observer CMF's */ + icmXYZNumber ill_wp_XYZ; /* if ill_wp != NULL, same as ill_wp */ + int npat; /* Number of patches */ int ti; /* Field index */ char *kw; @@ -654,10 +656,11 @@ main(int argc, char *argv[]) int Xi, Yi, Zi, Li, ai, bi; /* CGATS indexes for each field */ int spi[XSPECT_MAX_BANDS]; /* CGATS indexes for each wavelength */ int oXi, oYi, oZi, oLi, oai, obi; /* CGATS indexes for each ouput field */ + int oL2i, oa2i, ob2i; /* For illuminant wp L*a*b* output */ xsp2cie *sp2cie; /* Spectral conversion object */ xspect sp; double XYZ[3]; - double Lab[3]; + double Lab[3], Lab2[3]; char buf[100]; /* These are only set if fwa is needed */ xspect rmwsp; /* Raw medium white spectrum */ @@ -710,6 +713,17 @@ main(int argc, char *argv[]) } + /* If CIE calculation illuminant is not standard, compute it's white point */ + if (illum != icxIT_D50 && illum != icxIT_none) { + ill_wp = _ill_wp; + + /* Compute normalised XYZ of illuminant */ + if (icx_ill_sp2XYZ(ill_wp, obType, custObserver, illum, 0.0, &cust_illum, 0) != 0) + error("icx_ill_sp2XYZ returned error"); + + icmAry2XYZ(ill_wp_XYZ, ill_wp); + } + /* copy fields to output file (except spectral if nospec) */ for (i = 0; i < icg->t[0].nfields; i++) { @@ -758,27 +772,51 @@ main(int argc, char *argv[]) oai = ai; obi = bi; - /* allocate elements */ + /* If non-standard illuminant is being used, add extra LAB fields */ + /* to show illuminant relative values (Not used for profiling!) */ + if (ill_wp != NULL) { + char buf[50] = { '\000' }, *cp; - if ((elems = (cgats_set_elem *) - calloc(ocg->t[0].nfields, sizeof(cgats_set_elem))) == NULL) - { - error("Out of memory"); - } + strncpy(buf, illum_str, 40); - /* If CIE calculation illuminant is not standard, compute it's white point */ - if (illum != icxIT_D50 && illum != icxIT_none) { - ill_wp = _ill_wp; + /* Replace spaces */ + for (cp = buf; *cp != '\000'; cp++) { + if (*cp == ' ') + *cp = '_'; + } + /* Remove extension */ + for (; cp >= buf; cp--) { + if (*cp == '.') { + *cp = '\000'; + break; + } + } + strcat(buf, "LAB"); + cp = buf + strlen(buf); + cp[0] = '_'; - /* Compute normalised XYZ of illuminant */ - if (icx_ill_sp2XYZ(ill_wp, obType, custObserver, illum, 0.0, &cust_illum, 0) != 0) - error("icx_ill_sp2XYZ returned error"); + cp[1] = 'L'; + if ((oL2i = ocg->add_field(ocg, 0, buf, r_t)) < 0) + error ("Cannot add field to table"); + + cp[1] = 'A'; + if ((oa2i = ocg->add_field(ocg, 0, buf, r_t)) < 0) + error ("Cannot add field to table"); + + cp[1] = 'B'; + if ((ob2i = ocg->add_field(ocg, 0, buf, r_t)) < 0) + error ("Cannot add field to table"); + } + + /* allocate elements */ + if ((elems = (cgats_set_elem *) + calloc(ocg->t[0].nfields, sizeof(cgats_set_elem))) == NULL) { + error("Out of memory"); } /* Create a spectral conversion object */ - if ((sp2cie = new_xsp2cie(illum, &cust_illum, obType, custObserver, - icSigXYZData, icxClamp)) == NULL) - { + if ((sp2cie = new_xsp2cie(illum, 0.0, &cust_illum, obType, custObserver, + icSigXYZData, icxClamp)) == NULL) { error ("Creation of spectral conversion object failed"); } @@ -921,14 +959,15 @@ main(int argc, char *argv[]) ocg->add_kword(ocg, 0, "ILLUMINANT_WHITE_POINT_XYZ",buf, NULL); } - /* Transform patches from spectral to CIE */ + /* Transform patches from spectral to CIE, */ + /* after correcting the spectrum for possible XRGA and FWA. */ for (i = 0; i < npat; i++) { - xspect corr_sp; /* copy all input colums to output (except spectral if nospec) */ for (jj = j = 0; j < icg->t[0].nfields; j++) { if (nospec) { + /* See if this is a spectral field */ for (k = 0; nospec && k < sp.spec_n; k++) { if (spi[k] == j) @@ -963,39 +1002,27 @@ main(int argc, char *argv[]) } /* Read the spectral values for this patch */ - for (j = 0; j < sp.spec_n; j++) { + for (j = 0; j < sp.spec_n; j++) sp.spec[j] = *((double *)icg->t[0].fdata[i][spi[j]]); - } + if (calstdo != xcalstd_none) xspec_convert_xrga(&sp, &sp, calpol, calstdo, calstdi); + /* Convert it to CIE space */ if (fwacomp) { - corr_sp = sp; /* Copy spectrum */ - - /* Convert it to CIE space */ - sp2cie->sconvert (sp2cie, &corr_sp, XYZ, &sp); - - /* Write the corrected spectral values for this patch */ - if (nospec == 0) { - for (j = 0; j < sp.spec_n; j++) { - elems[spi[j]].d = sp.spec[j] = corr_sp.spec[j]; - } - } + sp2cie->sconvert(sp2cie, &sp, XYZ, &sp); + } else { + sp2cie->convert(sp2cie, XYZ, &sp); } - /* No FWA comp */ - else { - /* Convert it to CIE space */ - sp2cie->convert (sp2cie, XYZ, &sp); + /* Standard pseudo-absolute D50 ICC Lab */ + icmXYZ2Lab(&icmD50, Lab, XYZ); + /* Illuminant relative Lab */ + if (ill_wp != NULL) { + icmXYZ2Lab(&ill_wp_XYZ, Lab2, XYZ); } - /* Could use sp2cie->get_cie_il() to get CIE white point */ - /* if we wanted to return L*a*b* relative to that. */ - /* We would have to mark that in the .ti3 though. */ - /* This won't work for emmisive though, since get_cie_il() will return 'E' */ - icmXYZ2Lab(&icmD50, Lab, XYZ); - #ifdef ALLOW_PLOT if (doplot) { int ii; @@ -1018,14 +1045,28 @@ main(int argc, char *argv[]) do_plot(xx,y1,NULL,NULL,ii); } #endif + /* Write the corrected spectral values for this patch */ + if (nospec == 0 + && (calstdo != xcalstd_none || fwacomp)) { + for (j = 0; j < sp.spec_n; j++) { + elems[spi[j]].d = sp.spec[j]; + } + } + elems[oXi].d = XYZ[0] * 100.0; elems[oYi].d = XYZ[1] * 100.0; elems[oZi].d = XYZ[2] * 100.0; - + elems[oLi].d = Lab[0]; elems[oai].d = Lab[1]; elems[obi].d = Lab[2]; + if (ill_wp != NULL) { + elems[oL2i].d = Lab2[0]; + elems[oa2i].d = Lab2[1]; + elems[ob2i].d = Lab2[2]; + } + ocg->add_setarr(ocg, 0, elems); } diff --git a/spectro/specbos.c b/spectro/specbos.c index 136fb34..6d2d5c0 100755 --- a/spectro/specbos.c +++ b/spectro/specbos.c @@ -383,11 +383,9 @@ specbos_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { if (dispen) { p->model = 1511; - /* Set remote mode */ + /* Set remote mode (for old firmare) */ if ((ev = specbos_command(p, "*REMOTE 1\r", buf, MAX_MES_SIZE, 1.0)) != inst_ok) { - amutex_unlock(p->lock); - a1logd(p->log, 2, "specbos_init_coms: failed to set remote mode\n"); - return inst_protocol_error; + a1logd(p->log, 2, "specbos_init_coms: remote command failed (newer firmware ?)\n"); } } @@ -579,6 +577,9 @@ specbos_init_inst(inst *pp) { } } + /* Set target maximum measure time (no averaging) */ + /* (We will then setup instrument to compy with this target) */ + /* 3.6 is the assumed maximum fixed overhead */ p->measto = 20.0; /* Set default. Specbos default is 60.0 */ if (p->model == 1211) @@ -624,10 +625,11 @@ specbos_init_inst(inst *pp) { return ev; } #else /* Bound auto by no. averages (better - limit maxint to 1.0) */ - double dmaxtint = 1.0; /* Recommended maximum */ + double dmaxtint = 1.0; /* Recommended maximum is 1.0 */ int maxtint; int maxaver; /* Maximum averages for auto int time */ + /* Set the max integration time to 1.0 seconds: */ maxtint = (int)(dmaxtint * 1000.0+0.5); if (maxtint < 1000 || maxtint > 64999) { @@ -638,23 +640,24 @@ specbos_init_inst(inst *pp) { maxtint = 64999; } - /* Set maximum integration time */ sprintf(mes, "*para:maxtint %d\r", maxtint); if ((ev = specbos_command(p, mes, buf, MAX_MES_SIZE, 1.0)) != inst_ok) { amutex_unlock(p->lock); return ev; } + /* Then compute the maximum number of measurements to meet measto: */ + /* Total time = overhead + initial sample + 2 * int time per measure */ maxaver = (int)ceil((p->measto - 3.6)/(2.0 * dmaxtint)); - //printf("maxaver %d\n",maxaver); - if (maxaver < 2) { warning("specbos: assert, maxaver %d out of range",maxaver); maxaver = 2; } + a1logd(p->log, 6, "specbos_init_inst: set maxaver %d\n",maxaver); + /* Set maximum number of auto averages. Min value is 2 */ sprintf(mes, "*para:maxaver %d\r", maxaver); if ((ev = specbos_command(p, mes, buf, MAX_MES_SIZE, 1.0)) != inst_ok) { @@ -679,16 +682,25 @@ specbos_init_inst(inst *pp) { warning("specbos: assert, maxtint %d out of range",maxtin); if (maxtin < 1000) maxtin = 1000; - else if (maxtin > 64999) - maxtin = 64999; + else if (maxtin > 60000) /* 60 secs according to auxiliary doco. */ + maxtin = 60000; } - /* Set maximum integration time */ - /* (1201 *para:maxtint doesn't work !!) */ + /* Set maximum integration time that auto will use */ sprintf(mes, "*conf:maxtin %d\r", maxtin); if ((ev = specbos_command(p, mes, buf, MAX_MES_SIZE, 1.0)) != inst_ok) { - amutex_unlock(p->lock); - return ev; + /* 1201 Firmware V1.8.3 and earlier doesn't support maxtin. */ + /* Ignore error with a warning. */ + if (p->model == 1201) { + if (!p->maxtin_warn) + warning("specbos: conf:maxtin %d command failed (Old Firmware ?)",maxtin); + p->maxtin_warn = 1; + + /* Fatal error otherwise */ + } else { + amutex_unlock(p->lock); + return ev; + } } #ifdef NEVER /* Use default */ @@ -972,6 +984,7 @@ instClamping clamp) { /* NZ if clamp XYZ/Lab to be +ve */ int user_trig = 0; int pos = -1; inst_code rv = inst_protocol_error; + double measto = p->measto; if (!p->gotcoms) return inst_no_coms; @@ -1062,10 +1075,21 @@ instClamping clamp) { /* NZ if clamp XYZ/Lab to be +ve */ if ((rv = set_average(p, p->noaverage, 0)) != inst_ok) return rv; + /* Adjust timeout to account for averaging */ + /* (Allow extra 1 sec fudge factor per average) */ + if (p->noaverage > 1) { + measto = p->noaverage * (p->measto - 3.6 + 1.0) + 3.6; + a1logd(p->log, 6, " Adjusted measto to %f for noaver %d\n",measto,p->noaverage); + } + /* Set to average 10 readings for transmission */ } else if ((p->mode & inst_mode_illum_mask) == inst_mode_transmission) { if ((rv = set_average(p, DEFAULT_TRANS_NAV, 0)) != inst_ok) return rv; + + measto = DEFAULT_TRANS_NAV * (p->measto - 3.6 + 1.0) + 3.6; + a1logd(p->log, 6, " Adjusted measto to %f for noaver %d\n",measto,DEFAULT_TRANS_NAV); + /* Or default 1 otherwise */ } else { if ((rv = set_average(p, DEFAULT_NAV, 0)) != inst_ok) @@ -1080,12 +1104,12 @@ instClamping clamp) { /* NZ if clamp XYZ/Lab to be +ve */ } } - /* Trigger a measurement */ + /* Trigger a measurement (Allow 10 second timeout margine) */ /* (Note that ESC will abort it) */ if (p->model == 1501 || p->model == 1511) - ec = specbos_fcommand(p, "*meas:refer\r", buf, MAX_MES_SIZE, p->measto + 10.0 , 1, tmeas, 0); + ec = specbos_fcommand(p, "*meas:refer\r", buf, MAX_MES_SIZE, measto + 10.0 , 1, tmeas, 0); else - ec = specbos_fcommand(p, "*init\r", buf, MAX_MES_SIZE, p->measto + 10.0 , 1, tmeas, 0); + ec = specbos_fcommand(p, "*init\r", buf, MAX_MES_SIZE, measto + 10.0 , 1, tmeas, 0); // Test out bug workaround // if (!p->badCal) ec = SPECBOS_EXCEED_CAL_WL; @@ -1118,9 +1142,9 @@ instClamping clamp) { /* NZ if clamp XYZ/Lab to be +ve */ /* Try command again */ if (p->model == 1501 || p->model == 1511) - ec = specbos_fcommand(p, "*meas:refer\r", buf, MAX_MES_SIZE, p->measto + 10.0 , 1, tmeas, 0); + ec = specbos_fcommand(p, "*meas:refer\r", buf, MAX_MES_SIZE, measto + 10.0 , 1, tmeas, 0); else - ec = specbos_fcommand(p, "*init\r", buf, MAX_MES_SIZE, p->measto + 10.0 , 1, tmeas, 0); + ec = specbos_fcommand(p, "*init\r", buf, MAX_MES_SIZE, measto + 10.0 , 1, tmeas, 0); } /* Restore single reading if transmission */ @@ -1405,7 +1429,7 @@ instClamping clamp) { /* NZ if clamp XYZ/Lab to be +ve */ /* Convert to XYZ */ if (p->conv == NULL) { - p->conv = new_xsp2cie(icxIT_D50, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, + p->conv = new_xsp2cie(icxIT_D50, 0.0, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, icxNoClamp); if (p->conv == NULL) { a1logd(p->log, 1, "specbos_read_sample: Emulated transmission new_xsp2cie() failed"); diff --git a/spectro/specbos.h b/spectro/specbos.h index ef6fc2f..4ef4a88 100755 --- a/spectro/specbos.h +++ b/spectro/specbos.h @@ -150,7 +150,7 @@ struct _specbos { inst_opt_type trig; /* Reading trigger mode */ - double measto; /* Expected measurement timeout value */ + double measto; /* Measurement maximum time target value */ int nbands; /* Number of spectral bands */ double wl_short; double wl_long; @@ -169,6 +169,8 @@ struct _specbos { int dpos; /* Diffuser position, 0 = emissive, 1 = ambient */ int laser; /* Target laser state, nz = on */ + int maxtin_warn; /* NZ if conf:maxtin failure warning has been given */ + }; typedef struct _specbos specbos; /* Constructor */ diff --git a/spectro/spotread.c b/spectro/spotread.c index 16f6f2d..1b4189b 100755 --- a/spectro/spotread.c +++ b/spectro/spotread.c @@ -21,6 +21,8 @@ /* TTBD * + * Add option to automatically read continuously, until stopped. (A bit like -O) + * Make -V average the spectrum too (if present), and allow it to * be saved to a .sp file. * @@ -45,19 +47,19 @@ #include #include #ifndef SALONEINSTLIB -#include "copyright.h" -#include "aconfig.h" -#include "numlib.h" -#include "cgats.h" -#include "xicc.h" -#include "conv.h" -#include "plot.h" -#include "ui.h" +# include "copyright.h" +# include "aconfig.h" +# include "numlib.h" +# include "cgats.h" +# include "xicc.h" +# include "conv.h" +# include "plot.h" +# include "ui.h" #else /* SALONEINSTLIB */ -#include "sa_config.h" -#include "numsup.h" -#include "xspect.h" -#include "conv.h" +# include "sa_config.h" +# include "numsup.h" +# include "xspect.h" +# include "conv.h" #endif /* SALONEINSTLIB */ #include "inst.h" #include "icoms.h" @@ -252,7 +254,7 @@ static inst_code uicallback(void *cntx, inst_ui_purp purp) { ABCDEFGHIJKLMNOPQRSTUVWXYZ upper ... . . .. . .. ... - lower . .... .. . .. . .. + lower . .... .. . .. .... */ @@ -332,6 +334,9 @@ usage(char *diag, ...) { fprintf(stderr," u U.V. Cut\n"); fprintf(stderr," -E extrafilterfile Apply extra filter compensation file\n"); fprintf(stderr," -A N|A|X|G XRGA conversion (default N)\n"); +#ifndef SALONEINSTLIB + fprintf(stderr," -w Use -i param. illuminant for comuting L*a*b*\n"); +#endif fprintf(stderr," -x Display Yxy instead of Lab\n"); fprintf(stderr," -h Display LCh instead of Lab\n"); #ifndef SALONEINSTLIB @@ -413,7 +418,7 @@ int main(int argc, char *argv[]) { icompaths *icmps = NULL; int comport = COMPORT; /* COM port used */ icompath *ipath = NULL; - int dtype = 0; /* Display type selection charater */ + int ditype = 0; /* Display type selection character(s) */ inst_mode cap = inst_mode_none; /* Instrument mode capabilities */ inst2_capability cap2 = inst2_none; /* Instrument capabilities 2 */ inst3_capability cap3 = inst3_none; /* Instrument capabilities 3 */ @@ -430,7 +435,10 @@ int main(int argc, char *argv[]) { int illum_set = 0; /* User asked for custom illuminant spectrum */ icxIllumeType illum = icxIT_D50; /* Spectral defaults */ xspect cust_illum; /* Custom illumination spectrum */ - icxObserverType obType = icxOT_default; + int labwpillum = 0; /* nz to use illum WP for L*a*b* conversion */ + icmXYZNumber labwp = { icmD50_100.X, icmD50_100.Y, icmD50_100.Z }; /* Lab conversion wp */ + char labwpname[100] = "D50"; /* Name of Lab conversion wp */ + icxObserverType obType = icxOT_default; /* Default is 1931_2 */ xspect custObserver[3]; /* If obType = icxOT_custom */ xspect sp; /* Last spectrum read */ xspect rsp; /* Reference spectrum */ @@ -519,7 +527,9 @@ int main(int argc, char *argv[]) { } else if (argv[fa][1] == 'y') { fa = nfa; if (na == NULL) usage("Paramater expected following -y"); - dtype = na[0]; + ditype = na[0]; + if (ditype == '_' && na[1] != '\000') + ditype = ditype << 8 | na[1]; #ifndef SALONEINSTLIB /* Simulated instrument illumination (FWA) */ @@ -620,6 +630,12 @@ int main(int argc, char *argv[]) { usage("Unrecognised illuminant '%s'",na); #endif /* SALONEINSTLIB */ +#ifndef SALONEINSTLIB + /* Use -i illuminant for L*a*b* conversion */ + } else if (argv[fa][1] == 'w') { + labwpillum = 1; +#endif /* !SALONEINSTLIB */ + /* Spectral Observer type */ } else if (argv[fa][1] == 'Q') { fa = nfa; @@ -901,11 +917,29 @@ int main(int argc, char *argv[]) { } /* Check for some user mistakes */ - - if ((tillum_set || illum_set) && emiss) + if ((tillum_set || illum_set) && emiss ) warning("-I or -i parameter makes no sense with emissive or ambient measurement!"); + if (illum_set && labwpillum && emiss) { + warning("-w for emissive is ignored!"); + labwpillum = 0; + } + /* - - - - - - - - - - - - - - - - - - - */ + /* Setup Lab conversion wp if not D50 */ + if (illum_set && labwpillum && !emiss) { + double xyz[3]; + + strcpy(labwpname, standardIlluminant_name(illum, 0.0)); + + if (icx_ill_sp2XYZ(xyz, obType, custObserver, illum, 0.0, &cust_illum, 0)) + error("Looking up W.P. of illuminant failed"); + + icmScale3(xyz, xyz, 100.0); + icmAry2XYZ(labwp, xyz); + + } + if ((icmps = new_icompaths(g_log)) == NULL) error("Finding instrument paths failed"); if ((ipath = icmps->get_path(icmps, comport)) == NULL) @@ -1204,12 +1238,12 @@ int main(int argc, char *argv[]) { } /* Set displaytype or calibration mode */ - if (dtype != 0) { + if (ditype != 0) { if (cap2 & inst2_disptype) { int ix; - if ((ix = inst_get_disptype_index(it, dtype, 0)) < 0) { + if ((ix = inst_get_disptype_index(it, ditype, 0)) < 0) { it->del(it); - usage("Failed to locate display type matching '%c'",dtype); + usage("Failed to locate display type matching '%s'",inst_distr(ditype)); } if ((rv = it->set_disptype(it, ix)) != inst_ok) { @@ -1547,7 +1581,7 @@ int main(int argc, char *argv[]) { illum = icxIT_none; /* Create a spectral conversion object */ - if ((sp2cie = new_xsp2cie(illum, &cust_illum, obType, custObserver, icSigXYZData, + if ((sp2cie = new_xsp2cie(illum, 0.0, &cust_illum, obType, custObserver, icSigXYZData, refstats ? icxNoClamp : icxClamp)) == NULL) error("Creation of spectral conversion object failed"); @@ -1593,9 +1627,9 @@ int main(int argc, char *argv[]) { for (j = 0; j < 3; j++) rXYZ[j] *= 100.0; /* 0..100 scale */ } - icmXYZ2Lab(&icmD50_100, rLab, rXYZ); + icmXYZ2Lab(&labwp, rLab, rXYZ); if (verb) - printf("Preset ref. XYZ %f %f %f, Lab %f %f %f\n", rXYZ[0], rXYZ[1], rXYZ[2], rLab[0], rLab[1], rLab[2]); + printf("Preset ref. XYZ %f %f %f, %s Lab %f %f %f\n", rXYZ[0], rXYZ[1], rXYZ[2], labwpname, rLab[0], rLab[1], rLab[2]); } #endif @@ -2315,7 +2349,7 @@ int main(int argc, char *argv[]) { /* Creat the base conversion object */ if (sp2cief[fidx] == NULL) { - if ((sp2cief[fidx] = new_xsp2cie(illum, &cust_illum, obType, + if ((sp2cief[fidx] = new_xsp2cie(illum, 0.0, &cust_illum, obType, custObserver, icSigXYZData, refstats ? icxNoClamp : icxClamp)) == NULL) error("Creation of spectral conversion object failed"); } @@ -2520,8 +2554,8 @@ int main(int argc, char *argv[]) { vdt_sn = -1.0; } - /* Compute D50 Lab from XYZ */ - icmXYZ2Lab(&icmD50_100, Lab, XYZ); + /* Compute D50 (or other) Lab from XYZ */ + icmXYZ2Lab(&labwp, Lab, XYZ); /* Compute Yxy from XYZ */ icmXYZ2Yxy(Yxy, XYZ); @@ -2529,7 +2563,7 @@ int main(int argc, char *argv[]) { /* Compute LCh from Lab */ icmLab2LCh(LCh, Lab); - /* Compute D50 Yuv from XYZ */ + /* Compute Yuv from XYZ */ icmXYZ21976UCS(Yuv, XYZ); #else /* SALONEINSTLIB */ @@ -2547,8 +2581,8 @@ int main(int argc, char *argv[]) { if (wXYZ[0] < 0.0) { /* If we haven't save a white ref. yet */ if (XYZ[1] < 10.0) error ("White of XYZ %f %f %f doesn't seem reasonable",XYZ[0], XYZ[1], XYZ[2]); - printf("\n Making result XYZ: %f %f %f, D50 Lab: %f %f %f white reference.\n", - XYZ[0], XYZ[1], XYZ[2], Lab[0], Lab[1], Lab[2]); + printf("\n Making result XYZ: %f %f %f, %s Lab: %f %f %f white reference.\n", + XYZ[0], XYZ[1], XYZ[2], labwpname, Lab[0], Lab[1], Lab[2]); wXYZ[0] = XYZ[0]; wXYZ[1] = XYZ[1]; wXYZ[2] = XYZ[2]; @@ -2576,7 +2610,7 @@ int main(int argc, char *argv[]) { } /* recompute Lab */ - icmXYZ2Lab(&icmD50_100, Lab, XYZ); + icmXYZ2Lab(&labwp, Lab, XYZ); /* recompute Yxy from XYZ */ icmXYZ2Yxy(Yxy, XYZ); @@ -2625,8 +2659,8 @@ int main(int argc, char *argv[]) { #endif } else { /* Print out the XYZ and Lab */ - printf("\n Result is XYZ: %f %f %f, D50 Lab: %f %f %f\n", - XYZ[0], XYZ[1], XYZ[2], Lab[0], Lab[1], Lab[2]); + printf("\n Result is XYZ: %f %f %f, %s Lab: %f %f %f\n", + XYZ[0], XYZ[1], XYZ[2], labwpname, Lab[0], Lab[1], Lab[2]); } } diff --git a/spectro/spyd2.c b/spectro/spyd2.c index 28051f3..539c2c0 100755 --- a/spectro/spyd2.c +++ b/spectro/spyd2.c @@ -2146,7 +2146,7 @@ spyd4_comp_calmat( } /* Compute XYZ of the real sample array. */ - if ((conv = new_xsp2cie(icxIT_none, NULL, obType, custObserver, icSigXYZData, icxClamp)) == NULL) + if ((conv = new_xsp2cie(icxIT_none, 0.0, NULL, obType, custObserver, icSigXYZData, icxClamp)) == NULL) return spyd2_interp_code((inst *)p, SPYD2_INT_CIECONVFAIL); sampXYZ = dmatrix(0, nasamp-1, 0, 3-1); for (i = 0; i < nsamp; i++) { diff --git a/spectro/ss.c b/spectro/ss.c index 4f95fdb..7e67fbe 100755 --- a/spectro/ss.c +++ b/spectro/ss.c @@ -54,10 +54,11 @@ You should be able to use the table enter key anywhere the user is asked to hit a key. - The corner positioning could be smarter. + The corner positioning could be smarter (i.e. move to the anticipated corned + automatically). The SpectroscanT transmission cal. merely reminds the user (via verbose) - that it is assuming the correct apatture, rather than given them + that it is assuming the correct apature, rather than given them a chance to change it. */ diff --git a/spectro/ss_imp.c b/spectro/ss_imp.c index 0de14ea..bfe7e25 100755 --- a/spectro/ss_imp.c +++ b/spectro/ss_imp.c @@ -1497,8 +1497,8 @@ ss_tmt tm /* Table mode (Reflectance/Transmission) */ inst_code ss_do_SetDeviceOnline(ss *p) { #ifdef EMSST if (p->tmode != 0) - *((char *)0) = 55; -// return inst_unsupported; +// *((char *)0) = 55; // Trigger backtrace + return inst_unsupported; #endif ss_add_ssreq(p, ss_SetDeviceOnline); ss_command(p, DF_TMO); @@ -1514,7 +1514,8 @@ inst_code ss_do_SetDeviceOnline(ss *p) { inst_code ss_do_SetDeviceOffline(ss *p) { #ifdef EMSST if (p->tmode != 0) - *((char *)0) = 55; +// *((char *)0) = 55; // Trigger backtrace + return inst_unsupported; #endif ss_add_ssreq(p, ss_SetDeviceOffline); ss_command(p, DF_TMO); @@ -1559,7 +1560,8 @@ double y /* Y coord in mm, 0-230.0, accurate to 0.1mm */ ) { #ifdef EMSST if (p->tmode != 0) - *((char *)0) = 55; +// *((char *)0) = 55; // Trigger backtrace + return inst_unsupported; #endif ss_add_ssreq(p, ss_MoveAbsolut); ss_add_1(p, r); @@ -1581,7 +1583,8 @@ double y /* Y distance in mm, 0-230.0, accurate to 0.1mm */ ) { #ifdef EMSST if (p->tmode != 0) - *((char *)0) = 55; +// *((char *)0) = 55; // Trigger backtrace + return inst_unsupported; #endif ss_add_ssreq(p, ss_MoveRelative); ss_add_2(p, (int)(x * 10 + 0.5)); @@ -1600,7 +1603,8 @@ ss *p ) { #ifdef EMSST if (p->tmode != 0) - *((char *)0) = 55; +// *((char *)0) = 55; // Trigger backtrace + return inst_unsupported; #endif ss_add_ssreq(p, ss_MoveHome); ss_command(p, MV_TMO); @@ -1617,7 +1621,8 @@ ss *p ) { #ifdef EMSST if (p->tmode != 0) - *((char *)0) = 55; +// *((char *)0) = 55; // Trigger backtrace + return inst_unsupported; #endif ss_add_ssreq(p, ss_MoveUp); ss_command(p, MV_TMO); @@ -1634,7 +1639,8 @@ ss *p ) { #ifdef EMSST if (p->tmode != 0) - *((char *)0) = 55; +// *((char *)0) = 55; // Trigger backtrace + return inst_unsupported; #endif ss_add_ssreq(p, ss_MoveDown); ss_command(p, MV_TMO); @@ -1656,7 +1662,8 @@ ss_zkt *zk /* Return the Z coordinate (Up/Down) */ ) { #ifdef EMSST if (p->tmode != 0) - *((char *)0) = 55; +// *((char *)0) = 55; // Trigger backtrace + return inst_unsupported; #endif ss_add_ssreq(p, ss_OutputActualPosition); ss_add_1(p, r); @@ -1680,7 +1687,8 @@ ss_wrpt wrp /* White Reference Position (Tile1/Tile2) */ ) { #ifdef EMSST if (p->tmode != 0) - *((char *)0) = 55; +// *((char *)0) = 55; // Trigger backtrace + return inst_unsupported; #endif ss_add_ssreq(p, ss_MoveToWhiteRefPos); ss_add_1(p, wrp); @@ -1749,7 +1757,8 @@ ss_llt ll /* Transmission light level (Off/Surround/Low) */ if (p->tmode != 0) return inst_ok; else - *((char *)0) = 55; +// *((char *)0) = 55; // Trigger backtrace + return inst_unsupported; #endif ss_add_ssreq(p, ss_SetLightLevel); ss_add_1(p, ll); @@ -1775,7 +1784,8 @@ double y /* Y coord in mm, 0-230.0, accurate to 0.1mm */ p->sby = y; return inst_ok; } else { - *((char *)0) = 55; +// *((char *)0) = 55; // Trigger backtrace + return inst_unsupported; } #endif ss_add_ssreq(p, ss_SetTransmStandbyPos); diff --git a/spectro/strange.cal b/spectro/strange.cal index b31bbed..5f4d4b4 100755 --- a/spectro/strange.cal +++ b/spectro/strange.cal @@ -2,7 +2,7 @@ CAL DESCRIPTOR "Argyll Device Calibration Curves" ORIGINATOR "Argyll synthcal" -CREATED "Fri Nov 17 01:11:11 2017" +CREATED "Mon Jul 09 03:30:52 2018" DEVICE_CLASS "DISPLAY" COLOR_REP "RGB" diff --git a/spectro/vtpglut.c b/spectro/vtpglut.c index 2308466..b558bf4 100755 --- a/spectro/vtpglut.c +++ b/spectro/vtpglut.c @@ -14,6 +14,16 @@ * see the License2.txt file for licencing details. */ +/* + TTBD: + + Note that there is some support for HW 3dLUTs in X11 xrandr + in a patch for xf86-videeo-amdgpu drmmode_display.c + submitted on 3 May 2018. + See + +*/ + #include #include #include diff --git a/spectro/xrga.c b/spectro/xrga.c index 7318fce..d481b6a 100755 --- a/spectro/xrga.c +++ b/spectro/xrga.c @@ -160,23 +160,20 @@ void xspec_convert_xrga(xspect *dst, xspect *srcp, xcalpol pol, xcalstd dsp, xca xspect tmp, *src = srcp; /* If no conversion and no copy needed */ - if ((ssp == xcalstd_native || dsp == xcalstd_native || dsp == ssp) - && dst == src) + if (!XCALSTD_NEEDED(ssp, dsp) && dst == src) return; - /* If no conversion needed */ - if (ssp == xcalstd_native || dsp == xcalstd_native || dsp == ssp) { + /* If no conversion needed */ + if (!XCALSTD_NEEDED(ssp, dsp)) { *dst = *src; /* Struct copy */ return; } - /* If the dest is the same as the src, make a temporary copy */ + /* If the dest is the same as the src, make a temporary copy, */ + /* since convert_xrga() needs them to be distinct */ if (dst == src) { tmp = *src; /* Struct copy */ src = &tmp; - - } else { - XSPECT_COPY_INFO(dst, src); /* Copy parameters */ } eq = &xrga_equations[pol][ssp][dsp]; @@ -210,7 +207,7 @@ void ipatch_convert_xrga(ipatch *vals, int nvals, /* Re-compute XYZ */ if (vals[i].XYZ_v) { if (conv == NULL) { - conv = new_xsp2cie(icxIT_D50, NULL, icxOT_CIE_1931_2, + conv = new_xsp2cie(icxIT_D50, 0.0, NULL, icxOT_CIE_1931_2, NULL, icSigXYZData, (icxClamping)clamp); } conv->convert(conv, vals[i].XYZ, &vals[i].sp); -- cgit v1.2.3