Re: Concerns about using filters for downscaling

Krzysztof Kosiński <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAFLw2WT6G-3TtdADKg9C1JQh1OfXCZwuWRdhyVw9xmODZE__HA@mail.gmail.com>
2014-03-24 22:04 GMT+01:00 Owen Taylor <[email protected]>:
> On Sun, 2014-03-23 at 02:30 +0100, Søren Sandmann wrote:
>> Owen Taylor <[email protected]> writes:
>>
>> > (Søren pointed out on IRC that the pixman implemention of convolution
>> > is not SIMD optimized, so their would be future opportunity to improve
>> > what we can do within the constraints of 5-10x slower.)
>
> I took a stab at implementing a pretty straightforward port of the
> pixman-fast-path.c code to SSE2 - attached. I was able to get roughly
> a 2x speedup:
>
>>    scale    NEAREST BILINEAR   GOOD    BEST
>>    ----     ------  --------  -----   ------
>>      1.1      656     2860    15163   149147
>>      1.5      350     1574     7918   108820
>>      1.9      220      965     7176    89324
>>      2.0       51      873     6397    95665
>>      2.5       34      114     4331    71975
>>      3.0       25      392     4074    67211
>>      3.5       66      290     3101    60168
>>      4.0       15      223     3135    59207
>>      4.5       12       37     2524    58586
>>      5.0       34      143     2643    56798
>
>     scale    NEAREST BILINEAR   GOOD    BEST     MIPMAP
>     -----    ------- --------   ----    ----     ------
>       1.1      478     3073    10267    74341     3022
>       1.5      264     1662     5549    53639     1680
>       1.9      171     1053     3467    50495     1058
>       2.0       60      943     3080    46139      151
>       2.5       40      115     2709    40281      729
>       3.0       29      431     1907    37104      556
>       3.5       55      324     1878    35542      439
>       4.0       19      244     1515    34569      173
>       4.5       16       39     1451    33327      364
>       5.0       30      157     1219    33239      330
>
> I've added another column which is an implementation (in my test
> program) of the technique of creating a temporary power-of-two scaled
> down image and bilinear-filtering from that. As you can see, even
> tossing away the mipmaps, the performance is much better than with
> convolution - even though either way we have to touch all the pixels in
> the source image, it's much easier to write fast, cache friendly
> average-of-four-pixels code, then convolution code.

FWIW, the optimal method for Inkscape would be trilinear interpolation
from a mipmap or a ripmap. This would give the best interactive
transformation performance while maintaining good quality.

Regards, Krzysztof
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.