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

« back to all changes in this revision

Viewing changes to profile/profin.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:
37
37
#define verbo stdout
38
38
 
39
39
#include <stdio.h>
 
40
#include "counters.h"
40
41
#include "numlib.h"
41
42
#include "icc.h"
42
43
#include "cgats.h"
260
261
        int nooluts,                    /* nz to supress creation of output (PCS) shaper luts */
261
262
        int nocied,                             /* nz to supress inclusion of .ti3 data in profile */
262
263
        int verify,
263
 
        int nsabs,                              /* nz for non-standard absolute output */
 
264
        int autowpsc,                   /* nz for Auto scale the WP to prevent clipping above WP patch */
 
265
        int clipovwp,                   /* nz for Clip cLUT values above WP */
264
266
        double wpscale,                 /* >= 0.0 for media white point scale factor */
265
267
        int dob2a,                              /* nz to create a B2A table as well */
266
268
        int extrap,                             /* nz to create extra cLUT interpolation points */
307
309
                }
308
310
        }
309
311
 
310
 
        if (nsabs == 0)                         /* Don't introduce extra points if not absolute range */
311
 
                extrap = 0;
312
 
 
313
312
        /* Open up the file for writing */
314
313
        if ((wr_fp = new_icmFileStd_name(file_name,"w")) == NULL)
315
314
                error ("Write: Can't open file '%s'",file_name);
650
649
        }
651
650
 
652
651
        if (extrap) {
653
 
                npxpat = 2 * EXTRAP_MAXPNTS;            /* Allow for up to 20 extra patches */
 
652
                npxpat = 4 * EXTRAP_MAXPNTS;            /* Allow for up to 20 extra patches */
654
653
        }
655
654
 
656
655
        /* Allocate arrays to hold test patch input and output values */
778
777
 
779
778
                        /* Create a spectral conversion object */
780
779
                        if ((sp2cie = new_xsp2cie(illum, cust_illum, observ, NULL,
781
 
                                                  wantLab ? icSigLabData : icSigXYZData)) == NULL)
 
780
                                                  wantLab ? icSigLabData : icSigXYZData, icxClamp)) == NULL)
782
781
                                error("Creation of spectral conversion object failed");
783
782
 
