diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-11-24 01:33:09 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-11-24 01:33:09 +0300 |
commit | 25ed30f11cb192ae74051d7510569e696c5f0de2 (patch) | |
tree | abf06055d95f162b6029887e3b5ea33b847696ef /src/thirdparty/lcms2 | |
parent | c05d16ad93858d9d781f4b0a2f6f6c235e42835e (diff) |
update lcms
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2744 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/thirdparty/lcms2')
-rw-r--r-- | src/thirdparty/lcms2/AUTHORS | 3 | ||||
-rw-r--r-- | src/thirdparty/lcms2/ChangeLog | 9 | ||||
-rw-r--r-- | src/thirdparty/lcms2/src/cmsintrp.c | 118 | ||||
-rw-r--r-- | src/thirdparty/lcms2/src/cmspack.c | 41 | ||||
-rw-r--r-- | src/thirdparty/lcms2/src/cmsxform.c | 2 |
5 files changed, 143 insertions, 30 deletions
diff --git a/src/thirdparty/lcms2/AUTHORS b/src/thirdparty/lcms2/AUTHORS index 05960193e..e77c86ce5 100644 --- a/src/thirdparty/lcms2/AUTHORS +++ b/src/thirdparty/lcms2/AUTHORS @@ -14,10 +14,11 @@ Stuart Nixon Jordi Vilar
Richard Hughes
Auke Nauta
+Chris Evans
Special Thanks
--------------
Jan Morovic
Jos Vernon (WebSupergoo)
-Harald Schneider (Maxon)
+Harald Schneider (Maxon)
\ No newline at end of file diff --git a/src/thirdparty/lcms2/ChangeLog b/src/thirdparty/lcms2/ChangeLog index 5d4a42547..b9c1a694d 100644 --- a/src/thirdparty/lcms2/ChangeLog +++ b/src/thirdparty/lcms2/ChangeLog @@ -15,3 +15,12 @@ Peliminary Delphi wrapper Fixed a bug in tificc in floating point formats
Fixed a bug in device link creation on v4 profiles
Fixed a bug in psid and profile sequence tags
+Fixed memory leaks on when recovering from errors
+Fixed an issue on curve inversion
+Fixed several integer overflow and other integrity checks, thanks to Chris Evans
+linkicc now stores the rendering intent in the profile header
+Fixed delphi interface
+Added Duotone support (Bilinear interpolation)
+
+2.1 Maintenance release
+-----------------------
\ No newline at end of file diff --git a/src/thirdparty/lcms2/src/cmsintrp.c b/src/thirdparty/lcms2/src/cmsintrp.c index 6c8ed6c52..e3d05112b 100644 --- a/src/thirdparty/lcms2/src/cmsintrp.c +++ b/src/thirdparty/lcms2/src/cmsintrp.c @@ -26,7 +26,7 @@ #include "lcms2_internal.h"
-// This module incorporates several interpolation routines, for 1, 3, 4, 5, 6, 7 and 8 channels on input and
+// 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
@@ -289,6 +289,116 @@ void Eval1InputFloat(const cmsFloat32Number Value[], }
}
+// Bilinear interpolation (16 bits) - cmsFloat32Number version
+static
+void BilinearInterpFloat(const cmsFloat32Number Input[],
+ cmsFloat32Number Output[],
+ const cmsInterpParams* p)
+
+{
+# define LERP(a,l,h) (cmsFloat32Number) ((l)+(((h)-(l))*(a)))
+# define DENS(i,j) (LutTable[(i)+(j)+OutChan])
+
+ const cmsFloat32Number* LutTable = (cmsFloat32Number*) p ->Table;
+ cmsFloat32Number px, py;
+ int x0, y0,
+ X0, Y0, X1, Y1;
+ int TotalOut, OutChan;
+ cmsFloat32Number fx, fy,
+ d00, d01, d10, d11,
+ dx0, dx1,
+ dxy;
+
+ TotalOut = p -> nOutputs;
+ px = Input[0] * p->Domain[0];
+ py = Input[1] * p->Domain[1];
+
+ x0 = (int) _cmsQuickFloor(px); fx = px - (cmsFloat32Number) x0;
+ y0 = (int) _cmsQuickFloor(py); fy = py - (cmsFloat32Number) y0;
+
+ X0 = p -> opta[1] * x0;
+ X1 = X0 + (Input[0] >= 1.0 ? 0 : p->opta[1]);
+
+ Y0 = p -> opta[0] * y0;
+ Y1 = Y0 + (Input[1] >= 1.0 ? 0 : p->opta[0]);
+
+ for (OutChan = 0; OutChan < TotalOut; OutChan++) {
+
+ d00 = DENS(X0, Y0);
+ d01 = DENS(X0, Y1);
+ d10 = DENS(X1, Y0);
+ d11 = DENS(X1, Y1);
+
+ dx0 = LERP(fx, d00, d10);
+ dx1 = LERP(fx, d01, d11);
+
+ dxy = LERP(fy, dx0, dx1);
+
+ Output[OutChan] = dxy;
+ }
+
+
+# undef LERP
+# undef DENS
+}
+
+// Bilinear interpolation (16 bits) - optimized version
+static
+void BilinearInterp16(register const cmsUInt16Number Input[],
+ register cmsUInt16Number Output[],
+ register const cmsInterpParams* p)
+
+{
+#define DENS(i,j) (LutTable[(i)+(j)+OutChan])
+#define LERP(a,l,h) (cmsUInt16Number) (l + ROUND_FIXED_TO_INT(((h-l)*a)))
+
+ const cmsUInt16Number* LutTable = (cmsUInt16Number*) p ->Table;
+ int OutChan, TotalOut;
+ cmsS15Fixed16Number fx, fy;
+ register int rx, ry;
+ int x0, y0;
+ register int X0, X1, Y0, Y1;
+ int d00, d01, d10, d11,
+ dx0, dx1,
+ dxy;
+
+ TotalOut = p -> nOutputs;
+
+ fx = _cmsToFixedDomain((int) Input[0] * p -> Domain[0]);
+ x0 = FIXED_TO_INT(fx);
+ rx = FIXED_REST_TO_INT(fx); // Rest in 0..1.0 domain
+
+
+ fy = _cmsToFixedDomain((int) Input[1] * p -> Domain[1]);
+ y0 = FIXED_TO_INT(fy);
+ ry = FIXED_REST_TO_INT(fy);
+
+
+ X0 = p -> opta[1] * x0;
+ X1 = X0 + (Input[0] == 0xFFFFU ? 0 : p->opta[1]);
+
+ Y0 = p -> opta[0] * y0;
+ Y1 = Y0 + (Input[1] == 0xFFFFU ? 0 : p->opta[0]);
+
+ for (OutChan = 0; OutChan < TotalOut; OutChan++) {
+
+ d00 = DENS(X0, Y0);
+ d01 = DENS(X0, Y1);
+ d10 = DENS(X1, Y0);
+ d11 = DENS(X1, Y1);
+
+ dx0 = LERP(rx, d00, d10);
+ dx1 = LERP(rx, d01, d11);
+
+ dxy = LERP(ry, dx0, dx1);
+
+ Output[OutChan] = (cmsUInt16Number) dxy;
+ }
+
+
+# undef LERP
+# undef DENS
+}
// Trilinear interpolation (16 bits) - cmsFloat32Number version
@@ -1256,6 +1366,12 @@ cmsInterpFunction DefaultInterpolatorsFactory(cmsUInt32Number nInputChannels, cm }
break;
+ case 2: // Duotone
+ if (IsFloat)
+ Interpolation.LerpFloat = BilinearInterpFloat;
+ else
+ Interpolation.Lerp16 = BilinearInterp16;
+ break;
case 3: // RGB et al
diff --git a/src/thirdparty/lcms2/src/cmspack.c b/src/thirdparty/lcms2/src/cmspack.c index dcd58c6f2..147acc7bc 100644 --- a/src/thirdparty/lcms2/src/cmspack.c +++ b/src/thirdparty/lcms2/src/cmspack.c @@ -330,40 +330,41 @@ cmsUInt8Number* UnrollLabV2_16(register _cmsTRANSFORM* info, return accum;
}
-
-
-// Monochrome + alpha. Alpha is lost
+// for duplex
static
cmsUInt8Number* Unroll2Bytes(register _cmsTRANSFORM* info,
register cmsUInt16Number wIn[],
register cmsUInt8Number* accum,
register cmsUInt32Number Stride)
{
- wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++; // L
- wIn[3] = FROM_8_TO_16(*accum); accum++; // alpha
+ wIn[0] = FROM_8_TO_16(*accum); accum++; // ch1
+ wIn[1] = FROM_8_TO_16(*accum); accum++; // ch2
return accum;
}
+
+
+
+// Monochrome duplicates L into RGB for null-transforms
static
-cmsUInt8Number* Unroll2ByteSwapFirst(register _cmsTRANSFORM* info,
+cmsUInt8Number* Unroll1Byte(register _cmsTRANSFORM* info,
register cmsUInt16Number wIn[],
register cmsUInt8Number* accum,
register cmsUInt32Number Stride)
{
- wIn[3] = FROM_8_TO_16(*accum); accum++; // alpha
wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++; // L
return accum;
}
-// Monochrome duplicates L into RGB for null-transforms
static
-cmsUInt8Number* Unroll1Byte(register _cmsTRANSFORM* info,
+cmsUInt8Number* Unroll1ByteSkip1(register _cmsTRANSFORM* info,
register cmsUInt16Number wIn[],
register cmsUInt8Number* accum,
register cmsUInt32Number Stride)
{
wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++; // L
+ accum += 1;
return accum;
}
@@ -631,23 +632,12 @@ cmsUInt8Number* Unroll2Words(register _cmsTRANSFORM* info, register cmsUInt8Number* accum,
register cmsUInt32Number Stride)
{
- wIn[0] = wIn[1] = wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // L
- wIn[3] = *(cmsUInt16Number*) accum; accum += 2; // alpha
+ wIn[0] = *(cmsUInt16Number*) accum; accum += 2; // ch1
+ wIn[1] = *(cmsUInt16Number*) accum; accum += 2; // ch2
return accum;
}
-static
-cmsUInt8Number* Unroll2WordSwapFirst(register _cmsTRANSFORM* info,
- register cmsUInt16Number wIn[],
- register cmsUInt8Number* accum,
- register cmsUInt32Number Stride)
-{
- wIn[3] = *(cmsUInt16Number*) accum; accum += 2; // alpha
- wIn[0] = wIn[1] = wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // L
-
- return accum;
-}
// This is a conversion of Lab double to 16 bits
static
@@ -2245,11 +2235,10 @@ static cmsFormatters16 InputFormatters16[] = { { CHANNELS_SH(1)|BYTES_SH(1), ANYSPACE, Unroll1Byte},
+ { CHANNELS_SH(1)|BYTES_SH(1)|EXTRA_SH(1), ANYSPACE, Unroll1ByteSkip1},
{ CHANNELS_SH(1)|BYTES_SH(1)|EXTRA_SH(2), ANYSPACE, Unroll1ByteSkip2},
{ CHANNELS_SH(1)|BYTES_SH(1)|FLAVOR_SH(1), ANYSPACE, Unroll1ByteReversed},
-
- { CHANNELS_SH(2)|BYTES_SH(1), ANYSPACE, Unroll2Bytes},
- { CHANNELS_SH(2)|BYTES_SH(1)|SWAPFIRST_SH(1), ANYSPACE, Unroll2ByteSwapFirst},
+ { COLORSPACE_SH(PT_MCH2)|CHANNELS_SH(2)|BYTES_SH(1), 0, Unroll2Bytes},
{ TYPE_LabV2_8, 0, UnrollLabV2_8 },
{ TYPE_ALabV2_8, 0, UnrollALabV2_8 },
@@ -2275,8 +2264,6 @@ static cmsFormatters16 InputFormatters16[] = { { CHANNELS_SH(1)|BYTES_SH(2)|EXTRA_SH(3), ANYSPACE, Unroll1WordSkip3},
{ CHANNELS_SH(2)|BYTES_SH(2), ANYSPACE, Unroll2Words},
- { CHANNELS_SH(2)|BYTES_SH(2)|SWAPFIRST_SH(1), ANYSPACE, Unroll2WordSwapFirst},
-
{ CHANNELS_SH(3)|BYTES_SH(2), ANYSPACE, Unroll3Words},
{ CHANNELS_SH(4)|BYTES_SH(2), ANYSPACE, Unroll4Words},
diff --git a/src/thirdparty/lcms2/src/cmsxform.c b/src/thirdparty/lcms2/src/cmsxform.c index 109d09f43..4d6c978e9 100644 --- a/src/thirdparty/lcms2/src/cmsxform.c +++ b/src/thirdparty/lcms2/src/cmsxform.c @@ -788,7 +788,7 @@ cmsBool CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform, BytesPerPixelInput = T_BYTES(xform ->InputFormat);
if (!(xform ->dwOriginalFlags & cmsFLAGS_CAN_CHANGE_FORMATTER)) {
- cmsSignalError(xform ->ContextID, cmsERROR_NOT_SUITABLE, "cmsChangeBuffersFormat works() only on transforms created originally with at least 16 bits of precision");
+ cmsSignalError(xform ->ContextID, cmsERROR_NOT_SUITABLE, "cmsChangeBuffersFormat works only on transforms created originally with at least 16 bits of precision");
return FALSE;
}
|