[gegl] workshop: fix alpha condition in inpaint metric



commit 68531a7318efadabdfb1f4447f8b9e966f6302c8
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Jul 1 16:32:42 2019 +0200

    workshop: fix alpha condition in inpaint metric

 operations/workshop/inpaint.c      | 8 ++++----
 operations/workshop/pixel-duster.h | 4 +++-
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/operations/workshop/inpaint.c b/operations/workshop/inpaint.c
index 176523f2d..3f23aa57f 100644
--- a/operations/workshop/inpaint.c
+++ b/operations/workshop/inpaint.c
@@ -35,7 +35,7 @@ property_int (min_neigh, "min neigh", 4)
 property_int (min_iter, "min iter", 100)
   value_range (1, 512)
 
-property_int (improvement_iters, "improvement iters", 1)
+property_int (improvement_iters, "improvement iters", 3)
   value_range (1, 30)
 
 property_double (chance_try, "try chance", 0.75)
@@ -59,9 +59,9 @@ property_double (metric_dist_powk, "metric dist powk", 1.35)
   value_range (0.0, 10.0)
   ui_steps    (0.1, 1.0)
 
-property_double (metric_empty_score, "metric empty score", 0.25)
-  value_range (0.1, 100.0)
-  ui_steps    (0.1, 0.1)
+property_double (metric_empty_score, "metric empty score", 0.05)
+  value_range (0.01, 100.0)
+  ui_steps    (0.05, 0.1)
 
 #else
 
diff --git a/operations/workshop/pixel-duster.h b/operations/workshop/pixel-duster.h
index 8978958b1..546c0c9ad 100644
--- a/operations/workshop/pixel-duster.h
+++ b/operations/workshop/pixel-duster.h
@@ -353,12 +353,14 @@ score_site (PixelDuster *duster,
 
   for (i = 1; i < NEIGHBORHOOD && score < bail; i++)
   {
-    if (needle[i*4 + 3]<1.0f && hay[i*4 + 3]>0.001f)
+
+    if (needle[i*4 + 3]>0.01 && hay[i*4 + 3]>0.001f)
     {
       score += f_rgb_diff (&needle[i*4 + 0], &hay[i*4 + 0]) * duster->order[i][2];
     }
     else
     {
+      /* both empty in needle and empty in hay get a similar badness score */
       score += duster->metric_empty_score * duster->order[i][2];
     }
   }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]