[cairo] MIPMAPPING cairo.

Frédéric Plourde frederic.plourde at polymtl.ca
Sun Oct 26 13:30:13 PDT 2008


Here is mipmapping cairo and pixman patches, with some corrected stuff 
reviewed by Jeff !

You'll find two patches :
1- one against CAIRO revision '8ac8e8c523abaa5db24c5303c671ff3487bf0801'
  attached file : CAIRO_MIPMAPPING.patch

2- one against PIXMAN revision 'f5d4e01c399d6d23fd7e4cfaa26e0b07e2279690'
  attached file : PIXMAN_MIPMAPPING.patch

-fred-


Jeff Muizelaar a écrit :
> On Thu, Oct 16, 2008 at 09:19:33AM -0400, Frédéric Plourde wrote:
>   
>>> The other one I would like to try is integer-sized box filtering 
>>> followed by the bilinear filter. The idea is to reuse the XRender 
>>> code, but get better down-scaling. And there would be a slight amount 
>>> of caching for similar scales.
>>>       
>> Ok, let's debate about that and find pros and cons of both box filtering 
>> approaches that were proposed here :
>>
>> 1 - First, if I understand Bill correctly, the first approach would be 
>> to box-filter-downscale at nearest integer level, + bilinear to the 
>> target factor.
>> Example :
>>   let's say we're downscaling a 100 X 100 image by a factor of 0.22 
>> (4.54 X downscale) , you would first generate a scaled image at 
>> downscale factor 0.25 (4X and  "25 X 25" pixels) and cache it.
>>   second, you'd bilinearly downscale that cached image to size 22 X 22, 
>> and since that last scale is under 0.5 factor, the bilinear result is 
>> valid, since there's no "hole" in the bilinear sampling process.
>>
>>
>> 2 - Jeff's idea is more straightforward. It goes directly to target 
>> factor without caching.
>> Example:
>>   starting with that first 100 X 100 image, the first and only step 
>> would be to box-filter-downscale it to 22 X 22.
>>     
>
> Further, if the affine transformation is not rectangular, the 22x22
> image is then sampled bilinearly to the appropriate transformation.
>
>   
>> Pros and cons:
>> ------------------
>> I personally think that the "best" choice is tightly bound to someone's 
>> intended usage of it. For example, here at Mozilla, we've tried the 
>> mipmapping approach for "best" downscaling quality in Firefox3, but it 
>> would take too much memory, and the speed gain was not too satisfying 
>> because the end user would not zoom web pages across multiple zoom 
>> factors so much. So our goal for a new sampling technique in Cairo would 
>> be the "smallest memory needs"... and we would go for Jeff's solution.
>>
>> On the other hand, if such memory requirements were not an issue, one 
>> could definitely choose Bill's solution.
>>
>> I'm pretty sure both solution could get similar final quality... the 
>> question is really about memory usage and performance.
>>     
>
> Resizing directly should have a significant performance advantage
> especially for the common case where the transform is only scaling.
>
> -Jeff
>
>   
>> Because of that specific need from one of cairo's most important users, 
>> I would definitely go for the simplest case : "plain box filtering to 
>> target scale factor",  for now (before Firefox 3.1 release, of course 
>> ;-) and be open to move on with Bill's solution later on.
>>     
>
> I agree.
>
> -Jeff
>   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixman_MIPMAPPING.patch
Type: text/x-patch
Size: 70682 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20081026/7ea53cb6/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo_MIPMAPPING.patch
Type: text/x-patch
Size: 1385 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20081026/7ea53cb6/attachment-0003.bin 


More information about the cairo mailing list