gegl r2292 - in trunk: . gegl/operation operations/common operations/generated
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2292 - in trunk: . gegl/operation operations/common operations/generated
- Date: Fri, 16 May 2008 22:01:41 +0100 (BST)
Author: ok
Date: Fri May 16 21:01:40 2008
New Revision: 2292
URL: http://svn.gnome.org/viewvc/gegl?rev=2292&view=rev
Log:
* gegl/operation/gegl-operation-processors.c:
(gegl_class_register_alternate_vfunc): code reorganization.
(dispatch): cache the found codepath for a given quality, made the
order the checked for strings are used be:
choice = reference;
if (gegl_config()->quality <= 1.0 && simd) choice = simd;
if (gegl_config()->quality <= 0.75 && good) choice = good;
if (gegl_config()->quality <= 0.25 && fast) choice = fast;
Register the following operations with the new name "simd" instead of
g4float.
* operations/common/brightness-contrast.c:
* operations/common/invert.c:
* operations/generated/other-blend.rb:
* operations/generated/svg-12-porter-duff.rb:
Modified:
trunk/ChangeLog
trunk/gegl/operation/gegl-operation-processors.c
trunk/operations/common/brightness-contrast.c
trunk/operations/common/invert.c
trunk/operations/generated/other-blend.rb
trunk/operations/generated/svg-12-porter-duff.rb
Modified: trunk/gegl/operation/gegl-operation-processors.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-processors.c (original)
+++ trunk/gegl/operation/gegl-operation-processors.c Fri May 16 21:01:40 2008
@@ -52,6 +52,8 @@
{
GCallback callback[MAX_PROCESSOR];
gchar *string[MAX_PROCESSOR];
+ gdouble cached_quality;
+ gint cached;
} VFuncData;
void
@@ -90,10 +92,11 @@
gint fast = 0;
gint good = 0;
gint reference = 0;
- gint g4f = 0;
+ gint simd = 0;
gint i;
gint choice;
+
data = g_type_get_qdata (G_OBJECT_TYPE(object),
g_quark_from_string("dispatch-data"));
if (!data)
@@ -101,6 +104,13 @@
g_error ("dispatch called on object without dispatch-data");
}
+ if (gegl_config()->quality == data->cached_quality)
+ {
+ dispatch = (void*)data->callback[data->cached];
+ dispatch (object, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+ return;
+ }
+
for (i=0;i<MAX_PROCESSOR;i++)
{
const gchar *string = data->string[i];
@@ -108,12 +118,9 @@
if (string && cb!=NULL)
{
- if (g_str_equal (string, "fast"))
- fast = i;
- if (g_str_equal (string, "g4float"))
- g4f = i;
- else if (g_str_equal (string, "good"))
- good = i;
+ if (g_str_equal (string, "fast")) fast = i;
+ if (g_str_equal (string, "simd")) simd = i;
+ else if (g_str_equal (string, "good")) good = i;
else if (g_str_equal (string, "reference"))
reference = i;
}
@@ -122,18 +129,15 @@
g_assert (data->callback[reference]);
choice = reference;
- if (gegl_config()->quality <= 0.5)
- {
- if (good) choice = good;
- if (g4f) choice = g4f;
- }
- if (gegl_config()->quality <= 0.2)
- {
- if (fast) choice = fast;
- }
+ if (gegl_config()->quality <= 1.0 && simd) choice = simd;
+ if (gegl_config()->quality <= 0.75 && good) choice = good;
+ if (gegl_config()->quality <= 0.25 && fast) choice = fast;
GEGL_NOTE(PROCESSOR, "Using %s implementation for %s", data->string[choice], g_type_name (G_OBJECT_TYPE(object)));
- dispatch = (void*)data->callback[choice];
+
+ data->cached = choice;
+ data->cached_quality = gegl_config()->quality;
+ dispatch = (void*)data->callback[data->cached];
dispatch (object, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
}
@@ -156,6 +160,7 @@
if (!data)
{
data = g_new0 (VFuncData, 1);
+ data->cached_quality = -1.0;
g_type_set_qdata (type, quark, data);
g_type_set_qdata (type, g_quark_from_string("dispatch-data"), data);
}
Modified: trunk/operations/common/brightness-contrast.c
==============================================================================
--- trunk/operations/common/brightness-contrast.c (original)
+++ trunk/operations/common/brightness-contrast.c Fri May 16 21:01:40 2008
@@ -179,7 +179,7 @@
* broken and not conforming to the reference implementation.
*/
gegl_operation_class_add_processor (operation_class,
- G_CALLBACK (process_simd), "g4float");
+ G_CALLBACK (process_simd), "simd");
#endif
}
Modified: trunk/operations/common/invert.c
==============================================================================
--- trunk/operations/common/invert.c (original)
+++ trunk/operations/common/invert.c Fri May 16 21:01:40 2008
@@ -96,7 +96,7 @@
#ifdef HAS_G4FLOAT
gegl_operation_class_add_processor (operation_class,
- G_CALLBACK (process_g4f), "g4float");
+ G_CALLBACK (process_g4f), "simd");
#endif
}
Modified: trunk/operations/generated/other-blend.rb
==============================================================================
--- trunk/operations/generated/other-blend.rb (original)
+++ trunk/operations/generated/other-blend.rb Fri May 16 21:01:40 2008
@@ -92,7 +92,7 @@
#ifdef HAS_G4FLOAT
gegl_operation_class_add_processor (operation_class,
- G_CALLBACK (process_gegl4float), "g4float");
+ G_CALLBACK (process_gegl4float), "simd");
#endif
'
Modified: trunk/operations/generated/svg-12-porter-duff.rb
==============================================================================
--- trunk/operations/generated/svg-12-porter-duff.rb (original)
+++ trunk/operations/generated/svg-12-porter-duff.rb Fri May 16 21:01:40 2008
@@ -121,7 +121,7 @@
#ifdef HAS_G4FLOAT
gegl_operation_class_add_processor (operation_class,
- G_CALLBACK (process_gegl4float), "g4float");
+ G_CALLBACK (process_gegl4float), "simd");
#endif
'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]