[cairo] Compositing benchmarks

Jeff Muizelaar jeff at infidigm.net
Mon Mar 5 09:03:13 PST 2007


On Mon, Mar 05, 2007 at 05:39:37AM +0000, jose_ogp at juno.com wrote:
> 
> > In my investigation into 'fixing' libpixman cairo's software
> > compositing code, I built a benchmarking suite for different
> > software and hardware compositing libraries.
> > 
> > In theory, it supports the following backend:
> > - cairo
> > - pixman (directly)
> > - cairo-glitz
> > - cairo-xlib
> > - glitz
> > - liboil
> > - evas_core (compositing routines from enlightenment)
> > - intel performance primitives
> > 
> > ....
> > ....
> 
> 	Interesting. I can tell you that evas' blending routines
> use an approximation to the 'ideal' blending equation, which cairo
> chooses to follows more exactly.. hence likely the speed difference
> between these two. If liboil has something closer to cairo's, then
> that would be a great improvement indeed. If not, well, cairo already
> has a choice of filtering 'quality', so perhaps it could offer a
> choice of compositing 'quality' - especially if the speed gains are
> large and the 'quality loss' is small.

I had a look at the routine (_op_blend_p_dp_mmx) in evas and it looks it
is doing: a*b/256. Is this correct? The routine used in liboil
(composite_over_argb_sse2_3) appears to be using the exact and
traditional blin95 formula: (a*b+128)*(257/65536), however, I could be
misreading the code. Cairo also uses the blin95 formula.

> 
> 	It's curious to see how different sets of criteria lead to
> various choices in design and implementation.
> 	In evas for example, one wants to balance sometimes competing
> needs such as speed, low memory use, and good visual quality. This
> last is important, though somewhat vague.
> 	I once did a very unscientific test where I had several
> people look at the result of blending several images using various
> approximations to an ideal definition of 'over' blending. I asked
> them to tell me if they could see any differences.. No one could.

That doesn't surprise me. The formula used by evas is off by at most 2
which would be pretty difficult to percieve.  I guess the biggest
problem with that formula would be accumulated error, especially because
that formula always aproximates under the true value. Still, the idea of
controlable compositing quality is an interesting one, provided the
performance benefits are large enough to justify it.

> 
> 	Surely this is a foolish way to develop visual criteria,
> but it was interesting enough that I've performed a few other
> similar tests on such "typical viewers".
> 	Recently, I had several scaling algorithms I wanted to test,
> including cairo's (among others), and again asked if they could see
> any difference.
> 	This time, however, there was a rather different reaction
> from my test subjects. As I varied the x,y scaling factors below
> 1/2,1/2 and further, all of the methods that did not sample the
> src image in full - and this includes cairo - were eventually
> reported as giving results that were: "not clear", "blurry",
> "uneven", "missing things", and other similar such remarks.
> 
> 	It's curious to me that cairo puts so much emphasis on
> the 'accuracy' of compositing calculations - variations of which
> people are unable to discern - and yet seems to put much less
> emphasis on the 'accuracy' of scaling results - variations of
> which people note as giving considerable differences.
> 	Obviously there's a reason for this seeming disparity
> -- possibly it's the desire to have a single unified method for
> dealing with transforms... But I would say that this is an area
> that could use more looking into.

The scaling code that cairo currently uses is known to be bad and is not
really representive of the goals of cairo. It needs replacing, but no
one has actually done the work yet. I'd be very interested in knowing
more about the different scaling algorithms that you tested and what
your conclusions were.

-Jeff


More information about the cairo mailing list