gegl r2513 - in branches/branch2_zhangjb: . operations/frequency
- From: zhangjb svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2513 - in branches/branch2_zhangjb: . operations/frequency
- Date: Mon, 30 Jun 2008 04:27:53 +0000 (UTC)
Author: zhangjb
Date: Mon Jun 30 04:27:53 2008
New Revision: 2513
URL: http://svn.gnome.org/viewvc/gegl?rev=2513&view=rev
Log:
* operations/frequency/freq-general-filter.c: added the property flag to
decide which componet need to process.
Modified:
branches/branch2_zhangjb/ChangeLog
branches/branch2_zhangjb/operations/frequency/freq-general-filter.c
Modified: branches/branch2_zhangjb/operations/frequency/freq-general-filter.c
==============================================================================
--- branches/branch2_zhangjb/operations/frequency/freq-general-filter.c (original)
+++ branches/branch2_zhangjb/operations/frequency/freq-general-filter.c Mon Jun 30 04:27:53 2008
@@ -19,6 +19,9 @@
#ifdef GEGL_CHANT_PROPERTIES
gegl_chant_pointer(Hbuf, "Matrix", "The transfer function matrix.")
+gegl_chant_int(flag, "Flag", 0, 15, 14,
+ "Decide which componet need to process. Example: if flag=14, "
+ "14==0b1110, so we filter on componets RGB, do not filter on A.")
#else
@@ -72,23 +75,28 @@
gdouble *comp_real;
gdouble *comp_imag;
gdouble *H_buf = o->Hbuf;
+ gint flag = o->flag;
+ gint i;
src_buf = g_new0(gdouble, 8*width*height);
- dst_buf = g_new0(gdouble, 8*width*height);
- gegl_buffer_get(input, 1.0, NULL, babl_format ("frequency double"), src_buf,
- GEGL_AUTO_ROWSTRIDE);
-
+ dst_buf = g_new0(gdouble, 8*width*height);
comp_real = g_new0(gdouble, FFT_HALF(width)*height);
- comp_imag = g_new0(gdouble, FFT_HALF(width)*height);
-
- get_freq_component(src_buf, comp_real, 0, FFT_HALF(width)*height);
- get_freq_component(src_buf, comp_imag, 4, FFT_HALF(width)*height);
-
- freq_multiply(comp_real, comp_imag, H_buf, width, height);
-
- set_freq_component(comp_real, dst_buf, 0, FFT_HALF(width)*height);
- set_freq_component(comp_imag, dst_buf, 4, FFT_HALF(width)*height);
-
+ comp_imag = g_new0(gdouble, FFT_HALF(width)*height);
+ gegl_buffer_get(input, 1.0, NULL, babl_format ("frequency double"), src_buf,
+ GEGL_AUTO_ROWSTRIDE);
+ for (i=0; i<4; i++)
+ {
+ get_freq_component(src_buf, comp_real, i, FFT_HALF(width)*height);
+ get_freq_component(src_buf, comp_imag, 4+i, FFT_HALF(width)*height);
+
+ if ((8>>i)&flag)
+ {
+ freq_multiply(comp_real, comp_imag, H_buf, width, height);
+ }
+
+ set_freq_component(comp_real, dst_buf, i, FFT_HALF(width)*height);
+ set_freq_component(comp_imag, dst_buf, 4+i, FFT_HALF(width)*height);
+ }
gegl_buffer_set(output, NULL, babl_format ("frequency double"), dst_buf,
GEGL_AUTO_ROWSTRIDE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]