[babl] babl: make model_is_symmetric test adapt tolerance for high values
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: make model_is_symmetric test adapt tolerance for high values
- Date: Thu, 4 Jul 2019 10:34:22 +0000 (UTC)
commit e8b753ff9dadfb4819e4f3876aa792e4a719cbfc
Author: Øyvind Kolås <pippin gimp org>
Date: Thu Jul 4 12:32:07 2019 +0200
babl: make model_is_symmetric test adapt tolerance for high values
When the values used are in the billions, the tolerance that originally
was mostly intended for values in the range 0.0-1.0 and its neighborhood
break apart - use 1% of component values as symmetry threshold for such
values.
babl/babl-model.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/babl/babl-model.c b/babl/babl-model.c
index 90b1ad0..142734c 100644
--- a/babl/babl-model.c
+++ b/babl/babl-model.c
@@ -374,12 +374,17 @@ babl_model_is_symmetric (const Babl *cbabl)
{
int j;
for (j = 0; j < 4; j++)
- if (fabs (clipped[i *4 + j] - transformed[i * 4 + j]) > TOLERANCE)
+ {
+ float tolerance = TOLERANCE;
+ if (fabs(clipped[i*4+j]) > 1.0)
+ tolerance = fabs(clipped[i*4+j]) * 0.01;
+ if (fabs (clipped[i *4 + j] - transformed[i * 4 + j]) > tolerance)
{
if (!log)
log = 1;
symmetric = 0;
}
+ }
if (log && log < 5)
{
babl_log ("%s", babl->instance.name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]