[Pixman] [PATCH 4/8] Better support for NONE repeat in nearest scaling main loop template
Siarhei Siamashka
siarhei.siamashka at gmail.com
Thu Feb 10 16:32:14 PST 2011
On Thursday 10 February 2011 21:08:33 Bill Spitzak wrote:
> It sounds to me like you are proposing that a binary zero-or-source
> decision be made for each pixel in the output space. I don't think this
> will work.
Something like this (decision about which pixels in the output space correspond
to the zero padding source pixels) is done in 'pad_repeat_get_scanline_bounds'
function here for the nearest scaling:
http://cgit.freedesktop.org/pixman/tree/pixman/pixman-fast-path.h?id=pixman-0.21.4#n61
This function could be also used for Y axis to skip whole top/bottom padding
scanlines.
If I understand it correctly, Soeren suggests moving/duplicating this or
similar logic into some common code which would run before fast paths and
shrink the output region if possible.
> The pixel sampling of the source needs to do this, otherwise filtering
> cannot be used to produce an antialiased edge where the image
> transitions to NONE.
The discussed patch deals with the nearest filter only, so antialiased edges
are not involved there.
Anyway, right now I'm actually working on a similar function specifically for
bilinear scaling, which would detect 5 zones:
left-padding, transition-zone, only image, transition-zone, right-padding
When handling the pixels exclusively from the image itself, bilinear scanline
processing code can run at full speed. Left padding and right padding for NONE
repeat can be handled in a similar way as for nearest scaling (we can provide
source top/bottom scanline pointers pointing to a small zero filled buffer and
set 'unit_x' parameter to 0 in order to prevent it from advancing forward).
Transition zones are going to be a bit more tricky because a single extra
boolean hint argument will not help, and probably some kind of additional
optional mask buffers will be required to be passed to the scanline
processing function.
But I want to implement fast SIMD optimized bilinear scaling only for
a8r8g8b8/x8r8g8b8/r5g6b5 formats, SRC operator and PAD repeat first. So I'm
just going to ignore NONE repeat related issues initially :)
And in the case of bilinear scaling, left-padding and right-padding zones
could be removed from the output region too.
-- Siarhei
> Soeren Sandmann wrote:
> > Siarhei Siamashka <siarhei.siamashka at gmail.com> writes:
> >> From: Siarhei Siamashka <siarhei.siamashka at nokia.com>
> >>
> >> Scaling function now gets an extra boolean argument, which is set
> >> to TRUE when we are fetching padding pixels for NONE repeat. This
> >> allows to make a decision whether to interpret alpha as 0xFF or 0x00
> >> for such pixels when working with formats which don't have alpha
> >> channel (for example x8r8g8b8 and r5g6b5).
> >
> > Another way to do this would be to clip away zeros up front for source
> > images. For example, a new function pointer could be added to the
> >
> > image struct:
> > clip_zeros (pixman_image_t *image, pixman_region_t *region)
> >
> > that would clip away those parts of region where the image is known to
> > be zero. Then, in pixman.c, this function could be called for both
> > source and mask if the operator was one where zeros had no effect.
> >
> > That would benefit all operations and avoid cluttering these
> > macros. It would also cause the SAMPLES_COVER_CLIP to be set in more
> > cases.
> >
> > I'm fine with this patch as is too though.
> >
> >
> > Soren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20110211/6fc67229/attachment-0001.htm>
More information about the Pixman
mailing list