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 --- spectro/spotread.c | 83 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 29 deletions(-) mode change 100644 => 100755 spectro/spotread.c (limited to 'spectro/spotread.c') diff --git a/spectro/spotread.c b/spectro/spotread.c old mode 100644 new mode 100755 index 7689986..baf1c76 --- a/spectro/spotread.c +++ b/spectro/spotread.c @@ -333,7 +333,7 @@ usage(char *diag, ...) { fprintf(stderr," -h Display LCh instead of Lab\n"); fprintf(stderr," -V Show running average and std. devation from ref.\n"); #ifndef SALONEINSTLIB - fprintf(stderr," -T Display correlated color temperatures and CRI\n"); + fprintf(stderr," -T Display correlated color temperatures, CRI and TLCI\n"); #endif /* !SALONEINSTLIB */ // fprintf(stderr," -K type Run instrument calibration first\n"); fprintf(stderr," -N Disable auto calibration of instrument\n"); @@ -948,24 +948,6 @@ int main(int argc, char *argv[]) { refrmode = -1; } } - /* Set display type */ - if (dtype != 0) { - if (cap2 & inst2_disptype) { - int ix; - if ((ix = inst_get_disptype_index(it, dtype, 0)) < 0) { - it->del(it); - usage("Failed to locate display type matching '%c'",dtype); - } - - if ((rv = it->set_disptype(it, ix)) != inst_ok) { - printf("Setting display type ix %d not supported by instrument\n",ix); - it->del(it); - return -1; - } - } else - printf("Display type ignored - instrument doesn't support display type selection\n"); - } - } else { if (!IMODETST(cap, inst_mode_ref_spot) || it->check_mode(it, inst_mode_ref_spot) != inst_ok) { @@ -976,6 +958,24 @@ int main(int argc, char *argv[]) { } } + /* Set displaytype or calibration mode */ + if (dtype != 0) { + if (cap2 & inst2_disptype) { + int ix; + if ((ix = inst_get_disptype_index(it, dtype, 0)) < 0) { + it->del(it); + usage("Failed to locate display type matching '%c'",dtype); + } + + if ((rv = it->set_disptype(it, ix)) != inst_ok) { + printf("Setting display type ix %d not supported by instrument\n",ix); + it->del(it); + return -1; + } + } else + printf("Display/calibration type ignored - instrument doesn't support it\n"); + } + /* If we have non-standard observer we need spectral or CCSS */ if (obType != icxOT_default && !IMODETST(cap, inst_mode_spectral) && !(cap2 & inst2_ccss)) { printf("Non standard observer needs spectral information or CCSS capability\n"); @@ -1604,7 +1604,7 @@ int main(int argc, char *argv[]) { } #ifdef DEBUG - printf("read_sample returned '%s' (%s)\n", + printf("\nread_sample returned '%s' (%s)\n", it->inst_interp_error(it, rv), it->interp_error(it, rv)); #endif /* DEBUG */ @@ -1778,9 +1778,21 @@ int main(int argc, char *argv[]) { if (ch == 'S' || ch == 's') { /* Save last spectral into file */ if (sp.spec_n > 0) { char buf[500]; + xspect tsp; + + if (val.sp.spec_n <= 0) + error("Instrument didn't return spectral data"); + + tsp = val.sp; /* Temp. save spectral reading */ + + /* Compute FWA corrected spectrum */ + if (dofwa != 0) { + sp2cief[fidx]->sconvert(sp2cief[fidx], &tsp, NULL, &tsp); + } + printf("\nEnter filename (ie. xxxx.sp): "); fflush(stdout); if (getns(buf, 500) != NULL && strlen(buf) > 0) { - if(write_xspect(buf, &sp)) + if(write_xspect(buf, &tsp)) printf("\nWriting file '%s' failed\n",buf); else printf("\nWriting file '%s' succeeded\n",buf); @@ -2020,22 +2032,27 @@ int main(int argc, char *argv[]) { double yy[XSPECT_MAX_BANDS]; double yr[XSPECT_MAX_BANDS]; double xmin, xmax, ymin, ymax; + xspect trsp = rsp; xspect *ss; /* Spectrum range to use */ int nn; - if (rsp.spec_n > 0) { + if (dofwa != 0) { + sp2cief[fidx]->sconvert(sp2cief[fidx], &trsp, NULL, &tsp); + } + + if (trsp.spec_n > 0) { if ((tsp.spec_wl_long - tsp.spec_wl_short) > - (rsp.spec_wl_long - rsp.spec_wl_short)) + (trsp.spec_wl_long - trsp.spec_wl_short)) ss = &tsp; else - ss = &rsp; + ss = &trsp; } else ss = &tsp; - if (tsp.spec_n > rsp.spec_n) + if (tsp.spec_n > trsp.spec_n) nn = tsp.spec_n; else - nn = rsp.spec_n; + nn = trsp.spec_n; if (nn > XSPECT_MAX_BANDS) error("Got > %d spectral values (%d)",XSPECT_MAX_BANDS,nn); @@ -2050,7 +2067,7 @@ int main(int argc, char *argv[]) { yy[j] = value_xspect(&tsp, xx[j]); if (rLab[0] >= -1.0) { /* If there is a reference */ - yr[j] = value_xspect(&rsp, xx[j]); + yr[j] = value_xspect(&trsp, xx[j]); } } @@ -2317,9 +2334,17 @@ int main(int argc, char *argv[]) { #ifndef SALONEINSTLIB if (val.sp.spec_n > 0 && (ambient || doCCT)) { int invalid = 0; + double RR[14]; double cri; - cri = icx_CIE1995_CRI(&invalid, &sp); - printf(" Color Rendering Index (Ra) = %.1f%s\n",cri,invalid ? " (Invalid)" : ""); + cri = icx_CIE1995_CRI(&invalid, RR, &sp); + printf(" Color Rendering Index (Ra) = %.1f [ R9 = %.1f ]%s\n", + cri, RR[9-1], invalid ? " (Invalid)" : ""); + } + if (val.sp.spec_n > 0 && (ambient || doCCT)) { + int invalid = 0; + double tlci; + tlci = icx_EBU2012_TLCI(&invalid, &sp); + printf(" Television Lighting Consistency Index 2012 (Qa) = %.1f%s\n",tlci,invalid ? " (Invalid)" : ""); } #endif -- cgit v1.2.3