784
783
                        for (i = 0; i < npat; i++) {
824
823
                if (clipprims)
825
824
                        flags |= ICX_CLIP_WB | ICX_CLIP_PRIMS;
826
825
                                
827
 
                if (nsabs == 0)
828
 
                flags |= ICX_SET_WHITE | ICX_SET_BLACK;         /* Compute & use white and black */
 
826
        flags |= ICX_SET_BLACK;         /* Compute & use black */
 
827
                flags |= ICX_SET_WHITE;         /* Compute & use white */
 
828
                if (autowpsc)
 
829
                flags |= ICX_SET_WHITE_US;      /* Compute & use white without scaling to L */
829
830
 
830
 
        flags |= ICX_WRITE_WBL;         /* Write white/black/luminence */
 
831
        flags |= ICX_WRITE_WBL;         /* Matrix: write white/black/luminence */
831
832
 
832
833
                /* Setup Device -> XYZ conversion (Fwd) object from scattered data. */
833
834
                if ((xluo = wr_xicc->set_luobj(
835
836
                               wr_xicc, icmFwd, icmDefaultIntent,
836
837
                               icmLuOrdNorm,
837
838
                               flags,           /* Flags */
838
 
                               npat, tpat, 0.0, wpscale, smooth, avgdev,
 
839
                               npat, npat, tpat, NULL, 0.0, wpscale, smooth, avgdev,
839
840
                               NULL, NULL, NULL, iquality)) == NULL)
840
841
                        error("%d, %s",wr_xicc->errc, wr_xicc->err);
841
842
 
845
846
 
846
847
        } else {                /* cLUT based profile */
847
848
                int flags = 0;
 
849
                icxMatrixModel *mm = NULL;
848
850
 
849
851
                xicc *wr_xicc;                  /* extention object */
850
852
                icxLuBase *AtoB;                /* AtoB ixcLu */
851
853
 
852
854
                if (extrap) {
853
 
                        icxMatrixModel *mm;
854
 
                        double avgdist;         /* Average distance between points */
855
855
                        cow *mpat;
856
856
                        int nmpat;
857
 
                        double range;
858
857
                        int j;
859
858
 
860
859
                        if (verb) printf("Creating extrapolation black and white points:\n");
861
860
 
862
 
                        avgdist = pow(1.0/(double)npat, 1.0/3.0);
863
 
                        if (avgdist < 0.001)
864
 
                                avgdist = 0.001;
865
 
                        else if (avgdist > 0.3)
866
 
                                avgdist = 0.3;
867
 
//printf("~1 avgdist = %f\n",avgdist);
868
 
 
869
861
                        if ((mpat = (cow *)malloc(sizeof(cow) * npat)) == NULL)
870
862
                                error("Malloc failed - mpat[]");
871
863
 
872
 
                        /* Select points from full set */
873
 
                        for (range = 0.05;; range *= 1.5) {
874
 
                                if (range > 1.0)
875
 
                                        range = 1.0;
876
 
 
877
 
                                for (nmpat = j = 0; j < npat; j++) {
878
 
                                        double mnp, mxp;
879
 
                                        int k;
880
 
        
881
 
                                        icmCpy3(mpat[nmpat].p, tpat[j].p);
882
 
                                        icmCpy3(mpat[nmpat].v, tpat[j].v);
883
 
        
884
 
                                        /* Locate largest/smallest RGB value */
885
 
                                        mxp = -1e6, mnp = 1e6;
886
 
                                        for (k = 0; k < 3; k++) {
887
 
                                                if (tpat[j].p[k] > mxp)
888
 
                                                        mxp = tpat[j].p[k];
889
 
                                                if (tpat[j].p[k] < mnp)
890
 
                                                        mnp = tpat[j].p[k];
891
 
                                        }
892
 
                                        mxp -= mnp;                     /* Spread; 0 for R=G=B */
893
 
 
894
 
                                        if (mxp <= range) {
895
 
                                                mpat[nmpat].w = 1.0 - mxp/range;
 
864
                        /* Weight points from full set to build matrix model */
 
865
                        /* to extrapolate the neutral axis */
 
866
                        for (nmpat = j = 0; j < npat; j++) {
 
867
                                double mnp, mxp;
 
868
                                int k;
 
869
 
 
870
                                icmCpy3(mpat[nmpat].p, tpat[j].p);
 
871
                                icmCpy3(mpat[nmpat].v, tpat[j].v);
 
872
 
 
873
                                /* Locate largest/smallest RGB value */
 
874
                                mxp = -1e6, mnp = 1e6;
 
875
                                for (k = 0; k < 3; k++) {
 
876
                                        if (tpat[j].p[k] > mxp)
 
877
                                                mxp = tpat[j].p[k];
 
878
                                        if (tpat[j].p[k] < mnp)
 
879
                                                mnp = tpat[j].p[k];
 
880
                                }
 
881
                                mxp -= mnp;                     /* Spread; 0 for R=G=B */
 
882
 
 
883
                                mpat[nmpat].w = pow(1.1 - mxp, 2.0);
896
884
//printf("~1 added value %d: %f %f %f -> %f %f %f wt %f\n",j, mpat[nmpat].p[0], mpat[nmpat].p[1], mpat[nmpat].p[2], mpat[nmpat].v[0], mpat[nmpat].v[1], mpat[nmpat].v[2],mpat[nmpat].w);
897
 
                                                nmpat++;
898
 
                                        }
899
 
                                }
900
 
 
901
 
                                if (nmpat >= 16 || range >= 0.99) {
902
 
//printf("~1 stopping with %d points at range %f\n",nmpat,range);
903
 
                                        break;
904
 
                                }
905
 
 
906
 
                                /* Hmm. Not enough points with that range */
 
885
                                nmpat++;
907
886
                        }
908
 
 
909
 
                        if (verb) printf("%d/%d patches for extrapolation gamma/matrix model\n",nmpat,npat);
910
887
        
911
888
                        /* Create gamma/matrix model to extrapolate with. */
912
889
                        /* (Use ofset & gain, gamma curve as 0th order with 1 harmonic, */
913
 
                        /* and heavily smooth it.) */
 
890
                        /* and smooth it.) */
914
891
                        if ((mm = new_MatrixModel(verb, nmpat, mpat, wantLab,
915
892
                                      /* quality */ -1, /* isLinear */ ptype == prof_matonly,
916
893
                                      /* isGamma */ 0, /* isShTRC */ 0,
917
894
                                      /* shape0gam */ 1, /* clipbw */ 0, /* clipprims */ 0,
918
 
                                      /* smooth */ 1.0, /* scale */ 0.7)) == NULL) {
 
895
//                                    /* smooth */ 1.0, /* scale */ 0.7)) == NULL) {
 
896
                                      /* smooth */ 1.0, /* scale */ 1.0)) == NULL) {
919
897
                                error("Creating extrapolation matrix model failed - memory ?");
920
898
                        }
921
899
 
922
 
#ifdef NEVER
 
900
#ifdef NEVER    /* Plot Lab of model */
923
901
{
924
902
        #define XRES 100
925
903
        double xx[XRES];
932
910
                double rgb[3], lab[3];
933
911
                xx[i] = rgb[0] = rgb[1] = rgb[2] = i/(double)(XRES-1);
934
912
                mm->lookup(mm, lab, rgb);
935
 
                icmLab2XYZ(&icmD50,lab,lab);
 
913
                if (wantLab)
 
914
                        icmLab2XYZ(&icmD50,lab,lab);
936
915
                y0[i] = lab[0];
937
916
                y1[i] = lab[1];
938
917
                y2[i] = lab[2];
940
919
        do_plot(xx,y0,y1,y2,XRES);
941
920
}
942
921
#endif /* DEBUG_PLOT */
943
 
 
944
 
 
945
 
                        /* Create a black and white patch */
946
 
                        for (i = 0; i < 2; i++) {
947
 
                                int cix;                                        /* Closest point index */
948
 
                                int eix;                                        /* End point index */
949
 
                                double cde = 1e60;                      /* Closest point distance */
950
 
                                double tt;
951
 
                                double corr[3], cwt;            /* Correction */
952
 
 
953
 
                                tpat[npat + nxpat].p[0] = 
954
 
                                tpat[npat + nxpat].p[1] = 
955
 
                                tpat[npat + nxpat].p[2] = (double)i; 
956
 
 
957
 
                                /* Locate closest point */
958
 
                                for (nmpat = j = 0; j < npat; j++) {
959
 
                                        double mnp, mxp;
960
 
                                        int k;
961
 
        
962
 
                                        /* Locate largest/smallest RGB value */
963
 
                                        mxp = -1e6, mnp = 1e6;
964
 
                                        for (k = 0; k < 3; k++) {
965
 
                                                if (tpat[j].p[k] > mxp)
966
 
                                                        mxp = tpat[j].p[k];
967
 
                                                if (tpat[j].p[k] < mnp)
968
 
                                                        mnp = tpat[j].p[k];
969
 
                                        }
970
 
                                        mxp -= mnp;                     /* Spread; 0 for R=G=B */
971
 
 
972
 
                                        tt = icmNorm33(tpat[npat + nxpat].p, tpat[j].p);
973
 
                                        tt += mxp;
974
 
 
975
 
                                        if (tt < cde) {
976
 
                                                cde = tt;
977
 
                                                cix = j;
978
 
                                        }
 
922
                }
 
923
 
 
924
                if (extrap) {
 
925
                        int ii, wix = 0, j;
 
926
                        int pcsy;                                               /* Effective PCS L or Y chanel index */
 
927
                        double wpy = -1e60;
 
928
                        double dwhite[MXDI];  /* Device white */
 
929
                        double mxdw;
 
930
                        double avgdist;         /* Average distance between points */
 
931
 
 
932
                        /* Figure out the device white point. */
 
933
                        /* Note that this is duplicating code in xicc/xmatrix.c */
 
934
                        /* and xfit.c */
 
935
 
 
936
                        if (wantLab)
 
937
                                pcsy = 0;       /* L or Lab */
 
938
                        else
 
939
                                pcsy = 1;       /* Y of XYZ */
 
940
 
 
941
                        for (i = 0; i < npat; i++) {
 
942
                                double labv[3], yv;
 
943
 
 
944
                                /* Create D50 Lab to allow some chromatic sensitivity */
 
945
                                /* in picking the white point */
 
946
                                if (wantLab)
 
947
                                        icmCpy3(labv, tpat[i].v);
 
948
                                else
 
949
                                        icmXYZ2Lab(&icmD50, labv, tpat[i].v);
 
950
 
 
951
                                /* Tilt things towards D50 neutral white patches */
 
952
                                yv = labv[0] - 0.3 * sqrt(labv[1] * labv[1] + labv[2] * labv[2]);
 
953
                                if (yv > wpy) {
 
954
                                        for (j = 0; j < 3; j++)
 
955
                                                dwhite[j] = tpat[i].p[j];
 
956
                                        wpy = yv;
 
957
                                        wix = i;
979
958
                                }
 
959
                        }
 
960
 
 
961
                        /* Fix extrapolation matrix to be perfect at white point */
 
962
                        mm->force(mm, tpat[wix].v, tpat[wix].p);
 
963
 
 
964
                        /* Scale the white point to make one dev value 1.0 */
 
965
                        mxdw = -1;
 
966
                        for (j = 0; j < 3; j++) {
 
967
                                if (dwhite[j] > mxdw)
 
968
                                        mxdw = dwhite[j];
 
969
                        }
 
970
                        for (j = 0; j < 3; j++) {
 
971
                                dwhite[j] /= mxdw;
 
972
                        }
 
973
 
 
974
                        avgdist = pow(1.0/(double)npat, 1.0/3.0);
 
975
                        if (avgdist < 0.001)
 
976
                                avgdist = 0.001;
 
977
                        else if (avgdist > 0.3)
 
978
                                avgdist = 0.3;
 
979
//printf("~1 avgdist = %f\n",avgdist);
 
980
 
 
981
                        /* For points with white point device ratio, */
 
982
                        /* and points with R=G=B ratio, create extrapolation points. */
 
983
                        for (ii = 0; ii < 2; ii++) {
 
984
 
 
985
                                if (ii > 1)
 
986
                                        dwhite[0] = dwhite[1] = dwhite[2] = 1.0;
 
987
 
 
988
                                /* Create a series of black and white patch */
 
989
                                for (i = 0; i < 2; i++) {
 
990
                                        int cix;                                        /* Closest point index */
 
991
                                        int eix;                                        /* End point index */
 
992
                                        double cde = 1e60;                      /* Closest point distance */
 
993
                                        double tt;
 
994
                                        double corr[3], cwt;            /* Correction */
 
995
 
 
996
                                        eix = npat + nxpat;
 
997
 
 
998
                                        icmScale3(tpat[eix].p, dwhite, (double)i);
 
999
 
 
1000
                                        /* Locate closest point */
 
1001
                                        for (j = 0; j < npat; j++) {
 
1002
                                                double mnp, mxp;
 
1003
                                                int k;
 
1004
                
 
1005
                                                /* Locate largest/smallest RGB value */
 
1006
                                                mxp = -1e6, mnp = 1e6;
 
1007
                                                for (k = 0; k < 3; k++) {
 
1008
                                                        if (tpat[j].p[k] > mxp)
 
1009
                                                                mxp = tpat[j].p[k];
 
1010
                                                        if (tpat[j].p[k] < mnp)
 
1011
                                                                mnp = tpat[j].p[k];
 
1012
                                                }
 
1013
                                                mxp -= mnp;                     /* Spread; 0 for R=G=B */
 
1014
 
 
1015
                                                tt = icmNorm33(tpat[eix].p, tpat[j].p);
 
1016
                                                tt += mxp;
 
1017
 
 
1018
                                                if (tt < cde) {
 
1019
                                                        cde = tt;
 
1020
                                                        cix = j;
 
1021
                                                }
 
1022
                                        }
980
1023
 
981
1024
//printf("~1 closest %d: de %f, %f %f %f -> %f %f %f\n",cix, cde, tpat[cix].p[0], tpat[cix].p[1], tpat[cix].p[2], tpat[cix].v[0], tpat[cix].v[1], tpat[cix].v[2]);
982
1025
 
986
1029
//printf("~1 closest gam/matrix -> %f %f %f\n",val[0],val[1],val[2]);
987
1030
//}
988
1031
 
989
 
                                /* Lookup matrix value for our new point */
990
 
                                eix = npat + nxpat;
991
 
                                mm->lookup(mm, tpat[eix].v, tpat[eix].p);
 
1032
                                        /* Lookup matrix value for our new point */
 
1033
                                        mm->lookup(mm, tpat[eix].v, tpat[eix].p);
992
1034
//printf("~1 got value %d: %f %f %f -> %f %f %f\n",i, tpat[eix].p[0], tpat[eix].p[1], tpat[eix].p[2], tpat[eix].v[0], tpat[eix].v[1], tpat[eix].v[2]);
993
 
                                /* Weight the extra point so that it doesn't overpower the */
994
 
                                /* nearest real point to it too much. */
995
 
                                tt = cde;
996
 
                                if (tt > avgdist)               /* Distance at which sythetic point has 100% weight */
997
 
                                        tt = avgdist;
998
 
                                tpat[eix].w = EXTRAP_WEIGHT * tt/avgdist;       
 
1035
                                        /* Weight the extra point so that it doesn't overpower the */
 
1036
                                        /* nearest real point to it too much. */
 
1037
                                        tt = cde;
 
1038
                                        if (tt > avgdist)               /* Distance at which sythetic point has 100% weight */
 
1039
                                                tt = avgdist;
 
1040
                                        tpat[eix].w = 0.5 * EXTRAP_WEIGHT * tt/avgdist; 
999
1041
//printf("~1 weight %f\n",tpat[eix].w);
1000
 
                                if (verb)
1001
 
                                        printf("Added synthetic point @ %f %f %f, val %f %f %f, weight %f\n",tpat[eix].p[0], tpat[eix].p[1], tpat[eix].p[2], tpat[eix].v[0], tpat[eix].v[1], tpat[eix].v[2],tpat[eix].w);
1002
 
                                nxpat++;
1003
 
                                
1004
 
                                /* If there is a lot of space, add a second intemediate point */
 
1042
                                        if (verb)
 
1043
                                                printf("Added synthetic point @ %f %f %f, val %f %f %f, weight %f\n",tpat[eix].p[0], tpat[eix].p[1], tpat[eix].p[2], tpat[eix].v[0], tpat[eix].v[1], tpat[eix].v[2],tpat[eix].w);
 
1044
                                        nxpat++;
 
1045
                                        
 
1046
                                        /* If there is a lot of space, add a second intemediate point */
1005
1047
//printf("~1 cde = %f, avgdist = %f\n",cde,avgdist);
1006
 
                                if (cde >= (0.5 * avgdist)) {
1007
 
                                        int nxps;                               /* Number of extra points including end point */
1008
 
                                        nxps = 1 + (int)(cde/(0.5 * avgdist));
1009
 
                                        if (nxps > EXTRAP_MAXPNTS)
1010
 
                                                nxps = EXTRAP_MAXPNTS;
 
1048
                                        if (cde >= (0.5 * avgdist)) {
 
1049
                                                int nxps;                               /* Number of extra points including end point */
 
1050
                                                nxps = 1 + (int)(cde/(0.5 * avgdist));
 
1051
                                                if (nxps > EXTRAP_MAXPNTS)
 
1052
                                                        nxps = EXTRAP_MAXPNTS;
1011
1053
 
1012
1054
//printf("~1 nxps = %d\n",nxps);
1013
 
                                        for (j = 1; j < nxps; j++) {
1014
 
                                                double bl, ipos;
1015
 
        
1016
 
                                                bl = j/(nxps + 1.0);
 
1055
                                                for (j = 1; j < nxps; j++) {
 
1056
                                                        double bl, ipos;
 
1057
                
 
1058
                                                        bl = j/(nxps + 1.0);
1017
1059
 
1018
 
                                                ipos = (1.0 - bl) * tpat[eix].p[0]
1019
 
                                                     +        bl * (tpat[cix].p[0] + tpat[cix].p[1] + tpat[cix].p[1])/3.0;
1020
 
                                                tpat[npat + nxpat].p[0] = 
1021
 
                                                tpat[npat + nxpat].p[1] = 
1022
 
                                                tpat[npat + nxpat].p[2] = ipos;
1023
 
                
1024
 
                                                /* Lookup matrix value for our new point */
1025
 
                                                mm->lookup(mm, tpat[npat + nxpat].v, tpat[npat + nxpat].p);
1026
 
                
1027
 
                                                /* Weight the extra point so that it doesn't overpower the */
1028
 
                                                /* nearest real point to it too much. */
1029
 
                                                cde = icmNorm33(tpat[cix].p, tpat[npat + nxpat].p);
1030
 
                
1031
 
                                                if (cde > avgdist)              /* Distance at which sythetic point has 100% weight */
1032
 
                                                        cde = avgdist;
1033
 
                                                tpat[npat + nxpat].w = EXTRAP_WEIGHT * cde/avgdist;     
1034
 
                                                if (verb)
1035
 
                                                        printf("Added synthetic point @ %f %f %f, val %f %f %f, weight %f\n",tpat[npat + nxpat].p[0], tpat[npat + nxpat].p[1], tpat[npat + nxpat].p[2], tpat[npat + nxpat].v[0], tpat[npat + nxpat].v[1], tpat[npat + nxpat].v[2],tpat[npat + nxpat].w);
1036
 
                                                nxpat++;
 
1060
                                                        ipos = (1.0 - bl) * tpat[eix].p[0]
 
1061
                                                             +        bl * (tpat[cix].p[0] + tpat[cix].p[1] + tpat[cix].p[1])/3.0;
 
1062
                                                        icmScale3(tpat[npat + nxpat].p, dwhite, ipos);
 
1063
                        
 
1064
                                                        /* Lookup matrix value for our new point */
 
1065
                                                        mm->lookup(mm, tpat[npat + nxpat].v, tpat[npat + nxpat].p);
 
1066
                        
 
1067
                                                        /* Weight the extra point so that it doesn't overpower the */
 
1068
                                                        /* nearest real point to it too much. */
 
1069
                                                        cde = icmNorm33(tpat[cix].p, tpat[npat + nxpat].p);
 
1070
                        
 
1071
                                                        if (cde > avgdist)              /* Distance at which sythetic point has 100% weight */
 
1072
                                                                cde = avgdist;
 
1073
                                                        tpat[npat + nxpat].w = 0.5 * EXTRAP_WEIGHT * cde/avgdist;       
 
1074
                                                        if (verb)
 
1075
                                                                printf("Added synthetic point @ %f %f %f, val %f %f %f, weight %f\n",tpat[npat + nxpat].p[0], tpat[npat + nxpat].p[1], tpat[npat + nxpat].p[2], tpat[npat + nxpat].v[0], tpat[npat + nxpat].v[1], tpat[npat + nxpat].v[2],tpat[npat + nxpat].w);
 
1076
                                                        nxpat++;
 
1077
                                                }
1037
1078
                                        }
1038
1079
                                }
1039
1080
                        }
1040
 
                        mm->del(mm);
1041
1081
                }
1042
1082
 
1043
1083
                /* Wrap with an expanded icc */
1061
1101
                if (clipprims)
1062
1102
                        flags |= ICX_CLIP_WB;
1063
1103
                                
1064
 
                if (nsabs == 0)
1065
 
                flags |= ICX_SET_WHITE | ICX_SET_BLACK;         /* Compute & use white and black */
 
1104
        flags |= ICX_SET_BLACK;         /* Compute & use black */
 
1105
                flags |= ICX_SET_WHITE;         /* Compute & use white */
 
1106
                if (clipovwp)
 
1107
                flags |= ICX_SET_WHITE_C;       /* Compute & use white and clip cLUT over D50 */
 
1108
                else if (autowpsc)
 
1109
                flags |= ICX_SET_WHITE_US;      /* Compute & use white without scaling to L */
1066
1110
 
1067
1111
                /* Setup RGB -> Lab conversion object from scattered data. */
1068
1112
                /* Note that we've layered it on a native XYZ icc profile. */
 
1113
                /* (The skeleton model is not used - it doesn't seem to help) */
1069
1114
                if ((AtoB = wr_xicc->set_luobj(
1070
1115
                               wr_xicc, icmFwd, icmDefaultIntent,
1071
1116
                               icmLuOrdNorm,
1076
1121
                                       ICX_2PASSSMTH |
1077
1122
#endif
1078
1123
                               flags,           /* Flags */
1079
 
                               npat + nxpat, tpat, 0.0, wpscale, smooth, avgdev,
 
1124
                               npat + nxpat, npat, tpat, NULL, 0.0, wpscale, smooth, avgdev,
1080
1125
                                   NULL, NULL, NULL, iquality)) == NULL)
1081
1126
                        error ("%d, %s",wr_xicc->errc, wr_xicc->err);
1082
1127
 
 
1128
                if (mm != NULL)
 
1129
                        mm->del(mm);
 
1130
 
1083
1131
                /* Free up xicc stuff */
1084
1132
                AtoB->del(AtoB);
1085
1133