[Pixman] [PATCH v13 07/14] pixman-filter: Correct Simpsons integration
Søren Sandmann
soren.sandmann at gmail.com
Fri Mar 4 23:00:55 UTC 2016
On Wed, Feb 10, 2016 at 1:25 AM, <spitzak at gmail.com> wrote:
> From: Bill Spitzak <spitzak at gmail.com>
>
> Simpsons uses cubic curve fitting, with 3 samples defining each cubic. This
> makes the weights of the samples be in a pattern of 1,4,2,4,2...4,1, and
> then
> dividing the result by 3.
>
> The previous code was using weights of 1,2,6,6...6,2,1. Since it divided by
> 3 this produced about 2x the desired value (the normalization fixed this).
> Also this is effectively a linear interpolation, not Simpsons integration.
>
It is not true that the previous code used these weights because it only
ran for half the segments (it had += 2). The intention with the code was to
do both the 4 and the 2 weight in one loop, but for that to work a1 and a2
would have to be updated, which the code didn't do. So it was indeed buggy,
and I think the new code is correct.
There should be spaces before the parentheses in the SAMPLE() macros,
though.
Søren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pixman/attachments/20160304/021a054d/attachment.html>
More information about the Pixman
mailing list