< prev index next >
src/java.desktop/share/native/liblcms/cmscnvrt.c
Print this page
*** 28,38 ****
// file:
//
//---------------------------------------------------------------------------------
//
// Little Color Management System
! // Copyright (c) 1998-2017 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,
--- 28,38 ----
// file:
//
//---------------------------------------------------------------------------------
//
// Little Color Management System
! // Copyright (c) 1998-2020 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,
*** 54,76 ****
//
#include "lcms2_internal.h"
- // Link several profiles to obtain a single LUT modelling the whole color transform. Intents, Black point
- // compensation and Adaptation parameters may vary across profiles. BPC and Adaptation refers to the PCS
- // after the profile. I.e, BPC[0] refers to connexion between profile(0) and profile(1)
- cmsPipeline* _cmsLinkProfiles(cmsContext ContextID,
- cmsUInt32Number nProfiles,
- cmsUInt32Number Intents[],
- cmsHPROFILE hProfiles[],
- cmsBool BPC[],
- cmsFloat64Number AdaptationStates[],
- cmsUInt32Number dwFlags);
-
- //---------------------------------------------------------------------------------
-
// This is the default routine for ICC-style intents. A user may decide to override it by using a plugin.
// Supported intents are perceptual, relative colorimetric, saturation and ICC-absolute colorimetric
static
cmsPipeline* DefaultICCintents(cmsContext ContextID,
cmsUInt32Number nProfiles,
--- 54,63 ----
*** 737,747 ****
} GrayOnlyParams;
// Preserve black only if that is the only ink used
static
! int BlackPreservingGrayOnlySampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
{
GrayOnlyParams* bp = (GrayOnlyParams*) Cargo;
// If going across black only, keep black only
if (In[0] == 0 && In[1] == 0 && In[2] == 0) {
--- 724,734 ----
} GrayOnlyParams;
// Preserve black only if that is the only ink used
static
! int BlackPreservingGrayOnlySampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo)
{
GrayOnlyParams* bp = (GrayOnlyParams*) Cargo;
// If going across black only, keep black only
if (In[0] == 0 && In[1] == 0 && In[2] == 0) {
*** 864,874 ****
} PreserveKPlaneParams;
// The CLUT will be stored at 16 bits, but calculations are performed at cmsFloat32Number precision
static
! int BlackPreservingSampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
{
int i;
cmsFloat32Number Inf[4], Outf[4];
cmsFloat32Number LabK[4];
cmsFloat64Number SumCMY, SumCMYK, Error, Ratio;
--- 851,861 ----
} PreserveKPlaneParams;
// The CLUT will be stored at 16 bits, but calculations are performed at cmsFloat32Number precision
static
! int BlackPreservingSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo)
{
int i;
cmsFloat32Number Inf[4], Outf[4];
cmsFloat32Number LabK[4];
cmsFloat64Number SumCMY, SumCMYK, Error, Ratio;
*** 889,910 ****
Out[3] = _cmsQuickSaturateWord(LabK[3] * 65535.0);
return TRUE;
}
// Try the original transform,
! cmsPipelineEvalFloat( Inf, Outf, bp ->cmyk2cmyk);
// Store a copy of the floating point result into 16-bit
for (i=0; i < 4; i++)
Out[i] = _cmsQuickSaturateWord(Outf[i] * 65535.0);
// Maybe K is already ok (mostly on K=0)
! if ( fabs(Outf[3] - LabK[3]) < (3.0 / 65535.0) ) {
return TRUE;
}
! // K differ, mesure and keep Lab measurement for further usage
// this is done in relative colorimetric intent
cmsDoTransform(bp->hProofOutput, Out, &ColorimetricLab, 1);
// Is not black only and the transform doesn't keep black.
// Obtain the Lab of output CMYK. After that we have Lab + K
--- 876,897 ----
Out[3] = _cmsQuickSaturateWord(LabK[3] * 65535.0);
return TRUE;
}
// Try the original transform,
! cmsPipelineEvalFloat(Inf, Outf, bp ->cmyk2cmyk);
// Store a copy of the floating point result into 16-bit
for (i=0; i < 4; i++)
Out[i] = _cmsQuickSaturateWord(Outf[i] * 65535.0);
// Maybe K is already ok (mostly on K=0)
! if (fabsf(Outf[3] - LabK[3]) < (3.0 / 65535.0)) {
return TRUE;
}
! // K differ, measure and keep Lab measurement for further usage
// this is done in relative colorimetric intent
cmsDoTransform(bp->hProofOutput, Out, &ColorimetricLab, 1);
// Is not black only and the transform doesn't keep black.
// Obtain the Lab of output CMYK. After that we have Lab + K
*** 921,931 ****
// Make sure to pass through K (which now is fixed)
Outf[3] = LabK[3];
// Apply TAC if needed
! SumCMY = Outf[0] + Outf[1] + Outf[2];
SumCMYK = SumCMY + Outf[3];
if (SumCMYK > bp ->MaxTAC) {
Ratio = 1 - ((SumCMYK - bp->MaxTAC) / SumCMY);
--- 908,918 ----
// Make sure to pass through K (which now is fixed)
Outf[3] = LabK[3];
// Apply TAC if needed
! SumCMY = (cmsFloat64Number) Outf[0] + Outf[1] + Outf[2];
SumCMYK = SumCMY + Outf[3];
if (SumCMYK > bp ->MaxTAC) {
Ratio = 1 - ((SumCMYK - bp->MaxTAC) / SumCMY);
< prev index next >