diff --git a/rtengine/LUT.h b/rtengine/LUT.h index b58144a6f..29147df8b 100644 --- a/rtengine/LUT.h +++ b/rtengine/LUT.h @@ -200,6 +200,10 @@ public: clip = flags; } + int getClip() const { + return clip; + } + /** @brief Get the number of element in the LUT (i.e. dimension of the array) * For a LUT(500), it will return 500 * @return number of element in the array @@ -304,6 +308,9 @@ public: } #if defined( __SSE2__ ) && defined( __x86_64__ ) + + // NOTE: This version requires LUTs which clip at upper and lower bounds + // (which is the default). vfloat operator[](vfloat indexv) const { static_assert(std::is_same::value, "This method only works for float LUTs"); diff --git a/rtengine/curves.h b/rtengine/curves.h index 15ab96624..e8b65c33d 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -886,6 +886,8 @@ inline void StandardToneCurve::BatchApply( const size_t start, const size_t end, float *r, float *g, float *b) const { assert (lutToneCurve); + assert (lutToneCurve.getClip() & LUT_CLIP_BELOW); + assert (lutToneCurve.getClip() & LUT_CLIP_ABOVE); // All pointers must have the same alignment for SSE usage. In the loop body below, // we will only check `r`, assuming that the same result would hold for `g` and `b`.