PAD repeat support for fast scaling with nearest filter
authorSiarhei Siamashka <siarhei.siamashka@nokia.com>
Thu, 16 Sep 2010 14:10:40 +0000 (17:10 +0300)
committerSiarhei Siamashka <siarhei.siamashka@nokia.com>
Tue, 21 Sep 2010 10:32:11 +0000 (13:32 +0300)
commit45833d5b198507e9e69b918459eaaf6088e5de00
tree2b9d0d4faf7880c48952a05784d6f4de1d111bb8
parent3db0cc5c75a4a764726059511fa6d67082fbeb64
PAD repeat support for fast scaling with nearest filter

When processing pixels from the left and right padding, the same
scanline function is used with 'unit_x' set to 0.

Actually appears that gcc can handle this quite efficiently. When
using 'restrict' keyword, it is able to optimize the whole operation
performed on left or right padding pixels to a small unrolled loop
(the code is reduced to a simple fill implementation):

    9b30:       89 08                   mov    %ecx,(%rax)
    9b32:       89 48 04                mov    %ecx,0x4(%rax)
    9b35:       48 83 c0 08             add    $0x8,%rax
    9b39:       49 39 c0                cmp    %rax,%r8
    9b3c:       75 f2                   jne    9b30

Without 'restrict' keyword, there is one instruction more: reloading
source pixel data from memory in the beginning of each iteration. That
is slower, but also acceptable.
pixman/pixman-fast-path.c
pixman/pixman-fast-path.h