Archive for the ‘Geekeries’ Category

FOSDEM!

Sunday, January 24th, 2010

As Olivier was saying:

I'm going to FOSDEM!

Hope to see you there!

Vista…

Thursday, November 13th, 2008

Here and now at work, I have to do stuff under windows (obviously, we want elisa to work under windows). On the machine I have at work, that means Vista Home in Spanish (that’s what was installed). To do that stuff, I need some tools, like the excellent bzr, written in python (this detail has its importance).

A while ago, for some reason, I wanted to use bzr-svn on that setup, so I installed it in C:\Program Files\bazaar\plugins. I don’t remember if I managed to make it work or not (did I say it was a while ago?), but I eventually uninstalled it, as well as any dependency that I might have installed for the occasion. Ever since that day, whenever I ran a bzr command, I had the following output preceding the expected output of said command:

No Python bindings for Subversion installed. See the bzr-svn README for details.
Unable to load plugin u'bzr_svn' from u'C:/Program Files/Bazaar/plugins'

Even though I don’t have any bzr_svn plugin in that directory! Yes, I tripled checked!

This had been driving me crazy for months now, and today, by pure chance, I stepped across a directory called C:\Users\guijemont\AppData\Local\VirtualStore that contained a Program Files directory. Having a look at it, I discovered, after months of struggling with that awful and undeserved error message that there was a:

C:\Users\guijemont\AppData\Local\VirtualStore\Program Files\bazaar\plugins\bzr_svn

Yeah, really. And it was full of .pyc files. What happened is that, whenever a user program tries to write somewhere where it shouldn’t (such as Program Files), UAC gives it the impression that it succeeded, and write the stuff in that VirtualStore instead of the real place. That is a convenience that might save the day to some programs that don’t behave and write in places where they shouldn’t.

Enters python. Python writes .pyc files, which are slightly compressed versions of the original .py files (and therefore faster to load). It writes them in the directory where the .py file resides (I guess it makes a lot of things easier to manage).

Then you mix both. Install bzr-svn, use it as a normal user, remove it: it’s not removed! Because the .pyc files are still there, hidden in VirtualStore.

And they say that OS is user-friendly? As I user, I find it friendly that a directory is deleted when I delete it…

New Microsoft product?

Saturday, October 25th, 2008

Having heard of Dell’s new netbook, the mini 9, I wanted to know more about it; here’s what I found on Dell’s French site:


screenshot of dell's website

Opening windows

Friday, May 9th, 2008

To my friends who, for whatever reason, run that popular proprietary operating system from Redmond:

You can now try everyone’s favourite media centre on your machine, and have a glimpse of the cool stuff we do at my company. If you wonder what I do there: I work on the part that makes the display look buggy.

Quite obviously, since it is an alpha version, do expect bugs, and not a final product. If you find any, please be so kind as to report them.

Random vim tips

Friday, May 2nd, 2008

Here are two things I found quite useful recently with vim:

  • GOBgen, which I’ve used intensively while writing the code skeleton of PAF (which is now about complete). It’s not perfect, I always find myself tweaking the content it created, but it’s still a lot faster than doing everything by hand.
  • A small tweak to the quickfix stuff (you know, :make & co). I was annoyed by libtool executions often being interpreted as error output by vim. The problem is that a call to libtool with a -version-info 0:0:0 or something like that is often made by make, when using libtool (at least in the way it is set-up for pigment and PAF). That thing with numbers and columns looks too much like an error or warning from gcc for vim, and each time it is called, it is interpreted as an error that makes vim To tell it to calm down, I’ve created a gcc.vim file ~/.vim/after/compiler/ that contains the following:

    let &errorformat .= ',\%+G-version-info\ %*\\d:'

    This tells vim that anything with “-version-info [number]:” is a general message, and not an error or warning. To ensure this is used, I have the following line in my ~/.vimrc:

    au FileType c compiler gcc

    Note that you could also achieve a similar result by setting the g:compiler_gcc_ignore_unmatched_lines variable, but then you might miss real errors that don’t point to a specific file (like some linking errors) as I understand it.

How much does a g_object_set() cost?

Monday, April 14th, 2008

I was wondering about this issue for PAF. I want to provide facilities to animate GObject properties, but is this something sensible? In the case of an interactive GUI, can we think of updating a hundred properties for each frame?

To answer these questions, I have written some code, that would do as many g_object_set()/g_object_get() as you want, and measure how much CPU time it takes. The code is available as a bzr branch at http://emont.org/property-tests/, look in the gobject directory (I have also written a similar code in python, and in “simple C” with nested structures).

The result of this, on my laptop (a Pentium M 1.86 GHz) is the following:

$ ./gobject/test 1000000
n=1000000
stress_set(): 1.440000
stress_get(): 0.480000
stress_get_set(): 1.940000
$

Here I ask for a million of sets, then a million of gets, then a million of couples get,set (to increment my float property by 0.1 at each iteration).

