gegl r2506 - in branches/branch2_zhangjb: . operations/frequency/tools
- From: zhangjb svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2506 - in branches/branch2_zhangjb: . operations/frequency/tools
- Date: Sat, 28 Jun 2008 02:47:21 +0000 (UTC)
Author: zhangjb
Date: Sat Jun 28 02:47:21 2008
New Revision: 2506
URL: http://svn.gnome.org/viewvc/gegl?rev=2506&view=rev
Log:
Added encode/decode functions in order to support odd-size image.
* operations/frequency/tools/display.c: a small modify.
* operations/frequency/tools/fourier.c: added encode/decode functions.
Modified:
branches/branch2_zhangjb/ChangeLog
branches/branch2_zhangjb/operations/frequency/tools/display.c
branches/branch2_zhangjb/operations/frequency/tools/fourier.c
Modified: branches/branch2_zhangjb/operations/frequency/tools/display.c
==============================================================================
--- branches/branch2_zhangjb/operations/frequency/tools/display.c (original)
+++ branches/branch2_zhangjb/operations/frequency/tools/display.c Sat Jun 28 02:47:21 2008
@@ -103,10 +103,7 @@
for (i=0; i<samples; i++)
{
- if (*(buf+i)<1)
- *(buf+i) = 0;
- else
- *(buf+i) = log(*(buf+i));
+ *(buf+i) = log(*(buf+i)+1);
}
get_min_max(buf, &min, &max, samples);
for (i=0; i<samples; i++)
Modified: branches/branch2_zhangjb/operations/frequency/tools/fourier.c
==============================================================================
--- branches/branch2_zhangjb/operations/frequency/tools/fourier.c (original)
+++ branches/branch2_zhangjb/operations/frequency/tools/fourier.c Sat Jun 28 02:47:21 2008
@@ -27,6 +27,8 @@
gboolean dft(gdouble *src_buf, fftw_complex *dst_buf_pointer, gint width, gint height);
gboolean idft(fftw_complex *src_buf, gdouble *dst_buf, gint width, gint height);
+gboolean encode(gdouble *, gint);
+gint decode(gdouble *);
gboolean
dft(gdouble *src_buf, fftw_complex *dst_buf, gint width, gint height)
@@ -65,3 +67,40 @@
fftw_destroy_plan(fftplan);
return TRUE;
}
+
+gboolean encode(gdouble *pixelhandle, gint is_even)
+{
+ gint int_pixel = (int)(*pixelhandle);
+
+ if (is_even != 1 && is_even != 0)
+ return FALSE;
+
+ *pixelhandle -= int_pixel;
+ int_pixel = 10 * int_pixel + is_even;
+ *pixelhandle += int_pixel;
+
+ return TRUE;
+}
+
+
+gint decode(gdouble *pixelhandle)
+{
+ gint int_pixel = (int)(*pixelhandle);
+ *pixelhandle -= int_pixel;
+ if (int_pixel == 1)
+ {
+ *pixelhandle += int_pixel/10;
+ return 1;
+ }
+ elseif (int_pixel == 9)
+ {
+ *pixelhandle += int_pixel/10 - 1;
+ return 1;
+ }
+ else
+ {
+ *pixelhandle += int_pixel/10;
+ return 0;
+ }
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]