[babl] Use SSE2 u16 conversions for gamma <-> gamma



commit 85114133b44cf1cadebe8affadf5d1b03b6368ed
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Sun Jun 30 05:12:52 2013 -0700

    Use SSE2 u16 conversions for gamma <-> gamma

 extensions/sse2-int16.c |   42 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/extensions/sse2-int16.c b/extensions/sse2-int16.c
index 252d1a7..843e030 100644
--- a/extensions/sse2-int16.c
+++ b/extensions/sse2-int16.c
@@ -35,7 +35,7 @@
 static const __v4sf  u16_float = Q (1.f / 65535);
 
 static long
-conv_rgba16_linear_rgbaF_linear (const uint16_t *src, float *dst, long samples)
+conv_rgba16_rgbaF (const uint16_t *src, float *dst, long samples)
 {
   long i = 0;
 
@@ -71,7 +71,7 @@ conv_rgba16_linear_rgbaF_linear (const uint16_t *src, float *dst, long samples)
 }
 
 static long
-conv_rgba16_linear_rgbAF_linear (const uint16_t *src, float *dst, long samples)
+conv_rgba16_rgbAF (const uint16_t *src, float *dst, long samples)
 {
   long i = 0;
   long remainder;
@@ -137,9 +137,6 @@ conv_rgba16_linear_rgbAF_linear (const uint16_t *src, float *dst, long samples)
 
 #endif /* defined(USE_SSE2) */
 
-#define o(src, dst) \
-  babl_conversion_new (src, dst, "linear", conv_ ## src ## _ ## dst, NULL)
-
 int init (void);
 
 int
@@ -172,11 +169,42 @@ init (void)
     babl_component ("A"),
     NULL);
 
+  const Babl *rgbaF_gamma = babl_format_new (
+    babl_model ("R'G'B'A"),
+    babl_type ("float"),
+    babl_component ("R'"),
+    babl_component ("G'"),
+    babl_component ("B'"),
+    babl_component ("A"),
+    NULL);
+  const Babl *rgbAF_gamma = babl_format_new (
+    babl_model ("R'aG'aB'aA"),
+    babl_type ("float"),
+    babl_component ("R'a"),
+    babl_component ("G'a"),
+    babl_component ("B'a"),
+    babl_component ("A"),
+    NULL);
+  const Babl *rgba16_gamma = babl_format_new (
+    babl_model ("R'G'B'A"),
+    babl_type ("u16"),
+    babl_component ("R'"),
+    babl_component ("G'"),
+    babl_component ("B'"),
+    babl_component ("A"),
+    NULL);
+
+#define CONV(src, dst) \
+{ \
+  babl_conversion_new (src ## _linear, dst ## _linear, "linear", conv_ ## src ## _ ## dst, NULL); \
+  babl_conversion_new (src ## _gamma, dst ## _gamma, "linear", conv_ ## src ## _ ## dst, NULL); \
+}
+
   if ((babl_cpu_accel_get_support () & BABL_CPU_ACCEL_X86_SSE) &&
       (babl_cpu_accel_get_support () & BABL_CPU_ACCEL_X86_SSE2))
     {
-      o (rgba16_linear, rgbaF_linear);
-      o (rgba16_linear, rgbAF_linear);
+      CONV (rgba16, rgbaF);
+      CONV (rgba16, rgbAF);
     }
 
 #endif /* defined(USE_SSE2) */


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