[gegl] workshop: expose number of improvement iterations done on each probe
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] workshop: expose number of improvement iterations done on each probe
- Date: Fri, 28 Jun 2019 22:43:35 +0000 (UTC)
commit 3edfbf070df4d5c102b87d7513a72e459eb4874b
Author: Øyvind Kolås <pippin gimp org>
Date: Sat Jun 29 00:43:22 2019 +0200
workshop: expose number of improvement iterations done on each probe
operations/workshop/inpaint.c | 6 +++++-
operations/workshop/pixel-duster.h | 34 +++++++++++++---------------------
2 files changed, 18 insertions(+), 22 deletions(-)
---
diff --git a/operations/workshop/inpaint.c b/operations/workshop/inpaint.c
index 2552bfbe2..719e1d86b 100644
--- a/operations/workshop/inpaint.c
+++ b/operations/workshop/inpaint.c
@@ -35,6 +35,9 @@ 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)
+ value_range (1, 30)
+
property_double (chance_try, "try chance", 0.8)
value_range (0.0, 1.0)
@@ -84,13 +87,14 @@ process (GeglOperation *operation,
GeglRectangle out_rect = *gegl_buffer_get_extent (output);
PixelDuster *duster = pixel_duster_new (input, input, output, &in_rect, &out_rect,
o->seek_distance,
- 3,
+ 1,
o->min_neigh,
o->min_iter,
o->chance_try,
o->chance_retry,
1.0,
1.0,
+ o->improvement_iters,
operation);
gegl_buffer_copy (input, NULL, GEGL_ABYSS_NONE, output, NULL);
pixel_duster_add_probes_for_transparent (duster);
diff --git a/operations/workshop/pixel-duster.h b/operations/workshop/pixel-duster.h
index 8a34580eb..886fef60d 100644
--- a/operations/workshop/pixel-duster.h
+++ b/operations/workshop/pixel-duster.h
@@ -24,7 +24,6 @@
/*
todo:
- exclude identicals - when it is obvious
threading
create list of hashtables and to hashtable list per thread
@@ -33,14 +32,6 @@
replace hashtables with just lists - and include coords in element - perhaps with count..
for identical entries - thus not losing accurate median computation capabilitiy..
- do median instead of mean for matched pixel components
-
- complete code using relative to center pixel instead of center pixel -
- thus permitting a wider range of neighborhoods to produce valid data - thus
- will be good at least for superresolution
-
- add more symmetries mirroring each doubling data - add full rotation
- invariance
*/
#include <math.h>
@@ -82,16 +73,16 @@ typedef struct
} PixelDuster;
-#define MAX_K 4
+#define MAX_K 4
-#define RINGS 3
-#define IMPROVEMENT_ITERATIONS 3
-#define RAYS 12
-#define GAP 1.3
-#define RINGGAMMA 1.2
-#define TWIST 0.0
+#define RINGS 4
+#define RAYS 6
#define NEIGHBORHOOD (RINGS*RAYS+1)
+#define GAP 1.2
+#define RINGGAMMA 1.1
+#define TWIST 0.0
+
typedef struct Probe {
int target_x;
int target_y;
@@ -179,6 +170,7 @@ static PixelDuster * pixel_duster_new (GeglBuffer *reference,
float retry_chance,
float scale_x,
float scale_y,
+ int improvement_iterations,
GeglOperation *op)
{
PixelDuster *ret = g_malloc0 (sizeof (PixelDuster));
@@ -195,7 +187,7 @@ static PixelDuster * pixel_duster_new (GeglBuffer *reference,
ret->max_y = 0;
ret->min_x = 10000;
ret->min_y = 10000;
- ret->max_age = IMPROVEMENT_ITERATIONS;
+ ret->max_age = improvement_iterations;
if (max_k < 1) max_k = 1;
if (max_k > MAX_K) max_k = MAX_K;
@@ -316,7 +308,7 @@ static void extract_site (PixelDuster *duster, GeglBuffer *buffer, double x, dou
for (int ray = 0; ray < RAYS; ray ++)
{
- int swapped_ray = ray + warmest_ray_energy;
+ int swapped_ray = ray + warmest_ray;
if (swapped_ray >= RAYS) swapped_ray -= RAYS;
for (int circle = 0; circle < RINGS; circle++)
@@ -524,7 +516,7 @@ static void compare_needle (gpointer key, gpointer value, gpointer data)
gint y = offset / 65536;
float score;
-#if 0
+#if 1
#define pow2(a) ((a)*(a))
if ( duster->seek_radius > 1 &&
pow2 (probe->target_x / duster->scale_x - x) +
@@ -584,10 +576,10 @@ static int probe_improve (PixelDuster *duster,
extract_site (duster, duster->output, dst_x, dst_y, 1.0, &needle[0]);
g_hash_table_foreach (duster->ht[0], compare_needle, ptr);
- extract_site (duster, duster->output, dst_x, dst_y, 1.5, &needle[0]);
+ extract_site (duster, duster->output, dst_x, dst_y, 1.1, &needle[0]);
g_hash_table_foreach (duster->ht[0], compare_needle, ptr);
- extract_site (duster, duster->output, dst_x, dst_y, 0.666, &needle[0]);
+ extract_site (duster, duster->output, dst_x, dst_y, 0.9, &needle[0]);
g_hash_table_foreach (duster->ht[0], compare_needle, ptr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]