[gegl/wip/pippin/pipeline: 92/95] pipeline: do in-place processing on matching formats



commit 8c10bcf2413cf0e8d3374490b2b552afdb2cdbe2
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Jul 25 23:42:33 2018 +0200

    pipeline: do in-place processing on matching formats

 gegl/operation/gegl-operation-pipeline.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-pipeline.c b/gegl/operation/gegl-operation-pipeline.c
index 521a028e6..006f198af 100644
--- a/gegl/operation/gegl-operation-pipeline.c
+++ b/gegl/operation/gegl-operation-pipeline.c
@@ -56,8 +56,8 @@ struct _GeglOperationPipeLine {
 gboolean gegl_operation_is_pipelinable (GeglOperation *op)
 {
   gboolean ret = GEGL_IS_OPERATION_POINT_FILTER (op) ||
-         GEGL_IS_OPERATION_POINT_COMPOSER (op) ||
-         GEGL_IS_OPERATION_POINT_COMPOSER3 (op);
+                 GEGL_IS_OPERATION_POINT_COMPOSER (op) ||
+                 GEGL_IS_OPERATION_POINT_COMPOSER3 (op);
   if (ret)
   {
     GeglOperationClass *op_klass = GEGL_OPERATION_GET_CLASS (op);
@@ -75,11 +75,7 @@ gboolean gegl_operation_is_pipelinable (GeglOperation *op)
 
 static GeglNode *gegl_node_get_non_nop_producer (GeglNode *n)
 {
-  // XXX: look out for forks of the data/
   GeglNode *node = gegl_node_get_producer (n, "input", NULL);
-  if (node && !strcmp (gegl_node_get_operation (node), "gegl:nop"))
-    return NULL;
-  return node;
   while (node &&
    (!strcmp (gegl_node_get_operation (node), "gegl:nop")) && !
    node->priv->eval_manager)
@@ -146,7 +142,7 @@ gegl_operation_pipeline_is_intermediate_node (GeglOperation *op,
 
   n_consumers = gegl_node_get_consumers (it, "output", &consumers, NULL);
   it = consumers[0];
-#if 0
+#if 1
   while (n_consumers == 1 && (!strcmp (gegl_node_get_operation (consumers[0]), "gegl:nop")) && 
!consumers[0]->priv->eval_manager)
   {
     it = consumers[0];
@@ -179,10 +175,10 @@ gegl_operation_pipeline_is_intermediate_node (GeglOperation *op,
 }
 
 static gboolean
-_gegl_operation_pipeline_process (GeglOperationPipeLine            *pipeline,
-                                  GeglBuffer          *output,
-                                  const GeglRectangle *result,
-                                  gint                 level)
+_gegl_operation_pipeline_process (GeglOperationPipeLine  *pipeline,
+                                  GeglBuffer             *output,
+                                  const GeglRectangle    *result,
+                                  gint                    level)
 {
   GeglBufferIterator *i = gegl_buffer_iterator_new (output, result, level, 
pipeline->entry[pipeline->entries-1].out_format,
                                                     GEGL_ACCESS_WRITE, GEGL_ABYSS_NONE, 
pipeline->buffers_used+1);
@@ -270,10 +266,10 @@ _gegl_operation_pipeline_process (GeglOperationPipeLine            *pipeline,
         }
         else
         {
-          cur_output = temp[(buf_mod++)&1];
-          // XXX: through refactoring some in-place
-          //      processing on same-format should be achivable
-          //      for extra performance
+          if (entry->in_format == entry->out_format)
+            cur_output = cur_input;
+          else
+            cur_output = temp[(buf_mod++)&1];
         }
 
         switch (entry->in_pads)


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