gegl r2529 - in branches/branch2_zhangjb: . operations/frequency operations/frequency/tools



Author: zhangjb
Date: Fri Jul 11 17:08:38 2008
New Revision: 2529
URL: http://svn.gnome.org/viewvc/gegl?rev=2529&view=rev

Log:
* operations/frequency/lowpass-gaussian.c:
* operations/frequency/tools/filters.c: modified getH_lowpass_gaussian.


Modified:
   branches/branch2_zhangjb/ChangeLog
   branches/branch2_zhangjb/operations/frequency/lowpass-gaussian.c
   branches/branch2_zhangjb/operations/frequency/tools/filters.c

Modified: branches/branch2_zhangjb/operations/frequency/lowpass-gaussian.c
==============================================================================
--- branches/branch2_zhangjb/operations/frequency/lowpass-gaussian.c	(original)
+++ branches/branch2_zhangjb/operations/frequency/lowpass-gaussian.c	Fri Jul 11 17:08:38 2008
@@ -62,7 +62,7 @@
   
   Hr_buf = (gdouble, FFT_HALF(width)*height);
   Hi_buf = (gdouble, FFT_HALF(width)*height);
-  getH_lowpass_gaussian(Hr, Hi, cutoff);  
+  getH_lowpass_gaussian(Hr, Hi, width, height, cutoff);  
   
   src_buf = g_new0(gdouble, 8*width*height);
   dst_buf = g_new0(gdouble, 8*width*height);    

Modified: branches/branch2_zhangjb/operations/frequency/tools/filters.c
==============================================================================
--- branches/branch2_zhangjb/operations/frequency/tools/filters.c	(original)
+++ branches/branch2_zhangjb/operations/frequency/tools/filters.c	Fri Jul 11 17:08:38 2008
@@ -21,9 +21,10 @@
 #define ELEM_ID_MATRIX(x, y, c) ((y)*(c)+(x)) 
 #define ELEM_ID_HALF_MATRIX(x, y, c) ((y)*(FFT_HALF(c))+(x))
 #endif
+#include <math.h>
 
 gboolean freq_multiply(gdouble *, gdouble *, gdouble *, gdouble *, gint, gint);
-gboolean getH_lowpass_gaussian(gdouble *, gdouble *, gint);
+gboolean getH_lowpass_gaussian(gdouble *, gdouble *, gint, gint, gint);
 
 gboolean
 freq_multiply(gdouble *Xr, gdouble *Xi, gdouble *Hr,
@@ -86,3 +87,20 @@
   g_free(Yi);
   return TRUE;
 }
+
+gboolean
+getH_lowpass_gaussian(gdouble *Hr, gdouble *Hi, gint width, gint height,
+                      gint cutoff)
+{
+  gint x, y;
+  for (x=0; x<FFT_HALF(width); x++)
+    {
+      for (y=0; y<height; y++)
+        {
+          Hi[ELEM_ID_HALF_MATRIX(x, y, width)] = 0;
+          Hr[ELEM_ID_HALF_MATRIX(x, y, width)]
+            = exp(0 - (x*x+y*y)/2/(cutoff*cutoff));
+        }
+    }
+  retrun TRUE;
+}



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