new symbol babl_fish_get_process
authorØyvind Kolås <pippin@gimp.org>
Wed, 26 Jan 2022 03:38:53 +0000 (04:38 +0100)
committerØyvind Kolås <pippin@gimp.org>
Wed, 26 Jan 2022 06:00:21 +0000 (07:00 +0100)
This permits some APIs to avoid a function call per dispatch,
specifically the samplers in GeglBuffer.

babl/babl-fish.c
babl/babl.h
export-symbols

index ce22b6be037b03002af9c246379312c5f0832ab6..aece33b8cb2de636d4ed34f0009d0199a34a7b4e 100644 (file)
@@ -359,4 +359,10 @@ babl_fish (const void *source,
   }
 }
 
+
+BablFishProcess babl_fish_get_process (const Babl *babl)
+{
+  return babl->fish.dispatch;
+}
+
 BABL_CLASS_MINIMAL_IMPLEMENT (fish);
index 4032faaef885149ec86ba55e1f248b16982b4403..04bc00a0ca9c93b6740ed092424ae775dbb05dec 100644 (file)
@@ -713,6 +713,17 @@ const char * babl_format_get_encoding (const Babl *babl);
 int babl_space_is_cmyk (const Babl *space);
 int babl_space_is_gray (const Babl *space);
 
+typedef void (*BablFishProcess) (const Babl *babl, const char *src, char *dst, long n, void *data);
+/**
+ * babl_fish_get_dispatch: (skip)
+ *
+ * get the dispatch function of a fish, this allows faster use of a fish
+ * in a loop than the more indirect method of babl_process, this also avoids
+ * base-level instrumentation.
+ */
+BablFishProcess babl_fish_get_process (const Babl *babl);
+
+
 /* values below this are stored associated with this value, it should also be
  * used as a generic alpha zero epsilon in GEGL to keep the threshold effects
  * on one known value.
index 420ef87b241831dbde56a5ddadd8ff489edf0d02..07b4e95d7cde95381f3c83939e2c246db9d30025 100644 (file)
@@ -78,6 +78,7 @@ babl_conversion_class_for_each
 babl_set_extender
 babl_extension_quiet_log
 babl_fish_path
+babl_fish_get_process
 babl_extender
 babl_class_name
 babl_sanity