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

« back to all changes in this revision

Viewing changes to profile/colprof.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:
87
87
        fprintf(stderr," -M model        Model description string\n");
88
88
        fprintf(stderr," -D description  Profile Description string (Default \"inoutfile\")\n");
89
89
        fprintf(stderr," -C copyright    Copyright string\n");
90
 
        fprintf(stderr," -Z [tmnb]       Attributes: Transparency, Matte, Negative, BlackAndWhite\n");
91
 
        fprintf(stderr," -Z [prsa]       Default intent: Perceptual, Rel. Colorimetric, Saturation, Abs. Colorimetric\n");
 
90
        fprintf(stderr," -Z tmnb         Attributes: Transparency, Matte, Negative, BlackAndWhite\n");
 
91
        fprintf(stderr," -Z prsa         Default intent: Perceptual, Rel. Colorimetric, Saturation, Abs. Colorimetric\n");
92
92
 
93
93
        fprintf(stderr," -q lmhu         Quality - Low, Medium (def), High, Ultra\n");
94
94
//      fprintf(stderr," -q fmsu         Speed - Fast, Medium (def), Slow, Ultra Slow\n");
117
117
//  Development - not supported
118
118
//      fprintf(stderr," -I ver          Set ICC profile version > 2.2.0\n");
119
119
//      fprintf(stderr,"                 ver = 4, Enable ICC V4 creation\n");
120
 
        fprintf(stderr," -u              If input profile, make it absolute (non-standard)\n");
121
 
        fprintf(stderr," -un             Same as u, but don't extrapolate cLut white & black using matrix\n");
 
120
        fprintf(stderr," -u              If input profile, auto scale WP to allow extrapolation\n");
 
121
        fprintf(stderr," -uc             If input profile, clip cLUT values above WP\n");
122
122
        fprintf(stderr," -U scale        If input profile, scale media white point by scale\n");
123
123
        fprintf(stderr," -R              Restrict white <= 1.0, black and primaries to be +ve\n");
124
 
        fprintf(stderr," -i illum        Choose illuminant for print/transparency spectral data:\n");
125
 
        fprintf(stderr,"                 A, C, D50 (def.), D65, F5, F8, F10 or file.sp\n");
 
124
        fprintf(stderr," -f [illum]      Use Fluorescent Whitening Agent compensation [opt. simulated inst. illum.:\n");
 
125
        fprintf(stderr,"                  M0, M1, M2, A, C, D50 (def.), D50M2, D65, F5, F8, F10 or file.sp]\n");
 
126
        fprintf(stderr," -i illum        Choose illuminant for computation of CIE XYZ from spectral data & FWA:\n");
 
127
        fprintf(stderr,"                  A, C, D50 (def.), D50M2, D65, F5, F8, F10 or file.sp\n");
126
128
        fprintf(stderr," -o observ       Choose CIE Observer for spectral data:\n");
127
 
        fprintf(stderr,"                 1931_2 (def), 1964_10, S&B 1955_2, shaw, J&V 1978_2\n");
128
 
        fprintf(stderr," -f              Use Fluorescent Whitening Agent compensation\n");
 
129
        fprintf(stderr,"                  1931_2 (def), 1964_10, S&B 1955_2, shaw, J&V 1978_2\n");
129
130
        fprintf(stderr," -r avgdev       Average deviation of device+instrument readings as a percentage (default %4.2f%%)\n",DEFAVGDEV);
130
131
/* Research options: */
131
 
/*      fprintf(stderr," -r sSMOOTH      RSPL suplimental optimised smoothing factor\n"); */
132
 
/*      fprintf(stderr," -r rSMOOTH      RSPL raw underlying smoothing factor\n"); */
 
132
/*      fprintf(stderr," -r sSMOOTH      RSPL or shaper suplimental optimised smoothing factor\n"); */
 
133
/*      fprintf(stderr," -r rSMOOTH      RSPL or shaper raw underlying smoothing factor\n"); */
133
134
        fprintf(stderr," -s src%s      Apply gamut mapping to output profile perceptual B2A table for given source space\n",ICC_FILE_EXT);
134
135
        fprintf(stderr," -S src%s      Apply gamut mapping to output profile perceptual and saturation B2A table\n",ICC_FILE_EXT);
135
136
        fprintf(stderr," -nP             Use colormetric source gamut to make output profile perceptual table\n");
179
180
        int noptop = 0;                         /* Use colormetric source gamut to make perceptual table */
180
181
        int nostos = 0;                         /* Use colormetric source gamut to make saturation table */
181
182
        int gamdiag = 0;                        /* Make gamut mapping diagnostic wrl plots */
182
 
        int nsabs = 0;                          /* Make non-standard absolute input lut profile */
 
183
        int autowpsc = 0;                       /* Auto scale the WP to prevent clipping above WP patch */
 
184
        int clipovwp = 0;                       /* Clip cLUT values above WP */
