gegl r2379 - in trunk: . gegl gegl/buffer



Author: ok
Date: Tue Jun  3 23:44:29 2008
New Revision: 2379
URL: http://svn.gnome.org/viewvc/gegl?rev=2379&view=rev

Log:
* gegl/buffer/gegl-tile-storage.c: depend on gegl_config()'s
tile_width and tile_height for default values. (should be more dynamic
than default of paramspec, but this will do for now.)
* gegl/gegl-config.c: added GEGL_TILE_SIZE --gegl-tile-size
configuration which takes 128x128 type settings.
* gegl/gegl-config.h:
* gegl/gegl-init.c:


Modified:
   trunk/ChangeLog
   trunk/gegl/buffer/gegl-tile-storage.c
   trunk/gegl/gegl-config.c
   trunk/gegl/gegl-config.h
   trunk/gegl/gegl-init.c

Modified: trunk/gegl/buffer/gegl-tile-storage.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-storage.c	(original)
+++ trunk/gegl/buffer/gegl-tile-storage.c	Tue Jun  3 23:44:29 2008
@@ -33,13 +33,11 @@
 #include "gegl-tile-handler-log.h"
 #include "gegl-types.h"
 #include "gegl-utils.h"
+#include "gegl-config.h"
 
 
 G_DEFINE_TYPE (GeglTileStorage, gegl_tile_storage, GEGL_TYPE_TILE_HANDLER_CHAIN)
 
-#define TILE_WIDTH  128
-#define TILE_HEIGHT 64
-
 static GObjectClass * parent_class = NULL;
 
 enum
@@ -302,12 +300,12 @@
 
   g_object_class_install_property (gobject_class, PROP_TILE_WIDTH,
                                    g_param_spec_int ("tile-width", "tile-width", "width of a tile in pixels",
-                                                     0, G_MAXINT, TILE_WIDTH,
+                                                     0, G_MAXINT, gegl_config()->tile_width,
                                                      G_PARAM_READWRITE |
                                                      G_PARAM_CONSTRUCT_ONLY));
   g_object_class_install_property (gobject_class, PROP_TILE_HEIGHT,
                                    g_param_spec_int ("tile-height", "tile-height", "height of a tile in pixels",
-                                                     0, G_MAXINT, TILE_HEIGHT,
+                                                     0, G_MAXINT, gegl_config()->tile_height,
                                                      G_PARAM_READWRITE |
                                                      G_PARAM_CONSTRUCT_ONLY));
   g_object_class_install_property (gobject_class, PROP_TILE_SIZE,

Modified: trunk/gegl/gegl-config.c
==============================================================================
--- trunk/gegl/gegl-config.c	(original)
+++ trunk/gegl/gegl-config.c	Tue Jun  3 23:44:29 2008
@@ -32,7 +32,9 @@
   PROP_CACHE_SIZE,
   PROP_CHUNK_SIZE,
   PROP_SWAP,
-  PROP_BABL_ERROR
+  PROP_BABL_ERROR,
+  PROP_TILE_WIDTH,
+  PROP_TILE_HEIGHT
 };
 
 static void
@@ -53,6 +55,14 @@
         g_value_set_int (value, config->chunk_size);
         break;
 
+      case PROP_TILE_WIDTH:
+        g_value_set_int (value, config->tile_width);
+        break;
+
+      case PROP_TILE_HEIGHT:
+        g_value_set_int (value, config->tile_height);
+        break;
+
       case PROP_QUALITY:
         g_value_set_double (value, config->quality);
         break;
@@ -87,6 +97,12 @@
       case PROP_CHUNK_SIZE:
         config->chunk_size = g_value_get_int (value);
         break;
+      case PROP_TILE_WIDTH:
+        config->tile_width = g_value_get_int (value);
+        break;
+      case PROP_TILE_HEIGHT:
+        config->tile_height = g_value_get_int (value);
+        break;
       case PROP_QUALITY:
         config->quality = g_value_get_double (value);
         return;
@@ -135,6 +151,17 @@
   gobject_class->get_property = get_property;
   gobject_class->finalize = finalize;
 
+
+  g_object_class_install_property (gobject_class, PROP_TILE_WIDTH,
+                                   g_param_spec_int ("tile-width", "Tile width", "default tile width for created buffers.",
+                                                     0, G_MAXINT, 64,
+                                                     G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class, PROP_TILE_HEIGHT,
+                                   g_param_spec_int ("tile-height", "Tile height", "default tile heightfor created buffers.",
+                                                     0, G_MAXINT, 64,
+                                                     G_PARAM_READWRITE));
+
   g_object_class_install_property (gobject_class, PROP_CACHE_SIZE,
                                    g_param_spec_int ("cache-size", "Cache size", "size of cache in bytes",
                                                      0, G_MAXINT, 256*1024*1024,
@@ -168,5 +195,7 @@
   self->swap = NULL;
   self->quality = 1.0;
   self->cache_size = 256*1024*1024;
-  self->chunk_size = 256*300;
+  self->chunk_size = 256*256;
+  self->tile_width = 128;
+  self->tile_height = 64;
 }

Modified: trunk/gegl/gegl-config.h
==============================================================================
--- trunk/gegl/gegl-config.h	(original)
+++ trunk/gegl/gegl-config.h	Tue Jun  3 23:44:29 2008
@@ -43,6 +43,8 @@
   gint     chunk_size; /* The size of elements being processed at once */
   gdouble  quality;
   gdouble  babl_error;
+  gint     tile_width;
+  gint     tile_height;
 };
 
 struct _GeglConfigClass

Modified: trunk/gegl/gegl-init.c
==============================================================================
--- trunk/gegl/gegl-init.c	(original)
+++ trunk/gegl/gegl-init.c	Tue Jun  3 23:44:29 2008
@@ -158,6 +158,7 @@
 static gchar   *cmd_gegl_cache_size=NULL;
 static gchar   *cmd_gegl_chunk_size=NULL;
 static gchar   *cmd_gegl_quality=NULL;
+static gchar   *cmd_gegl_tile_size=NULL;
 static gchar   *cmd_babl_error=NULL;
 
 static const GOptionEntry cmd_entries[]=
@@ -178,6 +179,11 @@
      N_("How much memory to (approximately) use for caching imagery"), "<megabytes>"
     },
     {
+     "gegl-tile-size", 0, 0, 
+     G_OPTION_ARG_STRING, &cmd_gegl_tile_size, 
+     N_("Default size of tiles in GeglBuffers"), "<widthxheight>"
+    },
+    {
      "gegl-chunk-size", 0, 0, 
      G_OPTION_ARG_STRING, &cmd_gegl_chunk_size, 
      N_("The count of pixels to compute simulantous"), "pixel count"
@@ -355,6 +361,14 @@
     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 (g_getenv ("GEGL_TILE_SIZE"))
+    {
+      const gchar *str = g_getenv ("GEGL_TILE_SIZE");
+      config->tile_width = atoi(str);
+      str = strchr (str, 'x');
+      if (str)
+        config->tile_height = atoi(str+1);
+    }
 
   if (gegl_swap_dir())
     config->swap = g_strdup(gegl_swap_dir ());
@@ -366,6 +380,16 @@
     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_gegl_tile_size)
+    {
+      const gchar *str = cmd_gegl_tile_size;
+      config->tile_width = atoi(str);
+      str = strchr (str, 'x');
+      if (str)
+        config->tile_height = atoi(str+1);
+    }
+
+  g_print ("%i %i\n", config->tile_width, config->tile_height);
 
   if (cmd_babl_error)
     g_object_set (config, "babl-error", atof(cmd_babl_error), NULL);



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