summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarti Maria <marti.maria@littlecms.com>2023-04-26 16:30:38 +0200
committerMarti Maria <marti.maria@littlecms.com>2023-04-26 16:30:38 +0200
commit2dec6845c7b40340ce4ca11ab6205586d01023ed (patch)
tree03247d4922d3e4f5adb39db4e90f18ca0929e5f7
parentb97071f1a069eaff94f2b9aacdd593fe47591adf (diff)
parent03020d0fdd0f8a79f275657ad1ff757fe2cc4192 (diff)
downloadlcms2-2dec6845c7b40340ce4ca11ab6205586d01023ed.tar.gz
Merge branch 'master' of https://github.com/mm2/Little-CMS
-rw-r--r--include/lcms2.h3
-rw-r--r--plugins/fast_float/include/lcms2_fast_float.h2
-rw-r--r--plugins/fast_float/src/fast_float_internal.h9
-rw-r--r--plugins/fast_float/src/meson.build15
-rw-r--r--src/cmsgamma.c10
-rw-r--r--src/lcms2.def2
6 files changed, 24 insertions, 17 deletions
diff --git a/include/lcms2.h b/include/lcms2.h
index 924d40b..c361520 100644
--- a/include/lcms2.h
+++ b/include/lcms2.h
@@ -1220,7 +1220,8 @@ CMSAPI cmsBool CMSEXPORT cmsIsToneCurveMonotonic(const cmsToneCurve* t
CMSAPI cmsBool CMSEXPORT cmsIsToneCurveDescending(const cmsToneCurve* t);
CMSAPI cmsInt32Number CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t);
CMSAPI cmsFloat64Number CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision);
-CMSAPI cmsFloat64Number* CMSEXPORT cmsGetToneCurveParams(const cmsToneCurve* t);
+
+CMSAPI const cmsCurveSegment* CMSEXPORT cmsGetToneCurveSegment(cmsInt32Number n, const cmsToneCurve* t);
// Tone curve tabular estimation
CMSAPI cmsUInt32Number CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t);
diff --git a/plugins/fast_float/include/lcms2_fast_float.h b/plugins/fast_float/include/lcms2_fast_float.h
index 6dacd7a..6515c6b 100644
--- a/plugins/fast_float/include/lcms2_fast_float.h
+++ b/plugins/fast_float/include/lcms2_fast_float.h
@@ -30,7 +30,7 @@ extern "C" {
# endif
#endif
-#define LCMS2_FAST_FLOAT_VERSION 1501
+#define LCMS2_FAST_FLOAT_VERSION 1502
// Configuration toggles
diff --git a/plugins/fast_float/src/fast_float_internal.h b/plugins/fast_float/src/fast_float_internal.h
index 35d7c25..e5bdf8d 100644
--- a/plugins/fast_float/src/fast_float_internal.h
+++ b/plugins/fast_float/src/fast_float_internal.h
@@ -134,12 +134,15 @@ cmsINLINE cmsFloat32Number flerp(const cmsFloat32Number LutTable[], cmsFloat32Nu
cmsFloat32Number rest;
int cell0, cell1;
- if ((v < 1.0e-9f) || isnan(v)) {
- return LutTable[0];
+ if (isnan(v))
+ return LutTable[0];
+
+ if (v < 1.0e-9f) {
+ return v;
}
else
if (v >= 1.0) {
- return LutTable[MAX_NODES_IN_CURVE - 1];
+ return v;
}
v *= (MAX_NODES_IN_CURVE - 1);
diff --git a/plugins/fast_float/src/meson.build b/plugins/fast_float/src/meson.build
index e907c3b..c53639c 100644
--- a/plugins/fast_float/src/meson.build
+++ b/plugins/fast_float/src/meson.build
@@ -19,13 +19,16 @@ lcms2_fast_float_sources = files(
lcms2_fast_float_incdir = include_directories('../include', '.')
if host_machine.system() == 'windows'
- lcms2_fast_float_rc = configure_file(
- input: 'lcms2_fast_float.rc.in',
- configuration: version_cfg,
- output: 'lcms2_fast_float.rc',
- )
+ if get_option('default_library') == 'shared'
- lcms2_fast_float_sources += win.compile_resources(lcms2_fast_float_rc)
+ lcms2_fast_float_rc = configure_file(
+ input: 'lcms2_fast_float.rc.in',
+ configuration: version_cfg,
+ output: 'lcms2_fast_float.rc',
+ )
+
+ lcms2_fast_float_sources += win.compile_resources(lcms2_fast_float_rc)
+ endif
endif
liblcms2_fast_float = library(
diff --git a/src/cmsgamma.c b/src/cmsgamma.c
index 1031fc1..24b2ada 100644
--- a/src/cmsgamma.c
+++ b/src/cmsgamma.c
@@ -1491,13 +1491,13 @@ cmsFloat64Number CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Num
return (sum / n); // The mean
}
+// Retrieve segments on tone curves
-// Retrieve parameters on one-segment tone curves
-
-cmsFloat64Number* CMSEXPORT cmsGetToneCurveParams(const cmsToneCurve* t)
+const cmsCurveSegment* CMSEXPORT cmsGetToneCurveSegment(cmsInt32Number n, const cmsToneCurve* t)
{
_cmsAssert(t != NULL);
- if (t->nSegments != 1) return NULL;
- return t->Segments[0].Params;
+ if (n < 0 || n >= (cmsInt32Number) t->nSegments) return NULL;
+ return t->Segments + n;
}
+
diff --git a/src/lcms2.def b/src/lcms2.def
index b9ce630..5bd2678 100644
--- a/src/lcms2.def
+++ b/src/lcms2.def
@@ -362,7 +362,7 @@ cmsMD5add = cmsMD5add
cmsMD5alloc = cmsMD5alloc
cmsMD5finish = cmsMD5finish
_cmsComputeInterpParams = _cmsComputeInterpParams
-cmsGetToneCurveParams = cmsGetToneCurveParams
+cmsGetToneCurveSegment = cmsGetToneCurveSegment
cmsDetectRGBProfileGamma = cmsDetectRGBProfileGamma
_cmsOptimizePipeline = _cmsOptimizePipeline
_cmsReasonableGridpointsByColorspace = _cmsReasonableGridpointsByColorspace