~ubuntu-branches/ubuntu/trusty/argyll/trusty-proposed

« back to all changes in this revision

Viewing changes to spectro/spec2cie.c

  • Committer: Package Import Robot
  • Author(s): Artur Rona
  • Date: 2014-02-12 00:35:39 UTC
  • mfrom: (13.1.24 sid)
  • Revision ID: package-import@ubuntu.com-20140212003539-24tautzlitsiz61w
Tags: 1.5.1-5ubuntu1
* Merge from Debian unstable. (LP: #1275572) Remaining changes:
  - debian/control:
    + Build-depend on libtiff-dev rather than libtiff4-dev.
  - debian/control, debian/patches/06_fix_udev_rule.patch:
    + Fix udev rules to actually work; ENV{ACL_MANAGE} has
      stopped working ages ago, and with logind it's now the
      "uaccess" tag. Dropping also consolekit from Recommends.
  - debian/patches/drop-usb-db.patch:
    + Use hwdb builtin, instead of the obsolete usb-db
      in the udev rules.
* debian/patches/05_ftbfs-underlinkage.diff:
  - Dropped change, no needed anymore.
* Refresh the patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
#include "cgats.h"
65
65
#include "xicc.h"
66
66
#include "insttypes.h"
 
67
#include "conv.h"
67
68
#include "icoms.h"
68
 
#include "conv.h"
69
69
#include "inst.h"
70
70
#ifdef ALLOW_PLOT
71
71
#include "plot.h"
80
80
        fprintf (stderr, "\n");
81
81
        fprintf (stderr, "Usage: spec2cie [options] input.ti3 output.ti3\n");
82
82
        fprintf (stderr, " -v          Verbose mode\n");
83
 
        fprintf (stderr, " -i illum    Choose viewing illuminant:\n");
84
 
        fprintf (stderr, "             A, C, D50 (def.), D65, F5, F8, F10 or file.sp\n");
 
83
        fprintf (stderr, " -I illum    Override actual instrument illuminant in .ti3 file:\n");
 
84
        fprintf (stderr, "              A, C, D50, D50M2, D65, F5, F8, F10 or file.sp\n");
 
85
        fprintf (stderr, "              (only used in conjunction with -f)\n");
 
86
        fprintf (stderr, " -f [illum]  Use Fluorescent Whitening Agent compensation [simulated inst. illum.:\n");
 
87
        fprintf (stderr, "              M0, M1, M2, A, C, D50 (def.), D50M2, D65, F5, F8, F10 or file.sp]\n");
 
88
        fprintf (stderr, " -i illum    Choose illuminant for computation of CIE XYZ from spectral data & FWA:\n");
 
89
        fprintf (stderr, "             A, C, D50 (def.), D50M2, D65, F5, F8, F10 or file.sp\n");
85
90
        fprintf (stderr, " -o observ   Choose CIE Observer for spectral data:\n");
86
 
        fprintf (stderr, "             1931_2 (def), 1964_10, S&B 1955_2, shaw, J&V 1978_2\n");
87
 
        fprintf (stderr, " -f          Use Fluorescent Whitening Agent compensation\n");
88
 
        fprintf (stderr, " -I illum    Override instrument illuminant in .ti3 file:\n");
89
 
        fprintf (stderr, "             A, C, D50, D65, F5, F8, F10 or file.sp\n");
90
 
        fprintf (stderr, "             (only used in conjunction with -f)\n");
 
91
        fprintf (stderr, "              1931_2 (def), 1964_10, S&B 1955_2, shaw, J&V 1978_2\n");
91
92
        fprintf (stderr, " -n          Don't output spectral values\n"); 
92
93
#ifdef ALLOW_PLOT
93
94
        fprintf (stderr, " -p          Plot each values spectrum\n"); 
117
118
        int ci, mi, yi, ki;                             /* Indexes of device values */
118
119
        int fwacomp = 0;                                /* FWA compensation */
119
120
        int doplot = 0;                                 /* Plot each patches spectrum */
120
 
        xspect cust_illum;                              /* Custom illumination spectrum */
121
 
        xspect inst_cust_illum;                 /* Custom illumination spectrum */
122
121
        char* illum_str = "D50";
 
122
        icxIllumeType tillum = icxIT_none;      /* Target/simulated instrument illuminant */ 
 
123
        xspect cust_tillum, *tillump = NULL; /* Custom target/simulated illumination spectrum */
123
124
        icxIllumeType illum = icxIT_D50;                        /* Spectral defaults */
 
125
        xspect cust_illum;                              /* Custom illumination spectrum */
124
126
        icxIllumeType inst_illum = icxIT_none;          /* Spectral defaults */
 
127
        xspect inst_cust_illum;                 /* Custom illumination spectrum */
125
128
        icxObserverType observ = icxOT_CIE_1931_2;
126
129
 
127
130
        int npat;                                               /* Number of patches */
183
186
                                else if (strcmp (na, "D50") == 0) {
184
187
                                        inst_illum = icxIT_D50;
185
188
                                }
 
189
                                else if (strcmp (na, "D50M2") == 0) {
 
190
                                        inst_illum = icxIT_D50M2;
 
191
                                }
186
192
                                else if (strcmp (na, "D65") == 0) {
187
193
                                        inst_illum = icxIT_D65;
188
194
                                }
202
208
                                }
