RSS/Atom feed Twitter
Site is read-only, email is disabled

Use of Static Arrays in Nohalo Level 2

This discussion is connected to the gegl-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

Use of Static Arrays in Nohalo Level 2 Adam Turcotte 01 Jul 22:19
  Use of Static Arrays in Nohalo Level 2 Øyvind Kolås 02 Jul 02:28
Adam Turcotte
2009-07-01 22:19:51 UTC (over 15 years ago)

Use of Static Arrays in Nohalo Level 2

I will be implementing Nohalo Level 2 for GEGL. This basically involves computing double-density pixel data (with a specialized version of Nohalo Level 1 minus the finishing bilinear) and then running a slightly modified version of Nohalo Level 1. The simplest way of implementing this is by having a small "persistent" array or buffer storing double-density pixel data locally so that the required values from Level 1 are not recomputed over and over.

I originally thought that I could simply use GeglBuffers for this purpose, but the GeglBuffer code seems fairly complicated. Instead, I believe that small static arrays could be a better choice. For example, a 64x64 double-density data array can be computed with the buffer data corresponding to a context_rect/fetch_rectangle of size 35x35. When the currently stored static array does not contain the Level 1 data needed to compute the Level 2 value at the current location, it would simply be recomputed, much like they are in gegl_sampler_get_ptr (in gegl-sampler.c).

Does anyone have a more elegant solution? Any objection to the use of static arrays for this purpose?

Adam Turcotte

Øyvind Kolås
2009-07-02 02:28:33 UTC (over 15 years ago)

Use of Static Arrays in Nohalo Level 2

On Wed, Jul 1, 2009 at 9:19 PM, Adam Turcotte wrote:

I will be implementing Nohalo Level 2 for GEGL. This basically involves computing double-density pixel data (with a specialized version of Nohalo Level 1 minus the finishing bilinear) and then running a slightly modified version of Nohalo Level 1. The simplest way of implementing this is by having a small "persistent" array or buffer storing double-density pixel data locally so that the required values from Level 1 are not recomputed over and over.

I originally thought that I could simply use GeglBuffers for this purpose, but the GeglBuffer code seems fairly complicated. Instead, I believe that small static arrays could be a better choice. For example, a 64x64 double-density data array can be computed with the buffer data corresponding to a context_rect/fetch_rectangle of size 35x35. When the currently stored static array does not contain the Level 1 data needed to compute the Level 2 value at the current location, it would simply be recomputed, much like they are in gegl_sampler_get_ptr (in gegl-sampler.c).

It sounds like a reasonable approach it might be better if this buffer is allocated on the heap and allocated/freed by the sampler.

/Øyvind K.