babl: reduce default max path length to 3 (5)
authorØyvind Kolås <pippin@gimp.org>
Sun, 18 Aug 2019 23:00:11 +0000 (01:00 +0200)
committerØyvind Kolås <pippin@gimp.org>
Sun, 18 Aug 2019 23:02:23 +0000 (01:02 +0200)
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
babl/babl-format.c
babl/babl-icc.c

index 130b6b8361739589a36fba6beb6eda6c181e11f0..9d6a0c6bbc63f946c802c75b07418d0e72d2206b 100644 (file)
@@ -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 ();
index 20617d27784468056aab7bdb80a73017487e48e9..2e4e3d718980d5a9edfca0c01757e241801b3bc7 100644 (file)
@@ -130,6 +130,7 @@ format_new (const char      *name,
   babl->format.space = (void*)space;
   babl->format.encoding = NULL;
   babl->instance.doc = doc;
+
   return babl;
 }
 
index 9808c75c58d7f3b2517685093d1cd1d96e7c6e34..96cc1664d13208b9d9e5d58522e1c8270adaabf4 100644 (file)
@@ -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..";