[babl] babl: register gray and gray alpha shortcuts between spaces
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: register gray and gray alpha shortcuts between spaces
- Date: Tue, 20 Aug 2019 00:55:38 +0000 (UTC)
commit 6a85f56af6dfd7796112b9d3fc5c69d56c76a316
Author: Øyvind Kolås <pippin gimp org>
Date: Tue Aug 20 02:54:51 2019 +0200
babl: register gray and gray alpha shortcuts between spaces
The formats "Y float", "YA float" and "YaA float" between different RGB
and gray spaces are all exactly the same. This registers memcpy shortcuts
for these combinations for all spaces. This avoids temporarily expand
into RGBA for many babl path fishes.
babl/babl-space.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
---
diff --git a/babl/babl-space.c b/babl/babl-space.c
index c05796ca8..90c0a50f9 100644
--- a/babl/babl-space.c
+++ b/babl/babl-space.c
@@ -883,6 +883,27 @@ universal_rgb_converter (const Babl *conversion,
}
+static inline void
+universal_ya_converter (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
+{
+ memcpy (dst_char, src_char, samples * 4 * 2);
+}
+
+static inline void
+universal_y_converter (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
+{
+ memcpy (dst_char, src_char, samples * 4);
+}
+
+
static inline void
universal_nonlinear_rgb_u8_converter (const Babl *conversion,
unsigned char *src_char,
@@ -1268,6 +1289,22 @@ add_rgb_adapter (Babl *babl,
babl_format_with_space("RGB float", space),
"linear", universal_rgb_converter,
NULL));
+
+ prep_conversion(babl_conversion_new(
+ babl_format_with_space("Y float", space),
+ babl_format_with_space("Y float", babl),
+ "linear", universal_y_converter,
+ NULL));
+ prep_conversion(babl_conversion_new(
+ babl_format_with_space("YaA float", babl),
+ babl_format_with_space("YaA float", space),
+ "linear", universal_ya_converter,
+ NULL));
+ prep_conversion(babl_conversion_new(
+ babl_format_with_space("YA float", babl),
+ babl_format_with_space("YA float", space),
+ "linear", universal_ya_converter,
+ NULL));
}
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]