gegl r1833 - in trunk: . gegl operations/render operations/workshop
- From: kcozens svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r1833 - in trunk: . gegl operations/render operations/workshop
- Date: Tue, 8 Jan 2008 22:55:47 +0000 (GMT)
Author: kcozens
Date: Tue Jan 8 22:55:46 2008
New Revision: 1833
URL: http://svn.gnome.org/viewvc/gegl?rev=1833&view=rev
Log:
2008-01-08 Kevin Cozens <kcozens cvs gnome org>
* operations/render/FractalExplorer.c (process): Use g_object_get to
determine pixel size instead of using a hard-coded value.
The files listed below were updated due to changes in the API, and to
make them compile. There is no guarantee they actually work. There are
probably some reference counting issues that also need to be fixed.
* gegl/gegl-chant.h: Added missing process() prototype for
GEGL_CHANT_COMPOSER
* operations/workshop/box-max.c:
* operations/workshop/box-min.c:
* operations/workshop/box-percentile.c:
* operations/workshop/c2g.c:
* operations/workshop/demosaic-simple.c:
* operations/workshop/disc-percentile.c:
* operations/workshop/ff-save.c:
* operations/workshop/gluas.c:
* operations/workshop/gtk-display.c:
* operations/workshop/hstack.c:
* operations/workshop/kuwahara-max.c:
* operations/workshop/kuwahara-min.c:
* operations/workshop/kuwahara.c:
* operations/workshop/line-profile.c:
* operations/workshop/mandelbrot.c:
* operations/workshop/max-envelope.c:
* operations/workshop/mblur.c:
* operations/workshop/min-envelope.c:
* operations/workshop/rawbayer-load.c:
* operations/workshop/snn-percentile.c:
* operations/workshop/stress.c: Updated to new API.
* operations/workshop/box-max.c:
* operations/workshop/box-min.c:
* operations/workshop/box-percentile.c:
* operations/workshop/c2g.c:
* operations/workshop/demosaic-simple.c:
* operations/workshop/disc-percentile.c:
* operations/workshop/kuwahara.c:
* operations/workshop/kuwahara-max.c:
* operations/workshop/kuwahara-min.c:
* operations/workshop/snn-percentile.c: s/"inputt"/"input"/
Modified:
trunk/ChangeLog
trunk/gegl/gegl-chant.h
trunk/operations/render/FractalExplorer.c
trunk/operations/workshop/box-max.c
trunk/operations/workshop/box-min.c
trunk/operations/workshop/box-percentile.c
trunk/operations/workshop/c2g.c
trunk/operations/workshop/demosaic-simple.c
trunk/operations/workshop/disc-percentile.c
trunk/operations/workshop/ff-save.c
trunk/operations/workshop/gluas.c
trunk/operations/workshop/gtk-display.c
trunk/operations/workshop/hstack.c
trunk/operations/workshop/kuwahara-max.c
trunk/operations/workshop/kuwahara-min.c
trunk/operations/workshop/kuwahara.c
trunk/operations/workshop/line-profile.c
trunk/operations/workshop/mandelbrot.c
trunk/operations/workshop/max-envelope.c
trunk/operations/workshop/mblur.c
trunk/operations/workshop/min-envelope.c
trunk/operations/workshop/rawbayer-load.c
trunk/operations/workshop/snn-percentile.c
trunk/operations/workshop/stress.c
Modified: trunk/gegl/gegl-chant.h
==============================================================================
--- trunk/gegl/gegl-chant.h (original)
+++ trunk/gegl/gegl-chant.h Tue Jan 8 22:55:46 2008
@@ -413,9 +413,17 @@
void *out_buf,
glong samples);
#else
+#ifdef GEGL_CHANT_COMPOSER
+static gboolean process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *in_buf,
+ GeglBuffer *aux_buf,
+ GeglBuffer *out_buf,
+ const GeglRectangle *result);
+#else
#ifdef GEGL_CHANT_POINT_COMPOSER
static gboolean process (GeglOperation *operation,
- void *in_buf,
+ void *in_buf,
void *aux_buf,
void *out_buf,
glong samples);
@@ -454,6 +462,7 @@
#endif
#endif
#endif
+#endif
static void
gegl_chant_init (GeglChantOperation *self)
Modified: trunk/operations/render/FractalExplorer.c
==============================================================================
--- trunk/operations/render/FractalExplorer.c (original)
+++ trunk/operations/render/FractalExplorer.c Tue Jan 8 22:55:46 2008
@@ -393,12 +393,15 @@
{
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
{
- clrmap colormap;
- guchar *buf;
+ clrmap colormap;
+ guchar *buf;
+ gint pxsize;
make_color_map (self, colormap);
- buf = g_new (guchar, result->width * result->height * 4);
+ g_object_get (output, "px-size", &pxsize, NULL);
+
+ buf = g_new (guchar, result->width * result->height * pxsize);
{
guchar *dst=buf;
gint y;
Modified: trunk/operations/workshop/box-max.c
==============================================================================
--- trunk/operations/workshop/box-max.c (original)
+++ trunk/operations/workshop/box-max.c Tue Jan 8 22:55:46 2008
@@ -16,7 +16,7 @@
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
*/
#if GEGL_CHANT_PROPERTIES
-
+
gegl_chant_double (radius, 0.0, 200.0, 4.0,
"Radius of square pixel region, (width and height will be radius*2+1.")
@@ -28,6 +28,8 @@
#define GEGL_CHANT_CATEGORIES "misc"
#define GEGL_CHANT_AREA_FILTER
+#define GEGL_CHANT_PREPARE
+
#include "gegl-chant.h"
static void hor_max (GeglBuffer *src,
@@ -40,44 +42,44 @@
#include <stdio.h>
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
-
- input = gegl_node_context_get_source (context, "input");
{
- GeglBuffer *temp_in;
- GeglBuffer *temp;
- GeglRectangle compute = gegl_operation_compute_input_request (operation, "inputt", result);
+ GeglBuffer *temp_in;
+ GeglBuffer *temp;
+ GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
temp = gegl_buffer_new (&compute, babl_format ("RGBA float"));
- output = gegl_buffer_new (&compute, babl_format ("RGBA float"));
-
- hor_max (temp_in, temp, self->radius);
+ hor_max (temp_in, temp, self->radius);
ver_max (temp, output, self->radius);
g_object_unref (temp);
g_object_unref (temp_in);
-
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
- g_object_unref (output);
}
}
+
return TRUE;
}
@@ -165,7 +167,7 @@
src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
-
+
gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
offset=0;
Modified: trunk/operations/workshop/box-min.c
==============================================================================
--- trunk/operations/workshop/box-min.c (original)
+++ trunk/operations/workshop/box-min.c Tue Jan 8 22:55:46 2008
@@ -16,7 +16,7 @@
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
*/
#if GEGL_CHANT_PROPERTIES
-
+
gegl_chant_double (radius, 0.0, 200.0, 4.0,
"Radius of square pixel region, (width and height will be radius*2+1.")
@@ -28,6 +28,7 @@
#define GEGL_CHANT_CATEGORIES "misc"
#define GEGL_CHANT_AREA_FILTER
+#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
@@ -41,45 +42,43 @@
#include <stdio.h>
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
-
- input = gegl_node_context_get_source (context, "input");
{
GeglBuffer *temp_in;
GeglBuffer *temp;
- GeglRectangle compute = gegl_operation_compute_input_request (operation, "inputt", result);
-
+ GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
temp = gegl_buffer_new (&compute, babl_format ("RGBA float"));
- output = gegl_buffer_new (&compute, babl_format ("RGBA float"));
-
-
hor_min (temp_in, temp, self->radius);
ver_min (temp, output, self->radius);
g_object_unref (temp);
g_object_unref (temp_in);
-
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
- g_object_unref (output);
}
}
+
return TRUE;
}
@@ -168,7 +167,7 @@
src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
-
+
gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
offset=0;
Modified: trunk/operations/workshop/box-percentile.c
==============================================================================
--- trunk/operations/workshop/box-percentile.c (original)
+++ trunk/operations/workshop/box-percentile.c Tue Jan 8 22:55:46 2008
@@ -17,7 +17,7 @@
* 2007 Ãyvind KolÃs <oeyvindk hig no>
*/
-#if GEGL_CHANT_PROPERTIES
+#if GEGL_CHANT_PROPERTIES
#define MAX_SAMPLES 20000 /* adapted to max level of radius */
gegl_chant_double (radius, 0.0, 70.0, 4.0,
@@ -32,6 +32,7 @@
#define GEGL_CHANT_CATEGORIES "misc"
#define GEGL_CHANT_AREA_FILTER
+#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
@@ -42,23 +43,27 @@
#include <stdio.h>
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
- input = gegl_node_context_get_source (context, "input");
{
GeglBuffer *temp_in;
- GeglRectangle compute = gegl_operation_compute_input_request (operation, "inputt", result);
+ GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
if (self->radius < 1.0)
{
@@ -66,9 +71,7 @@
}
else
{
-
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
- output = gegl_buffer_new (&compute, babl_format ("RGBA float"));
median (temp_in, output, self->radius, self->percentile / 100.0);
g_object_unref (temp_in);
@@ -77,9 +80,9 @@
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
- g_object_unref (output);
}
}
+
return TRUE;
}
@@ -183,7 +186,7 @@
{
gint u,v;
gfloat *median_pix;
-
+
list_clear (&list);
for (v=y-radius;v<=y+radius;v++)
Modified: trunk/operations/workshop/c2g.c
==============================================================================
--- trunk/operations/workshop/c2g.c (original)
+++ trunk/operations/workshop/c2g.c Tue Jan 8 22:55:46 2008
@@ -17,7 +17,7 @@
* Ivar Farup <ivarf hig no>
*/
-#if GEGL_CHANT_PROPERTIES
+#if GEGL_CHANT_PROPERTIES
gegl_chant_int (radius, 2, 5000.0, 384, "neighbourhood taken into account")
gegl_chant_int (samples, 0, 1000, 3, "number of samples to do")
@@ -34,6 +34,7 @@
#define GEGL_CHANT_CATEGORIES "enhance"
#define GEGL_CHANT_AREA_FILTER
+#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
#include <math.h>
@@ -51,40 +52,40 @@
#include <stdlib.h>
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
-
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
-
- input = gegl_node_context_get_source (context, "input");
{
GeglBuffer *temp_in;
- GeglRectangle compute = gegl_operation_compute_input_request (operation, "inputt", result);
+ GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
- output = gegl_buffer_new (&compute, babl_format ("RGBA float"));
c2g (temp_in, output, self->radius, self->samples, self->iterations, self->same_spray, self->rgamma, self->strength, self->gamma);
g_object_unref (temp_in);
-
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
- g_object_unref (output);
}
}
+
return TRUE;
}
@@ -132,11 +133,11 @@
we just wonder whether we are more black than white */
gfloat gray;
gint c;
-
+
gray = pixel[0]*0.212671 + pixel[1] * 0.715160 + pixel[2] * 0.072169;
{
gfloat nominator = 0;
- gfloat denominator = 0;
+ gfloat denominator = 0;
for (c=0; c<3; c++)
{
gfloat delta = max_envelope[c]-min_envelope[c];
@@ -172,7 +173,7 @@
g_free (src_buf);
g_free (dst_buf);
}
-
+
static void tickle (GeglOperation *operation)
{
GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
Modified: trunk/operations/workshop/demosaic-simple.c
==============================================================================
--- trunk/operations/workshop/demosaic-simple.c (original)
+++ trunk/operations/workshop/demosaic-simple.c Tue Jan 8 22:55:46 2008
@@ -18,7 +18,7 @@
#if GEGL_CHANT_PROPERTIES
gegl_chant_int (pattern, 0, 3, 0, "Bayer pattern used, 0 seems to work for some nikon files, 2 for some Fuji files.")
-
+
#else
#define GEGL_CHANT_NAME demosaic_simple
@@ -36,40 +36,36 @@
GeglBuffer *dst);
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
- input = gegl_node_context_get_source (context, "input");
-
{
GeglBuffer *temp_in;
- GeglRectangle compute = gegl_operation_compute_input_request (operation, "inputt", result);
+ GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
+
-
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
output = gegl_buffer_new (&compute, babl_format ("RGBA float"));
demosaic (self, temp_in, output);
g_object_unref (temp_in);
-
+
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
- g_object_unref (output);
}
}
-
return TRUE;
}
@@ -87,7 +83,7 @@
src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4);
dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 3);
-
+
gegl_buffer_get (src, 1.0, NULL, babl_format ("Y float"), src_buf, GEGL_AUTO_ROWSTRIDE);
offset=0;
@@ -132,7 +128,7 @@
}
}
}
-
+
dst_buf [offset*3+0] = red;
dst_buf [offset*3+1] = green;
dst_buf [offset*3+2] = blue;
Modified: trunk/operations/workshop/disc-percentile.c
==============================================================================
--- trunk/operations/workshop/disc-percentile.c (original)
+++ trunk/operations/workshop/disc-percentile.c Tue Jan 8 22:55:46 2008
@@ -17,7 +17,7 @@
* 2007 Ãyvind KolÃs <oeyvindk hig no>
*/
#if GEGL_CHANT_PROPERTIES
-
+
#define MAX_SAMPLES 20000 /* adapted to max level of radius */
gegl_chant_double (radius, 0.0, 70.0, 4.0,
@@ -32,6 +32,8 @@
#define GEGL_CHANT_CATEGORIES "misc"
#define GEGL_CHANT_AREA_FILTER
+#define GEGL_CHANT_PREPARE
+
#include "gegl-chant.h"
#include <math.h>
@@ -42,24 +44,27 @@
#include <stdio.h>
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
-
- input = gegl_node_context_get_source (context, "input");
{
GeglBuffer *temp_in;
- GeglRectangle compute = gegl_operation_compute_input_request (operation, "inputt", result);
+ GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
if (self->radius < 1.0)
{
@@ -68,7 +73,6 @@
else
{
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
- output = gegl_buffer_new (&compute, babl_format ("RGBA float"));
median (temp_in, output, self->radius, self->percentile / 100.0);
g_object_unref (temp_in);
@@ -77,9 +81,9 @@
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
- g_object_unref (output);
}
}
+
return TRUE;
}
@@ -183,14 +187,14 @@
{
gint u,v;
gfloat *median_pix;
-
+
list_clear (&list);
for (v=y-radius;v<=y+radius;v++)
for (u=x-radius;u<=x+radius;u++)
{
gint ru, rv;
-
+
ru = (x-u)*(x-u);
rv = (y-v)*(y-v);
Modified: trunk/operations/workshop/ff-save.c
==============================================================================
--- trunk/operations/workshop/ff-save.c (original)
+++ trunk/operations/workshop/ff-save.c Tue Jan 8 22:55:46 2008
@@ -27,7 +27,7 @@
#define GEGL_CHANT_NAME ff_save
#define GEGL_CHANT_DESCRIPTION "FFmpeg video output sink"
#define GEGL_CHANT_SELF "ff-save.c"
-#define GEGL_CHANT_CATEGORIES "output"
+#define GEGL_CHANT_CATEGORIES "output:video"
#define GEGL_CHANT_INIT
#define GEGL_CHANT_CLASS_INIT
@@ -201,14 +201,13 @@
static gboolean
process (GeglOperation *operation,
GeglNodeContext *context,
+ GeglBuffer *input,
const GeglRectangle *result)
{
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
Priv *p = (Priv*)self->priv;
- GeglBuffer *input;
static gint inited = 0;
- input = gegl_node_context_get_source (context, "input");
g_assert (input);
p->width = result->width;
@@ -221,7 +220,6 @@
inited = 1;
}
-
write_video_frame (self, p->oc, p->video_st);
if (p->audio_st)
write_audio_frame (self, p->oc, p->audio_st);
Modified: trunk/operations/workshop/gluas.c
==============================================================================
--- trunk/operations/workshop/gluas.c (original)
+++ trunk/operations/workshop/gluas.c Tue Jan 8 22:55:46 2008
@@ -85,18 +85,16 @@
gdouble user_value);
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *aux,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
self = GEGL_CHANT_OPERATION (operation);
- input = gegl_node_context_get_source (context, "input");
-
- output = gegl_node_context_get_target (context, "output");
if (self->file && g_file_test (self->file, G_FILE_TEST_IS_REGULAR))
{
Modified: trunk/operations/workshop/gtk-display.c
==============================================================================
--- trunk/operations/workshop/gtk-display.c (original)
+++ trunk/operations/workshop/gtk-display.c Tue Jan 8 22:55:46 2008
@@ -36,7 +36,7 @@
typedef struct
{
- GtkWidget *window;
+ GtkWidget *window;
GtkWidget *drawing_area;
gint width;
gint height;
@@ -97,16 +97,14 @@
}
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *source,
const GeglRectangle *result)
{
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
- GeglBuffer *source;
- GeglBuffer *input;
- Priv *priv = init_priv (operation);
-
- input = gegl_node_context_get_source (context, "input");
+ Priv *priv = init_priv (operation);
g_assert (input);
@@ -136,7 +134,7 @@
}
else
{
- gtk_window_set_title (GTK_WINDOW (priv->window),
+ gtk_window_set_title (GTK_WINDOW (priv->window),
gegl_node_get_debug_name (gegl_node_get_producer(operation->node, "input", NULL))
);
}
Modified: trunk/operations/workshop/hstack.c
==============================================================================
--- trunk/operations/workshop/hstack.c (original)
+++ trunk/operations/workshop/hstack.c Tue Jan 8 22:55:46 2008
@@ -16,7 +16,7 @@
* Copyright 2007 Ãyvind KolÃs <oeyvindk hig no>
*/
-#if GEGL_CHANT_PROPERTIES
+#if GEGL_CHANT_PROPERTIES
#else
@@ -27,34 +27,36 @@
#define GEGL_CHANT_COMPOSER
#define GEGL_CHANT_CLASS_INIT
+#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
#include <math.h>
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *aux,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationComposer *composer;
- GeglBuffer *input;
- GeglBuffer *aux;
- GeglBuffer *output;
GeglBuffer *temp_in;
GeglBuffer *temp_aux;
-
composer = GEGL_OPERATION_COMPOSER (operation);
- input = gegl_node_context_get_source (context, "input");
- aux = gegl_node_context_get_source (context, "aux");
/* FIXME: just pass the originals buffers if the result rectangle does not
* include both input buffers
*/
- temp_in = gegl_buffer_create_sub_buffer (input, result);
- temp_aux = gegl_buffer_create_sub_buffer (aux, result);
- output = gegl_buffer_new (result, babl_format ("RGBA float"));
+ temp_in = gegl_buffer_create_sub_buffer (input, result);
+ temp_aux = gegl_buffer_create_sub_buffer (aux, result);
{
gfloat *buf = g_malloc0 (result->width * result->height * 4 * 4);
@@ -111,7 +113,7 @@
if (aux_rect->height > result.height)
result.height = aux_rect->height;
}
-
+
return result;
}
@@ -140,19 +142,19 @@
}
static GeglRectangle
-compute_affected_region (GeglOperation *self,
- const gchar *input_pad,
- GeglRectangle region)
+compute_affected_region (GeglOperation *self,
+ const gchar *input_pad,
+ const GeglRectangle *region)
{
if (!strcmp ("input_pad", "input"))
{
- return region;
+ return *region;
}
else
{
/*region.x -= radius * 2;*/
- }
- return region;
+ }
+ return *region;
}
static void class_init (GeglOperationClass *operation_class)
Modified: trunk/operations/workshop/kuwahara-max.c
==============================================================================
--- trunk/operations/workshop/kuwahara-max.c (original)
+++ trunk/operations/workshop/kuwahara-max.c Tue Jan 8 22:55:46 2008
@@ -16,7 +16,7 @@
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
*/
#if GEGL_CHANT_PROPERTIES
-
+
gegl_chant_double (radius, 0.0, 50.0, 4.0,
"Radius of square pixel region, (width and height will be radius*2+1.")
@@ -39,36 +39,31 @@
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
- input = gegl_node_context_get_source (context, "input");
-
{
GeglBuffer *temp_in;
- GeglRectangle compute = gegl_operation_compute_input_request (operation, "inputt", result);
+ GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
output = gegl_buffer_new (&compute, babl_format ("RGBA float"));
kuwahara (temp_in, output, self->radius);
g_object_unref (temp_in);
-
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
-
- g_object_unref (output);
}
}
return TRUE;
@@ -163,7 +158,7 @@
component,
NULL, /* min */
&max, /* max */
- NULL,
+ NULL,
&variance);
if (variance<best)
{
@@ -181,7 +176,7 @@
component,
NULL, /* min */
&max, /* max */
- NULL,
+ NULL,
&variance);
if (variance<best)
{
@@ -199,7 +194,7 @@
component,
NULL, /* min */
&max, /* max */
- NULL,
+ NULL,
&variance);
if (variance<best)
{
@@ -217,7 +212,7 @@
component,
NULL, /* min */
&max, /* max */
- NULL,
+ NULL,
&variance);
if (variance<best)
{
Modified: trunk/operations/workshop/kuwahara-min.c
==============================================================================
--- trunk/operations/workshop/kuwahara-min.c (original)
+++ trunk/operations/workshop/kuwahara-min.c Tue Jan 8 22:55:46 2008
@@ -16,7 +16,7 @@
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
*/
#if GEGL_CHANT_PROPERTIES
-
+
gegl_chant_double (radius, 0.0, 50.0, 4.0,
"Radius of square pixel region, (width and height will be radius*2+1.")
@@ -38,37 +38,34 @@
gint radius);
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
-
- input = gegl_node_context_get_source (context, "input");
{
GeglBuffer *temp_in;
- GeglRectangle compute = gegl_operation_compute_input_request (operation, "inputt", result);
+ GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
output = gegl_buffer_new (&compute, babl_format ("RGBA float"));
kuwahara (temp_in, output, self->radius);
g_object_unref (temp_in);
-
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
- g_object_unref (output);
}
}
+
return TRUE;
}
@@ -161,7 +158,7 @@
component,
&min, /* min */
NULL, /* max */
- NULL,
+ NULL,
&variance);
if (variance<best)
{
@@ -179,7 +176,7 @@
component,
&min, /* min */
NULL, /* max */
- NULL,
+ NULL,
&variance);
if (variance<best)
{
@@ -197,7 +194,7 @@
component,
&min, /* min */
NULL, /* max */
- NULL,
+ NULL,
&variance);
if (variance<best)
{
@@ -215,7 +212,7 @@
component,
&min, /* min */
NULL, /* max */
- NULL,
+ NULL,
&variance);
if (variance<best)
{
Modified: trunk/operations/workshop/kuwahara.c
==============================================================================
--- trunk/operations/workshop/kuwahara.c (original)
+++ trunk/operations/workshop/kuwahara.c Tue Jan 8 22:55:46 2008
@@ -16,7 +16,7 @@
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
*/
#if GEGL_CHANT_PROPERTIES
-
+
gegl_chant_double (radius, 0.0, 50.0, 10.0,
"Radius of square pixel region, (width and height will be radius*2+1.")
@@ -39,23 +39,21 @@
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
- input = gegl_node_context_get_source (context, "input");
-
{
GeglBuffer *temp_in;
- GeglRectangle compute = gegl_operation_compute_input_request (operation, "inputt", result);
+ GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
@@ -63,16 +61,14 @@
kuwahara (temp_in, output, self->radius);
g_object_unref (temp_in);
-
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
-
- g_object_unref (output);
}
}
+
return TRUE;
}
@@ -165,7 +161,7 @@
component,
NULL, /* min */
NULL, /* max */
- &mean,
+ &mean,
&variance);
if (variance<best)
{
@@ -183,7 +179,7 @@
component,
NULL, /* min */
NULL, /* max */
- &mean,
+ &mean,
&variance);
if (variance<best)
{
@@ -202,7 +198,7 @@
component,
NULL, /* min */
NULL, /* max */
- &mean,
+ &mean,
&variance);
if (variance<best)
{
@@ -220,7 +216,7 @@
component,
NULL, /* min */
NULL, /* max */
- &mean,
+ &mean,
&variance);
if (variance<best)
Modified: trunk/operations/workshop/line-profile.c
==============================================================================
--- trunk/operations/workshop/line-profile.c (original)
+++ trunk/operations/workshop/line-profile.c Tue Jan 8 22:55:46 2008
@@ -25,7 +25,7 @@
gegl_chant_int (height, 10, 10000, 256, "height of plot")
gegl_chant_double (min, -500.0, 500, 0.0, "value at bottom")
gegl_chant_double (max, -500.0, 500, 8.0, "value at top")
-
+
#else
#define GEGL_CHANT_NAME line_profile
@@ -53,17 +53,16 @@
}
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
- GeglBuffer *input,
- *output;
gint width = MAX(MAX (self->width, self->x0), self->x1);
gint height = MAX(MAX (self->height, self->y0), self->y1);
- input = gegl_node_context_get_source (context, "input");
{
GeglRectangle extent = {0,0,width,height};
output = gegl_buffer_new (&extent, babl_format ("B'aG'aR'aA u8"));
Modified: trunk/operations/workshop/mandelbrot.c
==============================================================================
--- trunk/operations/workshop/mandelbrot.c (original)
+++ trunk/operations/workshop/mandelbrot.c Tue Jan 8 22:55:46 2008
@@ -30,6 +30,7 @@
#define GEGL_CHANT_CATEGORIES "render"
#define GEGL_CHANT_SOURCE
+#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
@@ -43,9 +44,9 @@
gfloat fCImg = fViewRectImg + y * fMagLevel;
gfloat fZReal = fCReal;
gfloat fZImg = fCImg;
-
+
gint n;
-
+
for (n=0;n<self->maxiter;n++)
{
gfloat fZRealSquared = fZReal * fZReal;
@@ -61,22 +62,27 @@
return 1.0;
}
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "output", babl_format ("Y float"));
+}
+
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
- GeglBuffer *output;
{
gfloat *buf;
gint pxsize;
- output = gegl_buffer_new (result, babl_format ("Y float"));
g_object_get (output, "px-size", &pxsize, NULL);
buf = g_malloc (result->width * result->height * pxsize);
+
{
gfloat *dst=buf;
gint y;
@@ -101,14 +107,18 @@
}
}
}
- gegl_buffer_set (output, NULL, NULL, buf, GEGL_AUTO_ROWSTRIDE);
+
+ gegl_buffer_set (output, NULL, babl_format ("Y float"), buf,
+ GEGL_AUTO_ROWSTRIDE);
g_free (buf);
}
+
gegl_node_context_set_object (context, "output", G_OBJECT (output));
+
return TRUE;
}
-static GeglRectangle
+static GeglRectangle
get_defined_region (GeglOperation *operation)
{
GeglRectangle result = {-10000000,-10000000, 20000000, 20000000};
Modified: trunk/operations/workshop/max-envelope.c
==============================================================================
--- trunk/operations/workshop/max-envelope.c (original)
+++ trunk/operations/workshop/max-envelope.c Tue Jan 8 22:55:46 2008
@@ -16,7 +16,7 @@
* Copyright 2007 Ãyvind KolÃs <pippin gimp org>
*/
-#if GEGL_CHANT_PROPERTIES
+#if GEGL_CHANT_PROPERTIES
gegl_chant_int (radius, 2, 5000.0, 50, "neighbourhood taken into account")
gegl_chant_int (samples, 0, 1000, 3, "number of samples to do")
@@ -31,6 +31,7 @@
#define GEGL_CHANT_CATEGORIES "enhance"
#define GEGL_CHANT_AREA_FILTER
+#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
#include <math.h>
@@ -46,22 +47,24 @@
#include <stdlib.h>
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
-
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
-
- input = gegl_node_context_get_source (context, "input");
{
GeglBuffer *temp_in;
GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
@@ -73,7 +76,6 @@
else
{
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
- output = gegl_buffer_new (&compute, babl_format ("RGBA float"));
max_envelope (temp_in, output, self->radius, self->samples, self->iterations, self->same_spray, self->rgamma);
g_object_unref (temp_in);
@@ -82,14 +84,14 @@
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
- g_object_unref (output);
}
}
+
return TRUE;
}
#include "envelopes.h"
-
+
static void max_envelope (GeglBuffer *src,
GeglBuffer *dst,
gint radius,
Modified: trunk/operations/workshop/mblur.c
==============================================================================
--- trunk/operations/workshop/mblur.c (original)
+++ trunk/operations/workshop/mblur.c Tue Jan 8 22:55:46 2008
@@ -16,7 +16,7 @@
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
*/
#if GEGL_CHANT_PROPERTIES
-
+
gegl_chant_double (dampness, 0.0, 1.0, 0.95, "dampening, 0.0 is no dampening 1.0 is no change.")
#else
@@ -28,6 +28,7 @@
#define GEGL_CHANT_FILTER
#define GEGL_CHANT_INIT
+#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
@@ -47,33 +48,36 @@
self->priv = (void*) priv;
/* XXX: this is not freed when the op is destroyed */
- {
+ {
GeglRectangle extent = {0,0,1024,1024};
priv->acc = gegl_buffer_new (&extent, babl_format ("RGBA float"));
}
}
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output = NULL;
Priv *p;
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
p = (Priv*)self->priv;
- input = gegl_node_context_get_source (context, "input");
{
GeglBuffer *temp_in;
- temp_in = gegl_buffer_create_sub_buffer (input, result);
- output = gegl_buffer_new (result, babl_format ("RGBA float"));
+ temp_in = gegl_buffer_create_sub_buffer (input, result);
{
gint pixels = result->width*result->height;
@@ -99,6 +103,7 @@
g_object_unref (temp_in);
gegl_node_context_set_object (context, "output", G_OBJECT (output));
}
+
return TRUE;
}
Modified: trunk/operations/workshop/min-envelope.c
==============================================================================
--- trunk/operations/workshop/min-envelope.c (original)
+++ trunk/operations/workshop/min-envelope.c Tue Jan 8 22:55:46 2008
@@ -16,7 +16,7 @@
* Copyright 2007 Ãyvind KolÃs <pippin gimp org>
*/
-#if GEGL_CHANT_PROPERTIES
+#if GEGL_CHANT_PROPERTIES
gegl_chant_int (radius, 2, 5000.0, 50, "neighbourhood taken into account")
gegl_chant_int (samples, 0, 1000, 3, "number of samples to do")
@@ -31,6 +31,7 @@
#define GEGL_CHANT_CATEGORIES "enhance"
#define GEGL_CHANT_AREA_FILTER
+#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
#include <math.h>
@@ -46,22 +47,24 @@
#include <stdlib.h>
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
-
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
-
- input = gegl_node_context_get_source (context, "input");
{
GeglBuffer *temp_in;
GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
@@ -73,7 +76,6 @@
else
{
temp_in = gegl_buffer_create_sub_buffer (input, &compute);
- output = gegl_buffer_new (&compute, babl_format ("RGBA float"));
min_envelope (temp_in, output, self->radius, self->samples, self->iterations, self->same_spray, self->rgamma);
g_object_unref (temp_in);
@@ -82,14 +84,14 @@
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
- g_object_unref (output);
}
}
+
return TRUE;
}
#include "envelopes.h"
-
+
static void min_envelope (GeglBuffer *src,
GeglBuffer *dst,
gint radius,
Modified: trunk/operations/workshop/rawbayer-load.c
==============================================================================
--- trunk/operations/workshop/rawbayer-load.c (original)
+++ trunk/operations/workshop/rawbayer-load.c Tue Jan 8 22:55:46 2008
@@ -41,8 +41,9 @@
static void load_buffer (GeglChantOperation *op_raw_load);
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *output, /* Not used?? */
const GeglRectangle *result)
{
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
@@ -100,7 +101,7 @@
return;
}
- {
+ {
GeglRectangle extent = {0,0,width,height};
op_raw_load->priv = (void*)gegl_buffer_new (&extent, babl_format ("Y u16"));
}
Modified: trunk/operations/workshop/snn-percentile.c
==============================================================================
--- trunk/operations/workshop/snn-percentile.c (original)
+++ trunk/operations/workshop/snn-percentile.c Tue Jan 8 22:55:46 2008
@@ -17,7 +17,7 @@
* 2007 Ãyvind KolÃs <oeyvindk hig no>
*/
-#if GEGL_CHANT_PROPERTIES
+#if GEGL_CHANT_PROPERTIES
#define MAX_SAMPLES 20000 /* adapted to percentile level of radius */
gegl_chant_double (radius, 0.0, 70.0, 8.0,
@@ -48,22 +48,21 @@
static gboolean
-process (GeglOperation *operation,
- GeglNodeContext *context,
+process (GeglOperation *operation,
+ GeglNodeContext *context,
+ GeglBuffer *input,
+ GeglBuffer *output,
const GeglRectangle *result)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
- GeglBuffer *input;
- GeglBuffer *output;
filter = GEGL_OPERATION_FILTER (operation);
self = GEGL_CHANT_OPERATION (operation);
- input = gegl_node_context_get_source (context, "input");
{
GeglBuffer *temp_in;
- GeglRectangle compute = gegl_operation_compute_input_request (operation, "inputt", result);
+ GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
if (result->width == 0 ||
result->height== 0 ||
@@ -82,9 +81,9 @@
{
GeglBuffer *cropped = gegl_buffer_create_sub_buffer (output, result);
gegl_node_context_set_object (context, "output", G_OBJECT (cropped));
- g_object_unref (output);
}
}
+
return TRUE;
}
@@ -211,8 +210,8 @@
gfloat *center_pix = src_buf + offset * 4;
list_clear (&list);
-
- /* iterate through the upper left quater of pixels */
+
+ /* iterate through the upper left quater of pixels */
for (v=-radius;v<=0;v++)
for (u=-radius;u<= (pairs==1?radius:0);u++)
{
Modified: trunk/operations/workshop/stress.c
==============================================================================
--- trunk/operations/workshop/stress.c (original)
+++ trunk/operations/workshop/stress.c Tue Jan 8 22:55:46 2008
@@ -18,7 +18,7 @@
* Allesandro Rizzi <rizzi dti unimi it>
*/
-#if GEGL_CHANT_PROPERTIES
+#if GEGL_CHANT_PROPERTIES
gegl_chant_int (radius, 2, 5000.0, 300, "neighbourhood taken into account")
gegl_chant_int (samples, 0, 1000, 10, "number of samples to do")
@@ -79,7 +79,7 @@
}
#include "envelopes.h"
-
+
static void stress (GeglBuffer *src,
GeglBuffer *dst,
gint radius,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]