[gegl] operations/common/grey: Pass the buffer through, don't copy the pixels



commit fd83bbf37f53d42f68ecee21246022dc541a0f06
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jan 25 17:56:02 2017 +0100

    operations/common/grey: Pass the buffer through, don't copy the pixels
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777775

 operations/common/grey.c |   48 ++++++++-------------------------------------
 1 files changed, 9 insertions(+), 39 deletions(-)
---
diff --git a/operations/common/grey.c b/operations/common/grey.c
index 5b1282e..b5e6473 100644
--- a/operations/common/grey.c
+++ b/operations/common/grey.c
@@ -26,12 +26,11 @@
 
 #else
 
-#define GEGL_OP_POINT_FILTER
+#define GEGL_OP_FILTER
 #define GEGL_OP_NAME     grey
 #define GEGL_OP_C_SOURCE grey.c
 
 #include "gegl-op.h"
-#include <string.h>
 
 static void prepare (GeglOperation *operation)
 {
@@ -44,56 +43,27 @@ static void prepare (GeglOperation *operation)
 /* XXX: could be sped up by special casing op-filter behavior */
 
 static gboolean
-process (GeglOperation       *op,
-         void                *in_buf,
-         void                *out_buf,
-         glong                samples,
-         const GeglRectangle *roi,
-         gint                 level)
+process (GeglOperation        *op,
+         GeglOperationContext *context,
+         const gchar          *output_prop,
+         const GeglRectangle  *result,
+         gint                  level)
 {
-  memcpy (out_buf, in_buf, sizeof (gfloat) * 2 * samples);
-  return TRUE;
-}
-
-#include "opencl/gegl-cl.h"
-
-static gboolean
-cl_process (GeglOperation       *op,
-            cl_mem               in_tex,
-            cl_mem               out_tex,
-            size_t               global_worksize,
-            const GeglRectangle *roi,
-            gint                 level)
-{
-  cl_int cl_err = 0;
-
-  cl_err = gegl_clEnqueueCopyBuffer(gegl_cl_get_command_queue(),
-                                    in_tex , out_tex , 0 , 0 ,
-                                    global_worksize * sizeof (cl_float2),
-                                    0, NULL, NULL);
-  CL_CHECK;
-
-  return FALSE;
+  GObject *input = gegl_operation_context_get_object (context, "input");
 
-error:
+  gegl_operation_context_take_object (context, "output", g_object_ref (input));
   return TRUE;
 }
 
-
 static void
 gegl_op_class_init (GeglOpClass *klass)
 {
   GeglOperationClass            *operation_class;
-  GeglOperationPointFilterClass *point_filter_class;
 
   operation_class = GEGL_OPERATION_CLASS (klass);
-  point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
 
-  point_filter_class->process = process;
-  point_filter_class->cl_process = cl_process;
   operation_class->prepare = prepare;
-
-  operation_class->opencl_support = TRUE;
+  operation_class->process = process;
 
   gegl_operation_class_set_keys (operation_class,
       "name",        "gegl:gray",


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