183
185
        int clipprims = 0;                      /* Clip white, black and primaries */
184
186
        double iwpscale = -1.0;         /* Input white point scale factor */
185
 
        int doinextrap = 1;                     /* Sythesize extra input sample points for cLUT */
 
187
        int doinextrap = 1;                     /* Sythesize extra sample points for input device cLUT */
186
188
        int doinb2a = 1;                        /* Create an input device B2A table */
187
189
        int inking = 3;                         /* Default K target ramp K */
188
190
        int locus = 0;                          /* Default K value target */
193
195
        double avgdev = DEFAVGDEV/100.0;        /* Average measurement deviation */
194
196
        double smooth = 1.0;            /* RSPL Smoothness factor (relative, for verification) */
195
197
        int spec = 0;                           /* Use spectral data flag */
 
198
        icxIllumeType tillum = icxIT_none;      /* Target/simulated instrument illuminant */ 
 
199
        xspect cust_tillum;                     /* Custom target/simulated illumination spectrum */
196
200
        icxIllumeType illum = icxIT_D50;        /* Spectral defaults */
197
201
        xspect cust_illum;                      /* Custom illumination spectrum */
198
202
        icxObserverType observ = icxOT_CIE_1931_2;      /* The classic observer */
359
363
                        /* Quality */
360
364
                        else if (argv[fa][1] == 'q' || argv[fa][1] == 'Q') {
361
365
                                fa = nfa;
362
 
                                if (na == NULL) usage("Expect argument to quality flag -q");
 
366
//                              if (na == NULL) usage("Expect argument to quality flag -q");
 
367
                                if (na == NULL) usage("Expect argument to speed flag -q");
363
368
                                switch (na[0]) {
364
369
                                        case 'f':                               /* Fast */
365
370
                                        case 'l':
450
455
                        }
451
456
 
452
457
                        else if (argv[fa][1] == 'u') {
453
 
                                nsabs = 1;
454
 
                                if (argv[fa][2] == 'n')
455
 
                                        doinextrap = 0;
 
458
                                autowpsc = 1;
 
459
                                clipovwp = 0;
 
460
                                if (argv[fa][2] == 'c') {
 
461
                                        autowpsc = 0;
 
462
                                        clipovwp = 1;
 
463
                                } else if (argv[fa][2] != '\000') {
 
464
                                        usage("Unknown flag '%c' after -u",argv[fa][2]);
 
465
                                }
456
466
                        }
457
467
                        else if (argv[fa][1] == 'U') {
458
468
                                fa = nfa;
579
589
                                                usage("Unknown argument '%c' to version flag -I",na[0] );
580
590
                                }
581
591
                        }
 
592
 
 
593
                        /* FWA compensation */
 
594
                        else if (argv[fa][1] == 'f') {
 
595
                                fwacomp = 1;
 
596
 
 
597
                                if (na != NULL) {       /* Argument is present - target/simulated instr. illum. */
 
598
                                        fa = nfa;
 
599
                                        if (strcmp(na, "A") == 0
 
600
                                         || strcmp(na, "M0") == 0) {
 
601
                                                spec = 1;
 
602
                                                tillum = icxIT_A;
 
603
                                        } else if (strcmp(na, "C") == 0) {
 
604
                                                spec = 1;
 
605
                                                tillum = icxIT_C;
 
606
                                        } else if (strcmp(na, "D50") == 0
 
607
                                                || strcmp(na, "M1") == 0) {
 
608
                                                spec = 1;
 
609
                                                tillum = icxIT_D50;
 
610
                                        } else if (strcmp(na, "D50M2") == 0
 
611
                                                || strcmp(na, "M2") == 0) {
 
612
                                                spec = 1;
 
613
                                                tillum = icxIT_D50M2;
 
614
                                        } else if (strcmp(na, "D65") == 0) {
 
615
                                                spec = 1;
 
616
                                                tillum = icxIT_D65;
 
617
                                        } else if (strcmp(na, "F5") == 0) {
 
618
                                                spec = 1;
 
619
                                                tillum = icxIT_F5;
 
620
                                        } else if (strcmp(na, "F8") == 0) {
 
621
                                                spec = 1;
 
622
                                                tillum = icxIT_F8;
 
623
                                        } else if (strcmp(na, "F10") == 0) {
 
624
                                                spec = 1;
 
625
                                                tillum = icxIT_F10;
 
626
                                        } else {        /* Assume it's a filename */
 
627
                                                spec = 1;
 
628
                                                tillum = icxIT_custom;
 
629
                                                if (read_xspect(&cust_tillum, na) != 0)
 
630
                                                        usage("Failed to read custom target illuminant spectrum in file '%s'",na);
 
631
                                        }
 
632
                                }
 
633
                        }
 
634
 
582
635
                        /* Spectral Illuminant type */
