[babl] babl: fix overflow detection at end of luts
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: fix overflow detection at end of luts
- Date: Sat, 2 Sep 2017 20:42:25 +0000 (UTC)
commit 2ad089018134642b8c9073db232d7d1395705e95
Author: Øyvind Kolås <pippin gimp org>
Date: Sat Sep 2 22:42:05 2017 +0200
babl: fix overflow detection at end of luts
babl/babl-trc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/babl/babl-trc.c b/babl/babl-trc.c
index 221cf3a..3ceb0b1 100644
--- a/babl/babl-trc.c
+++ b/babl/babl-trc.c
@@ -41,7 +41,7 @@ static inline float babl_trc_lut_from_linear (const Babl *trc_, float x)
if (entry >= trc->lut_size) entry = trc->lut_size - 1;
else if (entry < 0) entry = 0;
- if (diff > 0.0 && entry < trc->lut_size)
+ if (diff > 0.0 && entry < trc->lut_size-1)
{
ret = trc->inv_lut[entry] * (1.0 - diff) + trc->inv_lut[entry+1] * diff;
}
@@ -64,7 +64,7 @@ static inline float babl_trc_lut_to_linear (const Babl *trc_, float x)
if (entry >= trc->lut_size) entry = trc->lut_size - 1;
else if (entry < 0) entry = 0;
- if (diff > 0.0 && entry < trc->lut_size)
+ if (diff > 0.0 && entry < trc->lut_size - 1)
{
ret = trc->lut[entry] * (1.0 - diff) + trc->lut[entry+1] * diff;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]