gegl r2495 - in branches/branch_zhangjb: . operations/frequency
- From: zhangjb svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2495 - in branches/branch_zhangjb: . operations/frequency
- Date: Sun, 22 Jun 2008 17:16:03 +0000 (UTC)
Author: zhangjb
Date: Sun Jun 22 17:16:03 2008
New Revision: 2495
URL: http://svn.gnome.org/viewvc/gegl?rev=2495&view=rev
Log:
* operations/frequency/dft-inverse.c: modified for freq-format.
Modified:
branches/branch_zhangjb/ChangeLog
branches/branch_zhangjb/operations/frequency/dft-inverse.c
Modified: branches/branch_zhangjb/operations/frequency/dft-inverse.c
==============================================================================
--- branches/branch_zhangjb/operations/frequency/dft-inverse.c (original)
+++ branches/branch_zhangjb/operations/frequency/dft-inverse.c Sun Jun 22 17:16:03 2008
@@ -36,7 +36,7 @@
GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation, "input");
GeglRectangle result = *in_rect;
- result.width -= 2;
+ result.width = 2*(result.width-1);
return result;
}
@@ -47,7 +47,7 @@
GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation, "input");
GeglRectangle result = *in_rect;
- result.width -= 2;
+ result.width = 2*(result.width-1);
return result;
}
@@ -64,9 +64,8 @@
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);
+ gegl_operation_set_format(operation, "input", babl_format("frequency double"));
+ gegl_operation_set_format(operation, "output", babl_format("RGBA double"));
}
static gboolean
@@ -75,7 +74,7 @@
GeglBuffer *output,
const GeglRectangle *result)
{
- gint width = gegl_buffer_get_width(input)-2; /* width always refers to the image's (not buffer's) width. */
+ gint width = 2*(gegl_buffer_get_width(input)-1); /* width always refers to the image's (not buffer's) width. */
gint height = gegl_buffer_get_height(input);
gdouble *src_buf;
gdouble *dst_buf;
@@ -83,23 +82,27 @@
gdouble *tmp_dst_buf;
gint i;
- src_buf = g_new0(gdouble, 4*2*height*FFT_HALF(width));
+ src_buf = g_new0(gdouble, 8*height*FFT_HALF(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("RGBA double"), (gdouble *)src_buf, GEGL_AUTO_ROWSTRIDE);
+ gegl_buffer_get(input, 1.0, NULL, babl_format("frequency double"),
+ (gdouble *)src_buf, GEGL_AUTO_ROWSTRIDE);
for (i=0; i<4; i++)
{
- get_component(src_buf, tmp_src_buf, i, 2*height*FFT_HALF(width));
+ get_freq_component(src_buf, tmp_src_buf, i, 2*height*FFT_HALF(width));
idft((fftw_complex *)tmp_src_buf, tmp_dst_buf, width, height);
- set_component(tmp_dst_buf, dst_buf, i, width*height);
+ set_rgba_component(tmp_dst_buf, dst_buf, i, width*height);
}
- gegl_buffer_set(output,
- NULL, babl_format("RGBA double"), dst_buf, GEGL_AUTO_ROWSTRIDE);
+ gegl_buffer_set(output, NULL, babl_format("RGBA double"), dst_buf,
+ 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]