Re: Scanline processing in a GeglOperation

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

 



On Mon, Apr 21, 2008 at 7:51 PM, Hans Petter Jansson <hpj@xxxxxxxxxxx> wrote:
> On Mon, 2008-04-21 at 16:43 +0100, Øyvind Kolås wrote:
>  > On Mon, Apr 21, 2008 at 11:18 AM, Øyvind Kolås <pippin@xxxxxxxx> wrote:
>
>  > >  Thus to correctly implement floyd steinberg you would actually have to
>  > >  request the processing of the entire image and not piece by piece thus
>  > >  losing the ability to handle larger than RAM images.
>
>  > This isn't entirely true as you can fetch and store individual
>  > scanlines when reading/writing from the involved GeglBuffers as the op
>  > is processing for the entire image, nevertheless such an op would need
>  > the entire image as source data to update the bottomrightmost pixel.
>  > And it would make future scheduling and paralellization of graphs
>  > involving such ops much harder than needed.
>
>  Yeah, that's what I thought. But insofar as my implementation is
>  concerned, I don't care about speed, as long as it can be done.

You need to do the following:

static GeglRectangle
get_required_for_output (GeglOperation        *operation,
                         const gchar         *input_pad,
                         const GeglRectangle *roi)
{
  /* request that we have the entire bounding box to operate on */
  return *gegl_operation_source_get_bounding_box (operation, "input");
}

static GeglRectangle
get_cached_region (GeglOperation       *operation,
                   const GeglRectangle *roi)
{
  /* request that all of the op should be cached for this request */
  return *gegl_operation_source_get_bounding_box (operation, "input");
}

As well as setting the corresponding methods on the
GeglOperationClass, see other operations for examples.

At this stage:

The input and output regions requested for processing
should be the same and you can start reading/writing linear
rectangular subregions to the input buffer as well as writing results
to the output buffer. You could at this stage choose to do the entire
buffer in one chunk, this is where an intelligent implementation
allows to still work on larger than RAM images, while a stupid one
needs the entire memory temporarily in memory as a linear buffer.

>  So I guess the question is: How do I request processing of the entire
>  image, on a row by row basis?

If you look at the stretch contrast operation it is operating on a
line by line basis when it is doing the actual stretching (it is slow
though and allocates a huge linear buffer for the min/max detection
instead of doing it in chunks).

/Øyvind K.
-- 
«The future is already here. It's just not very evenly distributed»
 -- William Gibson
http://pippin.gimp.org/ http://ffii.org/
_______________________________________________
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