583
636
                        else if (argv[fa][1] == 'i') {
584
637
                                fa = nfa;
592
645
                                } else if (strcmp(na, "D50") == 0) {
593
646
                                        spec = 1;
594
647
                                        illum = icxIT_D50;
 
648
                                } else if (strcmp(na, "D50M2") == 0) {
 
649
                                        spec = 1;
 
650
                                        illum = icxIT_D50M2;
595
651
                                } else if (strcmp(na, "D65") == 0) {
596
652
                                        spec = 1;
597
653
                                        illum = icxIT_D65;
635
691
                                        usage("Unrecognised argument '%s' to observer flag -o",na);
636
692
                        }
637
693
 
638
 
                        else if (argv[fa][1] == 'f' || argv[fa][1] == 'F')
639
 
                                fwacomp = 1;
640
694
 
641
695
                        /* Average Deviation percentage */
642
696
                        else if (argv[fa][1] == 'r') {
830
884
                sepsat = 1;
831
885
        }
832
886
 
 
887
        if (gamdiag && ipname[0] == '\000')
 
888
                warning("no gamut mapping called for, so -P will produce nothing");
 
889
                
833
890
        if (sgname[0] != '\000' && ipname[0] == '\000')
834
891
                warning("-g srcgam will do nothing without -s srcprof or -S srcprof");
835
892
 
981
1038
                        error ("Output profile can only be a cLUT algorithm");
982
1039
                }
983
1040
 
984
 
                if (nsabs)
985
 
                        error ("Input absolute mode isn't applicable to an output device");
 
1041
                if (autowpsc)
 
1042
                        error ("Input auto WP scale mode isn't applicable to an output device");
 
1043
                if (clipovwp)
 
1044
                        error ("Input cLUT clipping above WP mode isn't applicable to an output device");
986
1045
 
987
1046
                make_output_icc(ptype, 0, iccver, verb, iquality, oquality,
988
1047
                                noisluts, noipluts, nooluts, nocied, noptop, nostos,
989
 
                                gamdiag, verify, clipprims, &ink, inname, outname, icg, spec,
990
 
                                illum, &cust_illum, observ, fwacomp, smooth, avgdev,
 
1048
                                gamdiag, verify, clipprims, &ink, inname, outname, icg, 
 
1049
                                spec, tillum, &cust_tillum, illum, &cust_illum, observ, fwacomp,
 
1050
                                smooth, avgdev,
991
1051
                                ipname[0] != '\000' ? ipname : NULL,
992
1052
                                sgname[0] != '\000' ? sgname : NULL,
993
1053
                                absnames,
999
1059
                if (ptype == prof_default)
1000
1060
                        ptype = prof_clutLab;           /* For best possible quality */
1001
1061
 
 
1062
                if (clipovwp && ptype != prof_clutLab && ptype != prof_clutXYZ)
 
1063
                        error ("Input cLUT clipping above WP mode isn't applicable to a matrix profile");
 
1064
 
1002
1065
                make_input_icc(ptype, iccver, verb, iquality, oquality, noisluts, noipluts, nooluts, nocied,
1003
 
                               verify, nsabs, iwpscale, doinb2a, doinextrap, clipprims, inname, outname,
1004
 
                               icg, spec, illum, &cust_illum, observ, smooth, avgdev, &xpi);
 
1066
                               verify, autowpsc, clipovwp, iwpscale, doinb2a, doinextrap, clipprims,
 
1067
                               inname, outname, icg, spec, illum, &cust_illum, observ,
 
1068
                               smooth, avgdev, &xpi);
1005
1069
 
1006
1070
        } else if (strcmp(icg->t[0].kdata[ti],"DISPLAY") == 0) {
1007
1071
 
1008
 
                if (nsabs)
1009
 
                        error ("Input absolute mode isn't applicable to a display device");
 
1072
                if (autowpsc)
 
1073
                        error ("Input auto WP scale mode isn't applicable to an output device");
 
1074
                if (clipovwp)
 
1075
                        error ("Input cLUT clipping above WP mode isn't applicable to an output device");
1010
1076
 
1011
1077
                if (fwacomp)
1012
1078
                        error ("FWA compensation isn't applicable to a display device");
1017
1083
                /* If a source gamut is provided for a Display, then a V2.4.0 profile will be created */
1018
1084
                make_output_icc(ptype, mtxtoo, iccver, verb, iquality, oquality,
1019
1085
                                noisluts, noipluts, nooluts, nocied, noptop, nostos,
1020
 
                                gamdiag, verify, clipprims, NULL, inname, outname, icg, spec,
1021
 
                                illum, &cust_illum, observ, 0, smooth, avgdev,
 
1086
                                gamdiag, verify, clipprims, NULL, inname, outname, icg,
 
1087
                                spec, icxIT_none, NULL, illum, &cust_illum, observ, 0,
 
1088
                                smooth, avgdev,
1022
1089
                                ipname[0] != '\000' ? ipname : NULL,
1023
1090
                                sgname[0] != '\000' ? sgname : NULL,
1024
1091
                                absnames,