[Pixman] [PATCH v14 08/22] pixman-filter: rename "scale" to "size" when it is 1/scale

Bill Spitzak spitzak at gmail.com
Fri Mar 18 15:24:40 UTC 2016


On Thu, Mar 17, 2016 at 10:06 PM, Søren Sandmann <soren.sandmann at gmail.com>
wrote:

> I suppose it's a little illogical that scale_x and scale_y really are the
> reciprocal values of how much the source image should be scaled. I don't
> remember exactly what I was thinking, but it might have something like
> "this allows you to just pass t[0][0] and t[1][1] if you have a pure
> scaling, which avoids a division". There is also kind of precedence in the
> Pixman API since the transformation given as in the dst->source direction.
>
> I don't really like "size" either though. It's not really the size of the
> filter that we are specifying; it just happens to be proportional to it.
>
> If it comes down to "size" and "scale", I prefer "scale".
>

I tried "width" but it is not actually the filter width. How about "dx" and
"dy" since it is almost always the derivative of the x and y in the input
(or du,dv or dtx dtx)

>
>
> Søren
>
>
> On Sun, Mar 6, 2016 at 8:06 PM, <spitzak at gmail.com> wrote:
>
>> From: Bill Spitzak <spitzak at gmail.com>
>>
>> This is to remove some confusion when reading the code. "scale" gets
>> larger
>> as the picture gets larger, while "size" (ie the size of the filter) gets
>> smaller.
>>
>> v14: Removed changes to integral function
>>
>> Signed-off-by: Bill Spitzak <spitzak at gmail.com>
>> Reviewed-by: Oded Gabbay <oded.gabbay at gmail.com>
>> ---
>>  pixman/pixman-filter.c | 18 +++++++++---------
>>  pixman/pixman.h        |  6 +++---
>>  2 files changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
>> index a29116a..c03a7f6 100644
>> --- a/pixman/pixman-filter.c
>> +++ b/pixman/pixman-filter.c
>> @@ -221,7 +221,7 @@ static void
>>  create_1d_filter (int              width,
>>                   pixman_kernel_t  reconstruct,
>>                   pixman_kernel_t  sample,
>> -                 double           scale,
>> +                 double           size,
>>                   int              n_phases,
>>                   pixman_fixed_t *p)
>>  {
>> @@ -251,8 +251,8 @@ create_1d_filter (int              width,
>>             double pos = x + 0.5 - frac;
>>             double rlow = - filters[reconstruct].width / 2.0;
>>             double rhigh = rlow + filters[reconstruct].width;
>> -           double slow = pos - scale * filters[sample].width / 2.0;
>> -           double shigh = slow + scale * filters[sample].width;
>> +           double slow = pos - size * filters[sample].width / 2.0;
>> +           double shigh = slow + size * filters[sample].width;
>>             double c = 0.0;
>>             double ilow, ihigh;
>>
>> @@ -262,7 +262,7 @@ create_1d_filter (int              width,
>>                 ihigh = MIN (shigh, rhigh);
>>
>>                 c = integral (reconstruct, ilow,
>> -                             sample, 1.0 / scale, ilow - pos,
>> +                             sample, 1.0 / size, ilow - pos,
>>                               ihigh - ilow);
>>             }
>>
>> @@ -335,12 +335,12 @@ filter_width (pixman_kernel_t reconstruct,
>> pixman_kernel_t sample, double size)
>>  }
>>
>>  /* Create the parameter list for a SEPARABLE_CONVOLUTION filter
>> - * with the given kernels and scale parameters
>> + * with the given kernels and size parameters
>>   */
>>  PIXMAN_EXPORT pixman_fixed_t *
>>  pixman_filter_create_separable_convolution (int             *n_values,
>> -                                           pixman_fixed_t   scale_x,
>> -                                           pixman_fixed_t   scale_y,
>> +                                           pixman_fixed_t   size_x,
>> +                                           pixman_fixed_t   size_y,
>>                                             pixman_kernel_t
>> reconstruct_x,
>>                                             pixman_kernel_t
>> reconstruct_y,
>>                                             pixman_kernel_t  sample_x,
>> @@ -348,8 +348,8 @@ pixman_filter_create_separable_convolution (int
>>        *n_values,
>>                                             int
>> subsample_bits_x,
>>                                             int
>> subsample_bits_y)
>>  {
>> -    double sx = fabs (pixman_fixed_to_double (scale_x));
>> -    double sy = fabs (pixman_fixed_to_double (scale_y));
>> +    double sx = fabs (pixman_fixed_to_double (size_x));
>> +    double sy = fabs (pixman_fixed_to_double (size_y));
>>      pixman_fixed_t *params;
>>      int subsample_x, subsample_y;
>>      int width, height;
>> diff --git a/pixman/pixman.h b/pixman/pixman.h
>> index 509ba5e..b012a33 100644
>> --- a/pixman/pixman.h
>> +++ b/pixman/pixman.h
>> @@ -845,12 +845,12 @@ typedef enum
>>  } pixman_kernel_t;
>>
>>  /* Create the parameter list for a SEPARABLE_CONVOLUTION filter
>> - * with the given kernels and scale parameters.
>> + * with the given kernels and size parameters.
>>   */
>>  pixman_fixed_t *
>>  pixman_filter_create_separable_convolution (int             *n_values,
>> -                                           pixman_fixed_t   scale_x,
>> -                                           pixman_fixed_t   scale_y,
>> +                                           pixman_fixed_t   size_x,
>> +                                           pixman_fixed_t   size_y,
>>                                             pixman_kernel_t
>> reconstruct_x,
>>                                             pixman_kernel_t
>> reconstruct_y,
>>                                             pixman_kernel_t  sample_x,
>> --
>> 1.9.1
>>
>> _______________________________________________
>> Pixman mailing list
>> Pixman at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/pixman
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pixman/attachments/20160318/320e2585/attachment.html>


More information about the Pixman mailing list