Load and unload are both a job

April 8, 2011

“Fà e desfà l’è töt un laurà”
“Do and undo are both a job”
(A proverb from Brescia, Italy)

In order not to load all the images of a directory and hence saturate RAM, only the surrounding images of the current one are loaded. This has been implemented in r74, obtainable via Bazaar (see “Get it” page for details).

So while you step to the next images, luce loads one image which is ten images forward and unloads an image which is eleven images backward. Well, kind of.

This makes luce baaarely usable, and still very fast.


Just like a pipeline

March 24, 2011

(kind of).
Let’s give a look inside the luce engine.
Luce heavily uses multithreading. Its aim is to parallelize every single step that can get some advantage from this.

So while a picture is being loaded, the corresponding texture for the previuos picture is created. Also, every image can be processed as soon as it is loaded. The loading thread goes in the background and gives data to the next step of luce’s pipeline.

We have dual-, quad-, core microprocessors but this functionality is not fully used by our softwares. Luce already hits about 25% (two threads on average on my 8-threads CPU) during the first phase, when most of the images are processed, but I plan to go further.


Luce v.0.0.3 is out

March 21, 2011

Luce v.0.0.3 is out!

This is the first version using massively multithreading in order to improve performance.
Tons of bugfixes too, details here.

You can get it here (direct link to tarball here)


Setting up threads

March 19, 2011

I’m getting a little more comfortable about threads. The loader is not yet implemented but now it is run in the background. Mutexes make everything work.

I see some glitches and a lot of memory leaks, I have to work on them now.


The background loader algorithm

March 10, 2011

Here’s a prototype of the background loader algorithm:

int N = number of image;
int cur = pointer to current image;
bool going_forward = current direction
int max_memory = maximum memory for luce
int cur_memory = current used memory
bool async_load = do async/sync load

flag_loadable_neighbours(cur_memory, max_memory);
next=cur;
prev=cur;
for(i=0;i<N/2;i++)
{
async_load=!i;
if(!ThumbIsLoaded(next) && ThumbIsLoadable(next) && !ThumbIsLoading(next))
LoadThumb(next,async_load);
if(!ScreenIsLoaded(next) && ScreenIsLoadable(next) && !ScreenIsLoading(next))
LoadScreen(next,async_load);
if(!ThumbIsLoaded(prev) && ThumbIsLoadable(prev) && !ThumbIsLoading(prev))
LoadThumb(next,async_load);
if(NeedToBreak())
break; //usually triggered by a keypress
if(going_forward())
next=cur->next; prev=cur->prev;
else
next=cur->prev; prev=cur->next;
}


Luce 0.0.2 is out

March 8, 2011

Release 39 is Luce 0.0.2 and it is avalaible here:
https://launchpad.net/luce/trunk/0.0.2
Changes from release 37
Enhanced support for fullscreen;
avoided upscaling of small pics.


60 fps

March 8, 2011

Release 37 now works for all resolutions and it is limited at 60 fps; I suppose this limit is given by the keyboard typematic rate. This is a quite good result!

I have introduced a barely working full screen functionality (use the f key).

TODO list:
V move down text in full screen mode
V do not upscale small pictures
V resize function
V package 0.0.2
- start background loading of images instead of preloading
- enhance jpeg loader


A preview

March 3, 2011

This is a demo of a preliminary version of luce. The caching of the images makes everything quite fast.


Some improvements

March 2, 2011

On a testbed of 100 800×600 jpeg’s, the current bazaar version of luce behaves quite well.
Yes, the jpeg’s are very small, but at the moment the speed looks limited only by the typematic speed rate of the keyboard (about 20 images per second.)

This is achieved in a simple manner: I preload to memory all the 100 images. I’m writing an algorithm that manages the memory consumption and that uses multithreading to preload neighbourhood’s images.

I tried to realize a video with istanbul and recordmydesktop but the output framerate is too low. I have to use an external camera.


A change on focus

February 21, 2011

I’m trying to revive my project. It doesn’t make sense to do a full blown viewer. There are lot of them.

My focus will remain on speed; if I will be able to develop it, luce will be a proof of concept. A stimulus, a set of suggestions for developers in order to make their viewer faster.

In the while, I’ll learn something about open source development. I’m learning eclipse and Autotools.

I’ll keep you informed.


Follow

Get every new post delivered to your Inbox.