[babl] babl: set babl_rel_avg_error to a high value on NaN
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: set babl_rel_avg_error to a high value on NaN
- Date: Mon, 25 Sep 2017 20:49:39 +0000 (UTC)
commit 1081ca43b78bc7779337eb313edd84553a3cab24
Author: Øyvind Kolås <pippin gimp org>
Date: Mon Sep 25 22:46:21 2017 +0200
babl: set babl_rel_avg_error to a high value on NaN
In relation to bug #787441, if the sum of errors contain a nan the sum
is nan, we return pi as a much higher than expected average error to
indicate that this is not 0.0.
babl/babl-util.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/babl/babl-util.c b/babl/babl-util.c
index 9b08913..23c1513 100644
--- a/babl/babl-util.c
+++ b/babl/babl-util.c
@@ -91,10 +91,12 @@ babl_rel_avg_error (const double *imgA,
for (i = 0; i < samples; i++)
error += fabs (imgA[i] - imgB[i]);
- if (error >= 0.000001)
+ if (error >= 0.0000001)
error /= samples;
- else
+ else if (error <= 0.0)
error = 0.0;
+ else
+ error = M_PI;
return error;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]