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


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: