[gegl] workshop: split empty needle and empty hay score parameters



commit 27d0aed086f60adadc3fa52dac449de2ee589de5
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Jul 2 16:15:15 2019 +0200

    workshop: split empty needle and empty hay score parameters

 operations/workshop/inpaint.c      | 13 +++++++++----
 operations/workshop/pixel-duster.h | 28 +++++++++++++++++++++-------
 2 files changed, 30 insertions(+), 11 deletions(-)
---
diff --git a/operations/workshop/inpaint.c b/operations/workshop/inpaint.c
index 7a7f41b7f..20a7af0ae 100644
--- a/operations/workshop/inpaint.c
+++ b/operations/workshop/inpaint.c
@@ -41,7 +41,7 @@ property_int (max_iter, "max iter", 2000)
 property_int (improvement_iters, "improvement iters", 3)
   value_range (0, 30)
 
-property_double (chance_try, "try chance", 0.5)
+property_double (chance_try, "try chance", 0.66)
   value_range (0.0, 1.0)
   ui_steps    (0.01, 0.1)
 property_double (chance_retry, "retry chance", 1.0)
@@ -55,7 +55,7 @@ property_double (ring_gap,    "ring gap", 1.3)
 property_double (ring_gamma, "ring gamma", 1.4)
   value_range (0.0, 4.0)
   ui_steps    (0.1, 0.2)
-property_double (ring_twist, "ring twist", 0.10)
+property_double (ring_twist, "ring twist", 0.033)
   value_range (0.0, 1.0)
   ui_steps    (0.01, 0.2)
 
@@ -79,7 +79,11 @@ property_double (metric_dist_powk, "metric dist powk", 2.0)
   value_range (0.0, 10.0)
   ui_steps    (0.1, 1.0)
 
-property_double (metric_empty_score, "metric empty score", 0.07)
+property_double (metric_empty_hay_score, "metric empty hay score", 0.100)
+  value_range (0.01, 100.0)
+  ui_steps    (0.05, 0.1)
+
+property_double (metric_empty_needle_score, "metric empty needle score", 0.033)
   value_range (0.01, 100.0)
   ui_steps    (0.05, 0.1)
 
@@ -149,7 +153,8 @@ process (GeglOperation       *operation,
                                              o->ring_gamma,
                                              o->ring_twist,
                                              o->metric_dist_powk,
-                                             o->metric_empty_score,
+                                             o->metric_empty_hay_score,
+                                             o->metric_empty_needle_score,
                                              o->metric_cohesion/1000.0,
                                              operation);
   gegl_buffer_copy (input, NULL, GEGL_ABYSS_NONE, output, NULL);
diff --git a/operations/workshop/pixel-duster.h b/operations/workshop/pixel-duster.h
index 499116c76..4e714efb6 100644
--- a/operations/workshop/pixel-duster.h
+++ b/operations/workshop/pixel-duster.h
@@ -69,7 +69,8 @@ typedef struct
   float          ring_twist;
 
   float          metric_dist_powk;
-  float          metric_empty_score;
+  float          metric_empty_hay_score;
+  float          metric_empty_needle_score;
   float          metric_cohesion;
 
   GHashTable    *ht[1];
@@ -190,7 +191,8 @@ static PixelDuster * pixel_duster_new (GeglBuffer *reference,
                                        float       ring_gamma,
                                        float       ring_twist,
                                        float       metric_dist_powk,
-                                       float       metric_empty_score,
+                                       float       metric_empty_hay_score,
+                                       float       metric_empty_needle_score,
                                        float       metric_cohesion,
 
                                        GeglOperation *op)
@@ -227,7 +229,8 @@ static PixelDuster * pixel_duster_new (GeglBuffer *reference,
   ret->scale_x  = scale_x;
   ret->scale_y  = scale_y;
   ret->metric_dist_powk = metric_dist_powk;
-  ret->metric_empty_score = metric_empty_score;
+  ret->metric_empty_hay_score = metric_empty_hay_score;
+  ret->metric_empty_needle_score = metric_empty_needle_score;
   ret->metric_cohesion = metric_cohesion;
 
   ret->in_sampler_f = gegl_buffer_sampler_new (input,
@@ -380,15 +383,26 @@ score_site (PixelDuster *duster,
 
   for (i = 1; i < NEIGHBORHOOD && score < bail; i++)
   {
-
-    if (needle[i*4 + 3]>0.01 && hay[i*4 + 3]>0.001f)
+    if (needle[i*4 + 3]>0.001f)
     {
-      score += f_rgb_diff (&needle[i*4 + 0], &hay[i*4 + 0]) * duster->order[i][2];
+      if (hay[i*4 + 3]>0.001f)
+      {
+        score += f_rgb_diff (&needle[i*4 + 0], &hay[i*4 + 0]) * duster->order[i][2];
+      }
+      else
+      {
+        score += duster->metric_empty_hay_score * duster->order[i][2];
+      }
     }
     else
+    {
+      score += duster->metric_empty_needle_score * duster->order[i][2];
+    }
+
+
+
     {
       /* 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]