[babl] babl: further nan prevention in babl-trc
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: further nan prevention in babl-trc
- Date: Mon, 11 Sep 2017 10:52:55 +0000 (UTC)
commit e747cd9a21b2dcdca37d8dfc21a9c5d47767a89a
Author: Øyvind Kolås <pippin gimp org>
Date: Mon Sep 11 00:41:47 2017 +0200
babl: further nan prevention in babl-trc
babl/babl-trc.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/babl/babl-trc.c b/babl/babl-trc.c
index 6f97d83..7fa79f1 100644
--- a/babl/babl-trc.c
+++ b/babl/babl-trc.c
@@ -417,9 +417,13 @@ static inline float _babl_trc_formula_srgb_from_linear (const Babl *trc_, float
{
float v = babl_powf (x, 1.0/g);
v = (v-b)/a;
- return v;
+ if (v < 0.0 || v >= 0.0)
+ return v;
+ return 0.0;
}
- return x / c;
+ if (c > 0.0)
+ return x / c;
+ return 0.0;
}
static inline float _babl_trc_formula_srgb_to_linear (const Babl *trc_, float value)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]