[Pixman] [PATCH v10 10/15] pixman-filter: Gaussian fixes

Bill Spitzak spitzak at gmail.com
Thu Feb 4 19:53:17 PST 2016


On 02/04/2016 02:30 AM, Oded Gabbay wrote:
> On Tue, Feb 2, 2016 at 8:28 AM,  <spitzak at gmail.com> wrote:
>> From: Bill Spitzak <spitzak at gmail.com>
>>
>> The SIGMA term drops out on simplification.
>>
>> Expanded the size slightly (from ~4.25 to 5) to make the cutoff less noticable.
>> The filter is truncated at a value of .001 instead of .006, this new
>> value is less than 1/2 of 1/255, rather than greater than it.
>
> I'm just wondering how did you get to this result ?

Thats the value of the gaussian_kernel(2.5) verses 
gaussian_kernel(2.125). I also checked some other literature and putting 
the cutoff at 2.5 seems to be pretty common.

>
> Oded
>
>>
>> Signed-off-by: Bill Spitzak <spitzak at gmail.com>
>>
>> Acked-by: Oded Gabbay <oded.gabbay at gmail.com>
>> ---
>>   pixman/pixman-filter.c | 7 ++-----
>>   1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
>> index b6f8eb4..10fa398 100644
>> --- a/pixman/pixman-filter.c
>> +++ b/pixman/pixman-filter.c
>> @@ -63,10 +63,7 @@ linear_kernel (double x)
>>   static double
>>   gaussian_kernel (double x)
>>   {
>> -#define SQRT2 (1.4142135623730950488016887242096980785696718753769480)
>> -#define SIGMA (SQRT2 / 2.0)
>> -
>> -    return exp (- x * x / (2 * SIGMA * SIGMA)) / (SIGMA * sqrt (2.0 * M_PI));
>> +    return exp (- x * x) / sqrt (M_PI);
>>   }
>>
>>   static double
>> @@ -139,7 +136,7 @@ static const filter_info_t filters[] =
>>       { PIXMAN_KERNEL_BOX,               box_kernel,       1.0 },
>>       { PIXMAN_KERNEL_LINEAR,            linear_kernel,    2.0 },
>>       { PIXMAN_KERNEL_CUBIC,             cubic_kernel,     4.0 },
>> -    { PIXMAN_KERNEL_GAUSSIAN,          gaussian_kernel,  6 * SIGMA },
>> +    { PIXMAN_KERNEL_GAUSSIAN,          gaussian_kernel,  5.0 },
>>       { PIXMAN_KERNEL_LANCZOS2,          lanczos2_kernel,  4.0 },
>>       { PIXMAN_KERNEL_LANCZOS3,          lanczos3_kernel,  6.0 },
>>       { PIXMAN_KERNEL_LANCZOS3_STRETCHED, nice_kernel,      8.0 },
>> --
>> 1.9.1
>>
>> _______________________________________________
>> Pixman mailing list
>> Pixman at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/pixman



More information about the Pixman mailing list