gegl r2185 - in trunk: . operations/common



Author: ok
Date: Thu Apr 17 23:44:01 2008
New Revision: 2185
URL: http://svn.gnome.org/viewvc/gegl?rev=2185&view=rev

Log:
* configure.ac: added mmx and cpu detection.
* gegl/Makefile.am:
* gegl/gegl-cpuaccel.[ch]: added from GIMP.
* gegl/gegl-plugin.h: include config.h when compiling in-tree (to
allow checking for USE_SSE in ops.
* gegl/gegl-utils.[ch]: (gegl_malloc), (gegl_free): added malloc and
free that aligns on 16byte boundaries.
* gegl/operation/gegl-operation-point-composer.c:,
* gegl/operation/gegl-operation-point-filter.c:
(process_inner): align allocated buffers on 16byte boundaries to
make it possible to process RGBA buffers using SSE.
* gegl/operation/gegl-operation-processors.c: 
(gegl_operation_class_add_processor): added category SSE that is
autoenabled if sse support is compiled in and detected.
* operations/common/invert.c: (process_sse), 
* operations/common/brightness-contrast.c: (process_sse), 
(gegl_chant_class_init): accelerate the invert operation with vector
maths using SSE.
(gegl_chant_class_init): accelerate the invert operation with vector
maths using SSE.


Modified:
   trunk/ChangeLog
   trunk/operations/common/brightness-contrast.c

Modified: trunk/operations/common/brightness-contrast.c
==============================================================================
--- trunk/operations/common/brightness-contrast.c	(original)
+++ trunk/operations/common/brightness-contrast.c	Thu Apr 17 23:44:01 2008
@@ -105,6 +105,34 @@
   return TRUE;
 }
 
+
+#ifdef USE_SSE
+static gboolean
+process_sse (GeglOperation *op,
+             void          *in_buf,
+             void          *out_buf,
+             glong          samples)
+{
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
+  GeglV4     *in  = in_buf;
+  GeglV4     *out = out_buf;
+  GeglV4      half={{0.5,0.5,0.5,0.5}};
+  GeglV4      brightness={{o->brightness + 0.5,
+                           o->brightness + 0.5,
+                           o->brightness + 0.5,
+                           0.0}};
+  GeglV4      contrast={{o->contrast, o->contrast,o->contrast, 1.0}};
+
+  while (--samples)
+    {
+      out->v = (in->v - half.v) * contrast.v + brightness.v;
+      in  ++;
+      out ++;
+    }
+  return TRUE;
+}
+#endif
+
 /*
  * The class init function sets up information needed for this operations class
  * (template) in the GObject OO framework.
@@ -135,6 +163,12 @@
 
   /* a description of what this operations does */
   operation_class->description = _("Changes the light level and contrast.");
+
+
+#ifdef USE_SSE
+  gegl_operation_class_add_processor (operation_class,
+                                      G_CALLBACK (process_sse), "sse");
+#endif
 }
 
 #endif /* closing #ifdef GEGL_CHANT_PROPERTIES ... else ... */



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