Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
fd3017ff
Commit
fd3017ff
authored
Nov 08, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lcms2: Import upstream release 2.14.
parent
cfe8ee57
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
482 additions
and
123 deletions
+482
-123
lcms2.h
libs/lcms2/include/lcms2.h
+19
-3
lcms2_plugin.h
libs/lcms2/include/lcms2_plugin.h
+21
-1
cmscnvrt.c
libs/lcms2/src/cmscnvrt.c
+2
-2
cmserr.c
libs/lcms2/src/cmserr.c
+43
-1
cmsgamma.c
libs/lcms2/src/cmsgamma.c
+9
-4
cmsgmt.c
libs/lcms2/src/cmsgmt.c
+8
-3
cmshalf.c
libs/lcms2/src/cmshalf.c
+1
-1
cmsio0.c
libs/lcms2/src/cmsio0.c
+136
-17
cmsio1.c
libs/lcms2/src/cmsio1.c
+1
-4
cmslut.c
libs/lcms2/src/cmslut.c
+1
-1
cmsnamed.c
libs/lcms2/src/cmsnamed.c
+5
-1
cmsopt.c
libs/lcms2/src/cmsopt.c
+2
-2
cmspack.c
libs/lcms2/src/cmspack.c
+22
-5
cmspcs.c
libs/lcms2/src/cmspcs.c
+13
-2
cmsplugin.c
libs/lcms2/src/cmsplugin.c
+47
-29
cmssamp.c
libs/lcms2/src/cmssamp.c
+7
-1
cmstypes.c
libs/lcms2/src/cmstypes.c
+0
-0
cmsvirt.c
libs/lcms2/src/cmsvirt.c
+16
-15
cmsxform.c
libs/lcms2/src/cmsxform.c
+75
-4
lcms2_internal.h
libs/lcms2/src/lcms2_internal.h
+54
-27
No files found.
libs/lcms2/include/lcms2.h
View file @
fd3017ff
...
...
@@ -23,7 +23,7 @@
//
//---------------------------------------------------------------------------------
//
// Version 2.1
3.1
// Version 2.1
4
//
#ifndef _lcms2_H
...
...
@@ -81,7 +81,7 @@ extern "C" {
#endif
// Version/release
#define LCMS_VERSION 21
31
#define LCMS_VERSION 21
40
// I will give the chance of redefining basic types for compilers that are not fully C99 compliant
#ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
...
...
@@ -152,7 +152,7 @@ typedef double cmsFloat64Number;
#endif
// Handle "register" keyword
#if defined(CMS_NO_REGISTER_KEYWORD)
&& !defined(CMS_DLL) && !defined(CMS_DLL_BUILD)
#if defined(CMS_NO_REGISTER_KEYWORD)
# define CMSREGISTER
#else
# define CMSREGISTER register
...
...
@@ -290,6 +290,7 @@ typedef int cmsBool;
// Base ICC type definitions
typedef
enum
{
cmsSigChromaticityType
=
0x6368726D
,
// 'chrm'
cmsSigcicpType
=
0x63696370
,
// 'cicp'
cmsSigColorantOrderType
=
0x636C726F
,
// 'clro'
cmsSigColorantTableType
=
0x636C7274
,
// 'clrt'
cmsSigCrdInfoType
=
0x63726469
,
// 'crdi'
...
...
@@ -401,6 +402,7 @@ typedef enum {
cmsSigViewingConditionsTag
=
0x76696577
,
// 'view'
cmsSigVcgtTag
=
0x76636774
,
// 'vcgt'
cmsSigMetaTag
=
0x6D657461
,
// 'meta'
cmsSigcicpTag
=
0x63696370
,
// 'cicp'
cmsSigArgyllArtsTag
=
0x61727473
// 'arts'
}
cmsTagSignature
;
...
...
@@ -1038,6 +1040,16 @@ typedef struct {
}
cmsICCViewingConditions
;
typedef
struct
{
cmsUInt8Number
ColourPrimaries
;
// Recommendation ITU-T H.273
cmsUInt8Number
TransferCharacteristics
;
// (ISO/IEC 23091-2)
cmsUInt8Number
MatrixCoefficients
;
cmsUInt8Number
VideoFullRangeFlag
;
}
cmsVideoSignalType
;
// Get LittleCMS version (for shared objects) -----------------------------------------------------------------------------
CMSAPI
int
CMSEXPORT
cmsGetEncodedCMMversion
(
void
);
...
...
@@ -1520,8 +1532,12 @@ CMSAPI cmsBool CMSEXPORT cmsIsCLUT(cmsHPROFILE hProfile, cmsUInt32Numb
CMSAPI
cmsColorSpaceSignature
CMSEXPORT
_cmsICCcolorSpace
(
int
OurNotation
);
CMSAPI
int
CMSEXPORT
_cmsLCMScolorSpace
(
cmsColorSpaceSignature
ProfileSpace
);
// Deprecated, use cmsChannelsOfColorSpace instead
CMSAPI
cmsUInt32Number
CMSEXPORT
cmsChannelsOf
(
cmsColorSpaceSignature
ColorSpace
);
// Get number of channels of color space or -1 if color space is not listed/supported
CMSAPI
cmsInt32Number
CMSEXPORT
cmsChannelsOfColorSpace
(
cmsColorSpaceSignature
ColorSpace
);
// Build a suitable formatter for the colorspace of this profile. nBytes=1 means 8 bits, nBytes=2 means 16 bits.
CMSAPI
cmsUInt32Number
CMSEXPORT
cmsFormatterForColorspaceOfProfile
(
cmsHPROFILE
hProfile
,
cmsUInt32Number
nBytes
,
cmsBool
lIsFloat
);
CMSAPI
cmsUInt32Number
CMSEXPORT
cmsFormatterForPCSOfProfile
(
cmsHPROFILE
hProfile
,
cmsUInt32Number
nBytes
,
cmsBool
lIsFloat
);
...
...
libs/lcms2/include/lcms2_plugin.h
View file @
fd3017ff
...
...
@@ -209,6 +209,7 @@ typedef void* (* _cmsDupUserDataFn)(cmsContext ContextID, const void* Data);
#define cmsPluginOptimizationSig 0x6F707448 // 'optH'
#define cmsPluginTransformSig 0x7A666D48 // 'xfmH'
#define cmsPluginMutexSig 0x6D747A48 // 'mtxH'
#define cmsPluginParalellizationSig 0x70726C48 // 'prlH
typedef
struct
_cmsPluginBaseStruct
{
...
...
@@ -596,7 +597,7 @@ typedef void (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo, //
const
void
*
InputBuffer
,
void
*
OutputBuffer
,
cmsUInt32Number
Size
,
cmsUInt32Number
Stride
);
// Stride in bytes to the next plan
a
in planar formats
cmsUInt32Number
Stride
);
// Stride in bytes to the next plan
e
in planar formats
typedef
void
(
*
_cmsTransform2Fn
)(
struct
_cmstransform_struct
*
CMMcargo
,
...
...
@@ -669,6 +670,25 @@ CMSAPI void CMSEXPORT _cmsDestroyMutex(cmsContext ContextID, void* mtx);
CMSAPI
cmsBool
CMSEXPORT
_cmsLockMutex
(
cmsContext
ContextID
,
void
*
mtx
);
CMSAPI
void
CMSEXPORT
_cmsUnlockMutex
(
cmsContext
ContextID
,
void
*
mtx
);
//----------------------------------------------------------------------------------------------------------
// Parallelization
CMSAPI
_cmsTransform2Fn
CMSEXPORT
_cmsGetTransformWorker
(
struct
_cmstransform_struct
*
CMMcargo
);
CMSAPI
cmsInt32Number
CMSEXPORT
_cmsGetTransformMaxWorkers
(
struct
_cmstransform_struct
*
CMMcargo
);
CMSAPI
cmsUInt32Number
CMSEXPORT
_cmsGetTransformWorkerFlags
(
struct
_cmstransform_struct
*
CMMcargo
);
// Let's plug-in to guess the best number of workers
#define CMS_GUESS_MAX_WORKERS -1
typedef
struct
{
cmsPluginBase
base
;
cmsInt32Number
MaxWorkers
;
// Number of starts to do as maximum
cmsUInt32Number
WorkerFlags
;
// Reserved
_cmsTransform2Fn
SchedulerFn
;
// callback to setup functions
}
cmsPluginParalellization
;
#ifndef CMS_USE_CPP_API
# ifdef __cplusplus
...
...
libs/lcms2/src/cmscnvrt.c
View file @
fd3017ff
...
...
@@ -386,7 +386,7 @@ cmsBool ComputeConversion(cmsUInt32Number i,
if
(
BPC
)
{
cmsCIEXYZ
BlackPointIn
,
BlackPointOut
;
cmsCIEXYZ
BlackPointIn
=
{
0
,
0
,
0
},
BlackPointOut
=
{
0
,
0
,
0
}
;
cmsDetectBlackPoint
(
&
BlackPointIn
,
hProfiles
[
i
-
1
],
Intent
,
0
);
cmsDetectDestinationBlackPoint
(
&
BlackPointOut
,
hProfiles
[
i
],
Intent
,
0
);
...
...
@@ -630,7 +630,7 @@ cmsPipeline* DefaultICCintents(cmsContext ContextID,
ColorSpaceOut
==
cmsSigRgbData
||
ColorSpaceOut
==
cmsSigCmykData
)
{
cmsStage
*
clip
=
_cmsStageClipNegatives
(
Result
->
ContextID
,
cmsChannelsOf
(
ColorSpaceOut
));
cmsStage
*
clip
=
_cmsStageClipNegatives
(
Result
->
ContextID
,
cmsChannelsOf
ColorSpace
(
ColorSpaceOut
));
if
(
clip
==
NULL
)
goto
Error
;
if
(
!
cmsPipelineInsertStage
(
Result
,
cmsAT_END
,
clip
))
...
...
libs/lcms2/src/cmserr.c
View file @
fd3017ff
...
...
@@ -613,7 +613,6 @@ cmsBool _cmsRegisterMutexPlugin(cmsContext ContextID, cmsPluginBase* Data)
if
(
Plugin
->
CreateMutexPtr
==
NULL
||
Plugin
->
DestroyMutexPtr
==
NULL
||
Plugin
->
LockMutexPtr
==
NULL
||
Plugin
->
UnlockMutexPtr
==
NULL
)
return
FALSE
;
ctx
->
CreateMutexPtr
=
Plugin
->
CreateMutexPtr
;
ctx
->
DestroyMutexPtr
=
Plugin
->
DestroyMutexPtr
;
ctx
->
LockMutexPtr
=
Plugin
->
LockMutexPtr
;
...
...
@@ -661,3 +660,46 @@ void CMSEXPORT _cmsUnlockMutex(cmsContext ContextID, void* mtx)
ptr
->
UnlockMutexPtr
(
ContextID
,
mtx
);
}
}
// The global Context0 storage for parallelization plug-in
_cmsParallelizationPluginChunkType
_cmsParallelizationPluginChunk
=
{
0
};
// Allocate parallelization container.
void
_cmsAllocParallelizationPluginChunk
(
struct
_cmsContext_struct
*
ctx
,
const
struct
_cmsContext_struct
*
src
)
{
if
(
src
!=
NULL
)
{
void
*
from
=
src
->
chunks
[
ParallelizationPlugin
];
ctx
->
chunks
[
ParallelizationPlugin
]
=
_cmsSubAllocDup
(
ctx
->
MemPool
,
from
,
sizeof
(
_cmsParallelizationPluginChunkType
));
}
else
{
_cmsParallelizationPluginChunkType
ParallelizationPluginChunk
=
{
0
};
ctx
->
chunks
[
ParallelizationPlugin
]
=
_cmsSubAllocDup
(
ctx
->
MemPool
,
&
ParallelizationPluginChunk
,
sizeof
(
_cmsParallelizationPluginChunkType
));
}
}
// Register parallel processing
cmsBool
_cmsRegisterParallelizationPlugin
(
cmsContext
ContextID
,
cmsPluginBase
*
Data
)
{
cmsPluginParalellization
*
Plugin
=
(
cmsPluginParalellization
*
)
Data
;
_cmsParallelizationPluginChunkType
*
ctx
=
(
_cmsParallelizationPluginChunkType
*
)
_cmsContextGetClientChunk
(
ContextID
,
ParallelizationPlugin
);
if
(
Data
==
NULL
)
{
// No parallelization routines
ctx
->
MaxWorkers
=
0
;
ctx
->
WorkerFlags
=
0
;
ctx
->
SchedulerFn
=
NULL
;
return
TRUE
;
}
// callback is required
if
(
Plugin
->
SchedulerFn
==
NULL
)
return
FALSE
;
ctx
->
MaxWorkers
=
Plugin
->
MaxWorkers
;
ctx
->
WorkerFlags
=
Plugin
->
WorkerFlags
;
ctx
->
SchedulerFn
=
Plugin
->
SchedulerFn
;
// All is ok
return
TRUE
;
}
libs/lcms2/src/cmsgamma.c
View file @
fd3017ff
...
...
@@ -427,8 +427,8 @@ cmsFloat64Number DefaultEvalParametricFn(cmsInt32Number Type, const cmsFloat64Nu
// IEC 61966-3
// Y = (aX + b)^Gamma | X <= -b/a
// Y = c | else
// Y = (aX + b)^Gamma
+ c
| X <= -b/a
// Y = c
| else
case
3
:
{
if
(
fabs
(
Params
[
1
])
<
MATRIX_DET_TOLERANCE
)
...
...
@@ -462,7 +462,8 @@ cmsFloat64Number DefaultEvalParametricFn(cmsInt32Number Type, const cmsFloat64Nu
// X=-b/a | (Y<c)
case
-
3
:
{
if
(
fabs
(
Params
[
1
])
<
MATRIX_DET_TOLERANCE
)
if
(
fabs
(
Params
[
0
])
<
MATRIX_DET_TOLERANCE
||
fabs
(
Params
[
1
])
<
MATRIX_DET_TOLERANCE
)
{
Val
=
0
;
}
...
...
@@ -601,7 +602,8 @@ cmsFloat64Number DefaultEvalParametricFn(cmsInt32Number Type, const cmsFloat64Nu
// ((Y - c) ^1/Gamma - b) / a
case
-
6
:
{
if
(
fabs
(
Params
[
1
])
<
MATRIX_DET_TOLERANCE
)
if
(
fabs
(
Params
[
0
])
<
MATRIX_DET_TOLERANCE
||
fabs
(
Params
[
1
])
<
MATRIX_DET_TOLERANCE
)
{
Val
=
0
;
}
...
...
@@ -1473,6 +1475,9 @@ cmsFloat64Number CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Num
}
}
// We need enough valid samples
if
(
n
<=
1
)
return
-
1
.
0
;
// Take a look on SD to see if gamma isn't exponential at all
Std
=
sqrt
((
n
*
sum2
-
sum
*
sum
)
/
(
n
*
(
n
-
1
)));
...
...
libs/lcms2/src/cmsgmt.c
View file @
fd3017ff
...
...
@@ -297,7 +297,8 @@ cmsPipeline* _cmsCreateGamutCheckPipeline(cmsContext ContextID,
cmsStage
*
CLUT
;
cmsUInt32Number
dwFormat
;
GAMUTCHAIN
Chain
;
cmsUInt32Number
nChannels
,
nGridpoints
;
cmsUInt32Number
nGridpoints
;
cmsInt32Number
nChannels
;
cmsColorSpaceSignature
ColorSpace
;
cmsUInt32Number
i
;
cmsHPROFILE
ProfileList
[
256
];
...
...
@@ -346,8 +347,7 @@ cmsPipeline* _cmsCreateGamutCheckPipeline(cmsContext ContextID,
ColorSpace
=
cmsGetColorSpace
(
hGamut
);
nChannels
=
cmsChannelsOf
(
ColorSpace
);
nChannels
=
cmsChannelsOfColorSpace
(
ColorSpace
);
nGridpoints
=
_cmsReasonableGridpointsByColorspace
(
ColorSpace
,
cmsFLAGS_HIGHRESPRECALC
);
dwFormat
=
(
CHANNELS_SH
(
nChannels
)
|
BYTES_SH
(
2
));
...
...
@@ -472,6 +472,9 @@ cmsFloat64Number CMSEXPORT cmsDetectTAC(cmsHPROFILE hProfile)
// Create a fake formatter for result
dwFormatter
=
cmsFormatterForColorspaceOfProfile
(
hProfile
,
4
,
TRUE
);
// Unsupported color space?
if
(
dwFormatter
==
0
)
return
0
;
bp
.
nOutputChans
=
T_CHANNELS
(
dwFormatter
);
bp
.
MaxTAC
=
0
;
// Initial TAC is 0
...
...
@@ -619,6 +622,8 @@ cmsFloat64Number CMSEXPORT cmsDetectRGBProfileGamma(cmsHPROFILE hProfile, cmsFlo
ContextID
=
cmsGetProfileContextID
(
hProfile
);
hXYZ
=
cmsCreateXYZProfileTHR
(
ContextID
);
if
(
hXYZ
==
NULL
)
return
-
1
;
xform
=
cmsCreateTransformTHR
(
ContextID
,
hProfile
,
TYPE_RGB_16
,
hXYZ
,
TYPE_XYZ_DBL
,
INTENT_RELATIVE_COLORIMETRIC
,
cmsFLAGS_NOOPTIMIZE
);
...
...
libs/lcms2/src/cmshalf.c
View file @
fd3017ff
...
...
@@ -377,7 +377,7 @@ static const cmsUInt32Number Mantissa[2048] = {
0x387fc000
,
0x387fe000
};
static
cmsUInt16Number
Offset
[
64
]
=
{
static
c
onst
c
msUInt16Number
Offset
[
64
]
=
{
0x0000
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
0x0400
,
...
...
libs/lcms2/src/cmsio0.c
View file @
fd3017ff
This diff is collapsed.
Click to expand it.
libs/lcms2/src/cmsio1.c
View file @
fd3017ff
...
...
@@ -322,10 +322,8 @@ cmsPipeline* CMSEXPORT _cmsReadInputLUT(cmsHPROFILE hProfile, cmsUInt32Number In
if
(
nc
==
NULL
)
return
NULL
;
Lut
=
cmsPipelineAlloc
(
ContextID
,
0
,
0
);
if
(
Lut
==
NULL
)
{
cmsFreeNamedColorList
(
nc
);
if
(
Lut
==
NULL
)
return
NULL
;
}
if
(
!
cmsPipelineInsertStage
(
Lut
,
cmsAT_BEGIN
,
_cmsStageAllocNamedColor
(
nc
,
TRUE
))
||
!
cmsPipelineInsertStage
(
Lut
,
cmsAT_END
,
_cmsStageAllocLabV2ToV4
(
ContextID
)))
{
...
...
@@ -740,7 +738,6 @@ cmsPipeline* CMSEXPORT _cmsReadDevicelinkLUT(cmsHPROFILE hProfile, cmsUInt32Numb
return
Lut
;
Error:
cmsPipelineFree
(
Lut
);
cmsFreeNamedColorList
(
nc
);
return
NULL
;
}
...
...
libs/lcms2/src/cmslut.c
View file @
fd3017ff
...
...
@@ -467,7 +467,7 @@ cmsUInt32Number CubeSize(const cmsUInt32Number Dims[], cmsUInt32Number b)
for
(
rv
=
1
;
b
>
0
;
b
--
)
{
dim
=
Dims
[
b
-
1
];
if
(
dim
==
0
)
return
0
;
// Error
if
(
dim
<=
1
)
return
0
;
// Error
rv
*=
dim
;
...
...
libs/lcms2/src/cmsnamed.c
View file @
fd3017ff
...
...
@@ -542,8 +542,12 @@ cmsBool GrowNamedColorList(cmsNAMEDCOLORLIST* v)
// Allocate a list for n elements
cmsNAMEDCOLORLIST
*
CMSEXPORT
cmsAllocNamedColorList
(
cmsContext
ContextID
,
cmsUInt32Number
n
,
cmsUInt32Number
ColorantCount
,
const
char
*
Prefix
,
const
char
*
Suffix
)
{
cmsNAMEDCOLORLIST
*
v
=
(
cmsNAMEDCOLORLIST
*
)
_cmsMallocZero
(
ContextID
,
sizeof
(
cmsNAMEDCOLORLIST
))
;
cmsNAMEDCOLORLIST
*
v
;
if
(
ColorantCount
>
cmsMAXCHANNELS
)
return
NULL
;
v
=
(
cmsNAMEDCOLORLIST
*
)
_cmsMallocZero
(
ContextID
,
sizeof
(
cmsNAMEDCOLORLIST
));
if
(
v
==
NULL
)
return
NULL
;
v
->
List
=
NULL
;
...
...
libs/lcms2/src/cmsopt.c
View file @
fd3017ff
...
...
@@ -1517,10 +1517,10 @@ void* DupMatShaper(cmsContext ContextID, const void* Data)
}
// A fast matrix-shaper evaluator for 8 bits. This is a bit ticky since I'm using 1.14 signed fixed point
// A fast matrix-shaper evaluator for 8 bits. This is a bit t
r
icky since I'm using 1.14 signed fixed point
// to accomplish some performance. Actually it takes 256x3 16 bits tables and 16385 x 3 tables of 8 bits,
// in total about 50K, and the performance boost is huge!
static
static
CMS_NO_SANITIZE
void
MatShaperEval16
(
CMSREGISTER
const
cmsUInt16Number
In
[],
CMSREGISTER
cmsUInt16Number
Out
[],
CMSREGISTER
const
void
*
D
)
...
...
libs/lcms2/src/cmspack.c
View file @
fd3017ff
...
...
@@ -592,8 +592,11 @@ cmsUInt8Number* UnrollAnyWordsPremul(CMSREGISTER _cmsTRANSFORM* info,
if
(
SwapEndian
)
v
=
CHANGE_ENDIAN
(
v
);
v
=
(
v
<<
16
)
/
alpha_factor
;
if
(
v
>
0xffff
)
v
=
0xffff
;
if
(
alpha_factor
>
0
)
{
v
=
(
v
<<
16
)
/
alpha_factor
;
if
(
v
>
0xffff
)
v
=
0xffff
;
}
wIn
[
index
]
=
(
cmsUInt16Number
)
(
Reverse
?
REVERSE_FLAVOR_16
(
v
)
:
v
);
...
...
@@ -674,8 +677,11 @@ cmsUInt8Number* UnrollPlanarWordsPremul(CMSREGISTER _cmsTRANSFORM* info,
if
(
SwapEndian
)
v
=
CHANGE_ENDIAN
(
v
);
v
=
(
v
<<
16
)
/
alpha_factor
;
if
(
v
>
0xffff
)
v
=
0xffff
;
if
(
alpha_factor
>
0
)
{
v
=
(
v
<<
16
)
/
alpha_factor
;
if
(
v
>
0xffff
)
v
=
0xffff
;
}
wIn
[
index
]
=
(
cmsUInt16Number
)
(
Reverse
?
REVERSE_FLAVOR_16
(
v
)
:
v
);
...
...
@@ -3799,6 +3805,11 @@ cmsFormatter CMSEXPORT _cmsGetFormatter(cmsContext ContextID,
_cmsFormattersPluginChunkType
*
ctx
=
(
_cmsFormattersPluginChunkType
*
)
_cmsContextGetClientChunk
(
ContextID
,
FormattersPlugin
);
cmsFormattersFactoryList
*
f
;
if
(
T_CHANNELS
(
Type
)
==
0
)
{
static
const
cmsFormatter
nullFormatter
=
{
0
};
return
nullFormatter
;
}
for
(
f
=
ctx
->
FactoryList
;
f
!=
NULL
;
f
=
f
->
Next
)
{
cmsFormatter
fn
=
f
->
Factory
(
Type
,
Dir
,
dwFlags
);
...
...
@@ -3833,9 +3844,12 @@ cmsUInt32Number CMSEXPORT cmsFormatterForColorspaceOfProfile(cmsHPROFILE hProfil
cmsColorSpaceSignature
ColorSpace
=
cmsGetColorSpace
(
hProfile
);
cmsUInt32Number
ColorSpaceBits
=
(
cmsUInt32Number
)
_cmsLCMScolorSpace
(
ColorSpace
);
cms
UInt32Number
nOutputChans
=
cmsChannelsOf
(
ColorSpace
);
cms
Int32Number
nOutputChans
=
cmsChannelsOfColorSpace
(
ColorSpace
);
cmsUInt32Number
Float
=
lIsFloat
?
1U
:
0
;
// Unsupported color space?
if
(
nOutputChans
<
0
)
return
0
;
// Create a fake formatter for result
return
FLOAT_SH
(
Float
)
|
COLORSPACE_SH
(
ColorSpaceBits
)
|
BYTES_SH
(
nBytes
)
|
CHANNELS_SH
(
nOutputChans
);
}
...
...
@@ -3850,6 +3864,9 @@ cmsUInt32Number CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsU
cmsUInt32Number
nOutputChans
=
cmsChannelsOf
(
ColorSpace
);
cmsUInt32Number
Float
=
lIsFloat
?
1U
:
0
;
// Unsupported color space?
if
(
nOutputChans
<
0
)
return
0
;
// Create a fake formatter for result
return
FLOAT_SH
(
Float
)
|
COLORSPACE_SH
(
ColorSpaceBits
)
|
BYTES_SH
(
nBytes
)
|
CHANNELS_SH
(
nOutputChans
);
}
...
...
libs/lcms2/src/cmspcs.c
View file @
fd3017ff
...
...
@@ -874,7 +874,7 @@ int CMSEXPORT _cmsLCMScolorSpace(cmsColorSpaceSignature ProfileSpace)
}
cms
UInt32Number
CMSEXPORT
cmsChannelsOf
(
cmsColorSpaceSignature
ColorSpace
)
cms
Int32Number
CMSEXPORT
cmsChannelsOfColorSpace
(
cmsColorSpaceSignature
ColorSpace
)
{
switch
(
ColorSpace
)
{
...
...
@@ -935,6 +935,16 @@ cmsUInt32Number CMSEXPORT cmsChannelsOf(cmsColorSpaceSignature ColorSpace)
case
cmsSigMCHFData
:
case
cmsSig15colorData
:
return
15
;
default:
return
3
;
default:
return
-
1
;
}
}
/**
* DEPRECATED: Provided for compatibility only
*/
cmsUInt32Number
CMSEXPORT
cmsChannelsOf
(
cmsColorSpaceSignature
ColorSpace
)
{
int
n
=
cmsChannelsOfColorSpace
(
ColorSpace
);
if
(
n
<
0
)
return
3
;
return
(
cmsUInt32Number
)
n
;
}
\ No newline at end of file
libs/lcms2/src/cmsplugin.c
View file @
fd3017ff
...
...
@@ -168,18 +168,21 @@ cmsBool CMSEXPORT _cmsReadUInt32Number(cmsIOHANDLER* io, cmsUInt32Number* n)
cmsBool
CMSEXPORT
_cmsReadFloat32Number
(
cmsIOHANDLER
*
io
,
cmsFloat32Number
*
n
)
{
cmsUInt32Number
tmp
;
union
typeConverter
{
cmsUInt32Number
integer
;
cmsFloat32Number
floating_point
;
}
tmp
;
_cmsAssert
(
io
!=
NULL
);
if
(
io
->
Read
(
io
,
&
tmp
,
sizeof
(
cmsUInt32Number
),
1
)
!=
1
)
if
(
io
->
Read
(
io
,
&
tmp
.
integer
,
sizeof
(
cmsUInt32Number
),
1
)
!=
1
)
return
FALSE
;
if
(
n
!=
NULL
)
{
tmp
=
_cmsAdjustEndianess32
(
tmp
);
*
n
=
*
(
cmsFloat32Number
*
)(
void
*
)
&
tmp
;
tmp
.
integer
=
_cmsAdjustEndianess32
(
tmp
.
integer
);
*
n
=
tmp
.
floating_point
;
// Safeguard which covers against absurd values
if
(
*
n
>
1E+20
||
*
n
<
-
1E+20
)
return
FALSE
;
...
...
@@ -305,13 +308,14 @@ cmsBool CMSEXPORT _cmsWriteUInt32Number(cmsIOHANDLER* io, cmsUInt32Number n)
cmsBool
CMSEXPORT
_cmsWriteFloat32Number
(
cmsIOHANDLER
*
io
,
cmsFloat32Number
n
)
{
cmsUInt32Number
tmp
;
_cmsAssert
(
io
!=
NULL
);
tmp
=
*
(
cmsUInt32Number
*
)
(
void
*
)
&
n
;
tmp
=
_cmsAdjustEndianess32
(
tmp
);
if
(
io
->
Write
(
io
,
sizeof
(
cmsUInt32Number
),
&
tmp
)
!=
1
)
union
typeConverter
{
cmsUInt32Number
integer
;
cmsFloat32Number
floating_point
;
}
tmp
;
tmp
.
floating_point
=
n
;
tmp
.
integer
=
_cmsAdjustEndianess32
(
tmp
.
integer
);
if
(
io
->
Write
(
io
,
sizeof
(
cmsUInt32Number
),
&
tmp
.
integer
)
!=
1
)
return
FALSE
;
return
TRUE
;
...
...
@@ -621,6 +625,10 @@ cmsBool CMSEXPORT cmsPluginTHR(cmsContext id, void* Plug_in)
if
(
!
_cmsRegisterMutexPlugin
(
id
,
Plugin
))
return
FALSE
;
break
;
case
cmsPluginParalellizationSig
:
if
(
!
_cmsRegisterParallelizationPlugin
(
id
,
Plugin
))
return
FALSE
;
break
;
default:
cmsSignalError
(
id
,
cmsERROR_UNKNOWN_EXTENSION
,
"Unrecognized plugin type '%X'"
,
Plugin
->
Type
);
return
FALSE
;
...
...
@@ -643,24 +651,25 @@ void CMSEXPORT cmsUnregisterPlugins(void)
// pointers structure. All global vars are referenced here.
static
struct
_cmsContext_struct
globalContext
=
{
NULL
,
// Not in the linked list
NULL
,
// No suballocator
NULL
,
// Not in the linked list
NULL
,
// No suballocator
{
NULL
,
// UserPtr,
&
_cmsLogErrorChunk
,
// Logger,
&
_cmsAlarmCodesChunk
,
// AlarmCodes,
&
_cmsAdaptationStateChunk
,
// AdaptationState,
&
_cmsMemPluginChunk
,
// MemPlugin,
&
_cmsInterpPluginChunk
,
// InterpPlugin,
&
_cmsCurvesPluginChunk
,
// CurvesPlugin,
&
_cmsFormattersPluginChunk
,
// FormattersPlugin,
&
_cmsTagTypePluginChunk
,
// TagTypePlugin,
&
_cmsTagPluginChunk
,
// TagPlugin,
&
_cmsIntentsPluginChunk
,
// IntentPlugin,
&
_cmsMPETypePluginChunk
,
// MPEPlugin,
&
_cmsOptimizationPluginChunk
,
// OptimizationPlugin,
&
_cmsTransformPluginChunk
,
// TransformPlugin,
&
_cmsMutexPluginChunk
// MutexPlugin
NULL
,
// UserPtr,
&
_cmsLogErrorChunk
,
// Logger,
&
_cmsAlarmCodesChunk
,
// AlarmCodes,
&
_cmsAdaptationStateChunk
,
// AdaptationState,
&
_cmsMemPluginChunk
,
// MemPlugin,
&
_cmsInterpPluginChunk
,
// InterpPlugin,
&
_cmsCurvesPluginChunk
,
// CurvesPlugin,
&
_cmsFormattersPluginChunk
,
// FormattersPlugin,
&
_cmsTagTypePluginChunk
,
// TagTypePlugin,
&
_cmsTagPluginChunk
,
// TagPlugin,
&
_cmsIntentsPluginChunk
,
// IntentPlugin,
&
_cmsMPETypePluginChunk
,
// MPEPlugin,
&
_cmsOptimizationPluginChunk
,
// OptimizationPlugin,
&
_cmsTransformPluginChunk
,
// TransformPlugin,
&
_cmsMutexPluginChunk
,
// MutexPlugin,
&
_cmsParallelizationPluginChunk
// ParallelizationPlugin
},
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
}
// The default memory allocator is not used for context 0
...
...
@@ -787,6 +796,8 @@ void* _cmsContextGetClientChunk(cmsContext ContextID, _cmsMemoryClient mc)
// identify which plug-in to unregister.
void
CMSEXPORT
cmsUnregisterPluginsTHR
(
cmsContext
ContextID
)
{
struct
_cmsContext_struct
*
ctx
=
_cmsGetContext
(
ContextID
);
_cmsRegisterMemHandlerPlugin
(
ContextID
,
NULL
);
_cmsRegisterInterpPlugin
(
ContextID
,
NULL
);
_cmsRegisterTagTypePlugin
(
ContextID
,
NULL
);
...
...
@@ -798,6 +809,11 @@ void CMSEXPORT cmsUnregisterPluginsTHR(cmsContext ContextID)
_cmsRegisterOptimizationPlugin
(
ContextID
,
NULL
);
_cmsRegisterTransformPlugin
(
ContextID
,
NULL
);
_cmsRegisterMutexPlugin
(
ContextID
,
NULL
);
_cmsRegisterParallelizationPlugin
(
ContextID
,
NULL
);
if
(
ctx
->
MemPool
!=
NULL
)
_cmsSubAllocDestroy
(
ctx
->
MemPool
);
ctx
->
MemPool
=
NULL
;
}
...
...
@@ -881,6 +897,7 @@ cmsContext CMSEXPORT cmsCreateContext(void* Plugin, void* UserData)
_cmsAllocOptimizationPluginChunk
(
ctx
,
NULL
);
_cmsAllocTransformPluginChunk
(
ctx
,
NULL
);
_cmsAllocMutexPluginChunk
(
ctx
,
NULL
);
_cmsAllocParallelizationPluginChunk
(
ctx
,
NULL
);
// Setup the plug-ins
if
(
!
cmsPluginTHR
(
ctx
,
Plugin
))
{
...
...
@@ -944,6 +961,7 @@ cmsContext CMSEXPORT cmsDupContext(cmsContext ContextID, void* NewUserData)
_cmsAllocOptimizationPluginChunk
(
ctx
,
src
);
_cmsAllocTransformPluginChunk
(
ctx
,
src
);
_cmsAllocMutexPluginChunk
(
ctx
,
src
);
_cmsAllocParallelizationPluginChunk
(
ctx
,
src
);
// Make sure no one failed
for
(
i
=
Logger
;
i
<
MemoryClientMax
;
i
++
)
{
...
...
libs/lcms2/src/cmssamp.c
View file @
fd3017ff
...
...
@@ -126,6 +126,7 @@ cmsBool BlackPointAsDarkerColorant(cmsHPROFILE hInput,
// Force it to be neutral, clip to max. L* of 50
Lab
.
a
=
Lab
.
b
=
0
;
if
(
Lab
.
L
>
50
)
Lab
.
L
=
50
;
if
(
Lab
.
L
<
0
)
Lab
.
L
=
0
;
// Free the resources
cmsDeleteTransform
(
xform
);
...
...
@@ -322,6 +323,7 @@ cmsFloat64Number RootOfLeastSquaresFitQuadraticCurve(int n, cmsFloat64Number x[]
if
(
fabs
(
a
)
<
1.0E-10
)
{
if
(
fabs
(
b
)
<
1.0E-10
)
return
0
;
return
cmsmin
(
0
,
cmsmax
(
50
,
-
c
/
b
));
}
else
{
...
...
@@ -332,7 +334,11 @@ cmsFloat64Number RootOfLeastSquaresFitQuadraticCurve(int n, cmsFloat64Number x[]
}
else
{
double
rt
=
(
-
b
+
sqrt
(
d
))
/
(
2
.
0
*
a
);
double
rt
;
if
(
fabs
(
a
)
<
1.0E-10
)
return
0
;
rt
=
(
-
b
+
sqrt
(
d
))
/
(
2
.
0
*
a
);
return
cmsmax
(
0
,
cmsmin
(
50
,
rt
));
}
...
...
libs/lcms2/src/cmstypes.c
View file @
fd3017ff
This diff is collapsed.
Click to expand it.
libs/lcms2/src/cmsvirt.c
View file @
fd3017ff
...
...
@@ -114,7 +114,7 @@ cmsHPROFILE CMSEXPORT cmsCreateRGBProfileTHR(cmsContext ContextID,
if
(
!
hICC
)
// can't allocate
return
NULL
;
cmsSetProfileVersion
(
hICC
,
4
.
3
);
cmsSetProfileVersion
(
hICC
,
4
.
4
);
cmsSetDeviceClass
(
hICC
,
cmsSigDisplayClass
);
cmsSetColorSpace
(
hICC
,
cmsSigRgbData
);
...
...
@@ -235,7 +235,7 @@ cmsHPROFILE CMSEXPORT cmsCreateGrayProfileTHR(cmsContext ContextID,
if
(
!
hICC
)
// can't allocate
return
NULL
;
cmsSetProfileVersion
(
hICC
,
4
.
3
);
cmsSetProfileVersion
(
hICC
,
4
.
4
);
cmsSetDeviceClass
(
hICC
,
cmsSigDisplayClass
);
cmsSetColorSpace
(
hICC
,
cmsSigGrayData
);
...
...
@@ -291,13 +291,13 @@ cmsHPROFILE CMSEXPORT cmsCreateLinearizationDeviceLinkTHR(cmsContext ContextID,
{
cmsHPROFILE
hICC
;
cmsPipeline
*
Pipeline
;
cms
U
Int32Number
nChannels
;
cmsInt32Number
nChannels
;
hICC
=
cmsCreateProfilePlaceholder
(
ContextID
);
if
(
!
hICC
)
return
NULL
;
cmsSetProfileVersion
(
hICC
,
4
.
3
);
cmsSetProfileVersion
(
hICC
,
4
.
4
);
cmsSetDeviceClass
(
hICC
,
cmsSigLinkClass
);
cmsSetColorSpace
(
hICC
,
ColorSpace
);
...
...
@@ -306,7 +306,7 @@ cmsHPROFILE CMSEXPORT cmsCreateLinearizationDeviceLinkTHR(cmsContext ContextID,
cmsSetHeaderRenderingIntent
(
hICC
,
INTENT_PERCEPTUAL
);
// Set up channels
nChannels
=
cmsChannelsOf
(
ColorSpace
);
nChannels
=
cmsChannelsOf
ColorSpace
(
ColorSpace
);
// Creates a Pipeline with prelinearization step only
Pipeline
=
cmsPipelineAlloc
(
ContextID
,
nChannels
,
nChannels
);
...
...
@@ -397,7 +397,7 @@ cmsHPROFILE CMSEXPORT cmsCreateInkLimitingDeviceLinkTHR(cmsContext ContextID,
cmsHPROFILE
hICC
;
cmsPipeline
*
LUT
;
cmsStage
*
CLUT
;
cms
U
Int32Number
nChannels
;
cmsInt32Number
nChannels
;
if
(
ColorSpace
!=
cmsSigCmykData
)
{
cmsSignalError
(
ContextID
,
cmsERROR_COLORSPACE_CHECK
,
"InkLimiting: Only CMYK currently supported"
);
...
...
@@ -416,7 +416,7 @@ cmsHPROFILE CMSEXPORT cmsCreateInkLimitingDeviceLinkTHR(cmsContext ContextID,
if
(
!
hICC
)
// can't allocate
return
NULL
;
cmsSetProfileVersion
(
hICC
,
4
.
3
);
cmsSetProfileVersion
(
hICC
,
4
.
4
);
cmsSetDeviceClass
(
hICC
,
cmsSigLinkClass
);
cmsSetColorSpace
(
hICC
,
ColorSpace
);
...
...
@@ -526,7 +526,7 @@ cmsHPROFILE CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIE
hProfile
=
cmsCreateRGBProfileTHR
(
ContextID
,
WhitePoint
==
NULL
?
cmsD50_xyY
()
:
WhitePoint
,
NULL
,
NULL
);
if
(
hProfile
==
NULL
)
return
NULL
;
cmsSetProfileVersion
(
hProfile
,
4
.
3
);
cmsSetProfileVersion
(
hProfile
,
4
.
4
);
cmsSetDeviceClass
(
hProfile
,
cmsSigAbstractClass
);
cmsSetColorSpace
(
hProfile
,
cmsSigLabData
);
...
...
@@ -572,7 +572,7 @@ cmsHPROFILE CMSEXPORT cmsCreateXYZProfileTHR(cmsContext ContextID)
hProfile
=
cmsCreateRGBProfileTHR
(
ContextID
,
cmsD50_xyY
(),
NULL
,
NULL
);
if
(
hProfile
==
NULL
)
return
NULL
;
cmsSetProfileVersion
(
hProfile
,
4
.
3
);
cmsSetProfileVersion
(
hProfile
,
4
.
4
);
cmsSetDeviceClass
(
hProfile
,
cmsSigAbstractClass
);
cmsSetColorSpace
(
hProfile
,
cmsSigXYZData
);
...
...
@@ -839,7 +839,7 @@ cmsHPROFILE CMSEXPORT cmsCreateNULLProfileTHR(cmsContext ContextID)
if
(
!
hProfile
)
// can't allocate
return
NULL
;
cmsSetProfileVersion
(
hProfile
,
4
.
3
);
cmsSetProfileVersion
(
hProfile
,
4
.
4
);
if
(
!
SetTextTags
(
hProfile
,
L"NULL profile built-in"
))
goto
Error
;
...
...
@@ -974,7 +974,7 @@ cmsHPROFILE CreateNamedColorDevicelink(cmsHTRANSFORM xform)
// Make sure we have proper formatters
cmsChangeBuffersFormat
(
xform
,
TYPE_NAMED_COLOR_INDEX
,
FLOAT_SH
(
0
)
|
COLORSPACE_SH
(
_cmsLCMScolorSpace
(
v
->
ExitColorSpace
))
|
BYTES_SH
(
2
)
|
CHANNELS_SH
(
cmsChannelsOf
(
v
->
ExitColorSpace
)));
|
BYTES_SH
(
2
)
|
CHANNELS_SH
(
cmsChannelsOf
ColorSpace
(
v
->
ExitColorSpace
)));
// Apply the transfor to colorants.
for
(
i
=
0
;
i
<
nColors
;
i
++
)
{
...
...
@@ -1062,8 +1062,9 @@ const cmsAllowedLUT* FindCombination(const cmsPipeline* Lut, cmsBool IsV4, cmsTa
cmsHPROFILE
CMSEXPORT
cmsTransform2DeviceLink
(
cmsHTRANSFORM
hTransform
,
cmsFloat64Number
Version
,
cmsUInt32Number
dwFlags
)
{
cmsHPROFILE
hProfile
=
NULL
;
cmsUInt32Number
FrmIn
,
FrmOut
,
ChansIn
,
ChansOut
;
int
ColorSpaceBitsIn
,
ColorSpaceBitsOut
;
cmsUInt32Number
FrmIn
,
FrmOut
;
cmsInt32Number
ChansIn
,
ChansOut
;
int
ColorSpaceBitsIn
,
ColorSpaceBitsOut
;
_cmsTRANSFORM
*
xform
=
(
_cmsTRANSFORM
*
)
hTransform
;
cmsPipeline
*
LUT
=
NULL
;
cmsStage
*
mpe
;
...
...
@@ -1114,8 +1115,8 @@ cmsHPROFILE CMSEXPORT cmsTransform2DeviceLink(cmsHTRANSFORM hTransform, cmsFloat
// Optimize the LUT and precalculate a devicelink
ChansIn
=
cmsChannelsOf
(
xform
->
EntryColorSpace
);
ChansOut
=
cmsChannelsOf
(
xform
->
ExitColorSpace
);
ChansIn
=
cmsChannelsOf
ColorSpace
(
xform
->
EntryColorSpace
);
ChansOut
=
cmsChannelsOf
ColorSpace
(
xform
->
ExitColorSpace
);
ColorSpaceBitsIn
=
_cmsLCMScolorSpace
(
xform
->
EntryColorSpace
);
ColorSpaceBitsOut
=
_cmsLCMScolorSpace
(
xform
->
ExitColorSpace
);
...
...
libs/lcms2/src/cmsxform.c
View file @
fd3017ff
...
...
@@ -781,6 +781,73 @@ cmsUInt32Number CMSEXPORT _cmsGetTransformFlags(struct _cmstransform_struct* CMM
return
CMMcargo
->
dwOriginalFlags
;
}
// Returns the worker callback for parallelization plug-ins
_cmsTransform2Fn
CMSEXPORT
_cmsGetTransformWorker
(
struct
_cmstransform_struct
*
CMMcargo
)
{
_cmsAssert
(
CMMcargo
!=
NULL
);
return
CMMcargo
->
Worker
;
}
// This field holds maximum number of workers or -1 to auto
cmsInt32Number
CMSEXPORT
_cmsGetTransformMaxWorkers
(
struct
_cmstransform_struct
*
CMMcargo
)
{
_cmsAssert
(
CMMcargo
!=
NULL
);
return
CMMcargo
->
MaxWorkers
;
}
// This field is actually unused and reserved
cmsUInt32Number
CMSEXPORT
_cmsGetTransformWorkerFlags
(
struct
_cmstransform_struct
*
CMMcargo
)
{
_cmsAssert
(
CMMcargo
!=
NULL
);
return
CMMcargo
->
WorkerFlags
;
}
// In the case there is a parallelization plug-in, let it to do its job
static
void
ParalellizeIfSuitable
(
_cmsTRANSFORM
*
p
)
{
_cmsParallelizationPluginChunkType
*
ctx
=
(
_cmsParallelizationPluginChunkType
*
)
_cmsContextGetClientChunk
(
p
->
ContextID
,
ParallelizationPlugin
);
_cmsAssert
(
p
!=
NULL
);
if
(
ctx
!=
NULL
&&
ctx
->
SchedulerFn
!=
NULL
)
{
p
->
Worker
=
p
->
xform
;
p
->
xform
=
ctx
->
SchedulerFn
;
p
->
MaxWorkers
=
ctx
->
MaxWorkers
;
p
->
WorkerFlags
=
ctx
->
WorkerFlags
;
}
}
/**
* An empty unroll to avoid a check with NULL on cmsDoTransform()
*/
static
cmsUInt8Number
*
UnrollNothing
(
CMSREGISTER
_cmsTRANSFORM
*
info
,
CMSREGISTER
cmsUInt16Number
wIn
[],
CMSREGISTER
cmsUInt8Number
*
accum
,
CMSREGISTER
cmsUInt32Number
Stride
)
{
return
accum
;
cmsUNUSED_PARAMETER
(
info
);
cmsUNUSED_PARAMETER
(
wIn
);
cmsUNUSED_PARAMETER
(
Stride
);
}
static
cmsUInt8Number
*
PackNothing
(
CMSREGISTER
_cmsTRANSFORM
*
info
,
CMSREGISTER
cmsUInt16Number
wOut
[],
CMSREGISTER
cmsUInt8Number
*
output
,
CMSREGISTER
cmsUInt32Number
Stride
)
{
return
output
;
cmsUNUSED_PARAMETER
(
info
);
cmsUNUSED_PARAMETER
(
wOut
);
cmsUNUSED_PARAMETER
(
Stride
);
}
// Allocate transform struct and set it to defaults. Ask the optimization plug-in about if those formats are proper
// for separated transforms. If this is the case,
static
...
...
@@ -836,6 +903,7 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut,
p
->
xform
=
_cmsTransform2toTransformAdaptor
;
}
ParalellizeIfSuitable
(
p
);
return
p
;
}
}
...
...
@@ -872,8 +940,10 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut,
}
else
{
// Formats are intended to be changed before use
if
(
*
InputFormat
==
0
&&
*
OutputFormat
==
0
)
{
p
->
FromInput
=
p
->
ToOutput
=
NULL
;
p
->
FromInput
=
UnrollNothing
;
p
->
ToOutput
=
PackNothing
;
*
dwFlags
|=
cmsFLAGS_CAN_CHANGE_FORMATTER
;
}
else
{
...
...
@@ -890,7 +960,7 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut,
return
NULL
;
}
BytesPerPixelInput
=
T_BYTES
(
p
->
InputFormat
);
BytesPerPixelInput
=
T_BYTES
(
*
InputFormat
);
if
(
BytesPerPixelInput
==
0
||
BytesPerPixelInput
>=
2
)
*
dwFlags
|=
cmsFLAGS_CAN_CHANGE_FORMATTER
;
...
...
@@ -924,6 +994,7 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut,
p
->
dwOriginalFlags
=
*
dwFlags
;
p
->
ContextID
=
ContextID
;
p
->
UserData
=
NULL
;
ParalellizeIfSuitable
(
p
);
return
p
;
}
...
...
@@ -1098,8 +1169,8 @@ cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID,
}
// Check channel count
if
((
cmsChannelsOf
(
EntryColorSpace
)
!=
cmsPipelineInputChannels
(
Lut
))
||
(
cmsChannelsOf
(
ExitColorSpace
)
!=
cmsPipelineOutputChannels
(
Lut
)))
{
if
((
cmsChannelsOf
ColorSpace
(
EntryColorSpace
)
!=
(
cmsInt32Number
)
cmsPipelineInputChannels
(
Lut
))
||
(
cmsChannelsOf
ColorSpace
(
ExitColorSpace
)
!=
(
cmsInt32Number
)
cmsPipelineOutputChannels
(
Lut
)))
{
cmsPipelineFree
(
Lut
);
cmsSignalError
(
ContextID
,
cmsERROR_NOT_SUITABLE
,
"Channel count doesn't match. Profile is corrupted"
);
return
NULL
;
...
...
libs/lcms2/src/lcms2_internal.h
View file @
fd3017ff
...
...
@@ -283,38 +283,38 @@ typedef CRITICAL_SECTION _cmsMutex;
cmsINLINE
int
_cmsLockPrimitive
(
_cmsMutex
*
m
)
{
EnterCriticalSection
(
m
);
return
0
;
EnterCriticalSection
(
m
);
return
0
;
}
cmsINLINE
int
_cmsUnlockPrimitive
(
_cmsMutex
*
m
)
{
LeaveCriticalSection
(
m
);
return
0
;
LeaveCriticalSection
(
m
);
return
0
;
}
cmsINLINE
int
_cmsInitMutexPrimitive
(
_cmsMutex
*
m
)
{
InitializeCriticalSection
(
m
);
return
0
;
InitializeCriticalSection
(
m
);
return
0
;
}
cmsINLINE
int
_cmsDestroyMutexPrimitive
(
_cmsMutex
*
m
)
{
DeleteCriticalSection
(
m
);
return
0
;
DeleteCriticalSection
(
m
);
return
0
;
}
cmsINLINE
int
_cmsEnterCriticalSectionPrimitive
(
_cmsMutex
*
m
)
{
EnterCriticalSection
(
m
);
return
0
;
EnterCriticalSection
(
m
);
return
0
;
}
cmsINLINE
int
_cmsLeaveCriticalSectionPrimitive
(
_cmsMutex
*
m
)
{
LeaveCriticalSection
(
m
);
return
0
;
LeaveCriticalSection
(
m
);
return
0
;
}
#else
...
...
@@ -328,32 +328,32 @@ typedef pthread_mutex_t _cmsMutex;
cmsINLINE
int
_cmsLockPrimitive
(
_cmsMutex
*
m
)
{
return
pthread_mutex_lock
(
m
);
return
pthread_mutex_lock
(
m
);
}
cmsINLINE
int
_cmsUnlockPrimitive
(
_cmsMutex
*
m
)
{
return
pthread_mutex_unlock
(
m
);
return
pthread_mutex_unlock
(
m
);
}
cmsINLINE
int
_cmsInitMutexPrimitive
(
_cmsMutex
*
m
)
{
return
pthread_mutex_init
(
m
,
NULL
);
return
pthread_mutex_init
(
m
,
NULL
);
}
cmsINLINE
int
_cmsDestroyMutexPrimitive
(
_cmsMutex
*
m
)
{
return
pthread_mutex_destroy
(
m
);
return
pthread_mutex_destroy
(
m
);
}
cmsINLINE
int
_cmsEnterCriticalSectionPrimitive
(
_cmsMutex
*
m
)
{
return
pthread_mutex_lock
(
m
);
return
pthread_mutex_lock
(
m
);
}
cmsINLINE
int
_cmsLeaveCriticalSectionPrimitive
(
_cmsMutex
*
m
)
{
return
pthread_mutex_unlock
(
m
);
return
pthread_mutex_unlock
(
m
);
}
#endif
...
...
@@ -366,37 +366,37 @@ typedef int _cmsMutex;
cmsINLINE
int
_cmsLockPrimitive
(
_cmsMutex
*
m
)
{
cmsUNUSED_PARAMETER
(
m
);
return
0
;
return
0
;
}
cmsINLINE
int
_cmsUnlockPrimitive
(
_cmsMutex
*
m
)
{
cmsUNUSED_PARAMETER
(
m
);
return
0
;
return
0
;
}
cmsINLINE
int
_cmsInitMutexPrimitive
(
_cmsMutex
*
m
)
{
cmsUNUSED_PARAMETER
(
m
);
return
0
;
return
0
;
}
cmsINLINE
int
_cmsDestroyMutexPrimitive
(
_cmsMutex
*
m
)
{
cmsUNUSED_PARAMETER
(
m
);
return
0
;
return
0
;
}
cmsINLINE
int
_cmsEnterCriticalSectionPrimitive
(
_cmsMutex
*
m
)
{
cmsUNUSED_PARAMETER
(
m
);
return
0
;
return
0
;
}
cmsINLINE
int
_cmsLeaveCriticalSectionPrimitive
(
_cmsMutex
*
m
)
{
cmsUNUSED_PARAMETER
(
m
);
return
0
;
return
0
;
}
#endif
...
...
@@ -438,6 +438,9 @@ cmsBool _cmsRegisterTransformPlugin(cmsContext ContextID, cmsPluginBase* Plugin
// Mutex
cmsBool
_cmsRegisterMutexPlugin
(
cmsContext
ContextID
,
cmsPluginBase
*
Plugin
);
// Paralellization
cmsBool
_cmsRegisterParallelizationPlugin
(
cmsContext
ContextID
,
cmsPluginBase
*
Plugin
);
// ---------------------------------------------------------------------------------------------------------
// Suballocators.
...
...
@@ -485,6 +488,7 @@ typedef enum {
OptimizationPlugin
,
TransformPlugin
,
MutexPlugin
,
ParallelizationPlugin
,
// Last in list
MemoryClientMax
...
...
@@ -720,6 +724,24 @@ extern _cmsMutexPluginChunkType _cmsMutexPluginChunk;
void
_cmsAllocMutexPluginChunk
(
struct
_cmsContext_struct
*
ctx
,
const
struct
_cmsContext_struct
*
src
);
// Container for parallelization plug-in
typedef
struct
{
cmsInt32Number
MaxWorkers
;
// Number of workers to do as maximum
cmsInt32Number
WorkerFlags
;
// reserved
_cmsTransform2Fn
SchedulerFn
;
// callback to setup functions
}
_cmsParallelizationPluginChunkType
;
// The global Context0 storage for parallelization plug-in
extern
_cmsParallelizationPluginChunkType
_cmsParallelizationPluginChunk
;
// Allocate parallelization container.
void
_cmsAllocParallelizationPluginChunk
(
struct
_cmsContext_struct
*
ctx
,
const
struct
_cmsContext_struct
*
src
);
// ----------------------------------------------------------------------------------
// MLU internal representation
typedef
struct
{
...
...
@@ -1081,6 +1103,11 @@ typedef struct _cmstransform_struct {
// A way to provide backwards compatibility with full xform plugins
_cmsTransformFn
OldXform
;
// A one-worker transform entry for parallelization
_cmsTransform2Fn
Worker
;
cmsInt32Number
MaxWorkers
;
cmsUInt32Number
WorkerFlags
;
}
_cmsTRANSFORM
;
// Copies extra channels from input to output if the original flags in the transform structure
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment