gegl r2507 - in branches/branch2_zhangjb: . operations/frequency operations/frequency/tools
- From: zhangjb svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2507 - in branches/branch2_zhangjb: . operations/frequency operations/frequency/tools
- Date: Sat, 28 Jun 2008 04:25:41 +0000 (UTC)
Author: zhangjb
Date: Sat Jun 28 04:25:40 2008
New Revision: 2507
URL: http://svn.gnome.org/viewvc/gegl?rev=2507&view=rev
Log:
Now encode/decode works correctly.
* operations/frequency/dft.c: testing encode.
* operations/frequency/idft.c: testing decode.
* operations/frequency/preview-frequency.c: testing decode.
* operations/frequency/tools/fourier.c: now it was correct.
Modified:
branches/branch2_zhangjb/ChangeLog
branches/branch2_zhangjb/operations/frequency/dft.c
branches/branch2_zhangjb/operations/frequency/idft.c
branches/branch2_zhangjb/operations/frequency/preview-frequency.c
branches/branch2_zhangjb/operations/frequency/tools/fourier.c
Modified: branches/branch2_zhangjb/operations/frequency/dft.c
==============================================================================
--- branches/branch2_zhangjb/operations/frequency/dft.c (original)
+++ branches/branch2_zhangjb/operations/frequency/dft.c Sat Jun 28 04:25:40 2008
@@ -94,7 +94,7 @@
dft(tmp_src_buf, (fftw_complex *)tmp_dst_buf, width, height);
set_rgba_component(tmp_dst_buf, dst_buf, i, 2*FFT_HALF(width)*height);
}
-
+ encode(dst_buf, (width+1)%2);
gegl_buffer_set(output, NULL, babl_format ("frequency double"), dst_buf,
GEGL_AUTO_ROWSTRIDE);
Modified: branches/branch2_zhangjb/operations/frequency/idft.c
==============================================================================
--- branches/branch2_zhangjb/operations/frequency/idft.c (original)
+++ branches/branch2_zhangjb/operations/frequency/idft.c Sat Jun 28 04:25:40 2008
@@ -85,6 +85,7 @@
tmp_dst_buf = g_new0(gdouble, width*height);
gegl_buffer_get(input, 1.0, NULL, babl_format("frequency double"), (gdouble *)src_buf, GEGL_AUTO_ROWSTRIDE);
+ decode((gdouble *)src_buf);
for (i=0; i<4; i++)
{
get_rgba_component(src_buf, tmp_src_buf, i, 2*height*FFT_HALF(width));
Modified: branches/branch2_zhangjb/operations/frequency/preview-frequency.c
==============================================================================
--- branches/branch2_zhangjb/operations/frequency/preview-frequency.c (original)
+++ branches/branch2_zhangjb/operations/frequency/preview-frequency.c Sat Jun 28 04:25:40 2008
@@ -27,6 +27,7 @@
#include "gegl-chant.h"
#include "tools/display.c"
+#include "tools/fourier.c"
#include "tools/component.c"
#include <fftw3.h>
@@ -89,6 +90,7 @@
gegl_buffer_get(input, 1.0, NULL, babl_format("frequency double"),
(gdouble *)src_buf, GEGL_AUTO_ROWSTRIDE);
+ decode((gdouble *)src_buf);
for (i=0; i<3; i++)
{
get_rgba_component(src_buf, tmp_src_buf, i, 2*height*FFT_HALF(width));
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 04:25:40 2008
@@ -70,12 +70,13 @@
gboolean encode(gdouble *pixelhandle, gint is_even)
{
- gint int_pixel = (int)(*pixelhandle);
+ glong int_pixel = (glong)(*pixelhandle);
if (is_even != 1 && is_even != 0)
return FALSE;
-
- *pixelhandle -= int_pixel;
+ if (*pixelhandle<0 && *pixelhandle>-1)
+ is_even = 5;
+ *pixelhandle -= int_pixel;
int_pixel = 10 * int_pixel + is_even;
*pixelhandle += int_pixel;
@@ -85,14 +86,18 @@
gint decode(gdouble *pixelhandle)
{
- gint int_pixel = (int)(*pixelhandle);
+ glong int_pixel = (glong)(*pixelhandle);
*pixelhandle -= int_pixel;
- if (int_pixel == 1)
+ if (int_pixel == 5)
+ {
+ return 1;
+ }
+ else if (int_pixel%10 == 1)
{
*pixelhandle += int_pixel/10;
return 1;
}
- elseif (int_pixel == 9)
+ else if (int_pixel%10 == -9)
{
*pixelhandle += int_pixel/10 - 1;
return 1;
@@ -103,4 +108,4 @@
return 0;
}
}
-
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]