[Pixman] [PATCH 12/15] pixman-filter: Turn off subsampling when not necessary
Bill Spitzak
spitzak at gmail.com
Tue Dec 22 10:59:15 PST 2015
On Tue, Dec 22, 2015 at 4:44 AM, Oded Gabbay <oded.gabbay at gmail.com> wrote:
> On Sat, Dec 12, 2015 at 8:06 PM, <spitzak at gmail.com> wrote:
> > From: Bill Spitzak <spitzak at gmail.com>
> >
> > If sample is IMPULSE and reconstruct is BOX or IMPULSE the sub-pixel
> > position of the sample is not relevant, so only one subsample is needed.
> Why ?
> I mean why it is not relevant ? and why only one subsample is needed ?
>
Because all the filters for all the subsample positions are the same (a
single 1).
Actually though, the code is indicating this is happening by returning a
width of zero. But I think that is not necessary: if the filter width is 1,
and the filters are normalized so they sum to 1, then all the filters must
be equal and be a single 1. So I think the filter_width function can return
1 and the caller treats all values <= 1 as an indication that subsampling
is not needed.
Oded
> > ---
> > pixman/pixman-filter.c | 12 +++++++-----
> > 1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
> > index 64981cd..7e10108 100644
> > --- a/pixman/pixman-filter.c
> > +++ b/pixman/pixman-filter.c
> > @@ -230,6 +230,8 @@ filter_width (pixman_kernel_t reconstruct,
> > pixman_kernel_t sample,
> > double scale)
> > {
> > + if (reconstruct == PIXMAN_KERNEL_BOX && sample ==
> PIXMAN_KERNEL_IMPULSE)
> > + return 0;
> > return ceil (scale * filters[sample].width +
> filters[reconstruct].width);
> > }
> >
> > @@ -323,13 +325,13 @@ pixman_filter_create_separable_convolution (int
> *n_values,
> > int subsample_x, subsample_y;
> > int width, height;
> >
> > - subsample_x = (1 << subsample_bits_x);
> > - subsample_y = (1 << subsample_bits_y);
> > -
> > width = filter_width (reconstruct_x, sample_x, sx);
> > - if (width < 1) width = 1;
> > + if (width < 1) { width = 1; subsample_bits_x = 0; }
> > height = filter_width (reconstruct_y, sample_y, sy);
> > - if (height < 1) height = 1;
> > + if (height < 1) { height = 1; subsample_bits_y = 0; }
> > +
> > + subsample_x = (1 << subsample_bits_x);
> > + subsample_y = (1 << subsample_bits_y);
> >
> > *n_values = 4 + width * subsample_x + height * subsample_y;
> >
> > --
> > 1.9.1
> >
> > _______________________________________________
> > Pixman mailing list
> > Pixman at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/pixman
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20151222/d08af9e2/attachment.html>
More information about the Pixman
mailing list