improving the render performance
For GIMP 2.4 we dramatically improved the quality of the zoomed-out display. Much of this change was based on the introduction of a tile pyramid for the image projection. From a performance point of view this change helped for very large images as it reduces the need to access the image data. But overall it caused GIMP 2.4 to be slightly slower than GIMP 2.2 when it comes to updating the display.
The tile pyramid consists of a series of scaled down copies of the image. On level 0, we have the original projection created by combining all layers. Level 1 is a quarter of the original size, level 2 a quarter of the size of level 1 and so forth. So when the projection changes, in order to recompute one pixel on the upper level, four pixels from the pyramid level below are averaged. To do this correctly, the pixels have to be weighted by their alpha values. And this is where a lot of CPU cycles are burnt.
I have committed some changes to trunk last night that make the tile pyramid store the pixels in the upper levels with pre-multiplied alpha. Now averaging four pixels is as simple as adding their values and shifting the result two bits to the right (thus effectively dividing by four). Of course this means that the display rendering code had to be changed as well. But it turned out that this code also benefits from pre-multiplied alpha. It became simpler and we don’t any longer need the huge lookup tables that we used to use to blend the image pixels over the checkerboard pattern.

The graphics shows the time GIMP needs to recompute the image projection and to render it to the screen. I’ve measured this for a rather large image (10800 x 4856 pixels) and the time went down from 1.83 seconds to 1.45 seconds. This is an improvement that you actually notice as a user.
December 18th, 2007 at 9:28 pm
What was the computation time in Gimp 2.2 (just for reference)?
December 19th, 2007 at 11:03 am
Good question. I didn’t care to find out yet.
Update:
I’ve performed the same operation on GIMP 2.2 and found that it needs 1.72 seconds. So 2.4 is only marginally slower than 2.2 but provides much better display quality. And the code in trunk is a good deal faster, even compared to GIMP 2.2.
December 31st, 2007 at 8:02 am
Thank you for keeping us updated! I love to hear how GIMP is progressing.
February 2nd, 2008 at 12:47 am
Hallo Sven, ich habe eine Idee im Kopf für ein kleines Kunstprojekt und wollte mir mal ansehen, wie Ihr das Arcade programmiert habt. Bin kein Programmierer (…also, habe mit 12 mal in Basic programmiert…), aber vielleicht verstehe ich ja ein bischen was. Leider führt der Link von blinkenlights zu blib-1.1.3.tar.gz ins Leere – hast Du die Files noch irgendwo? Das würde mir helfen.
Besten Dank und Gruß,
David
February 4th, 2008 at 9:50 am
Not sure why you are using my weblog to ask for this, but here are the current links to the Blinkenlights software packages:
http://blinkenlights.de/dist/blib-1.1.7.tar.gz
http://blinkenlights.de/dist/blinkensim-2.7.tar.gz
http://blinkenlights.de/dist/blinkentools-2.9.tar.gz
http://blinkenlights.de/dist/blinkenthemes-0.10.tar.gz
February 6th, 2008 at 1:08 pm
wow!! Gimp faster. I will use it next batch processing.
February 20th, 2008 at 6:20 pm
Danke, dass du Gimp verbesserst! Ich habe gerade die Doku zu GEGL angeschaut … Klingt gut!