[babl] reduce size of max tempbuffer, and do chunking in fewer cases



commit 3cc240206515727c593252144e35974bb1a8874d
Author: Ãyvind KolÃs <pippin gimp org>
Date:   Sat Oct 27 22:17:34 2012 +0200

    reduce size of max tempbuffer, and do chunking in fewer cases
    
    Chunking is now only done for multi-step fish paths and reference conversions.

 babl/babl-fish-path.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index 0b630fa..018896f 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -380,7 +380,7 @@ babl_fish_process (Babl       *babl,
 }
 
 /* This size buffer needs to be possible to allocate on the stack..*/
-#define MAX_BUFFER_SIZE   65536
+#define MAX_BUFFER_SIZE   8192
 
 static long
 babl_process_chunks (const Babl *cbabl,
@@ -393,6 +393,7 @@ babl_process_chunks (const Babl *cbabl,
   const Babl *babl_dest;
   int source_bpp = 0;
   int dest_bpp = 0;
+  long i;
 
   babl_source = babl->fish.source;
   babl_dest = babl->fish.destination;
@@ -424,7 +425,6 @@ babl_process_chunks (const Babl *cbabl,
   babl_assert (source_bpp);
   babl_assert (dest_bpp);
 
-  long i;
   for (i = 0; i < n; i += MAX_BUFFER_SIZE)
     {
       long c;
@@ -455,9 +455,11 @@ babl_process (const Babl *cbabl,
   babl_assert (n > 0);
 
   if (n > MAX_BUFFER_SIZE  &&
-      babl->class_type >= BABL_FISH &&
-      babl->class_type <= BABL_FISH_PATH )
-    /* XXX: should only do the chunking if temporary buffers are needed */
+      (babl->class_type == BABL_FISH_PATH ||
+       babl->class_type == BABL_FISH_REFERENCE))
+        /* we only need to do chunking for multi-step conversions
+         * and reference code paths
+         */
     return babl_process_chunks (cbabl, source, destination, n);
 
   /* first check if it is a fish since that is our fast path */



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