[Pixman] [PATCH v10 09/15] pixman-filter: don't range-check in filter functions
Oded Gabbay
oded.gabbay at gmail.com
Thu Feb 4 02:23:13 PST 2016
On Tue, Feb 2, 2016 at 8:28 AM, <spitzak at gmail.com> wrote:
> From: Bill Spitzak <spitzak at gmail.com>
>
> The integral will not be called outside the width so there is no need
> to check against these.
>
> v9: merged commits for cubic and impulse into same one
>
> Signed-off-by: Bill Spitzak <spitzak at gmail.com>
> ---
> pixman/pixman-filter.c | 18 ++++++++----------
> 1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
> index bd4e174..b6f8eb4 100644
> --- a/pixman/pixman-filter.c
> +++ b/pixman/pixman-filter.c
> @@ -45,7 +45,7 @@ typedef struct
> static double
> impulse_kernel (double x)
> {
> - return (x == 0.0)? 1.0 : 0.0;
> + return 1;
> }
>
> static double
> @@ -109,18 +109,16 @@ general_cubic (double x, double B, double C)
>
> if (ax < 1)
> {
> - return ((12 - 9 * B - 6 * C) * ax * ax * ax +
> - (-18 + 12 * B + 6 * C) * ax * ax + (6 - 2 * B)) / 6;
> - }
> - else if (ax >= 1 && ax < 2)
> - {
> - return ((-B - 6 * C) * ax * ax * ax +
> - (6 * B + 30 * C) * ax * ax + (-12 * B - 48 * C) *
> - ax + (8 * B + 24 * C)) / 6;
> + return (((12 - 9 * B - 6 * C) * ax +
> + (-18 + 12 * B + 6 * C)) * ax * ax +
> + (6 - 2 * B)) / 6;
> }
> else
> {
> - return 0;
> + return ((((-B - 6 * C) * ax +
> + (6 * B + 30 * C)) * ax +
> + (-12 * B - 48 * C)) * ax +
> + (8 * B + 24 * C)) / 6;
> }
> }
>
> --
> 1.9.1
>
> _______________________________________________
> Pixman mailing list
> Pixman at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pixman
I'm sorry, but I still don't see the real benefit of removing those
checks, compared to the robustness of the code and I don't have the
sufficient knowledge to decide whether your commit message is true in
all cases or not.
More information about the Pixman
mailing list