gegl r2350 - in trunk: . gegl gegl/process



Author: ok
Date: Sun May 25 11:31:55 2008
New Revision: 2350
URL: http://svn.gnome.org/viewvc/gegl?rev=2350&view=rev

Log:
Add the ability to configure the default chunk size used during
processing, this is the amount of pixels the output is computed for
when doing one iteraiton of work for a processor. For now this needs
to be set configured before GEGL is initialized to take effect.
* gegl/gegl-config.[ch]: also fixed the installed property for
cache-size.
* gegl/gegl-init.c: (gegl_post_parse_hook):
* gegl/process/gegl-processor.c: (gegl_processor_class_init):


Modified:
   trunk/ChangeLog
   trunk/gegl/gegl-config.c
   trunk/gegl/gegl-config.h
   trunk/gegl/gegl-init.c
   trunk/gegl/process/gegl-processor.c

Modified: trunk/gegl/gegl-config.c
==============================================================================
--- trunk/gegl/gegl-config.c	(original)
+++ trunk/gegl/gegl-config.c	Sun May 25 11:31:55 2008
@@ -30,6 +30,7 @@
   PROP_0,
   PROP_QUALITY,
   PROP_CACHE_SIZE,
+  PROP_CHUNK_SIZE,
   PROP_SWAP,
   PROP_BABL_ERROR
 };
@@ -48,6 +49,10 @@
         g_value_set_int (value, config->cache_size);
         break;
 
+      case PROP_CHUNK_SIZE:
+        g_value_set_int (value, config->chunk_size);
+        break;
+
       case PROP_QUALITY:
         g_value_set_double (value, config->quality);
         break;
@@ -79,6 +84,9 @@
       case PROP_CACHE_SIZE:
         config->cache_size = g_value_get_int (value);
         break;
+      case PROP_CHUNK_SIZE:
+        config->chunk_size = g_value_get_int (value);
+        break;
       case PROP_QUALITY:
         config->quality = g_value_get_double (value);
         return;
@@ -128,8 +136,15 @@
   gobject_class->finalize = finalize;
 
   g_object_class_install_property (gobject_class, PROP_CACHE_SIZE,
-                                   g_param_spec_double ("cachei-size", "Cache size", "size of cache in bytes",
-                                                     0.0, 1.0, 1.0,
+                                   g_param_spec_int ("cache-size", "Cache size", "size of cache in bytes",
+                                                     0, G_MAXINT, 256*1024*1024,
+                                                     G_PARAM_READWRITE));
+
+
+  g_object_class_install_property (gobject_class, PROP_CHUNK_SIZE,
+                                   g_param_spec_int ("chunk-size", "Chunk size",
+                                     "the number of pixels processed simulatnously by GEGL.",
+                                                     0.0, G_MAXINT, 256*300,
                                                      G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, PROP_QUALITY,
@@ -153,4 +168,5 @@
   self->swap = NULL;
   self->quality = 1.0;
   self->cache_size = 256*1024*1024;
+  self->chunk_size = 256*300;
 }

Modified: trunk/gegl/gegl-config.h
==============================================================================
--- trunk/gegl/gegl-config.h	(original)
+++ trunk/gegl/gegl-config.h	Sun May 25 11:31:55 2008
@@ -40,6 +40,7 @@
 
   gchar   *swap;
   gint     cache_size;
+  gint     chunk_size; /* The size of elements being processed at once */
   gdouble  quality;
   gdouble  babl_error;
 };

Modified: trunk/gegl/gegl-init.c
==============================================================================
--- trunk/gegl/gegl-init.c	(original)
+++ trunk/gegl/gegl-init.c	Sun May 25 11:31:55 2008
@@ -38,7 +38,6 @@
 
 guint gegl_debug_flags = 0; 
 
-
 #include "gegl-instrument.h"
 #include "gegl-init.h"
 #include "module/geglmodule.h"
@@ -157,6 +156,7 @@
 
 static gchar   *cmd_gegl_swap=NULL;
 static gchar   *cmd_gegl_cache_size=NULL;
+static gchar   *cmd_gegl_chunk_size=NULL;
 static gchar   *cmd_gegl_quality=NULL;
 static gchar   *cmd_babl_error=NULL;
 
@@ -178,6 +178,11 @@
      N_("How much memory to (approximately) use for caching imagery"), "<megabytes>"
     },
     {
+     "gegl-chunk-size", 0, 0, 
+     G_OPTION_ARG_STRING, &cmd_gegl_chunk_size, 
+     N_("The count of pixels to compute simulantous"), "pixel count"
+    },
+    {
      "gegl-quality", 0, 0, 
      G_OPTION_ARG_STRING, &cmd_gegl_quality, 
      N_("The quality of rendering a value between 0.0(fast) and 1.0(reference)"), "<quality>"
@@ -348,6 +353,8 @@
     config->quality = atof(g_getenv("GEGL_QUALITY")); 
   if (g_getenv ("GEGL_CACHE_SIZE"))
     config->cache_size = atoi(g_getenv("GEGL_CACHE_SIZE"))* 1024*1024; 
+  if (g_getenv ("GEGL_CHUNK_SIZE"))
+    config->chunk_size = atoi(g_getenv("GEGL_CHUNK_SIZE"));
 
   if (gegl_swap_dir())
     config->swap = g_strdup(gegl_swap_dir ());
@@ -357,6 +364,9 @@
     config->quality = atof (cmd_gegl_quality);
   if (cmd_gegl_cache_size)
     config->cache_size = atoi (cmd_gegl_cache_size)*1024*1024;
+  if (cmd_gegl_chunk_size)
+    config->chunk_size = atoi (cmd_gegl_chunk_size);
+
   if (cmd_babl_error)
     g_object_set (config, "babl-error", atof(cmd_babl_error), NULL);
 

Modified: trunk/gegl/process/gegl-processor.c
==============================================================================
--- trunk/gegl/process/gegl-processor.c	(original)
+++ trunk/gegl/process/gegl-processor.c	Sun May 25 11:31:55 2008
@@ -15,7 +15,6 @@
  *
  * Copyright 2007 Ãyvind KolÃs
  */
-#define GEGL_PROCESSOR_CHUNK_SIZE 256*256
 
 #include "config.h"
 #include <glib-object.h>
@@ -25,6 +24,7 @@
 #include "gegl-utils.h"
 #include "buffer/gegl-region.h"
 #include "operation/gegl-operation-sink.h"
+#include "gegl-config.h"
 
 enum
 {
@@ -93,7 +93,8 @@
                                                      G_PARAM_READWRITE));
   g_object_class_install_property (gobject_class, PROP_CHUNK_SIZE,
                                    g_param_spec_int ("chunksize", "chunksize", "Size of chunks being rendered (larger chunks need more memory to do the processing).",
-                                                     8 * 8, 2048 * 2048, GEGL_PROCESSOR_CHUNK_SIZE,
+                                                     8 * 8, 2048*204, 
+                                                     gegl_config()->chunk_size, 
                                                      G_PARAM_READWRITE |
                                                      G_PARAM_CONSTRUCT_ONLY));
 }



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