[gegl] Revert "gegl: remove big overallocation in auto-threading code"



commit 45c714d7626d18cc936517f9ecbbdf7be347b94d
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Sep 27 23:30:18 2017 +0200

    Revert "gegl: remove big overallocation in auto-threading code"
    
    After some brief testing, this initial patch is not ready either,
    reverting to previous behavior.
    
    This reverts commit c9a1bc977496bd5a8828259fbb057a34cbe5ca49.

 gegl/operation/gegl-operation-point-composer.c  |   13 ++++---------
 gegl/operation/gegl-operation-point-composer3.c |   16 ++++++----------
 gegl/operation/gegl-operation-point-filter.c    |   12 +++---------
 3 files changed, 13 insertions(+), 28 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-point-composer.c b/gegl/operation/gegl-operation-point-composer.c
index 844a142..e68f28c 100644
--- a/gegl/operation/gegl-operation-point-composer.c
+++ b/gegl/operation/gegl-operation-point-composer.c
@@ -337,6 +337,7 @@ gegl_operation_point_composer_process (GeglOperation       *operation,
         gint in_buf_bpp = input?babl_format_get_bytes_per_pixel (in_buf_format):0;
         gint aux_buf_bpp = aux?babl_format_get_bytes_per_pixel (aux_buf_format):0;
         gint out_buf_bpp = babl_format_get_bytes_per_pixel (output_buf_format);
+        gint temp_id = 0;
 
         if (input)
         {
@@ -347,6 +348,7 @@ gegl_operation_point_composer_process (GeglOperation       *operation,
             if (in_buf_format != in_format)
             {
               thread_data[j].input_fish = babl_fish (in_buf_format, in_format);
+              thread_data[j].in_tmp = gegl_temp_buffer (temp_id++, in_bpp * result->width * result->height);
             }
             else
             {
@@ -366,6 +368,7 @@ gegl_operation_point_composer_process (GeglOperation       *operation,
             if (aux_buf_format != aux_format)
             {
               thread_data[j].aux_fish = babl_fish (aux_buf_format, aux_format);
+              thread_data[j].aux_tmp = gegl_temp_buffer (temp_id++, aux_bpp * result->width * 
result->height);
             }
             else
             {
@@ -384,6 +387,7 @@ gegl_operation_point_composer_process (GeglOperation       *operation,
           if (output_buf_format != gegl_buffer_get_format (output))
           {
             thread_data[j].output_fish = babl_fish (out_format, output_buf_format);
+            thread_data[j].output_tmp = gegl_temp_buffer (temp_id++, out_bpp * result->width * 
result->height);
           }
           else
           {
@@ -396,7 +400,6 @@ gegl_operation_point_composer_process (GeglOperation       *operation,
             gint threads = gegl_config_threads ();
             gint pending;
             gint bit;
-            gint temp_id = 0;
 
             if (i->roi[0].height < threads)
             {
@@ -426,14 +429,6 @@ gegl_operation_point_composer_process (GeglOperation       *operation,
               thread_data[j].level = level;
               thread_data[j].success = TRUE;
             }
-
-           for (gint j = 0; j < threads; j++)
-           {
-               thread_data[j].in_tmp = input?gegl_temp_buffer (temp_id++, in_bpp * i->roi[j].width * 
i->roi[j].height):NULL;
-               thread_data[j].aux_tmp = aux?gegl_temp_buffer (temp_id++, aux_bpp * i->roi[j].width * 
i->roi[j].height):NULL;
-               thread_data[j].output_tmp = gegl_temp_buffer (temp_id++, out_bpp * i->roi[j].width * 
i->roi[j].height);
-           }
-
             pending = threads;
 
             for (gint j = 1; j < threads; j++)
diff --git a/gegl/operation/gegl-operation-point-composer3.c b/gegl/operation/gegl-operation-point-composer3.c
index 70c65ad..705fa9b 100644
--- a/gegl/operation/gegl-operation-point-composer3.c
+++ b/gegl/operation/gegl-operation-point-composer3.c
@@ -255,6 +255,8 @@ gegl_operation_point_composer3_process (GeglOperation       *operation,
         gint aux2_buf_bpp = aux2?babl_format_get_bytes_per_pixel (aux2_buf_format):0;
         gint out_buf_bpp = babl_format_get_bytes_per_pixel (output_buf_format);
 
+        gint temp_id = 0;
+
         if (input)
         {
           if (! babl_format_has_alpha (in_buf_format))
@@ -269,6 +271,7 @@ gegl_operation_point_composer3_process (GeglOperation       *operation,
             if (in_buf_format != in_format)
             {
               thread_data[j].input_fish = babl_fish (in_buf_format, in_format);
+              thread_data[j].in_tmp = gegl_temp_buffer (temp_id++, in_bpp * result->width * result->height);
             }
             else
             {
@@ -294,6 +297,7 @@ gegl_operation_point_composer3_process (GeglOperation       *operation,
             if (aux_buf_format != aux_format)
             {
               thread_data[j].aux_fish = babl_fish (aux_buf_format, aux_format);
+              thread_data[j].aux_tmp = gegl_temp_buffer (temp_id++, aux_bpp * result->width * 
result->height);
             }
             else
             {
@@ -321,6 +325,7 @@ gegl_operation_point_composer3_process (GeglOperation       *operation,
             if (aux2_buf_format != aux2_format)
             {
               thread_data[j].aux2_fish = babl_fish (aux2_buf_format, aux2_format);
+              thread_data[j].aux2_tmp = gegl_temp_buffer (temp_id++, aux2_bpp * result->width * 
result->height);
             }
             else
             {
@@ -339,6 +344,7 @@ gegl_operation_point_composer3_process (GeglOperation       *operation,
           if (output_buf_format != gegl_buffer_get_format (output))
           {
             thread_data[j].output_fish = babl_fish (out_format, output_buf_format);
+            thread_data[j].output_tmp = gegl_temp_buffer (temp_id++, out_bpp * result->width * 
result->height);
           }
           else
           {
@@ -351,7 +357,6 @@ gegl_operation_point_composer3_process (GeglOperation       *operation,
             gint threads = gegl_config_threads ();
             gint pending;
             gint bit;
-           gint temp_id = 0;
 
             if (i->roi[0].height < threads)
             {
@@ -382,15 +387,6 @@ gegl_operation_point_composer3_process (GeglOperation       *operation,
               thread_data[j].level = level;
               thread_data[j].success = TRUE;
             }
-
-           for (gint j = 0; j < threads; j++)
-           {
-               thread_data[j].in_tmp = input?gegl_temp_buffer (temp_id++, in_bpp * i->roi[j].width * 
i->roi[j].height):NULL;
-               thread_data[j].aux_tmp = aux?gegl_temp_buffer (temp_id++, aux_bpp * i->roi[j].width * 
i->roi[j].height):NULL;
-               thread_data[j].aux2_tmp = aux2?gegl_temp_buffer (temp_id++, aux2_bpp * i->roi[j].width * 
i->roi[j].height):NULL;
-               thread_data[j].output_tmp = gegl_temp_buffer (temp_id++, out_bpp * i->roi[j].width * 
i->roi[j].height);
-           }
-
             pending = threads;
 
             for (gint j = 1; j < threads; j++)
diff --git a/gegl/operation/gegl-operation-point-filter.c b/gegl/operation/gegl-operation-point-filter.c
index 1e85836..18118bc 100644
--- a/gegl/operation/gegl-operation-point-filter.c
+++ b/gegl/operation/gegl-operation-point-filter.c
@@ -302,6 +302,7 @@ gegl_operation_point_filter_process (GeglOperation       *operation,
         gint out_bpp = babl_format_get_bytes_per_pixel (out_format);
         gint in_buf_bpp = input?babl_format_get_bytes_per_pixel (in_buf_format):0;
         gint out_buf_bpp = babl_format_get_bytes_per_pixel (output_buf_format);
+        gint temp_id = 0;
 
         if (input)
         {
@@ -311,6 +312,7 @@ gegl_operation_point_filter_process (GeglOperation       *operation,
             if (in_buf_format != in_format)
             {
               thread_data[j].input_fish = babl_fish (in_buf_format, in_format);
+              thread_data[j].in_tmp = gegl_temp_buffer (temp_id++, in_bpp * result->width * result->height);
             }
             else
             {
@@ -327,6 +329,7 @@ gegl_operation_point_filter_process (GeglOperation       *operation,
           if (output_buf_format != gegl_buffer_get_format (output))
           {
             thread_data[j].output_fish = babl_fish (out_format, output_buf_format);
+            thread_data[j].output_tmp = gegl_temp_buffer (temp_id++, out_bpp * result->width * 
result->height);
           }
           else
           {
@@ -339,7 +342,6 @@ gegl_operation_point_filter_process (GeglOperation       *operation,
             gint threads = gegl_config_threads ();
             gint pending;
             gint bit;
-           gint temp_id = 0;
 
             if (i->roi[0].height < threads)
             {
@@ -368,14 +370,6 @@ gegl_operation_point_filter_process (GeglOperation       *operation,
               thread_data[j].level = level;
               thread_data[j].success = TRUE;
             }
-
-
-           for (gint j = 0; j < threads; j++)
-           {
-               thread_data[j].in_tmp = input?gegl_temp_buffer (temp_id++, in_bpp * i->roi[j].width * 
i->roi[j].height):NULL;
-               thread_data[j].output_tmp = gegl_temp_buffer (temp_id++, out_bpp * i->roi[j].width * 
i->roi[j].height);
-           }
-
             pending = threads;
 
             for (gint j = 1; j < threads; j++)


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