Re: Proposition : GeglInterpolator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Rogers wrote:
On Wed, 2006-10-11 at 21:33 +0200, Geert Jordaens wrote:
In order not to rewrite interpolation fnctionality for every operation I would like to propose following API.

GeglInterpolator
 +- GeglInterpolatorLinear
| + GeglInterpolatorCubic | + GeglInterpolatorLanczos

usage :

/* first create the interpolator */
GeglInterpolatorLinear *interpolator = g_object_new (GEGL_TYPE_INTERPLATOR_LINEAR,
                                                     "source", buffer,
"format", babl_format ("RaGaBaA float"),
                                                     NULL);


gegl_interpolator_prepare(interpolator); /* prepares a linear buffer in the format suitable for the interpolation routine. */

gegl_interpolator_get(interpolator, x, y, dst); /* returns a interpolated pixel in dst */

sllooooooooooow.  I've encountered this oh-so-wonderful abstraction
before (JAI uses it, among others). Making a method call in the inner
loop of your pixel calculation routine is a big-nono.  The first
optimization you will make is to remove that.  Typically, the common
case will not use the abstraction, and an operator will be provided that
can accept the general interpolation object, but the operator will be so
slow no one will use it.  It is wonderful when developing your
foundations, to be sure, but it will eventually be ripped out as soon as
someone tries to speed it up.

If you can provide versions that accept arrays as input, then the
general case can be used everywhere.  Actually that can be made a
general rule.  Anything that manipulates pixels much accept arrays as
input (possibly masks as well) or they will be ripped out at the
earliest opportunity.

If i understand it correctly it is the GObject that is causing the slowdown?

I don't see any difference with the pixel_iterator in Gimp.

In your last paragraph, i assume you mean writing a function that can be used on a linear buffer :

interpolate_buffer_linear ( srcbuf, x0, y0,  width, height, x, y, destbuf );
srcbuf = linear source buffer (array)
x0,y0 = integer origin
width, height  = integer size of buffer
x,y = double position to be interpolated.
destbuf = destination pixel.

Then it is up to the operation to make sure the srcbuf/dstbuf is in a suitable format?

_______________________________________________
Gegl-developer mailing list
Gegl-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer

[Index of Archives]     [Yosemite News]     [Yosemite Photos]     [gtk]     [GIMP Users]     [KDE]     [Gimp's Home]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux