<div dir="ltr">On Tue, Dec 22, 2015 at 1:38 AM, Oded Gabbay <span dir="ltr"><<a href="mailto:oded.gabbay@gmail.com" target="_blank">oded.gabbay@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sat, Dec 12, 2015 at 8:06 PM,  <<a href="mailto:spitzak@gmail.com">spitzak@gmail.com</a>> wrote:<br>
> From: Bill Spitzak <<a href="mailto:spitzak@gmail.com">spitzak@gmail.com</a>><br>
><br>
> Only LINEAR is not differentiable at zero,<br>
<br>
</span>I'm sorry, I don't understand this sentence. Could you please give me<br>
a more detailed explanation + reference ?<br></blockquote><div><br></div><div>All the other filter functions have a continuous first derivative over their entire range.<br><br></div><div>The LINEAR function is a triangle and the first derivative changes from +1 to -1 at 0.0.<br><br></div><div>I believe Søren was concerned that the Simpson's integration would not work at this point. He solved this by splitting the integral into 2 or 3 at the zeros, so the integration is not done across these points.<br><br></div><div>I figured I should keep this, though I suspect the error is really invisibly tiny. Apparently Simpsons integration will have some error for any function where the third derivative is not constant, which is true for all the filters here except box. But the error is really really tiny and was being ignored for all the other filters, and it may be ok to ignore it here too.<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks,<br>
<br>
        Oded<br>
<div><div class="h5"><br>
> so only do the recursive split of the integral for it.<br>
> ---<br>
>  pixman/pixman-filter.c | 34 +++++++++++++++++-----------------<br>
>  1 file changed, 17 insertions(+), 17 deletions(-)<br>
><br>
> diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c<br>
> index 782f73d..0cd4a68 100644<br>
> --- a/pixman/pixman-filter.c<br>
> +++ b/pixman/pixman-filter.c<br>
> @@ -160,38 +160,38 @@ integral (pixman_kernel_t reconstruct, double x1,<br>
>           pixman_kernel_t sample, double scale, double x2,<br>
>           double width)<br>
>  {<br>
> +    if (reconstruct == PIXMAN_KERNEL_IMPULSE)<br>
> +    {<br>
> +       assert (width == 0.0);<br>
> +       return filters[sample].func (x2 / scale);<br>
> +    }<br>
> +    else if (reconstruct == PIXMAN_KERNEL_BOX && sample == PIXMAN_KERNEL_BOX)<br>
> +    {<br>
> +       assert (width <= 1.0);<br>
> +       return width;<br>
> +    }<br>
> +    else if (sample == PIXMAN_KERNEL_IMPULSE)<br>
> +    {<br>
> +       assert (width == 0.0);<br>
> +       return filters[reconstruct].func (x1);<br>
> +    }<br>
>      /* If the integration interval crosses zero, break it into<br>
>       * two separate integrals. This ensures that filters such<br>
>       * as LINEAR that are not differentiable at 0 will still<br>
>       * integrate properly.<br>
>       */<br>
> -    if (x1 < 0 && x1 + width > 0)<br>
> +    else if (reconstruct == PIXMAN_KERNEL_LINEAR && x1 < 0 && x1 + width > 0)<br>
>      {<br>
>         return<br>
>             integral (reconstruct, x1, sample, scale, x2, - x1) +<br>
>             integral (reconstruct, 0, sample, scale, x2 - x1, width + x1);<br>
>      }<br>
> -    else if (x2 < 0 && x2 + width > 0)<br>
> +    else if (sample == PIXMAN_KERNEL_LINEAR && x2 < 0 && x2 + width > 0)<br>
>      {<br>
>         return<br>
>             integral (reconstruct, x1, sample, scale, x2, - x2) +<br>
>             integral (reconstruct, x1 - x2, sample, scale, 0, width + x2);<br>
>      }<br>
> -    else if (reconstruct == PIXMAN_KERNEL_IMPULSE)<br>
> -    {<br>
> -       assert (width == 0.0);<br>
> -       return filters[sample].func (x2 / scale);<br>
> -    }<br>
> -    else if (reconstruct == PIXMAN_KERNEL_BOX && sample == PIXMAN_KERNEL_BOX)<br>
> -    {<br>
> -       assert (width <= 1.0);<br>
> -       return width;<br>
> -    }<br>
> -    else if (sample == PIXMAN_KERNEL_IMPULSE)<br>
> -    {<br>
> -       assert (width == 0.0);<br>
> -       return filters[reconstruct].func (x1);<br>
> -    }<br>
>      else<br>
>      {<br>
>         /* Integration via Simpson's rule */<br>
> --<br>
> 1.9.1<br>
><br>
</div></div>> _______________________________________________<br>
> Pixman mailing list<br>
> <a href="mailto:Pixman@lists.freedesktop.org">Pixman@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/pixman" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/pixman</a><br>
</blockquote></div><br></div></div>