So, we can say that on my machine, a g_object_set() takes about 1.5 µs. Now, if we want to animate simultaneously a hundred properties, meaning that we want to update them all at each frame, we will spend 150µs just for g_object_set().
Let’s consider we have a 60 Hz screen, that means we have a total time of 16.667 ms, or 16,667 µs, and that in that case, we will spend about 1% of our time updating properties; I want to say that’s something that can be afforded in most cases. On modern embedded device, I guess we can expect the CPU to be up to 5 times slower, so in this case, that would be more like 5% of our time spent on updating GObject properties. That might be more of an issue, especially since CPU usage means energy consumption.

A question that remains open is Could g_object_set() be more efficient?

To be frank, I don’t really know, but I have made a similar test with python:

$ python python/test.py 1000000
n= 1000000
stress_set(): 0.29
stress_get(): 0.14
stress_get_set(): 0.34
$

I would tend to consider that the object system of python provides a similar set of functionality, but here, we’re speaking of 0.3µs (about 5 times faster than GObject), so, yeah, I guess there is room for improvement in g_object_set(), but it is yet to be decided if it is worth it…

Yet, it is a certain thing that the price is cheap enough for animations on the desktop, and for that reason it makes sense to put GObject propertiy animation facilities in PAF, and to add GObject properties to Pigment or Clutter at some point, since it would tend to make the programming (and creation of language bindings) of these things much easier.

PAF update

Monday, April 14th, 2008

Haven’t been too active on PAF lately, but I’m coming back to it. I will try to have a satisfactory API this week, and then continue writing the code skeleton and doc, which I have started a bit (for stuff I don’t think I will change much in the API).

Also, I have put stuff in place to ease the job, and to ease collaboration (yes YOU are invited to participate), more specifically the following:

I am quite happy with most of PafClock and PafAnimation. I think PafImplicitAnimator needs a bit more reflection, and I don’t like that much the name of PafModifier. If you don’t understand what all these objects are, please have a look at the wiki page, get the branch (bzr branch lp:paf) and have a look at misc/paf.xmi (UML file, readable at least with umbrello) and examples/poc.c (examples of how the library could be used).

Future of Pigment

Tuesday, March 11th, 2008

Pigment, (especially Jerakeen) is great stuff. I have been involved in that for about five months now, and I am quite proud of being part of this. For instance, Elisa or my recent screencasts speak for themselves: Pigment rocks!
Yet, Pigment could rock even more; here is why, and how…

The issues

As I said earlier, we are thinking of what Pigment 0.5 should look like. First, here is a list of things that suck in pigment 0.3, and need (heavy) rearchitecturing to be fixed:

  • no real 3D support: we can’t do rotations or efficiently apply a transformation on a group of drawables, we can’t handle lighting, different cameras or camera movement.
  • there is no support (at least not in C) to ease the application of a transformation to a given set of drawables. There is a basic “group” support in pigment-python, but it is slower than it should and limited.
  • writing a rendering plug-in is too complicated. A lot of the stuff that is done in plug-ins could be factorised in the core. This is partly why we only have an OpenGL rendering plug-in in Pigment 0.3
  • there is no programmatic way (there’s only logging) to asynchronously retrieve errors, even though most pigment functions trigger asynchronous events.
  • the animation system (which is done in python, but that is not an architectural issue, we could do it in C) is not synchronised with the rendering.
  • it is impossible to build pigment without GStreamer because we use GstObjects everywhere.

(more…)

Paf! Animation Framework!

Monday, March 10th, 2008

As mentioned earlier, these days, I’ve been thinking about animation issues. It seems the free world lacks an animation library that abstracts out the complexities of animations. A lot of libraries implement their own animation routines, which are generally incomplete and often unusable in other contexts than these libraries. I feel that we need (and I am ready to work on developing) a library that implements a good animation framework, and would provide the following functionalities:

  • a timeline, similar to what is implemented in QTimeline or GtkTimeline
  • an animation object, that handles the evolution of the animated variables from an evolution function, that could be constructed using…
  • an interpolator, that could interpolate in different modes (linear, bezier splines, cubic hermite splines, …) between key values/times/speeds/accelerations.

(more…)

Some pigment bling

Monday, March 10th, 2008

Some of you may have been to FOSDEM this year, where Loic did a great talk on pigment, or so I have been told. I wasn’t there, but, to continue what Kaleo started, I have done these two screencasts.

Interactive Animation

This demonstration shows the ability of pigment to load images and place them in a 3D space. It shows a bit of what the animation system can do as well. This is done in about 150 lines of python code.

Click on the image to see the screencast

You can find the source code for that in Kaleo’s bzr branch: http://boucault.iiens.net/pigment_experiments/. It’s the same program (volume.py) than the last screencast in Kaleo’s blog post.

Effects

This one shows the ability of pigment to integrate with a graphical toolkit (here Gtk+). It also shows various effects that pigment can apply on images or videos (a 1080p HD video in this case) without any CPU cost, everything being done in the GPU. This is done in about 350 lines of python code, including 135 lines to construct the Gtk+ interface. Sorry, I didn’t have a decent webcam at hand, so I couldn’t reproduce what Loic did at his talk.

Hooray, fisheye effect on a fish! Click on the image to see the screencast

This is done with a branch of pigment not merged with trunk yet, you can find it on a branch of our subversion repository:

https://code.fluendo.com/pigment/svn/branches/pigment-effects

The example screencasted here is colormatrix.py, in pigment-python/examples on the branch