gegl r2347 - in branches/branch_zhangjb: . operations/frequency tests/frequency



Author: zhangjb
Date: Fri May 23 16:48:19 2008
New Revision: 2347
URL: http://svn.gnome.org/viewvc/gegl?rev=2347&view=rev

Log:
All operations about grey image fourier transform are able to use.
* operations/frequency/dft-inverse-grey.c: now works correctly with new data structure.
* operations/frequency/preview-frequency-grey.c: modified the description.
* tests/frequency/hello-world-fourier.c: performed the image->dft->idft->image process.


Modified:
   branches/branch_zhangjb/ChangeLog
   branches/branch_zhangjb/operations/frequency/dft-inverse-grey.c
   branches/branch_zhangjb/operations/frequency/preview-frequency-grey.c
   branches/branch_zhangjb/tests/frequency/hello-world-fourier.c

Modified: branches/branch_zhangjb/operations/frequency/dft-inverse-grey.c
==============================================================================
--- branches/branch_zhangjb/operations/frequency/dft-inverse-grey.c	(original)
+++ branches/branch_zhangjb/operations/frequency/dft-inverse-grey.c	Fri May 23 16:48:19 2008
@@ -1,5 +1,19 @@
-/* This file is just for test. This operation can NOT be used in any 
- * practice case by now. 
+/* This file is a part of GEGL
+ *
+ * GEGL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * GEGL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2008 Zhang Junbo  <zhangjb svn gnome org>
  */
 
 #ifdef GEGL_CHANT_PROPERTIES
@@ -16,12 +30,12 @@
 #include <fftw3.h>
 
 static GeglRectangle
-get_required_for_output(GeglOperation *operation,
-                        const gchar *input_pad,
-                        const GeglRectangle *roi)
+get_bounding_box (GeglOperation *operation)
 {
-  GeglRectangle result = *gegl_operation_source_get_bounding_box(operation,
-                                                                 "input");
+  GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation, "input");
+  GeglRectangle  result  = *in_rect;
+
+  result.width -= 2;
   return result;
 }
 
@@ -29,7 +43,21 @@
 get_cached_region(GeglOperation *operation,
                   const GeglRectangle *roi)
 {
-  return *gegl_operation_source_get_bounding_box(operation, "input");
+  GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation, "input");
+  GeglRectangle  result  = *in_rect;
+
+  result.width  -= 2;
+  return result;
+}
+
+static GeglRectangle
+get_required_for_output(GeglOperation *operation,
+                        const gchar *input_pad,
+                        const GeglRectangle *roi)
+{
+  GeglRectangle result = *gegl_operation_source_get_bounding_box(operation,
+                                                                 "input");
+  return result;
 }
 
 static void
@@ -53,7 +81,7 @@
         GeglBuffer *output,
         const GeglRectangle *result)
 {
-  gint width = gegl_buffer_get_width(input);
+  gint width = gegl_buffer_get_width(input)-2;
   gint height = gegl_buffer_get_height(input);
   gdouble *src_buf;
   gdouble *dst_buf;
@@ -88,15 +116,14 @@
 
   filter_class->process = process;
   operation_class->prepare = prepare;
+  operation_class->get_bounding_box = get_bounding_box;
   operation_class->get_required_for_output= get_required_for_output;
   operation_class->get_cached_region = get_cached_region;
 
   operation_class->name = "dft-inverse-grey";
   operation_class->categories = "frequency";
   operation_class->description
-    = "Perform 2-D Discrete Fourier Transform for the image.\n"
-    "Note this operation is just for test, which can NOT be "
-    "used to do anything by now.";
+    = "Perform 2-D inverse Discrete Fourier Transform for the image.\n";
 }
 
 #endif

Modified: branches/branch_zhangjb/operations/frequency/preview-frequency-grey.c
==============================================================================
--- branches/branch_zhangjb/operations/frequency/preview-frequency-grey.c	(original)
+++ branches/branch_zhangjb/operations/frequency/preview-frequency-grey.c	Fri May 23 16:48:19 2008
@@ -123,7 +123,7 @@
   operation_class->name = "preview-frequency-grey";
   operation_class->categories = "frequency";
   operation_class->description
-    = "convert the frequency buffer to a displayable gray image.";
+    = "Convert the frequency buffer to a displayable gray image.";
 }
 
 #endif

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	Fri May 23 16:48:19 2008
@@ -31,7 +31,7 @@
        gegl_node_process(display);
        }*/
 
-      gegl_node_link_many(image, dft, preview, save, NULL);
+      gegl_node_link_many(image, dft, idft, save, NULL);
       gegl_node_process(save);
 
       g_object_unref(gegl);



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