Re: [Pixman] [PATCH 13/15] pixman-filter: refactor cubic polynominal and don't range check

2016-01-03 Thread Bill Spitzak
Indeed, further tests reveal there was a bug if one of the filters is 
IMPULSE. It was not sampling at the center of the filter, but instead 
offset by the width. I have a patch to fix this that will be in the next 
set.


On 12/26/2015 08:05 PM, Bill Spitzak wrote:

Sounds like I better look at this more carefully, it is quite possible
it is producing bad filters but with small enough error that the images
look OK.

On Dec 23, 2015 5:25 AM, "Oded Gabbay" > wrote:

On Tue, Dec 22, 2015 at 9:01 PM, Bill Spitzak > wrote:
 >
 >
 > On Tue, Dec 22, 2015 at 4:38 AM, Oded Gabbay
> wrote:
 >>
 >> On Sat, Dec 12, 2015 at 8:06 PM,  > wrote:
 >> > From: Bill Spitzak >
 >> >
 >> > The other filters do not check for x being in range, so there is
 >> > no reason for cubic to do so.
 >>
 >> This argument is a bit problematic.
 >> We could also argue that this filter was actually implemented
 >> correctly/more robust and we should add checks for x to the other
 >> filters.
 >>
 >> I fail to see how this saves us much except from removing a
condition
 >> in a very specific path.
 >>
 >> Do you argue that ax will never ever be >=2 ?
 >
 >
 > Yes, because if that could happen, then out-of-range x could also
be sent to
 > the other filter functions that are not doing the range check.
 >
I run the scale demo, and added a printf everytime ax is >=2.
I got a LOT of prints...
So I don't think your argument is correct.

 > Adding range checks to all the other filters (especially the ones
that
 > return constants) would add a bunch of conditions that are never
used.

Maybe, but it might be necessary to produce more accurate results ?

Oded


 >
 >>
 >>
 >>Oded
 >>
 >> > ---
 >> >  pixman/pixman-filter.c | 16 +++-
 >> >  1 file changed, 7 insertions(+), 9 deletions(-)
 >> >
 >> > diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
 >> > index 7e10108..bf9dce3 100644
 >> > --- a/pixman/pixman-filter.c
 >> > +++ b/pixman/pixman-filter.c
 >> > @@ -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@lists.freedesktop.org 
 >> > http://lists.freedesktop.org/mailman/listinfo/pixman
 >
 >



___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


Re: [Pixman] [PATCH 13/15] pixman-filter: refactor cubic polynominal and don't range check

2015-12-26 Thread Bill Spitzak
Sounds like I better look at this more carefully, it is quite possible it
is producing bad filters but with small enough error that the images look
OK.
On Dec 23, 2015 5:25 AM, "Oded Gabbay"  wrote:

> On Tue, Dec 22, 2015 at 9:01 PM, Bill Spitzak  wrote:
> >
> >
> > On Tue, Dec 22, 2015 at 4:38 AM, Oded Gabbay 
> wrote:
> >>
> >> On Sat, Dec 12, 2015 at 8:06 PM,   wrote:
> >> > From: Bill Spitzak 
> >> >
> >> > The other filters do not check for x being in range, so there is
> >> > no reason for cubic to do so.
> >>
> >> This argument is a bit problematic.
> >> We could also argue that this filter was actually implemented
> >> correctly/more robust and we should add checks for x to the other
> >> filters.
> >>
> >> I fail to see how this saves us much except from removing a condition
> >> in a very specific path.
> >>
> >> Do you argue that ax will never ever be >=2 ?
> >
> >
> > Yes, because if that could happen, then out-of-range x could also be
> sent to
> > the other filter functions that are not doing the range check.
> >
> I run the scale demo, and added a printf everytime ax is >=2.
> I got a LOT of prints...
> So I don't think your argument is correct.
>
> > Adding range checks to all the other filters (especially the ones that
> > return constants) would add a bunch of conditions that are never used.
>
> Maybe, but it might be necessary to produce more accurate results ?
>
> Oded
>
>
> >
> >>
> >>
> >>Oded
> >>
> >> > ---
> >> >  pixman/pixman-filter.c | 16 +++-
> >> >  1 file changed, 7 insertions(+), 9 deletions(-)
> >> >
> >> > diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
> >> > index 7e10108..bf9dce3 100644
> >> > --- a/pixman/pixman-filter.c
> >> > +++ b/pixman/pixman-filter.c
> >> > @@ -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@lists.freedesktop.org
> >> > http://lists.freedesktop.org/mailman/listinfo/pixman
> >
> >
>
___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


Re: [Pixman] [PATCH 13/15] pixman-filter: refactor cubic polynominal and don't range check

2015-12-22 Thread Bill Spitzak
On Tue, Dec 22, 2015 at 4:38 AM, Oded Gabbay  wrote:

> On Sat, Dec 12, 2015 at 8:06 PM,   wrote:
> > From: Bill Spitzak 
> >
> > The other filters do not check for x being in range, so there is
> > no reason for cubic to do so.
>
> This argument is a bit problematic.
> We could also argue that this filter was actually implemented
> correctly/more robust and we should add checks for x to the other
> filters.
>
> I fail to see how this saves us much except from removing a condition
> in a very specific path.
>
> Do you argue that ax will never ever be >=2 ?
>

Yes, because if that could happen, then out-of-range x could also be sent
to the other filter functions that are not doing the range check.

Adding range checks to all the other filters (especially the ones that
return constants) would add a bunch of conditions that are never used.


>
>Oded
>
> > ---
> >  pixman/pixman-filter.c | 16 +++-
> >  1 file changed, 7 insertions(+), 9 deletions(-)
> >
> > diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
> > index 7e10108..bf9dce3 100644
> > --- a/pixman/pixman-filter.c
> > +++ b/pixman/pixman-filter.c
> > @@ -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@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/pixman
>
___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


Re: [Pixman] [PATCH 13/15] pixman-filter: refactor cubic polynominal and don't range check

2015-12-22 Thread Oded Gabbay
On Sat, Dec 12, 2015 at 8:06 PM,   wrote:
> From: Bill Spitzak 
>
> The other filters do not check for x being in range, so there is
> no reason for cubic to do so.

This argument is a bit problematic.
We could also argue that this filter was actually implemented
correctly/more robust and we should add checks for x to the other
filters.

I fail to see how this saves us much except from removing a condition
in a very specific path.

Do you argue that ax will never ever be >=2 ?

   Oded

> ---
>  pixman/pixman-filter.c | 16 +++-
>  1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
> index 7e10108..bf9dce3 100644
> --- a/pixman/pixman-filter.c
> +++ b/pixman/pixman-filter.c
> @@ -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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pixman
___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman