gegl r2385 - in branches/branch_zhangjb: . operations/frequency operations/frequency/filters operations/frequency/tools
- From: zhangjb svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2385 - in branches/branch_zhangjb: . operations/frequency operations/frequency/filters operations/frequency/tools
- Date: Thu, 5 Jun 2008 20:58:52 +0000 (UTC)
Author: zhangjb
Date: Thu Jun 5 20:58:52 2008
New Revision: 2385
URL: http://svn.gnome.org/viewvc/gegl?rev=2385&view=rev
Log:
Some work with guassian low-pass filter (still uncompleted).
* configure.ac: added "operations/frequency/filters/Makefile".
* operations/frequency/filters: new folder.
* operations/frequency/Makefile.am: added the folder "filters".
* operations/frequency/filter-lowpass-guassian.c: added the property "flag".
* operations/frequency/filters/Makefile.am: add the file "lowpass-gussian.c".
* operations/frequency/filters/lowpass-gussian.c: new. haven't been tested, seems not correct.
* operations/frequency/tools/filter.c: haven't implemented the function. just some small modifies.
Added:
branches/branch_zhangjb/operations/frequency/filters/
branches/branch_zhangjb/operations/frequency/filters/Makefile.am
branches/branch_zhangjb/operations/frequency/filters/lowpass-gussian.c
Modified:
branches/branch_zhangjb/ChangeLog
branches/branch_zhangjb/configure.ac
branches/branch_zhangjb/operations/frequency/Makefile.am
branches/branch_zhangjb/operations/frequency/filter-lowpass-guassian.c
branches/branch_zhangjb/operations/frequency/tools/filter.c
Modified: branches/branch_zhangjb/configure.ac
==============================================================================
--- branches/branch_zhangjb/configure.ac (original)
+++ branches/branch_zhangjb/configure.ac Thu Jun 5 20:58:52 2008
@@ -838,6 +838,7 @@
operations/external/Makefile
operations/frequency/Makefile
operations/frequency/tools/Makefile
+operations/frequency/filters/Makefile
operations/generated/Makefile
operations/workshop/Makefile
operations/workshop/external/Makefile
Modified: branches/branch_zhangjb/operations/frequency/Makefile.am
==============================================================================
--- branches/branch_zhangjb/operations/frequency/Makefile.am (original)
+++ branches/branch_zhangjb/operations/frequency/Makefile.am Thu Jun 5 20:58:52 2008
@@ -1,4 +1,4 @@
-SUBDIRS = tools
+SUBDIRS = tools filters
include $(top_srcdir)/operations/Makefile-operations.am
INCLUDES = $(FFTW_CFLAGS)
Modified: branches/branch_zhangjb/operations/frequency/filter-lowpass-guassian.c
==============================================================================
--- branches/branch_zhangjb/operations/frequency/filter-lowpass-guassian.c (original)
+++ branches/branch_zhangjb/operations/frequency/filter-lowpass-guassian.c Thu Jun 5 20:58:52 2008
@@ -17,9 +17,8 @@
*/
#ifdef GEGL_CHANT_PROPERTIES
-
gegl_chant_int (d0, "Limiting frequency", 0, G_MAXINT, 20, "Less value, more blur.")
-
+gegl_chant_int (flag, "Color Componets", 0, 15, 14, "The color componets to process. Use binary to represent.")
#else
#define GEGL_CHANT_TYPE_POINT_FILTER
@@ -27,6 +26,7 @@
#include "gegl-chant.h"
#include "tools/filter.c"
+#include "filters/lowpass-gussian.c"
static void prepare (GeglOperation *operation)
{
@@ -51,9 +51,9 @@
gegl_buffer_get(input, 1.0, NULL, babl_format ("RGBA double"), buf, GEGL_AUTO_ROWSTRIDE);
filter = g_new0(gdouble, width*height);
- /* TODO: fill the filter_matrix */
+ get_lowpass_guassian(filter, width, height, o->d0);
- freq_multiply(buf, filter, width, height);
+ freq_multiply(buf, filter, width, height, o->flag);
gegl_buffer_set(output, NULL, babl_format ("RGBA double"), buf, GEGL_AUTO_ROWSTRIDE);
g_free(filter);
Added: branches/branch_zhangjb/operations/frequency/filters/Makefile.am
==============================================================================
--- (empty file)
+++ branches/branch_zhangjb/operations/frequency/filters/Makefile.am Thu Jun 5 20:58:52 2008
@@ -0,0 +1,2 @@
+EXTRA_DIST = \
+ lowpass-gussian.c
Added: branches/branch_zhangjb/operations/frequency/filters/lowpass-gussian.c
==============================================================================
--- (empty file)
+++ branches/branch_zhangjb/operations/frequency/filters/lowpass-gussian.c Thu Jun 5 20:58:52 2008
@@ -0,0 +1,47 @@
+/* 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>
+ */
+
+#include <math.h>
+#include "gegl.h"
+
+#ifndef FFT_HALF
+#define FFT_HALF(n) (gint)((n)/2+1)
+#define ELEM_ID_MATRIX(x, y, c) ((y)*(c)+(x))
+#define ELEM_ID_HALF_MATRIX(x, y, c) ((y)*(FFT_HALF(c))+(x))
+#endif
+
+
+gboolean get_lowpass_guassian(gdouble *, gint, gint, gint);
+
+gboolean
+get_lowpass_guassian(gdouble *buf, gint width, gint height, gint d0)
+{
+ /* seems not correct */
+ gint x, y;
+ gint xc = width-1;
+ gint yc = height/2+1;
+ for (x=xc; x<xc+width; x++)
+ {
+ for (y=0; y<height; y++)
+ {
+ buf[ELEM_ID_MATRIX(x, y, width)] =
+ exp(0-((x-xc)*(x-xc)+(y-yc)*(y-yc))/2/d0/d0);
+ }
+ }
+ return TRUE;
+}
Modified: branches/branch_zhangjb/operations/frequency/tools/filter.c
==============================================================================
--- branches/branch_zhangjb/operations/frequency/tools/filter.c (original)
+++ branches/branch_zhangjb/operations/frequency/tools/filter.c Thu Jun 5 20:58:52 2008
@@ -16,18 +16,19 @@
* Copyright 2008 Zhang Junbo <zhangjb svn gnome org>
*/
+#include "gegl.h"
+
#ifndef FFT_HALF
#define FFT_HALF(n) (gint)((n)/2+1)
#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 "gegl.h"
-
-gboolean freq_multiply(gdouble *buf, gdouble *multiply_buf, gint width, gint height);
+gboolean freq_multiply(gdouble *buf, gdouble *multiply_buf, gint width, gint height, gint flag);
gboolean
-freq_multiply(gdouble *buf, gdouble *multiply_buf, gint width, gint height)
+freq_multiply(gdouble *buf, gdouble *multiply_buf, gint width, gint height, gint flag)
{
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]