203
209
                        }
204
210
 
205
 
                        /* Spectral Illuminant type */
 
211
                        /* FWA comp & simulated instrument illuminant */
 
212
                        else if (argv[fa][1] == 'f') {
 
213
                                fwacomp = 1;
 
214
 
 
215
                                if (na != NULL) {       /* Argument is present - target/simulated instr. illum. */
 
216
                                        fa = nfa;
 
217
                                        if (strcmp(na, "A") == 0
 
218
                                         || strcmp(na, "M0") == 0) {
 
219
                                                tillum = icxIT_A;
 
220
                                        } else if (strcmp(na, "C") == 0) {
 
221
                                                tillum = icxIT_C;
 
222
                                        } else if (strcmp(na, "D50") == 0
 
223
                                                || strcmp(na, "M1") == 0) {
 
224
                                                tillum = icxIT_D50;
 
225
                                        } else if (strcmp(na, "D50M2") == 0
 
226
                                                || strcmp(na, "M2") == 0) {
 
227
                                                tillum = icxIT_D50M2;
 
228
                                        } else if (strcmp(na, "D65") == 0) {
 
229
                                                tillum = icxIT_D65;
 
230
                                        } else if (strcmp(na, "F5") == 0) {
 
231
                                                tillum = icxIT_F5;
 
232
                                        } else if (strcmp(na, "F8") == 0) {
 
233
                                                tillum = icxIT_F8;
 
234
                                        } else if (strcmp(na, "F10") == 0) {
 
235
                                                tillum = icxIT_F10;
 
236
                                        } else {        /* Assume it's a filename */
 
237
                                                tillum = icxIT_custom;
 
238
                                                if (read_xspect(&cust_tillum, na) != 0)
 
239
                                                        usage();
 
240
                                        }
 
241
                                }
 
242
                        }
 
243
 
 
244
                        /* CIE tristimulous spectral Illuminant type */
206
245
                        else if (argv[fa][1] == 'i') {
207
246
                                fa = nfa;
208
247
                                if (na == NULL)
217
256
                                else if (strcmp (na, "D50") == 0) {
218
257
                                        illum = icxIT_D50;
219
258
                                }
 
259
                                else if (strcmp (na, "D50M2") == 0) {
 
260
                                        illum = icxIT_D50M2;
 
261
                                }
220
262
                                else if (strcmp (na, "D65") == 0) {
221
263
                                        illum = icxIT_D65;
222
264
                                }
260
302
                                        usage ();
261
303
                        }
262
304
 
263
 
                        else if (argv[fa][1] == 'f' || argv[fa][1] == 'F')
264
 
                                fwacomp = 1;
265
 
 
266
305
                        else
267
306
                                usage ();
268
307
                }
539
578
                /* Create a spectral conversion object */
540
579
                if ((sp2cie = new_xsp2cie (illum,
541
580
                                                                   illum == icxIT_none ?  NULL : &cust_illum,
542
 
                                                                   observ, NULL, icSigXYZData)) == NULL)
 
581
                                                                   observ, NULL, icSigXYZData, icxClamp)) == NULL)
543
582
                {
544
583
                        error ("Creation of spectral conversion object failed");
545
584
                }
639
678
                                                        error ("Failed to find standard illuminant");
640
679
                        }
641
680
 
 
681
                        /* If we are setting a specific simulated instrument illuminant */
 
682
                        if (tillum != icxIT_none) {
 
683
                                tillump = &cust_tillum;
 
684
                                if (tillum != icxIT_custom) {
 
685
                                        if (standardIlluminant(tillump, tillum, 0.0)) {
 
686
                                                error("simulated inst. illum. not recognised");
 
687
                                        }
 
688
                                }
 
689
                        }
 
690
 
642
691
                        /* (Note that sp and mwsp.norm is set to 100.0) */
643
 
                        if (sp2cie->set_fwa(sp2cie, &insp, &mwsp)) 
 
692
                        if (sp2cie->set_fwa(sp2cie, &insp, tillump, &mwsp)) 
644
693
                                error ("Set FWA on sp2cie failed");
645
694
 
646
695
                        if (verb) {