gegl r2508 - in branches/branch2_zhangjb: . operations/frequency



Author: zhangjb
Date: Sat Jun 28 15:20:28 2008
New Revision: 2508
URL: http://svn.gnome.org/viewvc/gegl?rev=2508&view=rev

Log:
The work of moving Transforming-opeartions into new format completed.
* operations/frequency/dft.c: used the same size input/out buffer.
* operations/frequency/idft.c: same as above.
* operations/frequency/preview-frequency.c: same as above.


Modified:
   branches/branch2_zhangjb/ChangeLog
   branches/branch2_zhangjb/operations/frequency/dft.c
   branches/branch2_zhangjb/operations/frequency/idft.c
   branches/branch2_zhangjb/operations/frequency/preview-frequency.c

Modified: branches/branch2_zhangjb/operations/frequency/dft.c
==============================================================================
--- branches/branch2_zhangjb/operations/frequency/dft.c	(original)
+++ branches/branch2_zhangjb/operations/frequency/dft.c	Sat Jun 28 15:20:28 2008
@@ -33,12 +33,7 @@
 static GeglRectangle
 get_bounding_box (GeglOperation *operation)
 {
-  GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation,
-                                                                   "input");
-  GeglRectangle  result  = *in_rect;
-
-  result.width = FFT_HALF(result.width);
-  return result;
+  return *gegl_operation_source_get_bounding_box (operation, "input");
 }
 
 static GeglRectangle
@@ -46,9 +41,7 @@
                         const gchar *input_pad,
                         const GeglRectangle *roi)
 {
-  GeglRectangle result = *gegl_operation_source_get_bounding_box(operation,
-                                                                 "input");
-  return result;
+  return *gegl_operation_source_get_bounding_box(operation, "input");
 }
 
 static GeglRectangle
@@ -82,7 +75,7 @@
 
   src_buf = g_new0(gdouble, 4*width*height);
   tmp_src_buf = g_new0(gdouble, width*height);
-  dst_buf = g_new0(gdouble, 4*2*height*FFT_HALF(width));
+  dst_buf = g_new0(gdouble, 8*height*width);
   tmp_dst_buf = g_new0(gdouble, 2*height*FFT_HALF(width));
 
   gegl_buffer_get(input, 1.0, NULL, babl_format ("RGBA double"), src_buf,
@@ -94,7 +87,7 @@
       dft(tmp_src_buf, (fftw_complex *)tmp_dst_buf, width, height);
       set_rgba_component(tmp_dst_buf, dst_buf, i, 2*FFT_HALF(width)*height);
     }
-  encode(dst_buf, (width+1)%2);
+  
   gegl_buffer_set(output, NULL, babl_format ("frequency double"), dst_buf,
                   GEGL_AUTO_ROWSTRIDE);
 

Modified: branches/branch2_zhangjb/operations/frequency/idft.c
==============================================================================
--- branches/branch2_zhangjb/operations/frequency/idft.c	(original)
+++ branches/branch2_zhangjb/operations/frequency/idft.c	Sat Jun 28 15:20:28 2008
@@ -33,11 +33,7 @@
 static GeglRectangle
 get_bounding_box (GeglOperation *operation)
 {
-  GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation, "input");
-  GeglRectangle  result  = *in_rect;
-
-  result.width = 2*(result.width-1);
-  return result;
+  return *gegl_operation_source_get_bounding_box (operation, "input");
 }
 
 static GeglRectangle
@@ -52,9 +48,7 @@
                         const gchar *input_pad,
                         const GeglRectangle *roi)
 {
-  GeglRectangle result = *gegl_operation_source_get_bounding_box(operation,
-                                                                 "input");
-  return result;
+  return *gegl_operation_source_get_bounding_box(operation, "input");
 }
 
 static void
