/*
* 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-2011 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.
//
//---------------------------------------------------------------------------------
//
#ifndef _lcms_internal_H
// Include plug-in foundation
#ifndef _lcms_plugin_H
# include "lcms2_plugin.h"
#endif
// ctype is part of C99 as per 7.1.2
#include <ctype.h>
// assert macro is part of C99 as per 7.2
#include <assert.h>
// Some needed constants
#ifndef M_PI
#endif
#ifndef M_LOG10E
#endif
// BorlandC 5.5, VC2003 are broken on that
#endif
// Alignment of ICC file format uses 4 bytes (cmsUInt32Number)
// Alignment to memory pointer
// Maximum encodeable values in floating point
// Maximum of channels for internal pipeline evaluation
// Unused parameter warning supression
#define cmsUNUSED_PARAMETER(x) ((void)x)
// unfortunately VisualC++ does not conform that
#if defined(_MSC_VER) || defined(__BORLANDC__)
#else
# define cmsINLINE static inline
#endif
// Other replacement functions
#ifdef _MSC_VER
# ifndef snprintf
# endif
# ifndef vsnprintf
# endif
#endif
// Code analysis is broken on asserts
#ifdef _MSC_VER
# if (_MSC_VER >= 1500)
# else
# endif
#else
#endif
//---------------------------------------------------------------------------------
// Determinant lower than that are assumed zero (used on matrix invert)
//---------------------------------------------------------------------------------
// Fixed point
// -----------------------------------------------------------------------------------------------------------
// Fast floor conversion logic. Thanks to Sree Kotay and Stuart Nixon
// note than this only works in the range ..-32767...+32767 because
// mantissa is interpreted as 15.16 fixed point.
// The union is to avoid pointer aliasing overoptimization.
{
#ifdef CMS_DONT_USE_FAST_FLOOR
#else
const cmsFloat64Number _lcms_double2fixmagic = 68719476736.0 * 1.5; // 2^36 * 1.5, (52-16=36) uses limited precision to floor
union {
int halves[2];
} temp;
#ifdef CMS_USE_BIG_ENDIAN
#else
#endif
#endif
}
// Fast floor restricted to 0..65535.0
{
}
// Floor to word, taking care of saturation
{
d += 0.5;
if (d <= 0) return 0;
if (d >= 65535.0) return 0xffff;
return _cmsQuickFloorWord(d);
}
// Plug-In registering ---------------------------------------------------------------
// Specialized function for plug-in memory management. No pairing free() since whole pool is freed at once.
// Memory management
// Interpolation
// Parametric curves
// Formatters management
// Tag type management
// Tag management
// Intent management
// Multi Process elements
// Optimization
// Transform
// ---------------------------------------------------------------------------------------------------------
// Suballocators. Those are blocks of memory that is freed at the end on whole block.
typedef struct _cmsSubAllocator_chunk_st {
typedef struct {
void _cmsSubAllocDestroy(_cmsSubAllocator* s);
// ----------------------------------------------------------------------------------
// MLU internal representation
typedef struct {
} _cmsMLUentry;
struct _cms_MLU_struct {
// The directory
int AllocatedEntries;
int UsedEntries;
// The Pool
};
// Named color list internal representation
typedef struct {
struct _cms_NAMEDCOLORLIST_struct {
};
// ----------------------------------------------------------------------------------
// This is the internal struct holding profile details.
// Maximum supported tags in a profile
typedef struct _cms_iccprofile_struct {
// I/O handler
// The thread ID
// Creation time
// Only most important items found in ICC profiles
// Dictionary
cmsTagTypeHandler* TagTypeHandlers[MAX_TABLE_TAG]; // Same structure may be serialized on different types
// depending on profile version, so we keep track of the // type handler for each tag in the list.
// Special
// IO helpers for profiles
// Tag types
// Error logging ---------------------------------------------------------------------------------------------------------
// Interpolation ---------------------------------------------------------------------------------------------------------
cmsInterpParams* _cmsComputeInterpParams(cmsContext ContextID, int nSamples, int InputChan, int OutputChan, const void* Table, cmsUInt32Number dwFlags);
cmsInterpParams* _cmsComputeInterpParamsEx(cmsContext ContextID, const cmsUInt32Number nSamples[], int InputChan, int OutputChan, const void* Table, cmsUInt32Number dwFlags);
void _cmsFreeInterpParams(cmsInterpParams* p);
// Curves ----------------------------------------------------------------------------------------------------------------
// This struct holds information about a segment, plus a pointer to the function that implements the evaluation.
// In the case of table-based, Eval pointer is set to NULL
// The gamma function main structure
struct _cms_curve_struct {
cmsInterpParams** SegInterp; // Array of private optimizations for interpolation in table-based segments
// 16 bit Table-based representation follows
};
// Pipelines & Stages ---------------------------------------------------------------------------------------------
// A single stage
struct _cmsStage_struct {
// A generic pointer to whatever memory needed by the stage
void* Data;
// Maintains linked list (used internally)
};
// Special Stages (cannot be saved)
// For curve set only
// Pipeline Evaluator (in floating point)
const void* Data);
struct _cmsPipeline_struct {
// Data & evaluators
void *Data;
};
// LUT reading & creation -------------------------------------------------------------------------------------------
// Read tags using low-level function, provide necessary glue code to adapt versions, etc. All those return a brand new copy
// of the LUTS, since ownership of original is up to the profile. The user should free allocated resources.
// Special values
// Profile linker --------------------------------------------------------------------------------------------------
// Sequence --------------------------------------------------------------------------------------------------------
cmsSEQ* _cmsCompileProfileSequence(cmsContext ContextID, cmsUInt32Number nProfiles, cmsHPROFILE hProfiles[]);
// LUT optimization ------------------------------------------------------------------------------------------------
int _cmsReasonableGridpointsByColorspace(cmsColorSpaceSignature Colorspace, cmsUInt32Number dwFlags);
int Intent,
// Hi level LUT building ----------------------------------------------------------------------------------------------
// Formatters ------------------------------------------------------------------------------------------------------------
#ifndef CMS_NO_HALF_SUPPORT
// Half float
#endif
// Transform logic ------------------------------------------------------------------------------------------------------
struct _cmstransform_struct;
typedef struct {
// 1-pixel cache (16 bits only)
} _cmsCACHE;
// Transformation
typedef struct _cmstransform_struct {
// Points to transform code
// Formatters, cannot be embedded into LUT because cache
// 1-pixel cache seed for zero as input (16 bits, read only)
// A Pipeline holding the full (optimized) transform
// A Pipeline holding the gamut check. It goes from the input space to bilevel
// Colorant tables
// Informational only
// Profiles used to create the transform
// The intent of this transform. That is usually the last intent in the profilechain, but may differ
// An id that uniquely identifies the running context. May be null.
// A user-defined pointer that can be used to store data for transform plug-ins
void* UserData;
// --------------------------------------------------------------------------------------------------
const cmsUInt32Number Intents[],
const cmsHPROFILE hProfiles[],
const cmsFloat64Number AdaptationStates[],
const cmsUInt32Number Intents[],
const cmsHPROFILE hProfiles[],
const cmsFloat64Number AdaptationStates[],
cmsBool _cmsAdaptationMatrix(cmsMAT3* r, const cmsMAT3* ConeMatrix, const cmsCIEXYZ* FromIll, const cmsCIEXYZ* ToIll);
cmsBool _cmsBuildRGB2XYZtransferMatrix(cmsMAT3* r, const cmsCIExyY* WhitePoint, const cmsCIExyYTRIPLE* Primaries);
#define _lcms_internal_H
#endif