[gegl/wip/pippin/pipeline: 91/95] ops update



commit 8d9ba66b32a5a3434b34d18dcd3f15f73d83b7cf
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Jul 25 21:24:02 2018 +0200

    ops update

 gegl/operation/gegl-operation-point-composer.c  | 59 +++++++++++++++---------
 gegl/operation/gegl-operation-point-composer3.c | 52 +++++++++++++--------
 gegl/operation/gegl-operation-point-filter.c    | 60 +++++++++++++------------
 3 files changed, 104 insertions(+), 67 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-point-composer.c b/gegl/operation/gegl-operation-point-composer.c
index c0e0901ff..35d60cb85 100644
--- a/gegl/operation/gegl-operation-point-composer.c
+++ b/gegl/operation/gegl-operation-point-composer.c
@@ -141,33 +141,50 @@ gegl_operation_composer_process (GeglOperation        *operation,
   if (!input && !aux)
     return FALSE;
 
-  pipeline = gegl_operation_pipeline_ensure (operation, context, input);
+  if (gegl_operation_is_pipelinable (operation))
+  {
+    pipeline = gegl_operation_pipeline_ensure (operation, context, input);
 
-  gegl_operation_pipeline_add (pipeline, operation, 2,
-       gegl_operation_get_format (operation, "input"),
-       gegl_operation_get_format (operation, "output"),
-       gegl_operation_get_format (operation, "aux"),
-       NULL,
-       aux, NULL,
-       point_composer_class->process);
+    gegl_operation_pipeline_add (pipeline, operation, 2,
+         gegl_operation_get_format (operation, "input"),
+         gegl_operation_get_format (operation, "output"),
+         gegl_operation_get_format (operation, "aux"),
+         NULL,
+         aux, NULL,
+         point_composer_class->process);
 
-  if (gegl_operation_pipeline_is_intermediate_node (operation, pipeline))
-  {
-    gegl_operation_context_take_object (context, "output", G_OBJECT (input));
+    if (gegl_operation_pipeline_is_intermediate_node (operation, pipeline))
+    {
+      gegl_operation_context_take_object (context, "output", G_OBJECT (input));
 
-    return TRUE;
-  }
+      return TRUE;
+    }
 
+    output = gegl_operation_context_get_output_maybe_in_place (operation,
+                                                               context,
+                                                               input,
+                                                               result);
 
-  output = gegl_operation_context_get_output_maybe_in_place (operation,
-                                                             context,
-                                                             input,
-                                                             result);
-  gegl_operation_pipeline_process (pipeline, output, result, level);
-  g_free (pipeline);
-  gegl_operation_context_set_pipeline (context, NULL);
-  return TRUE;
+    gegl_operation_context_set_pipeline (context, NULL);
+    if (gegl_operation_pipeline_get_entries (pipeline) > 1)
+    {
+      gegl_operation_pipeline_process (pipeline, output, result, level);
+      gegl_operation_pipeline_destroy (pipeline);
+      return TRUE;
+    }
+    g_object_ref (input);
+    if (aux)
+      g_object_ref (aux);
+    gegl_operation_pipeline_destroy (pipeline);
 
+  }
+  else
+  {
+    output = gegl_operation_context_get_output_maybe_in_place (operation,
+                                                               context,
+                                                               input,
+                                                               result);
+  }
 
   /* A composer with a NULL aux, can still be valid, the
    * subclass has to handle it.
diff --git a/gegl/operation/gegl-operation-point-composer3.c b/gegl/operation/gegl-operation-point-composer3.c
index 945bed154..82d103335 100644
--- a/gegl/operation/gegl-operation-point-composer3.c
+++ b/gegl/operation/gegl-operation-point-composer3.c
@@ -103,7 +103,6 @@ static GThreadPool *thread_pool (void)
   return pool;
 }
 
-
 static gboolean
 gegl_operation_composer3_process (GeglOperation        *operation,
                                   GeglOperationContext *context,
@@ -139,9 +138,11 @@ gegl_operation_composer3_process (GeglOperation        *operation,
   if (!input && !aux && !aux2)
     return FALSE;
 
-  pipeline = gegl_operation_pipeline_ensure (operation, context, input);
+  if (gegl_operation_is_pipelinable (operation))
+  {
+    pipeline = gegl_operation_pipeline_ensure (operation, context, input);
 
-  gegl_operation_pipeline_add (pipeline, operation, 3,
+    gegl_operation_pipeline_add (pipeline, operation, 3,
        gegl_operation_get_format (operation, "input"),
        gegl_operation_get_format (operation, "output"),
        gegl_operation_get_format (operation, "aux"),
@@ -149,24 +150,39 @@ gegl_operation_composer3_process (GeglOperation        *operation,
        aux, aux2,
        point_composer3_class->process);
 
-  if (gegl_operation_pipeline_is_intermediate_node (operation, pipeline))
-  {
-    gegl_operation_context_take_object (context, "output", G_OBJECT (input));
+    if (gegl_operation_pipeline_is_intermediate_node (operation, pipeline))
+    {
+      gegl_operation_context_take_object (context, "output", G_OBJECT (input));
 
-    return TRUE;
-  }
+      return TRUE;
+    }
 
-  output = gegl_operation_context_get_output_maybe_in_place (operation,
-                                                              context,
-                                                              input,
-                                                              result);
-  gegl_operation_pipeline_process (pipeline, output, result, level);
-  g_free (pipeline);
-  gegl_operation_context_set_pipeline (context, NULL);
-  return TRUE;
+    output = gegl_operation_context_get_output_maybe_in_place (operation,
+                                                                context,
+                                                                input,
+                                                                result);
+    gegl_operation_context_set_pipeline (context, NULL);
 
-  aux   = (GeglBuffer*) gegl_operation_context_dup_object (context, "aux");
-  aux2  = (GeglBuffer*) gegl_operation_context_dup_object (context, "aux2");
+    if (gegl_operation_pipeline_get_entries (pipeline) > 1)
+    {
+      gegl_operation_pipeline_process (pipeline, output, result, level);
+      gegl_operation_pipeline_destroy (pipeline);
+      return TRUE;
+    }
+    g_object_ref (input);
+    if (aux)
+      g_object_ref (aux);
+    if (aux2)
+      g_object_ref (aux2);
+    gegl_operation_pipeline_destroy (pipeline);
+  }
+  else
+  {
+    output = gegl_operation_context_get_output_maybe_in_place (operation,
+                                                               context,
+                                                               input,
+                                                               result);
+  }
 
   /* A composer with a NULL aux, can still be valid, the
    * subclass has to handle it.
diff --git a/gegl/operation/gegl-operation-point-filter.c b/gegl/operation/gegl-operation-point-filter.c
index 3c00f2001..c76b7cf35 100644
--- a/gegl/operation/gegl-operation-point-filter.c
+++ b/gegl/operation/gegl-operation-point-filter.c
@@ -131,40 +131,46 @@ gegl_operation_filter_process (GeglOperation        *operation,
     return FALSE;
   }
 
+
   if (gegl_operation_is_pipelinable (operation))
   {
+    pipeline = gegl_operation_pipeline_ensure (operation, context, input);
 
-  pipeline = gegl_operation_pipeline_ensure (operation, context, input);
-
-  gegl_operation_pipeline_add (pipeline, operation, 1,
-       gegl_operation_get_format (operation, "input"),
-       gegl_operation_get_format (operation, "output"),
-       NULL, NULL, NULL, NULL, // auxes are not set
-       point_filter_class->process);
+    gegl_operation_pipeline_add (pipeline, operation, 1,
+         gegl_operation_get_format (operation, "input"),
+         gegl_operation_get_format (operation, "output"),
+         NULL, NULL, NULL, NULL, // auxes are not set
+         point_filter_class->process);
 
-  if (gegl_operation_pipeline_is_intermediate_node (operation, pipeline))
-  {
-    gegl_operation_context_take_object (context, "output", G_OBJECT (input));
-
-    return TRUE;
-  }
+    if (gegl_operation_pipeline_is_intermediate_node (operation, pipeline))
+    {
+      gegl_operation_context_take_object (context, "output", G_OBJECT (input));
 
-  output = gegl_operation_context_get_output_maybe_in_place (operation,
-                                                             context,
-                                                             input,
-                                                             result);
+      return TRUE;
+    }
 
-  gegl_operation_pipeline_process (pipeline, output, result, level);
-  g_free (pipeline);
-  gegl_operation_context_set_pipeline (context, NULL);
+    output = gegl_operation_context_get_output_maybe_in_place (operation,
+                                                               context,
+                                                               input,
+                                                               result);
 
-  return TRUE;
+    gegl_operation_context_set_pipeline (context, NULL);
+    if (gegl_operation_pipeline_get_entries (pipeline) > 1)
+    {
+      gegl_operation_pipeline_process (pipeline, output, result, level);
+      gegl_operation_pipeline_destroy (pipeline);
+      return TRUE;
+    }
+    g_object_ref (input);
+    gegl_operation_pipeline_destroy (pipeline);
+  }
+  else
+  {
+    output = gegl_operation_context_get_output_maybe_in_place (operation,
+                                                               context,
+                                                               input,
+                                                               result);
   }
-
-  output = gegl_operation_context_get_output_maybe_in_place (operation,
-                                                             context,
-                                                             input,
-                                                             result);
 
   if (input != NULL)
     {
@@ -323,8 +329,6 @@ gegl_operation_point_filter_process (GeglOperation       *operation,
             return TRUE;
       }
 
-
-
       if (gegl_operation_use_threading (operation, result) && result->height > 1)
       {
         gint threads = gegl_config_threads ();


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