[gegl] gegl: do thread-split on longest axis for point-ops
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl: do thread-split on longest axis for point-ops
- Date: Wed, 15 Nov 2017 03:26:28 +0000 (UTC)
commit c141bbf26f629f70d33414247a42e8cac1056b29
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Nov 15 03:20:56 2017 +0100
gegl: do thread-split on longest axis for point-ops
gegl/operation/gegl-operation-point-composer.c | 34 +++++++++++++++++-----
gegl/operation/gegl-operation-point-composer3.c | 35 ++++++++++++++++++----
gegl/operation/gegl-operation-point-filter.c | 32 +++++++++++++++------
3 files changed, 77 insertions(+), 24 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-point-composer.c b/gegl/operation/gegl-operation-point-composer.c
index 0a1a83a..684468f 100644
--- a/gegl/operation/gegl-operation-point-composer.c
+++ b/gegl/operation/gegl-operation-point-composer.c
@@ -319,16 +319,35 @@ gegl_operation_point_composer_process (GeglOperation *operation,
GThreadPool *pool = thread_pool ();
gint pending;
gint j;
- GeglRectangle sub_result;
+
+ if (result->width > result->height)
+ for (j = 0; j < threads; j++)
+ {
+ GeglRectangle rect = *result;
+ rect.width /= threads;
+ rect.x += rect.width * j;
+
+ if (j == threads-1)
+ rect.width = (result->width + result->x) - rect.x;
+
+ thread_data[j].result = rect;
+ }
+ else
+ for (j = 0; j < threads; j++)
+ {
+ GeglRectangle rect = *result;
+ rect = *result;
+ rect.height /= threads;
+ rect.y += rect.height * j;
+
+ if (j == threads-1)
+ rect.height = (result->height + result->y) - rect.y;
+
+ thread_data[j].result = rect;
+ }
for (j = 0; j < threads; j++)
{
- sub_result = *result;
- sub_result.height /= threads;
- sub_result.y += sub_result.height * j;
- if (j == threads-1)
- sub_result.height = (result->height + result->y) - sub_result.y;
-
thread_data[j].klass = point_composer_class;
thread_data[j].operation = operation;
thread_data[j].input = input;
@@ -339,7 +358,6 @@ gegl_operation_point_composer_process (GeglOperation *operation,
thread_data[j].input_format = in_format;
thread_data[j].aux_format = aux_format;
thread_data[j].output_format = out_format;
- thread_data[j].result = sub_result;
}
pending = threads;
diff --git a/gegl/operation/gegl-operation-point-composer3.c b/gegl/operation/gegl-operation-point-composer3.c
index 8d6e81b..4e202d3 100644
--- a/gegl/operation/gegl-operation-point-composer3.c
+++ b/gegl/operation/gegl-operation-point-composer3.c
@@ -233,15 +233,37 @@ gegl_operation_point_composer3_process (GeglOperation *operation,
GThreadPool *pool = thread_pool ();
gint pending;
gint j;
- GeglRectangle sub_result;
+
+ if (result->width > result->height)
+ for (j = 0; j < threads; j++)
+ {
+ GeglRectangle rect = *result;
+
+ rect.width /= threads;
+ rect.x += rect.width * j;
+
+ if (j == threads-1)
+ rect.width = (result->width + result->x) - rect.x;
+
+ thread_data[j].result = rect;
+ }
+ else
+ for (j = 0; j < threads; j++)
+ {
+ GeglRectangle rect = *result;
+
+ rect = *result;
+ rect.height /= threads;
+ rect.y += rect.height * j;
+
+ if (j == threads-1)
+ rect.height = (result->height + result->y) - rect.y;
+
+ thread_data[j].result = rect;
+ }
for (j = 0; j < threads; j++)
{
- sub_result = *result;
- sub_result.height /= threads;
- sub_result.y += sub_result.height * j;
- if (j == threads-1)
- sub_result.height = (result->height + result->y) - sub_result.y;
thread_data[j].klass = point_composer3_class;
thread_data[j].operation = operation;
thread_data[j].input = input;
@@ -254,7 +276,6 @@ gegl_operation_point_composer3_process (GeglOperation *operation,
thread_data[j].aux_format = aux_format;
thread_data[j].aux2_format = aux2_format;
thread_data[j].output_format = out_format;
- thread_data[j].result = sub_result;
}
pending = threads;
diff --git a/gegl/operation/gegl-operation-point-filter.c b/gegl/operation/gegl-operation-point-filter.c
index c20ca3e..8137d4e 100644
--- a/gegl/operation/gegl-operation-point-filter.c
+++ b/gegl/operation/gegl-operation-point-filter.c
@@ -290,18 +290,33 @@ gegl_operation_point_filter_process (GeglOperation *operation,
GThreadPool *pool = thread_pool ();
gint pending;
int j;
- GeglRectangle sub_result;
- for (j = 0; j < threads; j++)
- {
- sub_result = *result;
- sub_result.height /= threads;
- sub_result.y += sub_result.height * j;
- if (j == threads-1)
+ if (result->width > result->height)
+ for (j = 0; j < threads; j++)
+ {
+ GeglRectangle rect = *result;
+ rect.width /= threads;
+ rect.x += rect.width * j;
+
+ if (j == threads-1)
+ rect.width = (result->width + result->x) - rect.x;
+
+ thread_data[j].result = rect;
+ }
+ else
+ for (j = 0; j < threads; j++)
{
- sub_result.height = (result->height + result->y) - sub_result.y;
+ GeglRectangle rect = *result;
+ rect = *result;
+ rect.height /= threads;
+ rect.y += rect.height * j;
+ if (j == threads-1)
+ rect.height = (result->height + result->y) - rect.y;
+ thread_data[j].result = rect;
}
+ for (j = 0; j < threads; j++)
+ {
thread_data[j].klass = point_filter_class;
thread_data[j].operation = operation;
thread_data[j].input = input;
@@ -310,7 +325,6 @@ gegl_operation_point_filter_process (GeglOperation *operation,
thread_data[j].level = level;
thread_data[j].input_format = in_format;
thread_data[j].output_format = out_format;
- thread_data[j].result = sub_result;
}
pending = threads;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]