jdk/src/share/native/sun/java2d/cmm/lcms/cmssamp.c
author prr
Tue, 24 Mar 2009 09:14:02 -0700
changeset 2394 404cbe399601
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
6821031: Upgrade OpenJDK's LittleCMS version to 1.18 Reviewed-by: bae, igor
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
// This file is available under and governed by the GNU General Public
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
// License version 2 only, as published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
// However, the following notice accompanied the original version of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
// file:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
//  Little cms
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
    32
//  Copyright (C) 1998-2007 Marti Maria
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
// Permission is hereby granted, free of charge, to any person obtaining
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
// a copy of this software and associated documentation files (the "Software"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
// to deal in the Software without restriction, including without limitation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
// and/or sell copies of the Software, and to permit persons to whom the Software
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
// is furnished to do so, subject to the following conditions:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
// The above copyright notice and this permission notice shall be included in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
// all copies or substantial portions of the Software.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#include "lcms.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
// ---------------------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
static volatile int GlobalBlackPreservationStrategy = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
// Quantize a value 0 <= i < MaxSamples
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
WORD _cmsQuantizeVal(double i, int MaxSamples)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
       double x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
       x = ((double) i * 65535.) / (double) (MaxSamples - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
       return (WORD) floor(x + .5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
// Is a table linear?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
int cmsIsLinear(WORD Table[], int nEntries)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
       register int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
       int diff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
       for (i=0; i < nEntries; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
           diff = abs((int) Table[i] - (int) _cmsQuantizeVal(i, nEntries));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
           if (diff > 3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                     return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
       return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
// pow() restricted to integer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
static
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
int ipow(int base, int exp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        int res = base;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        while (--exp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
               res *= base;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        return res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
// Given n, 0<=n<=clut^dim, returns the colorant.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
static
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
int ComponentOf(int n, int clut, int nColorant)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        if (nColorant <= 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                return (n % clut);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        n /= ipow(clut, nColorant);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        return (n % clut);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
// This routine does a sweep on whole input space, and calls its callback
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
// function on knots. returns TRUE if all ok, FALSE otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   123
LCMSBOOL LCMSEXPORT cmsSample3DGrid(LPLUT Lut, _cmsSAMPLER Sampler, LPVOID Cargo, DWORD dwFlags)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
   int i, t, nTotalPoints, Colorant, index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
   WORD In[MAXCHANNELS], Out[MAXCHANNELS];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
   nTotalPoints = ipow(Lut->cLutPoints, Lut -> InputChan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
   index = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
   for (i = 0; i < nTotalPoints; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        for (t=0; t < (int) Lut -> InputChan; t++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                Colorant =  ComponentOf(i, Lut -> cLutPoints, (Lut -> InputChan - t  - 1 ));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                In[t]    = _cmsQuantizeVal(Colorant, Lut -> cLutPoints);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        if (dwFlags & SAMPLER_HASTL1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                 for (t=0; t < (int) Lut -> InputChan; t++)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                     In[t] = cmsReverseLinearInterpLUT16(In[t],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                                                Lut -> L1[t],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                                                &Lut -> In16params);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   148
        for (t=0; t < (int) Lut -> OutputChan; t++)
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   149
                     Out[t] = Lut->T[index + t];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   151
        if (dwFlags & SAMPLER_HASTL2) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
             for (t=0; t < (int) Lut -> OutputChan; t++)
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   154
                     Out[t] = cmsLinearInterpLUT16(Out[t],
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   155
                                                   Lut -> L2[t],
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   156
                                                   &Lut -> Out16params);
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   157
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        if (!Sampler(In, Out, Cargo))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                return FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        if (!(dwFlags & SAMPLER_INSPECT)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            if (dwFlags & SAMPLER_HASTL2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                for (t=0; t < (int) Lut -> OutputChan; t++)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                     Out[t] = cmsReverseLinearInterpLUT16(Out[t],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                                                   Lut -> L2[t],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                                                   &Lut -> Out16params);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            for (t=0; t < (int) Lut -> OutputChan; t++)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                        Lut->T[index + t] = Out[t];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        index += Lut -> OutputChan;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    return TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
// choose reasonable resolution
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
int _cmsReasonableGridpointsByColorspace(icColorSpaceSignature Colorspace, DWORD dwFlags)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    int nChannels;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    // Already specified?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    if (dwFlags & 0x00FF0000) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            // Yes, grab'em
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            return (dwFlags >> 16) & 0xFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    nChannels = _cmsChannelsOf(Colorspace);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    // HighResPrecalc is maximum resolution
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    if (dwFlags & cmsFLAGS_HIGHRESPRECALC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        if (nChannels > 4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                return 7;       // 7 for Hifi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        if (nChannels == 4)     // 23 for CMYK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                return 23;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        return 49;      // 49 for RGB and others
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    // LowResPrecal is stripped resolution
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    if (dwFlags & cmsFLAGS_LOWRESPRECALC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        if (nChannels > 4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                return 6;       // 6 for Hifi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        if (nChannels == 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                return 33;      // For monochrome
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        return 17;              // 17 for remaining
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    // Default values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    if (nChannels > 4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                return 7;       // 7 for Hifi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    if (nChannels == 4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
                return 17;      // 17 for CMYK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    return 33;                  // 33 for RGB
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
// Sampler implemented by another transform. This is a clean way to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
// precalculate the devicelink 3D CLUT for almost any transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
static
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
int XFormSampler(register WORD In[], register WORD Out[], register LPVOID Cargo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        cmsDoTransform((cmsHTRANSFORM) Cargo, In, Out, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        return TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
// This routine does compute the devicelink CLUT containing whole
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
// transform. Handles any channel number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
LPLUT _cmsPrecalculateDeviceLink(cmsHTRANSFORM h, DWORD dwFlags)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
       _LPcmsTRANSFORM p = (_LPcmsTRANSFORM) h;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
       LPLUT Grid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
       int nGridPoints;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
       DWORD dwFormatIn, dwFormatOut;
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   262
       DWORD SaveFormatIn, SaveFormatOut;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
       int ChannelsIn, ChannelsOut;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
       LPLUT SaveGamutLUT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   266
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
       // Remove any gamut checking
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
       SaveGamutLUT = p ->Gamut;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
       p ->Gamut = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
       ChannelsIn   = _cmsChannelsOf(p -> EntryColorSpace);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
       ChannelsOut  = _cmsChannelsOf(p -> ExitColorSpace);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
       nGridPoints = _cmsReasonableGridpointsByColorspace(p -> EntryColorSpace, dwFlags);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
       Grid =  cmsAllocLUT();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
       if (!Grid) return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
       Grid = cmsAlloc3DGrid(Grid, nGridPoints, ChannelsIn, ChannelsOut);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
       // Compute device link on 16-bit basis
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
       dwFormatIn   = (CHANNELS_SH(ChannelsIn)|BYTES_SH(2));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
       dwFormatOut  = (CHANNELS_SH(ChannelsOut)|BYTES_SH(2));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   285
       SaveFormatIn  = p ->InputFormat;
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   286
       SaveFormatOut = p ->OutputFormat;
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   287
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   288
       p -> InputFormat  = dwFormatIn;
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   289
       p -> OutputFormat = dwFormatOut;
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   290
       p -> FromInput    = _cmsIdentifyInputFormat(p, dwFormatIn);
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   291
       p -> ToOutput     = _cmsIdentifyOutputFormat(p, dwFormatOut);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
       // Fix gamut & gamma possible mismatches.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
       if (!(dwFlags & cmsFLAGS_NOPRELINEARIZATION)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
           cmsHTRANSFORM hOne[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
           hOne[0] = h;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
           _cmsComputePrelinearizationTablesFromXFORM(hOne, 1, Grid);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
       // Attention to this typecast! we can take the luxury to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
       // do this since cmsHTRANSFORM is only an alias to a pointer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
       // to the transform struct.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
       if (!cmsSample3DGrid(Grid, XFormSampler, (LPVOID) p, Grid -> wFlags)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                cmsFreeLUT(Grid);
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   310
                Grid = NULL;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   313
       p ->Gamut        = SaveGamutLUT;
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   314
       p ->InputFormat  = SaveFormatIn;
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   315
       p ->OutputFormat = SaveFormatOut;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
       return Grid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
// Sampler for Black-preserving CMYK->CMYK transforms
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                cmsHTRANSFORM cmyk2cmyk;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                cmsHTRANSFORM cmyk2Lab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                LPGAMMATABLE  KTone;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
                L16PARAMS     KToneParams;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
                LPLUT         LabK2cmyk;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                double        MaxError;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                cmsHTRANSFORM hRoundTrip;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                int           MaxTAC;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
                cmsHTRANSFORM hProofOutput;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    } BPCARGO, *LPBPCARGO;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
// Preserve black only if that is the only ink used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
static
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
int BlackPreservingGrayOnlySampler(register WORD In[], register WORD Out[], register LPVOID Cargo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    BPCARGO* bp = (LPBPCARGO) Cargo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    // If going across black only, keep black only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    if (In[0] == 0 && In[1] == 0 && In[2] == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        // TAC does not apply because it is black ink!
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        Out[0] = Out[1] = Out[2] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        Out[3] = cmsLinearInterpLUT16(In[3], bp->KTone ->GammaTable, &bp->KToneParams);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    // Keep normal transform for other colors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    cmsDoTransform(bp ->cmyk2cmyk, In, Out, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   363
// Preserve all K plane.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
static
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
int BlackPreservingSampler(register WORD In[], register WORD Out[], register LPVOID Cargo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    WORD LabK[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    double SumCMY, SumCMYK, Error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    cmsCIELab ColorimetricLab, BlackPreservingLab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    BPCARGO* bp = (LPBPCARGO) Cargo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    // Get the K across Tone curve
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    LabK[3] = cmsLinearInterpLUT16(In[3], bp->KTone ->GammaTable, &bp->KToneParams);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    // If going across black only, keep black only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    if (In[0] == 0 && In[1] == 0 && In[2] == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        Out[0] = Out[1] = Out[2] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        Out[3] = LabK[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    // Try the original transform, maybe K is already ok (valid on K=0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    cmsDoTransform(bp ->cmyk2cmyk, In, Out, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    if (Out[3] == LabK[3]) return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    // No, mesure and keep Lab measurement for further usage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    cmsDoTransform(bp->hProofOutput, Out, &ColorimetricLab, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    // Is not black only and the transform doesn't keep black.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    // Obtain the Lab of CMYK. After that we have Lab + K
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    cmsDoTransform(bp ->cmyk2Lab, In, LabK, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    // Obtain the corresponding CMY using reverse interpolation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    // As a seed, we use the colorimetric CMY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    cmsEvalLUTreverse(bp ->LabK2cmyk, LabK, Out, Out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    // Estimate the error
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
    cmsDoTransform(bp->hProofOutput, Out, &BlackPreservingLab, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    Error = cmsDeltaE(&ColorimetricLab, &BlackPreservingLab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    // Apply TAC if needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    SumCMY   = Out[0]  + Out[1] + Out[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    SumCMYK  = SumCMY + Out[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    if (SumCMYK > bp ->MaxTAC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        double Ratio = 1 - ((SumCMYK - bp->MaxTAC) / SumCMY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        if (Ratio < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
                  Ratio = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        Out[0] = (WORD) floor(Out[0] * Ratio + 0.5);     // C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        Out[1] = (WORD) floor(Out[1] * Ratio + 0.5);     // M
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        Out[2] = (WORD) floor(Out[2] * Ratio + 0.5);     // Y
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
// Sample whole gamut to estimate maximum TAC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
#ifdef _MSC_VER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
#pragma warning(disable : 4100)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
static
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
int EstimateTAC(register WORD In[], register WORD Out[], register LPVOID Cargo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
    BPCARGO* bp = (LPBPCARGO) Cargo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
    WORD RoundTrip[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
    int Sum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    cmsDoTransform(bp->hRoundTrip, In, RoundTrip, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    Sum = RoundTrip[0] + RoundTrip[1] + RoundTrip[2] + RoundTrip[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    if (Sum > bp ->MaxTAC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
            bp ->MaxTAC = Sum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
// Estimate the maximum error
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
static
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
int BlackPreservingEstimateErrorSampler(register WORD In[], register WORD Out[], register LPVOID Cargo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    BPCARGO* bp = (LPBPCARGO) Cargo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    WORD ColorimetricOut[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    cmsCIELab ColorimetricLab, BlackPreservingLab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    double Error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
    if (In[0] == 0 && In[1] == 0 && In[2] == 0) return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
    cmsDoTransform(bp->cmyk2cmyk, In, ColorimetricOut, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    cmsDoTransform(bp->hProofOutput, ColorimetricOut, &ColorimetricLab, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    cmsDoTransform(bp->hProofOutput, Out, &BlackPreservingLab, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    Error = cmsDeltaE(&ColorimetricLab, &BlackPreservingLab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    if (Error > bp ->MaxError)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        bp ->MaxError = Error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
// Setup the K preservation strategy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
int LCMSEXPORT cmsSetCMYKPreservationStrategy(int n)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
    int OldVal = GlobalBlackPreservationStrategy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
    if (n >= 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
            GlobalBlackPreservationStrategy = n;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
    return OldVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   484
#pragma warning(disable: 4550)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
// Get a pointer to callback on depending of strategy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
static
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
_cmsSAMPLER _cmsGetBlackPreservationSampler(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    switch (GlobalBlackPreservationStrategy) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        case 0: return BlackPreservingGrayOnlySampler;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
        default: return BlackPreservingSampler;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
// This is the black-preserving devicelink generator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
LPLUT _cmsPrecalculateBlackPreservingDeviceLink(cmsHTRANSFORM hCMYK2CMYK, DWORD dwFlags)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
       _LPcmsTRANSFORM p = (_LPcmsTRANSFORM) hCMYK2CMYK;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
       BPCARGO Cargo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
       LPLUT Grid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
       DWORD LocalFlags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
       cmsHPROFILE hLab = cmsCreateLabProfile(NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
       int nGridPoints;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
       icTagSignature Device2PCS[] = {icSigAToB0Tag,       // Perceptual
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
                                      icSigAToB1Tag,       // Relative colorimetric
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
                                      icSigAToB2Tag,       // Saturation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
                                      icSigAToB1Tag };     // Absolute colorimetric
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
                                                           // (Relative/WhitePoint)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
       nGridPoints = _cmsReasonableGridpointsByColorspace(p -> EntryColorSpace, dwFlags);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
       // Get a copy of inteserting flags for this kind of xform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
       LocalFlags = cmsFLAGS_NOTPRECALC;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
       if (p -> dwOriginalFlags & cmsFLAGS_BLACKPOINTCOMPENSATION)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
           LocalFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
       // Fill in cargo struct
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
       Cargo.cmyk2cmyk = hCMYK2CMYK;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   523
       // Compute tone curve.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
       Cargo.KTone  =  _cmsBuildKToneCurve(hCMYK2CMYK, 256);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
       if (Cargo.KTone == NULL) return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
       cmsCalcL16Params(Cargo.KTone ->nEntries, &Cargo.KToneParams);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
       // Create a CMYK->Lab "normal" transform on input, without K-preservation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
       Cargo.cmyk2Lab  = cmsCreateTransform(p ->InputProfile, TYPE_CMYK_16,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
                                            hLab, TYPE_Lab_16, p->Intent, LocalFlags);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
       // We are going to use the reverse of proof direction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
       Cargo.LabK2cmyk = cmsReadICCLut(p->OutputProfile, Device2PCS[p->Intent]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
       // Is there any table available?
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   537
       if (Cargo.LabK2cmyk == NULL) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   539
           Grid = NULL;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
           goto Cleanup;
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   541
       }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
       // Setup a roundtrip on output profile for TAC estimation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
       Cargo.hRoundTrip = cmsCreateTransform(p ->OutputProfile, TYPE_CMYK_16,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
                                             p ->OutputProfile, TYPE_CMYK_16, p->Intent, cmsFLAGS_NOTPRECALC);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
       // Setup a proof CMYK->Lab on output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
       Cargo.hProofOutput  = cmsCreateTransform(p ->OutputProfile, TYPE_CMYK_16,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
                                            hLab, TYPE_Lab_DBL, p->Intent, LocalFlags);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
       // Create an empty LUT for holding K-preserving xform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
       Grid =  cmsAllocLUT();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
       if (!Grid) goto Cleanup;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
       Grid = cmsAlloc3DGrid(Grid, nGridPoints, 4, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
       // Setup formatters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
       p -> FromInput = _cmsIdentifyInputFormat(p,  TYPE_CMYK_16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
       p -> ToOutput  = _cmsIdentifyOutputFormat(p, TYPE_CMYK_16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
       // Step #1, estimate TAC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
       Cargo.MaxTAC = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
       if (!cmsSample3DGrid(Grid, EstimateTAC, (LPVOID) &Cargo, 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
                cmsFreeLUT(Grid);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
                Grid = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
                goto Cleanup;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
       // Step #2, compute approximation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
       if (!cmsSample3DGrid(Grid, _cmsGetBlackPreservationSampler(), (LPVOID) &Cargo, 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
                cmsFreeLUT(Grid);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
                Grid = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
                goto Cleanup;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
       // Step #3, estimate error
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
        Cargo.MaxError = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
        cmsSample3DGrid(Grid, BlackPreservingEstimateErrorSampler, (LPVOID) &Cargo, SAMPLER_INSPECT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
Cleanup:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
       if (Cargo.cmyk2Lab) cmsDeleteTransform(Cargo.cmyk2Lab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
       if (Cargo.hRoundTrip) cmsDeleteTransform(Cargo.hRoundTrip);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
       if (Cargo.hProofOutput) cmsDeleteTransform(Cargo.hProofOutput);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
       if (hLab) cmsCloseProfile(hLab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
       if (Cargo.KTone) cmsFreeGamma(Cargo.KTone);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
       if (Cargo.LabK2cmyk) cmsFreeLUT(Cargo.LabK2cmyk);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
       return Grid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
// Fix broken LUT. just to obtain other CMS compatibility
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
static
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
void PatchLUT(LPLUT Grid, WORD At[], WORD Value[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
                     int nChannelsOut, int nChannelsIn)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
       LPL16PARAMS p16  = &Grid -> CLut16params;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
       double     px, py, pz, pw;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
       int        x0, y0, z0, w0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
       int        i, index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
       if (Grid ->wFlags & LUT_HASTL1) return;  // There is a prelinearization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
       px = ((double) At[0] * (p16->Domain)) / 65535.0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
       py = ((double) At[1] * (p16->Domain)) / 65535.0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
       pz = ((double) At[2] * (p16->Domain)) / 65535.0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
       pw = ((double) At[3] * (p16->Domain)) / 65535.0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
       x0 = (int) floor(px);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
       y0 = (int) floor(py);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
       z0 = (int) floor(pz);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
       w0 = (int) floor(pw);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
       if (nChannelsIn == 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
              if (((px - x0) != 0) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
                  ((py - y0) != 0) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
                  ((pz - z0) != 0) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
                  ((pw - w0) != 0)) return; // Not on exact node
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
              index = p16 -> opta4 * x0 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
                      p16 -> opta3 * y0 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
                      p16 -> opta2 * z0 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
                      p16 -> opta1 * w0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
       else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
       if (nChannelsIn == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
              if (((px - x0) != 0) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
                  ((py - y0) != 0) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
                  ((pz - z0) != 0)) return;  // Not on exact node
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
              index = p16 -> opta3 * x0 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
                      p16 -> opta2 * y0 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
                      p16 -> opta1 * z0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
       else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
       if (nChannelsIn == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
              if (((px - x0) != 0)) return; // Not on exact node
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
              index = p16 -> opta1 * x0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
       else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
           cmsSignalError(LCMS_ERRC_ABORTED, "(internal) %d Channels are not supported on PatchLUT", nChannelsIn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
           return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
       for (i=0; i < nChannelsOut; i++)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
              Grid -> T[index + i] = Value[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   669
LCMSBOOL _cmsFixWhiteMisalignment(_LPcmsTRANSFORM p)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
       WORD *WhitePointIn, *WhitePointOut, *BlackPointIn, *BlackPointOut;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
       int nOuts, nIns;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
       if (!p -> DeviceLink) return FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
       if (p ->Intent == INTENT_ABSOLUTE_COLORIMETRIC) return FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
       if ((p ->PreviewProfile != NULL) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
           (p ->ProofIntent == INTENT_ABSOLUTE_COLORIMETRIC)) return FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
       if (!_cmsEndPointsBySpace(p -> EntryColorSpace,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
                                 &WhitePointIn, &BlackPointIn, &nIns)) return FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
       if (!_cmsEndPointsBySpace(p -> ExitColorSpace,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
                                   &WhitePointOut, &BlackPointOut, &nOuts)) return FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
       // Fix white only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
       PatchLUT(p -> DeviceLink, WhitePointIn, WhitePointOut, nOuts, nIns);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
       // PatchLUT(p -> DeviceLink, BlackPointIn, BlackPointOut, nOuts, nIns);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
       return TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
}
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   697