I think that the user should see something about the selected picture in less than 0.1 seconds, regardless of the size of the image.
In order to achieve this I’m thinking about three levels for each image:
– low: a 128×128 image
– medium: a 640×480 image
– screen: a image with the same size of the screen (or less).
The 128×128 image could be a thumbnail if present or a newly opened picture.
All the three levels shall be loaded via a fast downscaling algorithm, such as djpeg.
I’m working on integrating it.
To my needs, the standard djpeg has two drawbacks.
1) If I am not wrong, during the image loading djpeg allocates memory enough for the full image (hence not optimal)
2) 1/8 is the maximum downscaling. 1/16, 1/32, 1/64,… and so on could be easily achieved by simply picking up one 8×8 matrix every respectively 2, 4, 8 matrixes, both for x and y axis.
Addressing these two issues requires minor modifications to libjpeg, so I’ll have to provide my own jpeg loader with Luce.
Another thing for speeding up things is multithreading. There shall be threads for loading all the levels of an image, threads for loading low levels for all the images of the directory, and so on.
A lot of threads; hence, given a maximum number of concurrent threads, the need of a thread serializer for pausing some minor priority threads.
Any suggestion or comment is appreciated!