[Pixman] [PATCH v9 04/15] pixman-filter: Consistency in arg names to integral ()
Oded Gabbay
oded.gabbay at gmail.com
Mon Feb 1 06:24:48 PST 2016
On Fri, Jan 22, 2016 at 11:42 AM, <spitzak at gmail.com> wrote:
> From: Bill Spitzak <spitzak at gmail.com>
>
> Rename kernel1/2 to reconstruct/sample and use 1/scale as the
> scale argument, thus matching the names in other functions.
>
> Signed-off-by: Bill Spitzak <spitzak at gmail.com>
> ---
> pixman/pixman-filter.c | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
> index fe0d261..aaa7de9 100644
> --- a/pixman/pixman-filter.c
> +++ b/pixman/pixman-filter.c
> @@ -147,8 +147,8 @@ static const filter_info_t filters[] =
> { PIXMAN_KERNEL_LANCZOS3_STRETCHED, nice_kernel, 8.0 },
> };
>
> -/* This function scales @kernel2 by @scale, then
> - * aligns @x1 in @kernel1 with @x2 in @kernel2 and
> +/* This function scales @sample by @scale, then
> + * aligns @x1 in @reconstruct with @x2 in @sample and
> * and integrates the product of the kernels across @width.
> *
> * This function assumes that the intervals are within
> @@ -156,8 +156,8 @@ static const filter_info_t filters[] =
> * try to integrate a linear kernel ouside of [-1:1]
> */
> static double
> -integral (pixman_kernel_t kernel1, double x1,
> - pixman_kernel_t kernel2, double scale, double x2,
> +integral (pixman_kernel_t reconstruct, double x1,
> + pixman_kernel_t sample, double scale, double x2,
> double width)
> {
> /* If the integration interval crosses zero, break it into
> @@ -168,31 +168,31 @@ integral (pixman_kernel_t kernel1, double x1,
> if (x1 < 0 && x1 + width > 0)
> {
> return
> - integral (kernel1, x1, kernel2, scale, x2, - x1) +
> - integral (kernel1, 0, kernel2, scale, x2 - x1, width + x1);
> + integral (reconstruct, x1, sample, scale, x2, - x1) +
> + integral (reconstruct, 0, sample, scale, x2 - x1, width + x1);
> }
> else if (x2 < 0 && x2 + width > 0)
> {
> return
> - integral (kernel1, x1, kernel2, scale, x2, - x2) +
> - integral (kernel1, x1 - x2, kernel2, scale, 0, width + x2);
> + integral (reconstruct, x1, sample, scale, x2, - x2) +
> + integral (reconstruct, x1 - x2, sample, scale, 0, width + x2);
> }
> - else if (kernel1 == PIXMAN_KERNEL_IMPULSE)
> + else if (reconstruct == PIXMAN_KERNEL_IMPULSE)
> {
> assert (width == 0.0);
> - return filters[kernel2].func (x2 * scale);
> + return filters[sample].func (x2 / scale);
> }
> - else if (kernel2 == PIXMAN_KERNEL_IMPULSE)
> + else if (sample == PIXMAN_KERNEL_IMPULSE)
> {
> assert (width == 0.0);
> - return filters[kernel1].func (x1);
> + return filters[reconstruct].func (x1);
> }
> else
> {
> /* Integration via Simpson's rule */
> #define N_SEGMENTS 128
> #define SAMPLE(a1, a2) \
> - (filters[kernel1].func ((a1)) * filters[kernel2].func ((a2) * scale))
> + (filters[reconstruct].func ((a1)) * filters[sample].func ((a2) / scale))
>
> double s = 0.0;
> double h = width / (double)N_SEGMENTS;
> @@ -270,7 +270,7 @@ create_1d_filter (int *width,
> ihigh = MIN (shigh, rhigh);
>
> c = integral (reconstruct, ilow,
> - sample, 1.0 / scale, ilow - pos,
> + sample, scale, ilow - pos,
> ihigh - ilow);
> }
>
> --
> 1.9.1
>
> _______________________________________________
> Pixman mailing list
> Pixman at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pixman
Reviewed-by: Oded Gabbay <oded.gabbay at gmail.com>
More information about the Pixman
mailing list