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

gimp_pixel_rgns_register

This discussion is connected to the gimp-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.

4 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

gimp_pixel_rgns_register Luis A. Florit 16 Mar 18:25
gimp_pixel_rgns_register William Skaggs 16 Mar 18:39
  gimp_pixel_rgns_register Sven Neumann 16 Mar 19:21
mailman.3.1174071603.29621.... 07 Oct 20:25
  gimp_pixel_rgns_register Luis A. Florit 17 Mar 01:13
Luis A. Florit
2007-03-16 18:25:55 UTC (about 17 years ago)

gimp_pixel_rgns_register

Pals,

As you noticed, this is my first plugin and I have many silly questions... Sorry for bothering you with these.

What my plugin does is an iterpolation to get rid of noise by means of a classical local analysis of a square neighborhood or radius r of each pixel to change it (if necessary) after the analysis.

My plugin is working fine, using the 'gimp_pixel_rgn_set_row' procedure and the shuffle raw function contained in

http://developer.gimp.org/writing-a-plug-in/3/myblur5.c

I am already using this in big images (5MB or more).

However, I saw that what is vastly used for plugins is 'gimp_pixel_rgns_register' with ONE iterator like:

for (pr = gimp_pixel_rgns_register (1, &dest_rgn); pr != NULL; pr = gimp_pixel_rgns_process (pr)) {
....
}

or even TWO iterators like:

for ( pr = gimp_pixel_rgns_register (2, &dest_rgn, &src_rgn); pr != NULL; pr = gimp_pixel_rgns_process (pr)) {
......
}

I don't really understand what these for loop do, except that it somehow loops between the tiles.

My questions: When to use one and when two iterators? Which one should I use for a procedure like the one described in my plugin? Is this indeed faster than the method I implemented based in myblur5.c?

Thanks a lot,

Luis.

William Skaggs
2007-03-16 18:39:52 UTC (about 17 years ago)

gimp_pixel_rgns_register

From: "Luis A. Florit"

[ . . . ]
My questions: When to use one and when two iterators? Which one should I use for a procedure like the one described in my plugin? Is this indeed faster than the method I implemented based in myblur5.c?

You probably shouldn't do this at all. The gimp_pixel_rgns_process method handles the data tile by tile, which means that it is impossible, or at least quite difficult, to handle interactions that extend across multiple tiles. It is mainly useful -- and very efficient -- for plugins that act on individual pixels. Your plugin, because it needs to look at neighborhoods, does not fall into that category.

-- Bill


______________ ______________ ______________ ______________ Sent via the CNPRC Email system at primate.ucdavis.edu

Sven Neumann
2007-03-16 19:21:23 UTC (about 17 years ago)

gimp_pixel_rgns_register

Hi,

On Fri, 2007-03-16 at 10:39 -0700, William Skaggs wrote:

You probably shouldn't do this at all. The gimp_pixel_rgns_process method handles the data tile by tile, which means that it is impossible, or at least quite difficult, to handle interactions that extend across multiple tiles. It is mainly useful -- and very efficient -- for plugins that act on individual pixels. Your plugin, because it needs to look at neighborhoods, does not fall into that category.

Correct. It would be worth nothing though that a plug-in that processes the data row-by-row should make a call to gimp_tile_cache_ntiles() to make sure that tiles can be cached on the plug-in side. With a tile cache that is large enough to hold two rows of tiles, using gimp_pixel_rgn_get_row() and set_row() shouldn't make much a of a difference performance-wise.

Sven

Luis A. Florit
2007-03-17 01:13:18 UTC (about 17 years ago)

gimp_pixel_rgns_register

Sven and Bill,

I see. My plugin is already reasonably fast, so is good to know I don't need huge changes.

Thanks a lot for your prompt answer!! Nice forum!

Cheers,

Luis.