summaryrefslogtreecommitdiff
path: root/thirdparty/liblcms2/src/cmslut.c
diff options
context:
space:
mode:
authorMatthieu Darbois <mayeut@users.noreply.github.com>2016-04-30 17:58:04 +0200
committerMatthieu Darbois <mayeut@users.noreply.github.com>2016-04-30 17:58:04 +0200
commit9a20f8e8d1a91bd032e81ac53bf9a48dbb92bc29 (patch)
treed5387a97517acf7e8f5880a9f44bda772a0022dd /thirdparty/liblcms2/src/cmslut.c
parent72deb588cbc8d5f56f8b0db3a2d120913e792cb8 (diff)
Update lcms (#544)
Update to mm2/Little-CMS@0e8234e090d6aab33f90e2eb0296f30aa0705e57
Diffstat (limited to 'thirdparty/liblcms2/src/cmslut.c')
-rw-r--r--thirdparty/liblcms2/src/cmslut.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/thirdparty/liblcms2/src/cmslut.c b/thirdparty/liblcms2/src/cmslut.c
index c491662b..df3dfc1a 100644
--- a/thirdparty/liblcms2/src/cmslut.c
+++ b/thirdparty/liblcms2/src/cmslut.c
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------------
//
// Little Color Management System
-// Copyright (c) 1998-2012 Marti Maria Saguer
+// Copyright (c) 1998-2016 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"),
@@ -505,7 +505,7 @@ void* CLUTElemDup(cmsStage* mpe)
goto Error;
} else {
NewElem ->Tab.T = (cmsUInt16Number*) _cmsDupMem(mpe ->ContextID, Data ->Tab.T, Data ->nEntries * sizeof (cmsUInt16Number));
- if (NewElem ->Tab.TFloat == NULL)
+ if (NewElem ->Tab.T == NULL)
goto Error;
}
}
@@ -1125,7 +1125,23 @@ cmsStage* _cmsStageNormalizeToXyzFloat(cmsContext ContextID)
return mpe;
}
+// Clips values smaller than zero
+static
+void Clipper(const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsStage *mpe)
+{
+ cmsUInt32Number i;
+ for (i = 0; i < mpe->InputChannels; i++) {
+
+ cmsFloat32Number n = In[i];
+ Out[i] = n < 0 ? 0 : n;
+ }
+}
+cmsStage* _cmsStageClipNegatives(cmsContext ContextID, int nChannels)
+{
+ return _cmsStageAllocPlaceholder(ContextID, cmsSigClipNegativesElemType,
+ nChannels, nChannels, Clipper, NULL, NULL, NULL);
+}
// ********************************************************************************
// Type cmsSigXYZ2LabElemType
@@ -1437,7 +1453,8 @@ cmsPipeline* CMSEXPORT cmsPipelineDup(const cmsPipeline* lut)
First = FALSE;
}
else {
- Anterior ->Next = NewMPE;
+ if (Anterior != NULL)
+ Anterior ->Next = NewMPE;
}
Anterior = NewMPE;
@@ -1482,7 +1499,7 @@ int CMSEXPORT cmsPipelineInsertStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage
for (pt = lut ->Elements;
pt != NULL;
pt = pt -> Next) Anterior = pt;
-
+
Anterior ->Next = mpe;
mpe ->Next = NULL;
}