[babl] babl: reduce default max path length to 3 (5)



commit 7084fc49bb78c9ea9df354498fda62cded557ee6
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Aug 19 01:00:11 2019 +0200

    babl: reduce default max path length to 3 (5)
    
    With the space invasion progressing, we're starting to have
    many more conversions to search through - in some cases
    looking for conversions - when there are no conversions
    become too expensive with an exhaustive search of all
    conversions up to 7 steps. (it is likely possible to reduce
    the amount of conversions tried).
    
    As well re-enable handling of grayscale ICC profiles - since
    the formerly patological tests on gimp now pass.

 babl/babl-fish-path.c | 12 +++++++-----
 babl/babl-format.c    |  1 +
 babl/babl-icc.c       |  2 --
 3 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index 130b6b836..9d6a0c6bb 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -103,7 +103,7 @@ static int max_path_length (void);
 static int debug_conversions = 0;
 int _babl_instrument = 0;
 
-double 
+double
 _babl_legal_error (void)
 {
   static double error = 0.0;
@@ -133,7 +133,7 @@ _babl_legal_error (void)
   return error;
 }
 
-static int 
+static int
 max_path_length (void)
 {
   static int  max_length = 0;
@@ -146,9 +146,11 @@ max_path_length (void)
   if (env)
     max_length = atoi (env);
   else
-    max_length = 4; /* reducing this number makes finding short fishes much
+    max_length = 3; /* reducing this number makes finding short fishes much
                        faster - even if we lose out on some of the fast
-                       bigger fish
+                       bigger fish, the fishes we can get with a max_length of 3
+                       is actually 5, since we deepen the search twice if no
+                       sufficient results are found.
                      */
   if (max_length > BABL_HARD_MAX_PATH_LENGTH)
     max_length = BABL_HARD_MAX_PATH_LENGTH;
@@ -157,7 +159,7 @@ max_path_length (void)
   return max_length;
 }
 
-int 
+int
 _babl_max_path_len (void)
 {
   return max_path_length ();
diff --git a/babl/babl-format.c b/babl/babl-format.c
index 20617d277..2e4e3d718 100644
--- a/babl/babl-format.c
+++ b/babl/babl-format.c
@@ -130,6 +130,7 @@ format_new (const char      *name,
   babl->format.space = (void*)space;
   babl->format.encoding = NULL;
   babl->instance.doc = doc;
+
   return babl;
 }
 
diff --git a/babl/babl-icc.c b/babl/babl-icc.c
index 9808c75c5..96cc1664d 100644
--- a/babl/babl-icc.c
+++ b/babl/babl-icc.c
@@ -996,9 +996,7 @@ babl_space_from_icc (const char   *icc_data,
 
 
     if (strcmp (color_space.str, "RGB ")
-#if 0  /* XXX: commented out, as gimp-2.99 doesn't like loading grayscale jpegs with grayscale icc profiles 
when it is enabled */
         && strcmp (color_space.str, "GRAY")
-#endif
     )
     {
       *error = "not defining RGB, CMYK or GRAY space..";


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