Re: Proposition : GeglInterpolator

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

 



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.

-- 
Daniel


_______________________________________________
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