gegl r2327 - in branches/branch_zhangjb: . operations/frequency tests/frequency
- From: zhangjb svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2327 - in branches/branch_zhangjb: . operations/frequency tests/frequency
- Date: Wed, 21 May 2008 15:41:07 +0000 (UTC)
Author: zhangjb
Date: Wed May 21 15:41:06 2008
New Revision: 2327
URL: http://svn.gnome.org/viewvc/gegl?rev=2327&view=rev
Log:
* operations/frequency/dft-grey.c: already can process the entire image correctly.
* tests/frequency/hello-world-fourier.c: some small modifies.
Modified:
branches/branch_zhangjb/ChangeLog
branches/branch_zhangjb/operations/frequency/dft-grey.c
branches/branch_zhangjb/tests/frequency/hello-world-fourier.c
Modified: branches/branch_zhangjb/operations/frequency/dft-grey.c
==============================================================================
--- branches/branch_zhangjb/operations/frequency/dft-grey.c (original)
+++ branches/branch_zhangjb/operations/frequency/dft-grey.c Wed May 21 15:41:06 2008
@@ -19,8 +19,7 @@
#include "tools/display.c"
#include <fftw3.h>
-static GeglRectangle
-get_required_for_output(GeglOperation *operation,
+static GeglRectangle get_required_for_output(GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *roi)
{
@@ -29,8 +28,15 @@
return result;
}
-static void
-prepare(GeglOperation *operation)
+static GeglRectangle
+get_cached_region (GeglOperation *operation,
+ const GeglRectangle *roi)
+{
+ return *gegl_operation_source_get_bounding_box (operation, "input");
+}
+
+
+static void prepare(GeglOperation *operation)
{
Babl *image_format = babl_format_new(babl_model("Y"),
babl_type("double"),
@@ -44,14 +50,13 @@
gegl_operation_set_format(operation, "output", frequency_format);
}
-static gboolean
-process(GeglOperation *operation,
+static gboolean process(GeglOperation *operation,
GeglBuffer *input,
GeglBuffer *output,
const GeglRectangle *result)
{
- gint width= gegl_buffer_get_width(input);
- gint height= gegl_buffer_get_height(input);
+ gint width = gegl_buffer_get_width(input);
+ gint height = gegl_buffer_get_height(input);
gdouble *src_buf;
gdouble *dst_buf;
gdouble *dst_imag_buf;
@@ -66,15 +71,24 @@
dst_buf = g_new0(gdouble, height*width);
dst_imag_buf = g_new0(gdouble, height*width);
+#if 1
dft(src_buf, dst_buf, dst_imag_buf, width, height);
- // zoomshow(dst_buf, width*height);
- // shift_dft(dst_buf, width, height);
-
- // int i;
- // for (i=0; i<width*height; i++)
- // {
- // dst_buf[i] = src_buf[i];
- // }
+ zoomshow(dst_buf, width*height);
+ shift_dft(dst_buf, width, height);
+#endif
+
+#if 1
+ /* to show how many times this section be executed. */
+ printf("@\t");
+#endif
+
+#if 0
+ int i;
+ for (i=0; i<width*height; i++)
+ {
+ dst_buf[i] = src_buf[i];
+ }
+#endif
#if 0
int i, j;
@@ -107,8 +121,7 @@
return TRUE;
}
-static void
-gegl_chant_class_init(GeglChantClass *klass)
+static void gegl_chant_class_init(GeglChantClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationFilterClass *filter_class;
@@ -118,7 +131,8 @@
filter_class->process = process;
operation_class->prepare = prepare;
- operation_class->get_required_for_output = get_required_for_output;
+ operation_class->get_required_for_output= get_required_for_output;
+ operation_class->get_cached_region = get_cached_region;
operation_class->name = "dft-grey";
operation_class->categories = "frequency";
Modified: branches/branch_zhangjb/tests/frequency/hello-world-fourier.c
==============================================================================
--- branches/branch_zhangjb/tests/frequency/hello-world-fourier.c (original)
+++ branches/branch_zhangjb/tests/frequency/hello-world-fourier.c Wed May 21 15:41:06 2008
@@ -17,9 +17,7 @@
NULL);
GeglNode *proc = gegl_node_new_child(gegl, "operation", "dft-grey", NULL);
GeglNode *grey = gegl_node_new_child(gegl, "operation", "grey", NULL);
- GeglNode
- *save =
- gegl_node_new_child(gegl,
+ GeglNode *save = gegl_node_new_child(gegl,
"operation",
"png-save",
"path",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]