[cairo] downscaling capabilities

Frédéric Plourde frederic.plourde at polymtl.ca
Fri Apr 18 11:28:15 PDT 2008


yeah.. cool :-)
  but I sure have some code too..and some other in progress, but I'll be 
glad to work with your ideas and strategies in mind.

I'm pretty sure you're familiar with all this, Jeff, but for the 
community's sake, let me state the current cairo/pixman downscaling 
capabilities :

The current pixman code does bilinear filtering for sure, but without 
any prefiltering step... which leads to the unwanted situation where, 
for instance, if we're downscaling by a scaling factor greater than 2, 
our source image is being sampled with "holes", that is, pixels not 
taken into account in the final result... and we don't want that, as we 
may completely miss small, thin objects from the sampling pixels... 
small objects like text !

See the attached images for a demonstration of that phenomenon. It's 
pretty striking.

That little summary of cairo/pixman downscaling being done,  what I 
intend to do is simply to add that prefiltering step to cairo and/or 
pixman in the "downscaling" case. I'm talking about some low-pass 
filtering (either in pixel or in frequency space) that could be fast 
enough without compromising sampling quality too much. Right now, I do 
not think spacially-adaptative filtering would be necessary, but I may 
take a look in that direction in a short while.  Currently, I'm studying 
the code to find out what's the best filtering strategy... either in 
frequency or pixel space and more importantly, where could be the best 
location in the code for it.

Any hint from "someone-who-knows-cairos-codebase-well" would be 
appreciated, of course...
Best,
-fred-


Jeff Muizelaar a écrit :
> On Fri, Apr 18, 2008 at 10:47:44AM -0400, Frédéric Plourde wrote:
>   
>> Hi everybody !
>>
>> I just wanted to let you guys know that I'll be working for the next few 
>> days on cairo and pixman downscaling quality using bilinear filtering.
>> It's an important issue, since FF3 allows the user to scale a whole page 
>> up or down as he sees fit... and when the page content is maintly text, 
>> the current downcaling algorithm has a hard time displaying the little 
>> details correctly.
>>     
>
> I have some code that does this. It seems to work quite well but needs
> some cleanup and verification that I haven't had the time to do.
>
> What strategy do you plan on taking for doing downscaling?
>
> -Jeff
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 01_sourceImg.png
Type: image/png
Size: 3223 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080418/92ec49a1/attachment-0003.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 02_correct_downscale.png
Type: image/png
Size: 3114 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080418/92ec49a1/attachment-0004.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 03_cairo_downscale.png
Type: image/png
Size: 3038 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080418/92ec49a1/attachment-0005.png 


More information about the cairo mailing list