/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// This file is available under and governed by the GNU General Public
// License version 2 only, as published by the Free Software Foundation.
// However, the following notice accompanied the original version of this
// file:
//
//---------------------------------------------------------------------------------
//
// Little Color Management System
// Copyright (c) 1998-2012 Marti Maria Saguer
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//---------------------------------------------------------------------------------
//
#include "lcms2_internal.h"
// This module incorporates several interpolation routines, for 1 to 8 channels on input and
// up to 65535 channels on output. The user may change those by using the interpolation plug-in
// Interpolation routines by default
static cmsInterpFunction DefaultInterpolatorsFactory(cmsUInt32Number nInputChannels, cmsUInt32Number nOutputChannels, cmsUInt32Number dwFlags);
// This is the default factory
// Main plug-in entry
{
return TRUE;
}
// Set replacement functions
return TRUE;
}
// Set the interpolation method
{
// Invoke factory, possibly in the Plug-in
// If unsupported by the plug-in, go for the LittleCMS default.
// If happens only if an extern plug-in is being used
// Check for valid interpolator (we just check one member of the union)
return FALSE;
}
return TRUE;
}
// This function precalculates as many parameters as possible to speed up the interpolation.
const cmsUInt32Number nSamples[],
int InputChan, int OutputChan,
const void *Table,
{
cmsInterpParams* p;
int i;
// Check for maximum inputs
if (InputChan > MAX_INPUT_DIMENSIONS) {
cmsSignalError(ContextID, cmsERROR_RANGE, "Too many input channels (%d channels, max=%d)", InputChan, MAX_INPUT_DIMENSIONS);
return NULL;
}
// Creates an empty object
// Keep original parameters
p -> nOutputs = OutputChan;
// Fill samples per input direction and domain (which is number of nodes minus one)
for (i=0; i < InputChan; i++) {
}
// Compute factors to apply to each component to index the grid array
for (i=1; i < InputChan; i++)
if (!_cmsSetInterpolationRoutine(p)) {
cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported interpolation (%d->%d channels)", InputChan, OutputChan);
return NULL;
}
// All seems ok
return p;
}
// This one is a wrapper on the anterior, but assuming all directions have same number of nodes
cmsInterpParams* _cmsComputeInterpParams(cmsContext ContextID, int nSamples, int InputChan, int OutputChan, const void* Table, cmsUInt32Number dwFlags)
{
int i;
// Fill the auxiliar array
for (i=0; i < MAX_INPUT_DIMENSIONS; i++)
// Call the extended function
}
// Free all associated memory
{
}
// Inline fixed point interpolation
cmsINLINE cmsUInt16Number LinearInterp(cmsS15Fixed16Number a, cmsS15Fixed16Number l, cmsS15Fixed16Number h)
{
return (cmsUInt16Number) (dif);
}
// Linear interpolation (Fixed-point optimized)
static
register cmsUInt16Number Output[],
register const cmsInterpParams* p)
{
int val3;
// if last value...
if (Value[0] == 0xffff) {
return;
}
}
// Floating-point version of 1D interpolation
static
const cmsInterpParams* p)
{
// if last value...
if (Value[0] == 1.0) {
return;
}
// Rest is 16 LSB bits
}
// Eval gray LUT having only one input channel
static
register cmsUInt16Number Output[],
register const cmsInterpParams* p16)
{
int v;
fk = _cmsToFixedDomain(v);
}
}
// Eval gray LUT having only one input channel
static
const cmsInterpParams* p)
{
// if last value...
if (Value[0] == 1.0) {
return;
}
// Rest is 16 LSB bits
}
}
// Bilinear interpolation (16 bits) - cmsFloat32Number version
static
const cmsInterpParams* p)
{
dxy;
}
}
// Bilinear interpolation (16 bits) - optimized version
static
register cmsUInt16Number Output[],
register const cmsInterpParams* p)
{
dxy;
}
}
// Trilinear interpolation (16 bits) - cmsFloat32Number version
static
const cmsInterpParams* p)
{
// We need some clipping here
}
}
// Trilinear interpolation (16 bits) - optimized version
static
register cmsUInt16Number Output[],
register const cmsInterpParams* p)
{
}
}
// Tetrahedral interpolation, using Sakamoto algorithm.
static
const cmsInterpParams* p)
{
// We need some clipping here
// These are the 6 Tetrahedral
}
else
}
else
}
else
}
else
}
else
}
else {
}
}
}
static
register cmsUInt16Number Output[],
register const cmsInterpParams* p)
{
// Output should be computed as x = ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest))
// which expands as: x = (Rest + ((Rest+0x7fff)/0xFFFF) + 0x8000)>>16
// This can be replaced by: t = Rest+0x8001, x = (t + (t>>16))>>16
// at the cost of being off by one at 7fff and 17ffe.
}
}
} else {
}
}
} else {
}
}
} else {
}
}
}
}
static
register cmsUInt16Number Output[],
register const cmsInterpParams* p16)
{
}
else
}
else
}
else
}
else
}
else
}
else {
}
}
}
else
}
else
}
else
}
else
}
else
}
else {
}
}
}
}
// For more that 3 inputs (i.e., CMYK)
// evaluate two 3-dimensional interpolations and then linearly interpolate between them.
static
const cmsInterpParams* p)
{
const cmsFloat32Number* T;
p1 = *p;
for (i=0; i < p -> nOutputs; i++)
{
}
}
static
register cmsUInt16Number Output[],
register const cmsInterpParams* p16)
{
const cmsUInt16Number* T;
}
}
static
const cmsInterpParams* p)
{
const cmsFloat32Number* T;
p1 = *p;
for (i=0; i < p -> nOutputs; i++) {
}
}
static
register cmsUInt16Number Output[],
register const cmsInterpParams* p16)
{
const cmsUInt16Number* T;
}
}
static
const cmsInterpParams* p)
{
const cmsFloat32Number* T;
p1 = *p;
for (i=0; i < p -> nOutputs; i++) {
}
}
static
register cmsUInt16Number Output[],
register const cmsInterpParams* p16)
{
const cmsUInt16Number* T;
}
}
static
const cmsInterpParams* p)
{
const cmsFloat32Number* T;
p1 = *p;
for (i=0; i < p -> nOutputs; i++) {
}
}
static
register cmsUInt16Number Output[],
register const cmsInterpParams* p16)
{
const cmsUInt16Number* T;
}
}
static
const cmsInterpParams* p)
{
const cmsFloat32Number* T;
p1 = *p;
for (i=0; i < p -> nOutputs; i++) {
}
}
// The default factory
static
cmsInterpFunction DefaultInterpolatorsFactory(cmsUInt32Number nInputChannels, cmsUInt32Number nOutputChannels, cmsUInt32Number dwFlags)
{
// Safety check
return Interpolation;
switch (nInputChannels) {
case 1: // Gray LUT / linear
if (nOutputChannels == 1) {
if (IsFloat)
else
}
else {
if (IsFloat)
else
}
break;
case 2: // Duotone
if (IsFloat)
else
break;
case 3: // RGB et al
if (IsTrilinear) {
if (IsFloat)
else
}
else {
if (IsFloat)
else {
}
}
break;
case 4: // CMYK lut
if (IsFloat)
else
break;
case 5: // 5 Inks
if (IsFloat)
else
break;
case 6: // 6 Inks
if (IsFloat)
else
break;
case 7: // 7 inks
if (IsFloat)
else
break;
case 8: // 8 inks
if (IsFloat)
else
break;
break;
default:
}
return Interpolation;
}