@@ -71,7 +65,7 @@
                         GeglBuffer *output,
                         const GeglRectangle *result)
 {
-  gint width = 2*(gegl_buffer_get_width(input)-1); /* width always refers to the image's (not buffer's) width. */
+  gint width = gegl_buffer_get_width(input);
   gint height = gegl_buffer_get_height(input);
   gdouble *src_buf;
   gdouble *dst_buf;
@@ -79,13 +73,12 @@
   gdouble *tmp_dst_buf;
   gint i;
 
-  src_buf = g_new0(gdouble, 8*height*FFT_HALF(width));
+  src_buf = g_new0(gdouble, 8*height*width);
   dst_buf = g_new0(gdouble, 4*width*height);
   tmp_src_buf = g_new0(gdouble, 2*height*FFT_HALF(width));
   tmp_dst_buf = g_new0(gdouble, width*height);
 
   gegl_buffer_get(input, 1.0, NULL, babl_format("frequency double"), (gdouble *)src_buf, GEGL_AUTO_ROWSTRIDE);
-  decode((gdouble *)src_buf);
   for (i=0; i<4; i++)
     {
       get_rgba_component(src_buf, tmp_src_buf, i, 2*height*FFT_HALF(width));

Modified: branches/branch2_zhangjb/operations/frequency/preview-frequency.c
==============================================================================
--- branches/branch2_zhangjb/operations/frequency/preview-frequency.c	(original)
+++ branches/branch2_zhangjb/operations/frequency/preview-frequency.c	Sat Jun 28 15:20:28 2008
@@ -27,19 +27,13 @@
 
 #include "gegl-chant.h"
 #include "tools/display.c"
-#include "tools/fourier.c"
 #include "tools/component.c"
 #include <fftw3.h>
 
 static GeglRectangle
 get_bounding_box (GeglOperation *operation)
 {
-  GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation,
-                                                                   "input");
-  GeglRectangle  result  = *in_rect;
-
-  result.width = 2*(result.width-1);
-  return result;
+  return *gegl_operation_source_get_bounding_box (operation, "input");
 }
 
 static GeglRectangle
@@ -54,9 +48,7 @@
                         const gchar *input_pad,
                         const GeglRectangle *roi)
 {
-  GeglRectangle result = *gegl_operation_source_get_bounding_box(operation,
-                                                                 "input");
-  return result;
+  return *gegl_operation_source_get_bounding_box(operation, "input");
 }
 
 static void
@@ -73,9 +65,7 @@
         GeglBuffer *output,
         const GeglRectangle *result)
 {
-  gint width = 2*(gegl_buffer_get_width(input)-1); /* width always refers to the
-                                                      image's (not buffer's)
-                                                      width. */
+  gint width = gegl_buffer_get_width(input);
   gint height = gegl_buffer_get_height(input);
   gdouble *src_buf;
   gdouble *dst_buf;
@@ -83,14 +73,13 @@
   gdouble *tmp_dst_buf;
   glong i;
   
-  src_buf = g_new0(gdouble, 4*2*height*FFT_HALF(width));
+  src_buf = g_new0(gdouble, 8*height*width);
   dst_buf = g_new0(gdouble, 4*width*height);
   tmp_src_buf = g_new0(gdouble, 2*height*FFT_HALF(width));
   tmp_dst_buf = g_new0(gdouble, width*height);
 
   gegl_buffer_get(input, 1.0, NULL, babl_format("frequency double"),
                   (gdouble *)src_buf, GEGL_AUTO_ROWSTRIDE);
-  decode((gdouble *)src_buf);
   for (i=0; i<3; i++)
     {
       get_rgba_component(src_buf, tmp_src_buf, i, 2*height*FFT_HALF(width));
@@ -107,8 +96,6 @@
                   GEGL_AUTO_ROWSTRIDE);   
   g_free(src_buf);
   g_free(dst_buf);
-  g_free(tmp_src_buf);
-  g_free(tmp_dst_buf);
   return TRUE;
 }
 



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