summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarti Maria <marti.maria@littlecms.com>2020-07-01 12:54:54 +0200
committerMarti Maria <marti.maria@littlecms.com>2020-07-01 12:54:54 +0200
commit8638f1ca827e99ce53039960cb0916d834027a14 (patch)
treeec6e078ea48ed2d2b6dcf537d1c0a83f3041d3e9
parent1c940c898a3a03c2e949259dc399a3dc44148baa (diff)
downloadlcms2-8638f1ca827e99ce53039960cb0916d834027a14.tar.gz
no SSE2 toggle on plugin
allow to compile withou SSE2
-rw-r--r--plugins/fast_float/include/lcms2_fast_float.h6
-rw-r--r--plugins/fast_float/src/fast_16_tethra.c3
-rw-r--r--plugins/fast_float/src/fast_8_matsh_sse.c11
-rw-r--r--plugins/fast_float/src/fast_float_sup.c3
4 files changed, 18 insertions, 5 deletions
diff --git a/plugins/fast_float/include/lcms2_fast_float.h b/plugins/fast_float/include/lcms2_fast_float.h
index 1dbf134..4b96800 100644
--- a/plugins/fast_float/include/lcms2_fast_float.h
+++ b/plugins/fast_float/include/lcms2_fast_float.h
@@ -32,6 +32,12 @@ extern "C" {
#define LCMS2_FAST_FLOAT_VERSION 1200
+// Configuration toggles
+
+// Uncomment this if yout target platform can deal with SSE2
+// #define CMS_DONT_USE_SSE2 1
+
+
// The one and only plug-in entry point. To install this plugin in your code
// you need to place this in some initialization place:
//
diff --git a/plugins/fast_float/src/fast_16_tethra.c b/plugins/fast_float/src/fast_16_tethra.c
index 6808fd3..9252d93 100644
--- a/plugins/fast_float/src/fast_16_tethra.c
+++ b/plugins/fast_float/src/fast_16_tethra.c
@@ -334,6 +334,9 @@ cmsBool Optimize16BitRGBTransform(_cmsTransformFn* TransformFn,
// Only real 16 bits
if (T_BIT15(*InputFormat) != 0 || T_BIT15(*OutputFormat) != 0) return FALSE;
+ // Swap endian is not supported
+ if (T_ENDIAN16(*InputFormat) != 0 || T_ENDIAN16(*OutputFormat) != 0) return FALSE;
+
// Only on input RGB
if (T_COLORSPACE(*InputFormat) != PT_RGB) return FALSE;
diff --git a/plugins/fast_float/src/fast_8_matsh_sse.c b/plugins/fast_float/src/fast_8_matsh_sse.c
index 233ffce..ddffd0d 100644
--- a/plugins/fast_float/src/fast_8_matsh_sse.c
+++ b/plugins/fast_float/src/fast_8_matsh_sse.c
@@ -24,6 +24,8 @@
#include "fast_float_internal.h"
+#ifndef CMS_DONT_USE_SSE2
+
#ifdef _MSC_VER
#include <intrin.h>
#else
@@ -229,7 +231,7 @@ void MatShaperXform8SSE(struct _cmstransform_struct *CMMcargo,
aout = (cmsUInt8Number*)Output + DestStartingOrder[3] + strideOut;
/**
- * Prefectch
+ * Prefetch
*/
__m128 rvector = _mm_set1_ps(p->Shaper1R[*rin]);
__m128 gvector = _mm_set1_ps(p->Shaper1G[*gin]);
@@ -336,7 +338,7 @@ cmsBool Optimize8MatrixShaperSSE(_cmsTransformFn* TransformFn,
// Check for SSE2 support
if (!(IsSSE2Available())) return FALSE;
- // Only works on RGB to RGB and gray to gray
+ // Only works on 3 to 3, probably RGB
if ( !( (T_CHANNELS(*InputFormat) == 3 && T_CHANNELS(*OutputFormat) == 3) ) ) return FALSE;
// Only works on 8 bit input
@@ -396,8 +398,8 @@ cmsBool Optimize8MatrixShaperSSE(_cmsTransformFn* TransformFn,
_cmsStageToneCurvesData* mpeC1 = (_cmsStageToneCurvesData*) cmsStageData(Curve1);
_cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*) cmsStageData(Curve2);
- // In this particular optimization, caché does not help as it takes more time to deal with
- // the caché that with the pixel handling
+ // In this particular optimization, cache does not help as it takes more time to deal with
+ // the cache that with the pixel handling
*dwFlags |= cmsFLAGS_NOCACHE;
@@ -414,4 +416,5 @@ cmsBool Optimize8MatrixShaperSSE(_cmsTransformFn* TransformFn,
return TRUE;
}
+#endif
diff --git a/plugins/fast_float/src/fast_float_sup.c b/plugins/fast_float/src/fast_float_sup.c
index 4b25705..e4bf794 100644
--- a/plugins/fast_float/src/fast_float_sup.c
+++ b/plugins/fast_float/src/fast_float_sup.c
@@ -40,9 +40,10 @@ cmsBool Floating_Point_Transforms_Dispatcher(_cmsTransformFn* TransformFn,
// Try to optimize by joining curves
if (Optimize8ByJoiningCurves(TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE;
+#ifndef CMS_DONT_USE_SSE2
// Try to use SSE2 to optimize as a set of curves plus a matrix plus a set of curves
if (Optimize8MatrixShaperSSE(TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE;
-
+#endif
// Try to optimize as a set of curves plus a matrix plus a set of curves
if (Optimize8MatrixShaper(TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE;