<div dir="ltr">DOH!<div><br></div><div>You are right, I should make sure each step compiles. I am also very much tempted to change "scale" to "size" to avoid the fact that the value is approximately the reciprocal of what must users would call the "scale" of the transform. That will require testing each patch.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 1, 2016 at 6:34 AM, Oded Gabbay <span dir="ltr"><<a href="mailto:oded.gabbay@gmail.com" target="_blank">oded.gabbay@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Jan 22, 2016 at 11:42 AM,  <<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>
> Simpsons uses cubic curve fitting, with 3 samples defining each cubic. This<br>
> makes the weights of the samples be in a pattern of 1,4,2,4,2...4,1, and then<br>
> dividing the result by 3.<br>
><br>
> The previous code was using weights of 1,2,6,6...6,2,1. Since it divided by<br>
> 3 this produced about 2x the desired value (the normalization fixed this).<br>
> Also this is effectively a linear interpolation, not Simpsons integration.<br>
><br>
> With this fix the integration is accurate enough that the number of samples<br>
> could be reduced a lot. Multiples of 12 seem to work best.<br>
><br>
> v9: Changed samples from 16 to 12<br>
> v7: Merged with patch to reduce from 128 samples to 16<br>
><br>
> Signed-off-by: Bill Spitzak <<a href="mailto:spitzak@gmail.com">spitzak@gmail.com</a>><br>
> ---<br>
>  pixman/pixman-filter.c | 29 +++++++++++++++++++----------<br>
>  1 file changed, 19 insertions(+), 10 deletions(-)<br>
><br>
> diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c<br>
> index 55073c4..718649a 100644<br>
> --- a/pixman/pixman-filter.c<br>
> +++ b/pixman/pixman-filter.c<br>
> @@ -189,13 +189,19 @@ integral (pixman_kernel_t reconstruct, double x1,<br>
>      }<br>
>      else<br>
>      {<br>
> -       /* Integration via Simpson's rule */<br>
> -#define N_SEGMENTS 128<br>
> -#define SAMPLE(a1, a2)                                                 \<br>
> -       (filters[reconstruct].func ((a1)) * filters[sample].func ((a2) / scale))<br>
> -<br>
> +       /* Integration via Simpson's rule<br>
> +        * See <a href="http://www.intmath.com/integration/6-simpsons-rule.php" rel="noreferrer" target="_blank">http://www.intmath.com/integration/6-simpsons-rule.php</a><br>
> +        * 12 segments (6 cubic approximations) seems to produce best<br>
> +        * result for lanczos3.linear, which was the combination that<br>
> +        * showed the most errors.  This makes sense as the lanczos3<br>
> +        * filter is 6 wide.<br>
> +        */<br>
> +#define N_SEGMENTS 12<br>
> +#define SAMPLE(a)                                                      \<br>
> +       (filters[reconstruct].func ((a)) * filters[sample].func (((a) - pos) / scale))<br>
> +<br>
</div></div>You changed the SAMPLE macro to get 1 parameter, but in all the calls<br>
you send 2 parameters, which make the compilation fail.<br>
<br>
Please fix this and resend the patch.<br>
<br>
Oded<br>
<span class=""><br>
>         double s = 0.0;<br>
> -       double h = width / (double)N_SEGMENTS;<br>
> +       double h = width / N_SEGMENTS;<br>
>         int i;<br>
><br>
>         s = SAMPLE (x1, x2);<br>
> @@ -204,11 +210,14 @@ integral (pixman_kernel_t reconstruct, double x1,<br>
>         {<br>
>             double a1 = x1 + h * i;<br>
>             double a2 = x2 + h * i;<br>
> +           s += 4 * SAMPLE(a1, a2);<br>
> +       }<br>
><br>
> -           s += 2 * SAMPLE (a1, a2);<br>
> -<br>
> -           if (i >= 2 && i < N_SEGMENTS - 1)<br>
> -               s += 4 * SAMPLE (a1, a2);<br>
> +       for (i = 2; i < N_SEGMENTS; i += 2)<br>
> +       {<br>
> +           double a1 = x1 + h * i;<br>
> +           double a2 = x2 + h * i;<br>
> +           s += 2 * SAMPLE(a1, a2);<br>
>         }<br>
><br>
>         s += SAMPLE (x1 + width, x2 + width);<br>
> --<br>
> 1.9.1<br>
><br>
</span>> _______________________________________________<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>