Add comment and assertions

This commit is contained in:
gatoatigrado
2017-12-25 22:50:40 -05:00
parent 59e31ed36f
commit 6dab5742dd
2 changed files with 9 additions and 0 deletions

View File

@@ -200,6 +200,10 @@ public:
clip = flags; clip = flags;
} }
int getClip() const {
return clip;
}
/** @brief Get the number of element in the LUT (i.e. dimension of the array) /** @brief Get the number of element in the LUT (i.e. dimension of the array)
* For a LUT(500), it will return 500 * For a LUT(500), it will return 500
* @return number of element in the array * @return number of element in the array
@@ -304,6 +308,9 @@ public:
} }
#if defined( __SSE2__ ) && defined( __x86_64__ ) #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 vfloat operator[](vfloat indexv) const
{ {
static_assert(std::is_same<T, float>::value, "This method only works for float LUTs"); static_assert(std::is_same<T, float>::value, "This method only works for float LUTs");

View File

@@ -886,6 +886,8 @@ inline void StandardToneCurve::BatchApply(
const size_t start, const size_t end, const size_t start, const size_t end,
float *r, float *g, float *b) const { float *r, float *g, float *b) const {
assert (lutToneCurve); 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, // 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`. // we will only check `r`, assuming that the same result would hold for `g` and `b`.