app: use adaptive chunk size when rendering projections
In GimpProjection, use an adaptive chunk size when rendering the projection asynchronously, rather than using a fixed chunk size. The chunk size is determined according to the number of pixels processed during the last frame, and the time it took to process them, aiming for some target frame-rate (currently, 15 FPS). In other words, the chunks become bigger when processing is fast, and smaller when processing is slow. We're currently aiming for generally-square chunks, whose sides are powers of 2, within a predefined range. Note that the chunk size represents a trade off between throughput and responsiveness: bigger chunks result in better throughput, since each individual chunk incurs an overhead, in particular when rendering area filters or multithreaded ops, while smaller chunks result in better responsiveness, since the time each chunk individual takes to render is smaller, allowing us to more accurately meet the target frame rate. With this commit, we aim to find a good compromise dynamically, rather than statically. The use of adaptive chunk sizes can be disabled by defining the environment variable GIMP_NO_ADAPTIVE_CHUNK_SIZE, in which case we use a fixed chunk size, as before.
Showing with 180 additions and 12 deletions