gegl r2366 - in branches/branch_zhangjb: . operations/frequency operations/frequency/tools
- From: zhangjb svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2366 - in branches/branch_zhangjb: . operations/frequency operations/frequency/tools
- Date: Sun, 1 Jun 2008 18:51:06 +0000 (UTC)
Author: zhangjb
Date: Sun Jun 1 18:51:06 2008
New Revision: 2366
URL: http://svn.gnome.org/viewvc/gegl?rev=2366&view=rev
Log:
A guassian low-pass filter (uncompleted).
* operations/frequency/filter-lowpass-guassian.c: new op, uncompleted.
* operations/frequency/tools/Makefile.am: add the file filter.c.
* operations/frequency/tools/filter.c: haven't implement the function.
Added:
branches/branch_zhangjb/operations/frequency/filter-lowpass-guassian.c (contents, props changed)
branches/branch_zhangjb/operations/frequency/tools/filter.c (contents, props changed)
Modified:
branches/branch_zhangjb/ChangeLog
branches/branch_zhangjb/operations/frequency/tools/Makefile.am
Added: branches/branch_zhangjb/operations/frequency/filter-lowpass-guassian.c
==============================================================================
--- (empty file)
+++ branches/branch_zhangjb/operations/frequency/filter-lowpass-guassian.c Sun Jun 1 18:51:06 2008
@@ -0,0 +1,82 @@
+/* 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
+
+gegl_chant_int (d0, "Limiting frequency", 0, G_MAXINT, 20, "Less value, more blur.")
+
+#else
+
+#define GEGL_CHANT_TYPE_POINT_FILTER
+#define GEGL_CHANT_C_FILE "filter-lowpass-guassian.c"
+
+#include "gegl-chant.h"
+#include "tools/filter.c"
+
+static void prepare (GeglOperation *operation)
+{
+ Babl *format = babl_format ("RGBA double");
+ gegl_operation_set_format (operation, "input", format);
+ gegl_operation_set_format (operation, "output", format);
+}
+
+static gboolean
+process(GeglOperation *operation,
+ GeglBuffer *input,
+ GeglBuffer *output,
+ const GeglRectangle *result)
+{
+ gint width = gegl_buffer_get_width(input);
+ gint height = gegl_buffer_get_height(input);
+ gdouble *buf;
+ gdouble *filter;
+ GeglChantO *o = GEGL_CHANT_PROPERTIES(operation);
+
+ buf = g_new0(gdouble, width*height);
+ 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 */
+
+ freq_multiply(buf, filter, width, height);
+ gegl_buffer_set(output, NULL, babl_format ("RGBA double"), buf, GEGL_AUTO_ROWSTRIDE);
+
+ g_free(filter);
+ g_free(buf);
+ return TRUE;
+}
+
+static void
+gegl_chant_class_init(GeglChantClass *klass)
+{
+ GeglOperationClass *operation_class;
+ GeglOperationFilterClass *filter_class;
+
+ operation_class = GEGL_OPERATION_CLASS(klass);
+ filter_class = GEGL_OPERATION_FILTER_CLASS(klass);
+
+ filter_class->process = process;
+ operation_class->prepare = prepare;
+
+ operation_class->name = "filter-lowpass-guassian";
+ operation_class->categories = "frequency";
+ operation_class->description
+ = "A guassian low-pass filter.";
+}
+
+#endif
Modified: branches/branch_zhangjb/operations/frequency/tools/Makefile.am
==============================================================================
--- branches/branch_zhangjb/operations/frequency/tools/Makefile.am (original)
+++ branches/branch_zhangjb/operations/frequency/tools/Makefile.am Sun Jun 1 18:51:06 2008
@@ -1,4 +1,5 @@
EXTRA_DIST = \
+ filter.c \
fourier.c \
display.c \
component.c
\ No newline at end of file
Added: branches/branch_zhangjb/operations/frequency/tools/filter.c
==============================================================================
--- (empty file)
+++ branches/branch_zhangjb/operations/frequency/tools/filter.c Sun Jun 1 18:51:06 2008
@@ -0,0 +1,33 @@
+/* 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>
+ */
+
+#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)
+{
+ return TRUE;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]