gegl r2666 - in trunk: . gegl/process



Author: ok
Date: Thu Oct 30 10:43:33 2008
New Revision: 2666
URL: http://svn.gnome.org/viewvc/gegl?rev=2666&view=rev

Log:
* gegl/process/gegl-processor.c: (render_rectangle): Initial steps
aiming towards more tile aligned access for the chunks that are pulled
by GeglProcessor.


Modified:
   trunk/ChangeLog
   trunk/gegl/process/gegl-processor.c

Modified: trunk/gegl/process/gegl-processor.c
==============================================================================
--- trunk/gegl/process/gegl-processor.c	(original)
+++ trunk/gegl/process/gegl-processor.c	Thu Oct 30 10:43:33 2008
@@ -359,20 +359,40 @@
         {
           gint band_size;
 
-          if (dr->height > dr->width)
+          if (dr->width > dr->height)
             {
               GeglRectangle *fragment;
 
-              band_size = dr->height / 2;
+/* try to make the rects generated match better with potential 2^n sized
+ * tiles, XXX: should be improved to make the next slice fit as well.
+ */
+              band_size = dr->width / 2;
+#if 1
+              if (band_size <= 128)
+                {
+                  band_size = MIN(band_size, 64); /* prefer a band_size of 128,
+                                                      hoping to hit tiles */
+                }
+              else if (band_size <= 256)
+                {
+                  band_size = MIN(band_size, 128); /* prefer a band_size of 128,
+                                                      hoping to hit tiles */
+                }
+              else if (band_size <= 512)
+                {
+                  band_size = MIN(band_size, 256); /* prefer a band_size of 128,
+                                                      hoping to hit tiles */
+                }
+#endif
 
               if (band_size < 1)
                 band_size = 1;
 
               fragment = g_slice_dup (GeglRectangle, dr);
 
-              fragment->height = band_size;
-              dr->height      -= band_size;
-              dr->y           += band_size;
+              fragment->width = band_size;
+              dr->width      -= band_size;
+              dr->x          += band_size;
 
               processor->dirty_rectangles = g_slist_prepend (processor->dirty_rectangles, fragment);
 
@@ -382,16 +402,33 @@
             {
               GeglRectangle *fragment;
 
-              band_size = dr->width / 2;
+              band_size = dr->height / 2;
+
+
+              if (band_size <= 128)
+                {
+                  band_size = MIN(band_size, 64); /* prefer a band_size of 128,
+                                                      hoping to hit tiles */
+                }
+              else if (band_size <= 256)
+                {
+                  band_size = MIN(band_size, 128); /* prefer a band_size of 128,
+                                                      hoping to hit tiles */
+                }
+              else if (band_size <= 512)
+                {
+                  band_size = MIN(band_size, 256); /* prefer a band_size of 128,
+                                                      hoping to hit tiles */
+                }
 
               if (band_size < 1)
                 band_size = 1;
 
               fragment = g_slice_dup (GeglRectangle, dr);
 
-              fragment->width = band_size;
-              dr->width      -= band_size;
-              dr->x          += band_size;
+              fragment->height = band_size;
+              dr->height      -= band_size;
+              dr->y           += band_size;
 
               processor->dirty_rectangles = g_slist_prepend (processor->dirty_rectangles, fragment);
 



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