[gegl/samplers-api-rework: 2/3] add test implementation of jacobian inverse
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/samplers-api-rework: 2/3] add test implementation of jacobian inverse
- Date: Sat, 2 Jul 2011 03:02:50 +0000 (UTC)
commit 4e3331cf7b0b258650d0381b8ce03f0216253dae
Author: Ãyvind KolÃs <pippin gimp org>
Date: Fri Jul 1 03:03:28 2011 +0100
add test implementation of jacobian inverse
gegl/buffer/gegl-buffer-access.c | 30 +++++++++++++++++++++---------
gegl/buffer/gegl-buffer.h | 17 +++++++++++++----
gegl/buffer/gegl-sampler.c | 6 ++++++
gegl/buffer/gegl-sampler.h | 4 ++++
gegl/gegl.h | 1 +
operations/workshop/plasma.c | 4 ++--
6 files changed, 47 insertions(+), 15 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 50b301e..3614a86 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -1066,13 +1066,13 @@ gegl_buffer_get_abyss (GeglBuffer *buffer)
}
void
-gegl_buffer_sample (GeglBuffer *buffer,
- gdouble x,
- gdouble y,
- gdouble scale,
- gpointer dest,
- const Babl *format,
- GeglInterpolation interpolation)
+gegl_buffer_sample2 (GeglBuffer *buffer,
+ gdouble x,
+ gdouble y,
+ GeglMatrix2 *inverse_jacobian,
+ gpointer dest,
+ const Babl *format,
+ GeglInterpolation interpolation)
{
GType desired_type;
g_return_if_fail (GEGL_IS_BUFFER (buffer));
@@ -1105,9 +1105,22 @@ gegl_buffer_sample (GeglBuffer *buffer,
buffer->sampler_format = format;
gegl_sampler_prepare (buffer->sampler);
}
+ if (inverse_jacobian)
+ gegl_sampler_set_inverse_jacobian (buffer->sampler, inverse_jacobian);
+
gegl_sampler_get (buffer->sampler, x, y, dest);
+}
- /* if (scale < 1.0) do decimation, possibly using pyramid instead */
+void
+gegl_buffer_sample (GeglBuffer *buffer,
+ gdouble x,
+ gdouble y,
+ gdouble scale,
+ gpointer dest,
+ const Babl *format,
+ GeglInterpolation interpolation)
+{
+ gegl_buffer_sample2 (buffer, x, y, NULL, dest, format, interpolation);
}
void
@@ -1122,7 +1135,6 @@ gegl_buffer_sample_cleanup (GeglBuffer *buffer)
}
}
-
void
gegl_buffer_copy (GeglBuffer *src,
const GeglRectangle *src_rect,
diff --git a/gegl/buffer/gegl-buffer.h b/gegl/buffer/gegl-buffer.h
index f303f52..469189f 100644
--- a/gegl/buffer/gegl-buffer.h
+++ b/gegl/buffer/gegl-buffer.h
@@ -21,6 +21,7 @@
#include <glib-object.h>
#include <babl/babl.h>
+#include <gegl/gegl-matrix.h>
G_BEGIN_DECLS
@@ -315,6 +316,7 @@ typedef enum {
GEGL_INTERPOLATION_LOHALO
} GeglInterpolation;
+
/**
* gegl_buffer_sample:
* @buffer: the GeglBuffer to sample from
@@ -323,11 +325,10 @@ typedef enum {
* @scale: the scale we're fetching at (<1.0 can lead to decimation)
* @dest: buffer capable of storing one pixel in @format.
* @format: the format to store the sampled color in.
- * @interpolation: the interpolation behavior to use, currently only nearest
- * neighbour is implemented for this API, bilinear, bicubic and lanczos needs
+ * @interpolation: the interpolation behavior to use,
* to be ported from working code. Valid values: GEGL_INTERPOLATION_NEAREST and
- * GEGL_INTERPOLATION_LINEAR, GEGL_INTERPOLATION_CUBIC and
- * GEGL_INTERPOLATION_LANCZOS.
+ * GEGL_INTERPOLATION_LINEAR, GEGL_INTERPOLATION_CUBIC,
+ * GEGL_INTERPOLATION_LANCZOS and GEGL_INTERPOLATION_LOHALO
*
* Query interpolate pixel values at a given coordinate using a specified form
* of interpolation. The samplers used cache for a small neighbourhood of the
@@ -340,6 +341,14 @@ void gegl_buffer_sample (GeglBuffer *buffer,
gpointer dest,
const Babl *format,
GeglInterpolation interpolation);
+void
+gegl_buffer_sample2 (GeglBuffer *buffer,
+ gdouble x,
+ gdouble y,
+ GeglMatrix2 *inverse_jacobian,
+ gpointer dest,
+ const Babl *format,
+ GeglInterpolation interpolation);
/**
diff --git a/gegl/buffer/gegl-sampler.c b/gegl/buffer/gegl-sampler.c
index 24a1de9..9d45e49 100644
--- a/gegl/buffer/gegl-sampler.c
+++ b/gegl/buffer/gegl-sampler.c
@@ -590,3 +590,9 @@ gegl_sampler_type_from_interpolation (GeglInterpolation interpolation)
return GEGL_TYPE_SAMPLER_LINEAR;
}
}
+
+void gegl_sampler_set_inverse_jacobian (GeglSampler *self,
+ GeglMatrix2 *inverse_jacobian)
+{
+ self->inverse_jacobian = inverse_jacobian;
+}
diff --git a/gegl/buffer/gegl-sampler.h b/gegl/buffer/gegl-sampler.h
index 8b2b69c..0568e6a 100644
--- a/gegl/buffer/gegl-sampler.h
+++ b/gegl/buffer/gegl-sampler.h
@@ -77,6 +77,10 @@ void gegl_sampler_get (GeglSampler *self,
gdouble x,
gdouble y,
void *output);
+
+void gegl_sampler_set_inverse_jacobian (GeglSampler *self,
+ GeglMatrix2 *inverse_jacobian);
+
gfloat * gegl_sampler_get_from_buffer (GeglSampler *sampler,
gint x,
gint y);
diff --git a/gegl/gegl.h b/gegl/gegl.h
index ebea328..99358b3 100644
--- a/gegl/gegl.h
+++ b/gegl/gegl.h
@@ -28,6 +28,7 @@
#include <gegl-color.h>
#include <gegl-curve.h>
#include <gegl-path.h>
+#include <gegl-matrix.h>
#include <gegl-version.h>
diff --git a/operations/workshop/plasma.c b/operations/workshop/plasma.c
index 13eb7cb..298cab1 100644
--- a/operations/workshop/plasma.c
+++ b/operations/workshop/plasma.c
@@ -181,7 +181,7 @@ do_plasma_big (PlasmaContext *context,
xm = (x1 + x2) / 2;
ym = (y1 + y2) / 2;
- if (depth == -1)
+// if (depth == -1)
{
random_rgba (context->gr, tl);
put_pixel (context, tl, x1, y1);
@@ -213,7 +213,7 @@ do_plasma_big (PlasmaContext *context,
return FALSE;
}
- if (!depth)
+ //if (!depth)
{
if (x1 == x2 && y1 == y2)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]