[gegl] dither: do not use several threads for the Floyd-Steinberg dithering method
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] dither: do not use several threads for the Floyd-Steinberg dithering method
- Date: Fri, 17 Nov 2017 14:03:42 +0000 (UTC)
commit 4ea2b423250196b9edecc316f9ffaa19498b87bc
Author: Thomas Manni <thomas manni free fr>
Date: Fri Nov 17 12:44:39 2017 +0100
dither: do not use several threads for the Floyd-Steinberg dithering method
Floyd-Steinberg dithering method needs to process the whole input buffer at
once, so bypass the multitreading split done by the operation filter process.
operations/common/dither.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/operations/common/dither.c b/operations/common/dither.c
index ebbf54b..8b2ebe0 100644
--- a/operations/common/dither.c
+++ b/operations/common/dither.c
@@ -553,6 +553,49 @@ process (GeglOperation *operation,
return TRUE;
}
+static gboolean
+operation_process (GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result,
+ gint level)
+{
+ GeglProperties *o = GEGL_PROPERTIES (operation);
+ gboolean success = FALSE;
+
+ if (o->dither_method == GEGL_DITHER_FLOYD_STEINBERG)
+ {
+ GeglOperationFilterClass *klass;
+ GeglBuffer *input;
+ GeglBuffer *output;
+
+ if (strcmp (output_prop, "output"))
+ {
+ g_warning ("requested processing of %s pad on a filter", output_prop);
+ return FALSE;
+ }
+
+ input = gegl_operation_context_get_source (context, "input");
+ output = gegl_operation_context_get_output_maybe_in_place (operation,
+ context,
+ input,
+ result);
+ klass = GEGL_OPERATION_FILTER_GET_CLASS (operation);
+ success = klass->process (operation, input, output, result, level);
+
+ g_clear_object (&input);
+ }
+ else
+ {
+ GeglOperationClass *operation_class;
+ operation_class = GEGL_OPERATION_CLASS (gegl_op_parent_class);
+
+ success = operation_class->process (operation, context, output_prop, result, level);
+ }
+
+ return success;
+}
+
static void
gegl_op_class_init (GeglOpClass *klass)
{
@@ -580,6 +623,7 @@ gegl_op_class_init (GeglOpClass *klass)
filter_class = GEGL_OPERATION_FILTER_CLASS (klass);
operation_class->prepare = prepare;
+ operation_class->process = operation_process;
operation_class->get_required_for_output = get_required_for_output;
operation_class->get_cached_region = get_cached_region;
filter_class->process = process;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]