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



Author: zhangjb
Date: Sat Aug  2 09:45:29 2008
New Revision: 2556
URL: http://svn.gnome.org/viewvc/gegl?rev=2556&view=rev

Log:


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

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	Sat Aug  2 09:45:29 2008
@@ -32,17 +32,34 @@
 {
   gint x, y;
   gdouble Yr,Yi;
-  gint index;
+  gint index,h_index;
   gint max_x = FFT_HALF(width);
 
-  for(y=0;y<height;y++)
+#include <stdio.h>
+
     for(x=0;x<max_x;x++)
       {
-        index = ELEM_ID_HALF_MATRIX(x, y, width);
-        Yr= Xr[index]*Hr[index] - Xi[index]*Hi[index];
-        Yi= Xi[index]*Hr[index] + Xr[index]*Hi[index];
-        Xr[index] = Yr;
-        Xi[index] = Yi;
+        for(y=0;y<height/2;y++)
+          {
+            index = y*max_x+x;
+            h_index = (height/2-y-1)*max_x+width/2-x-1;
+
+            Yr= Xr[index]*Hr[h_index] - Xi[index]*Hi[h_index];
+            Yi= Xi[index]*Hr[h_index] + Xr[index]*Hi[h_index];
+            Xr[index] = Yr;
+            Xi[index] = Yi;
+          }
+
+        for(y=height/2;y<height;y++)
+          {
+            index = (y*max_x)+x;
+            h_index = (3*height/2-y-1)*max_x+width/2-x-1;
+
+            Yr= Xr[index]*Hr[h_index] - Xi[index]*Hi[h_index];
+            Yi= Xi[index]*Hr[h_index] + Xr[index]*Hi[h_index];
+            Xr[index] = Yr;
+            Xi[index] = Yi;
+          }
       }
     return TRUE;
 }
@@ -55,25 +72,15 @@
   gint max_x = FFT_HALF(width);
   gint index;
 
-      for (y=0; y<height/2; y++){
-        for (x=0; x<max_x; x++)
-          {
-            index = ELEM_ID_HALF_MATRIX(x, y, width);
-            Hi[index] = 0;
-            Hr[index] = exp( -((gdouble)(x+1)*(x+1)+(y+1)*(y+1))/(2*cutoff*cutoff) );
-          }
+  for (y=0; y<height; y++){
+    for (x=0; x<max_x; x++)
+      {
+        index = ELEM_ID_HALF_MATRIX(x, y, width);
+        Hi[index] = 0;
+        Hr[index] = exp( -((gdouble)(x+1-width/2)*(x+1-width/2)
+                           +(y+1-height/2)*(y+1-height/2))/(2*cutoff*cutoff) );
       }
-
-      for(y=height/2; y<height; y++)
-        {
-          for (x=0; x<max_x; x++)
-            {
-              index = ELEM_ID_HALF_MATRIX(x, y, width);
-              Hi[index] = 0;
-              Hr[index] = 
-                exp(-((gdouble)(x+1)*(x+1)+(y-height+1)*(y-height+1))/(2*cutoff*cutoff) );
-            }
-        }
+  }
 
   return TRUE;
 }



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