[babl] extensions/simple: improve u16 fast paths
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] extensions/simple: improve u16 fast paths
- Date: Sat, 10 Dec 2016 15:11:05 +0000 (UTC)
commit b07b273e641b3541c4553e88cd3ac7938497c126
Author: Øyvind Kolås <pippin gimp org>
Date: Sat Dec 10 16:10:45 2016 +0100
extensions/simple: improve u16 fast paths
extensions/simple.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/extensions/simple.c b/extensions/simple.c
index 31ec455..1430ab1 100644
--- a/extensions/simple.c
+++ b/extensions/simple.c
@@ -240,7 +240,7 @@ u32_to_float_x2 (unsigned char *src_char, unsigned char *dst_char, long samples)
static inline long
u16_to_float (unsigned char *src_char, unsigned char *dst_char, long samples)
{
- uint32_t *src = (uint32_t *)src_char;
+ uint16_t *src = (uint16_t *)src_char;
float *dst = (float *)dst_char;
long n = samples;
while (n--)
@@ -274,6 +274,24 @@ u16_to_float_x2 (unsigned char *src_char, unsigned char *dst_char, long samples)
return samples;
}
+static inline long
+yau16_rgbaf (unsigned char *src_char, unsigned char *dst_char, long samples)
+{
+ uint16_t *src = (uint16_t *)src_char;
+ float *dst = (float *)dst_char;
+ long n = samples;
+ while (n--)
+ {
+ dst[0] = src[0] / 65535.0f;
+ dst[1] = src[0] / 65535.0f;
+ dst[2] = src[0] / 65535.0f;
+ dst[3] = src[1] / 65535.0f;
+ dst +=4;
+ src +=2;
+ }
+ return samples;
+}
+
int
init (void)
@@ -520,6 +538,10 @@ init (void)
"linear",
u16_to_float_x3,
NULL);
-
+ babl_conversion_new (babl_format ("Y'A u16"),
+ babl_format ("R'G'B'A float"),
+ "linear",
+ yau16_rgbaf,
+ NULL);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]