On Tue, Apr 12, 2016 at 5:36 AM, Søren Sandmann Pedersen <soren.sandm...@gmail.com> wrote: > The convolution of two BOX filters is simply the length of the > interval where both are non-zero, so we can simply return width from > the integral() function because the integration region has already > been restricted to be such that both functions are non-zero on it. > > This is both faster and more accurate than doing numerical integration. > > This patch is based on one by Bill Spitzak > > https://lists.freedesktop.org/archives/pixman/2016-March/004446.html > > with these changes: > > - Rebased to not assume any changes in the arguments to integral(). > > - Dropped the multiplication by scale > > - Added more details in the commit message. > > Signed-off-by: Søren Sandmann <soren.sandm...@gmail.com> > --- > pixman/pixman-filter.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c > index c868723..32aaa9a 100644 > --- a/pixman/pixman-filter.c > +++ b/pixman/pixman-filter.c > @@ -160,11 +160,15 @@ integral (pixman_kernel_t kernel1, double x1, > pixman_kernel_t kernel2, double scale, double x2, > double width) > { > + if (kernel1 == PIXMAN_KERNEL_BOX && kernel2 == PIXMAN_KERNEL_BOX) > + { > + return width; > + } > /* The LINEAR filter is not differentiable at 0, so if the > * integration interval crosses zero, break it into two > * separate integrals. > */ > - if (kernel1 == PIXMAN_KERNEL_LINEAR && x1 < 0 && x1 + width > 0) > + else if (kernel1 == PIXMAN_KERNEL_LINEAR && x1 < 0 && x1 + width > 0) > { > return > integral (kernel1, x1, kernel2, scale, x2, - x1) + > -- > 1.7.11.7 > > _______________________________________________ > Pixman mailing list > Pixman@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/pixman
This patch is: Acked-by: Oded Gabbay <oded.gab...@gmail.com> _______________________________________________ Pixman mailing list Pixman@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/pixman