[cairo] downscaling capabilities

Frédéric Plourde frederic.plourde at polymtl.ca
Mon May 5 20:43:16 PDT 2008


Here it is, at last !

   A patch for enabling better-than-bilinear sampling methods in pixman

There are 4 new pixman filtering modes:

- PIXMAN_FILTER_LINEAR_MIPMAP_NEAREST
- PIXMAN_FILTER_NEAREST_MIPMAP_LINEAR
- PIXMAN_FILTER_TRILINEAR
- PIXMAN_FILTER_LINEAR_MIPMAP_LINEAR

the two last mode do the exact same thing. I chose to use the openGL 
terms for clarity.
I also created another perf test, called "resample.c", but it's not 
included in the patch, since  I need to clean it a little before sending it.

I'd like the concerned developpers to test the code ... look at the 
results and tell me what you think. 

Since I'm relatively new to cairo and pixman, the hardest part for me 
was the code integration inside pixman structures.
I made many design choices and I'd like to discuss them with you ;-) 
There are still some "FIXME" in the code to grasp the reader's 
attention.. and mine ;-)

Performance-wise, nothing's optimized yet... That's going to be my next 
step, but I would really appreciate you inputs.
I think the perf results aren't too bad. Of course, when you consider 
performance on ONE resample only, the "mipmap pyramid generation step" 
takes up the biggest part of the execution time, but since the mipmap 
pyramid is generated only once during surface creation, you make 
considerable perf gains as you scale the same image 2, 4, 8...32 times !

I've also attached another image, called "perf_graph.jpg" showing the 
slowdown VS number of resamplings for the same image (using the same 
mipmap). A simple regression on that curve shows that performance tends 
to 1.2X slowdown.
I'm sure that theses figures can use a great deal of optimization... 
more news coming up :-)

Best,
-fred-

-------------- next part --------------
A non-text attachment was scrubbed...
Name: perf_graph.jpg
Type: image/jpeg
Size: 38604 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080505/db1bcbb9/attachment-0001.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixman_enhanced_sampling_methods.patch
Type: text/x-patch
Size: 61417 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080505/db1bcbb9/attachment-0001.bin 


More information about the cairo mailing list