[babl] babl: make powf approximation yield 0 for negatives
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: make powf approximation yield 0 for negatives
- Date: Sun, 17 Sep 2017 18:25:09 +0000 (UTC)
commit 83ccc6d027554527d84b9883c08145fce8193454
Author: Øyvind Kolås <pippin gimp org>
Date: Sun Sep 17 20:24:16 2017 +0200
babl: make powf approximation yield 0 for negatives
babl/babl-trc.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/babl/babl-trc.c b/babl/babl-trc.c
index 7d9f82f..7524ef8 100644
--- a/babl/babl-trc.c
+++ b/babl/babl-trc.c
@@ -93,10 +93,11 @@ static inline float _babl_trc_gamma_to_linear (const Babl *trc_, float value)
{
return babl_polynomial_eval (&trc->poly_gamma_to_linear, value);
}
- else
+ else if (value > 0.0f)
{
return powf (value, trc->gamma);
}
+ return 0.0f;
}
static inline float _babl_trc_gamma_from_linear (const Babl *trc_, float value)
@@ -107,10 +108,11 @@ static inline float _babl_trc_gamma_from_linear (const Babl *trc_, float value)
{
return babl_polynomial_eval (&trc->poly_gamma_from_linear, value);
}
- else
+ else if (value > 0.0f)
{
return powf (value, trc->rgamma);
}
+ return 0.0f;
}
static inline void _babl_trc_gamma_to_linear_buf (const Babl *trc_, const float *in, float *out, int in_gap,
int out_gap, int components, int count)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]