diff options
author | Marti Maria <marti.maria@littlecms.com> | 2020-05-25 14:16:04 +0200 |
---|---|---|
committer | Marti Maria <marti.maria@littlecms.com> | 2020-05-25 14:16:04 +0200 |
commit | c60ea48180760c4c4b1631cb8a272b488b96e43e (patch) | |
tree | 5f35c42d420bc48df5436733e9697391236032c4 | |
parent | d702e32c9d6dc07302aea3be2c0ad3b47d519d5e (diff) | |
download | lcms2-c60ea48180760c4c4b1631cb8a272b488b96e43e.tar.gz |
Changes from Artifex
Many thanks for sharing!
-rw-r--r-- | plugins/fast_float/Projects/VC2019/lcms2_fast_float_plugin_testbed.vcxproj | 8 | ||||
-rw-r--r-- | plugins/fast_float/testbed/fast_float_testbed.c | 46 | ||||
-rw-r--r-- | src/cmsalpha.c | 6 | ||||
-rw-r--r-- | src/cmsgamma.c | 3 | ||||
-rw-r--r-- | src/cmslut.c | 28 | ||||
-rw-r--r-- | src/lcms2_internal.h | 2 |
6 files changed, 67 insertions, 26 deletions
diff --git a/plugins/fast_float/Projects/VC2019/lcms2_fast_float_plugin_testbed.vcxproj b/plugins/fast_float/Projects/VC2019/lcms2_fast_float_plugin_testbed.vcxproj index b9f4b42..8244865 100644 --- a/plugins/fast_float/Projects/VC2019/lcms2_fast_float_plugin_testbed.vcxproj +++ b/plugins/fast_float/Projects/VC2019/lcms2_fast_float_plugin_testbed.vcxproj @@ -70,22 +70,22 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> <IntDir>$(Platform)\testbed_$(Configuration)\</IntDir> - <OutDir>$(ProjectDir)..\..\testbed</OutDir> + <OutDir>$(ProjectDir)..\..\testbed\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</LinkIncremental> <IntDir>$(Platform)\testbed_$(Configuration)\</IntDir> - <OutDir>$(ProjectDir)..\..\testbed</OutDir> + <OutDir>$(ProjectDir)..\..\testbed\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LinkIncremental>false</LinkIncremental> <IntDir>$(Platform)\testbed_$(Configuration)\</IntDir> - <OutDir>$(ProjectDir)..\..\testbed</OutDir> + <OutDir>$(ProjectDir)..\..\testbed\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LinkIncremental>false</LinkIncremental> <IntDir>$(Platform)\testbed_$(Configuration)\</IntDir> - <OutDir>$(ProjectDir)..\..\testbed</OutDir> + <OutDir>$(ProjectDir)..\..\testbed\</OutDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> diff --git a/plugins/fast_float/testbed/fast_float_testbed.c b/plugins/fast_float/testbed/fast_float_testbed.c index 96e67b9..1852bf2 100644 --- a/plugins/fast_float/testbed/fast_float_testbed.c +++ b/plugins/fast_float/testbed/fast_float_testbed.c @@ -1297,6 +1297,42 @@ cmsFloat64Number SpeedTest16bitsRGB(cmsContext ct, cmsHPROFILE hlcmsProfileIn, c } + +static +void SpeedTest8(void) +{ + cmsContext noPlugin = cmsCreateContext(0, 0); + + cmsFloat64Number t[10]; + + printf("\n\n"); + printf("P E R F O R M A N C E T E S T S 8 B I T S (D E F A U L T)\n"); + printf("==============================================================\n\n"); + fflush(stdout); + + PerformanceHeader(); + t[0] = Performance("8 bits on CLUT profiles ", SpeedTest8bitsRGB, noPlugin, "test5.icc", "test3.icc", sizeof(Scanline_rgb8bits), 0); + t[1] = Performance("8 bits on Matrix-Shaper ", SpeedTest8bitsRGB, noPlugin, "test5.icc", "test0.icc", sizeof(Scanline_rgb8bits), 0); + t[2] = Performance("8 bits on same MatrixSh ", SpeedTest8bitsRGB, noPlugin, "test0.icc", "test0.icc", sizeof(Scanline_rgb8bits), 0); + t[3] = Performance("8 bits on curves ", SpeedTest8bitsRGB, noPlugin, NULL, NULL, sizeof(Scanline_rgb8bits), 0); + + // Note that context 0 has the plug-in installed + + printf("\n\n"); + printf("P E R F O R M A N C E T E S T S 8 B I T S (P L U G I N)\n"); + printf("===========================================================\n\n"); + fflush(stdout); + + PerformanceHeader(); + Performance("8 bits on CLUT profiles ", SpeedTest8bitsRGB, 0, "test5.icc", "test3.icc", sizeof(Scanline_rgb8bits), t[0]); + Performance("8 bits on Matrix-Shaper ", SpeedTest8bitsRGB, 0, "test5.icc", "test0.icc", sizeof(Scanline_rgb8bits), t[1]); + Performance("8 bits on same MatrixSh ", SpeedTest8bitsRGB, 0, "test0.icc", "test0.icc", sizeof(Scanline_rgb8bits), t[2]); + Performance("8 bits on curves ", SpeedTest8bitsRGB, 0, NULL, NULL, sizeof(Scanline_rgb8bits), t[3]); + + cmsDeleteContext(noPlugin); +} + +#if 0 static void SpeedTest8(void) { @@ -1308,8 +1344,9 @@ void SpeedTest8(void) Performance("8 bits on Matrix-Shaper profiles", SpeedTest8bitsRGB, 0, "test5.icc", "test0.icc", sizeof(Scanline_rgb8bits), 0); Performance("8 bits on same Matrix-Shaper ", SpeedTest8bitsRGB, 0, "test0.icc", "test0.icc", sizeof(Scanline_rgb8bits), 0); Performance("8 bits on curves ", SpeedTest8bitsRGB, 0, NULL, NULL, sizeof(Scanline_rgb8bits), 0); - // Performance("8 bits on CMYK CLUT profiles ", SpeedTest8bitsCMYK, 0, "test1.icc", "test2.icc", sizeof(Scanline_rgba15bits), 0); + } +#endif static @@ -1419,6 +1456,10 @@ void SpeedTestFloat(void) } + + + + static cmsFloat64Number SpeedTestFloatByUsing16BitsRGB(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) { @@ -1768,8 +1809,7 @@ int main() printf("Installing plug-in ... "); cmsPlugin(cmsFastFloatExtensions()); printf("done.\n\n"); - - CheckLab2Roundtrip(); + CheckComputeIncrements(); diff --git a/src/cmsalpha.c b/src/cmsalpha.c index e6c80c9..f747bc6 100644 --- a/src/cmsalpha.c +++ b/src/cmsalpha.c @@ -138,21 +138,25 @@ void from16to16(void* dst, const void* src) *(cmsUInt16Number*)dst = CHANGE_ENDIAN(n); } +static void from16toFLT(void* dst, const void* src) { *(cmsFloat32Number*)dst = (*(cmsUInt16Number*)src) / 65535.0f; } +static void from16SEtoFLT(void* dst, const void* src) { *(cmsFloat32Number*)dst = (CHANGE_ENDIAN(*(cmsUInt16Number*)src)) / 65535.0f; } +static void from16toDBL(void* dst, const void* src) { *(cmsFloat64Number*)dst = (*(cmsUInt16Number*)src) / 65535.0f; } +static void from16SEtoDBL(void* dst, const void* src) { *(cmsFloat64Number*)dst = (CHANGE_ENDIAN(*(cmsUInt16Number*)src)) / 65535.0f; @@ -271,6 +275,7 @@ void fromHLFto16SE(void* dst, const void* src) cmsUNUSED_PARAMETER(src); #endif } + static void fromHLFtoFLT(void* dst, const void* src) { @@ -315,6 +320,7 @@ void fromDBLto16SE(void* dst, const void* src) cmsUInt16Number i = _cmsQuickSaturateWord(n * 65535.0f); *(cmsUInt16Number*)dst = CHANGE_ENDIAN(i); } + static void fromDBLtoFLT(void* dst, const void* src) { diff --git a/src/cmsgamma.c b/src/cmsgamma.c index 1358252..b538b07 100644 --- a/src/cmsgamma.c +++ b/src/cmsgamma.c @@ -300,7 +300,8 @@ cmsToneCurve* AllocateToneCurveStruct(cmsContext ContextID, cmsUInt32Number nEnt return p; Error: - if (p -> Segments) _cmsFree(ContextID, p ->Segments); + if (p -> SegInterp) _cmsFree(ContextID, p -> SegInterp); + if (p -> Segments) _cmsFree(ContextID, p -> Segments); if (p -> Evals) _cmsFree(ContextID, p -> Evals); if (p ->Table16) _cmsFree(ContextID, p ->Table16); _cmsFree(ContextID, p); diff --git a/src/cmslut.c b/src/cmslut.c index ee6372a..e77f035 100644 --- a/src/cmslut.c +++ b/src/cmslut.c @@ -397,37 +397,31 @@ cmsStage* CMSEXPORT cmsStageAllocMatrix(cmsContext ContextID, cmsUInt32Number R NewElem = (_cmsStageMatrixData*) _cmsMallocZero(ContextID, sizeof(_cmsStageMatrixData)); - if (NewElem == NULL) return NULL; - + if (NewElem == NULL) goto Error; + NewMPE->Data = (void*)NewElem; NewElem ->Double = (cmsFloat64Number*) _cmsCalloc(ContextID, n, sizeof(cmsFloat64Number)); - - if (NewElem->Double == NULL) { - MatrixElemTypeFree(NewMPE); - return NULL; - } - + if (NewElem->Double == NULL) goto Error; + for (i=0; i < n; i++) { NewElem ->Double[i] = Matrix[i]; } - if (Offset != NULL) { NewElem ->Offset = (cmsFloat64Number*) _cmsCalloc(ContextID, Rows, sizeof(cmsFloat64Number)); - if (NewElem->Offset == NULL) { - MatrixElemTypeFree(NewMPE); - return NULL; - } - + if (NewElem->Offset == NULL) goto Error; + for (i=0; i < Rows; i++) { NewElem ->Offset[i] = Offset[i]; } - } - - NewMPE ->Data = (void*) NewElem; + return NewMPE; + +Error: + cmsStageFree(NewMPE); + return NULL; } diff --git a/src/lcms2_internal.h b/src/lcms2_internal.h index 816eaf8..683ec4c 100644 --- a/src/lcms2_internal.h +++ b/src/lcms2_internal.h @@ -106,7 +106,7 @@ /// Properly define some macros to accommodate /// older MSVC versions. -# if _MSC_VER <= 1700 +# if defined(_MSC_VER) && _MSC_VER <= 1700 #include <float.h> #define isnan _isnan #define isinf(x) (!_finite((x))) |