10.10. Hitting a (Tiled) Wall


In addition to using the tile cache, the Web pages suggest a better way to increase the performance of get_pixel. By accessing the pixel information directly (without a call to gimp_pixel_rgn_get_pixel), it is possible to dramatically increase the performance of the pixel access.

GIMP can provide a way for the filter programmer to directly access the tiles of an image. The filter can then access the image data as if it were accessing a data array, instead of requiring a call into a GIMP library. However, there is a catch. When you have direct access to the pixel data, it is only for the current tile. GIMP will then iterate over all the tiles in the image, allowing you to ultimately have access to all the pixels in the image, but you cannot access them all simultaneously. It is only possible to look at the pixels from a single tile, and this is incompatible with how lic accesses data. When the lic filter is generating a new pixel at a particular location, it calculates its new value based on the values of the pixels that surround it. Therefore, when generating new pixels on the edge of a tile, the lic filter requires pixel data from all the pixels around it. Unfortunately, these pixels may be on the previous tile or the next tile in the image. Because this pixel information is not available, the image filter will not work with this optimized access method.



Optimizing Linux Performance. A Hands-On Guide to Linux Performance Tools
Optimizing Linux Performance: A Hands-On Guide to Linux Performance Tools
ISBN: 0131486829
EAN: 2147483647
Year: 2004
Pages: 132

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net