[Pixman] [PATCH 08/15] pixman-filter: Don't recurse unnecessarily.
Oded Gabbay
oded.gabbay at gmail.com
Tue Dec 22 01:38:43 PST 2015
On Sat, Dec 12, 2015 at 8:06 PM, <spitzak at gmail.com> wrote:
> From: Bill Spitzak <spitzak at gmail.com>
>
> Only LINEAR is not differentiable at zero,
I'm sorry, I don't understand this sentence. Could you please give me
a more detailed explanation + reference ?
Thanks,
Oded
> so only do the recursive split of the integral for it.
> ---
> pixman/pixman-filter.c | 34 +++++++++++++++++-----------------
> 1 file changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
> index 782f73d..0cd4a68 100644
> --- a/pixman/pixman-filter.c
> +++ b/pixman/pixman-filter.c
> @@ -160,38 +160,38 @@ integral (pixman_kernel_t reconstruct, double x1,
> pixman_kernel_t sample, double scale, double x2,
> double width)
> {
> + if (reconstruct == PIXMAN_KERNEL_IMPULSE)
> + {
> + assert (width == 0.0);
> + return filters[sample].func (x2 / scale);
> + }
> + else if (reconstruct == PIXMAN_KERNEL_BOX && sample == PIXMAN_KERNEL_BOX)
> + {
> + assert (width <= 1.0);
> + return width;
> + }
> + else if (sample == PIXMAN_KERNEL_IMPULSE)
> + {
> + assert (width == 0.0);
> + return filters[reconstruct].func (x1);
> + }
> /* If the integration interval crosses zero, break it into
> * two separate integrals. This ensures that filters such
> * as LINEAR that are not differentiable at 0 will still
> * integrate properly.
> */
> - if (x1 < 0 && x1 + width > 0)
> + else if (reconstruct == PIXMAN_KERNEL_LINEAR && x1 < 0 && x1 + width > 0)
> {
> return
> integral (reconstruct, x1, sample, scale, x2, - x1) +
> integral (reconstruct, 0, sample, scale, x2 - x1, width + x1);
> }
> - else if (x2 < 0 && x2 + width > 0)
> + else if (sample == PIXMAN_KERNEL_LINEAR && x2 < 0 && x2 + width > 0)
> {
> return
> integral (reconstruct, x1, sample, scale, x2, - x2) +
> integral (reconstruct, x1 - x2, sample, scale, 0, width + x2);
> }
> - else if (reconstruct == PIXMAN_KERNEL_IMPULSE)
> - {
> - assert (width == 0.0);
> - return filters[sample].func (x2 / scale);
> - }
> - else if (reconstruct == PIXMAN_KERNEL_BOX && sample == PIXMAN_KERNEL_BOX)
> - {
> - assert (width <= 1.0);
> - return width;
> - }
> - else if (sample == PIXMAN_KERNEL_IMPULSE)
> - {
> - assert (width == 0.0);
> - return filters[reconstruct].func (x1);
> - }
> else
> {
> /* Integration via Simpson's rule */
> --
> 1.9.1
>
> _______________________________________________
> Pixman mailing list
> Pixman at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pixman
More information about the Pixman
mailing list