[Pixman] [PATCH v13 13/14] pixman-image: Implement PIXMAN_FILTER_GOOD/BEST as separable convolutions
soren.sandmann at gmail.com
Sat Mar 5 00:17:44 UTC 2016
On Wed, Feb 10, 2016 at 1:25 AM, <spitzak at gmail.com> wrote:
> From: Bill Spitzak <spitzak at gmail.com>
> Detects and uses PIXMAN_FILTER_NEAREST for all 8 90-degree rotations and
> reflections when the scale is 1.0 and integer translation.
> GOOD uses:
> scale < 1/16 : BOX.BOX at size 16
> scale < 3/4 : BOX.BOX at size 1/scale
> larger : BOX.BOX at size 1
> If both directions have a scale >= 3/4 or a scale of 1/2 and an integer
> translation, the faster PIXMAN_FILTER_BILINEAR code is used. This is
> compatable at these scales with older versions of pixman where bilinear
> was always used for GOOD.
> BEST uses:
> scale < 1/24 : BOX.BOX at size 24
> scale < 1/16 : BOX.BOX at size 1/scale
> scale < 1 : IMPULSE.LANCZOS2 at size 1/scale
> scale < 2.333 : IMPULSE.LANCZOS2 at size 1
> scale < 128 : BOX.LANCZOS2 at size 1/(scale-1) (antialiased square pixels)
> larger : BOX.LANCZOS2 at size 1/127 (antialias blur gets thicker)
> v8: Cutoff in BEST between IMPULSE.LANCZOS2 and BOX.LANCZOS2 adjusted for
> a better match between the filters.
> v9: Use the new negative subsample controls to scale the subsamples. These
> were chosen by finding the lowest number that did not add visible
> artifacts to the zone plate image.
> Scale demo altered to default to GOOD and locked-together x+y scale
> Fixed divide-by-zero from all-zero matrix found by stress-test
> v11: Whitespace and formatting fixes
> Moved demo changes to a later patch
> v12: Whitespace and formatting fixes
> Signed-off-by: Bill Spitzak <spitzak at gmail.com>
The short answer to this patch is NACK - it doesn't make sense to change
the meaning of GOOD and BEST.
There are at least three reasons:
1. Pixman is a low-level API that is in the camp of "do what I say" not "do
what I mean". When users such as cairo specify GOOD and BEST, they are
essentially asking Pixman to make a tradeoff that it doesn't have the
knowledge to do. As such, I think it was a mistake to have these values in
the first place (and indeed also a mistake to have them in the Render
extension since X11 is also supposed to be a do-what-I-say API). As such, I
think they should remain aliases to BILINEAR as they are now.
2. The motivation for doing this in Pixman (and not in cairo) is that
supposedly the X server will then pick it up automatically and use the
high-quality filters when PictFilterBest and PictFilterGood is set. But
that doesn't actually work because the X server doesn't map those Render
filters to the corresponding Pixman filters. See:
So it looks to me like the whole scheme just won't work. But even if it
did, you would still need to make all the hardware drivers do the same
thing, so it's not just a matter of adding some constants in that function.
The way to go is to add a new SeparateConvolution filter to Render and make
fb call into Pixman to implement it. Once that is in place, the hardware
drivers can then implement it.
3. The patch is completely broken as written. I could go into details, but
there is no point since I don't think the patch should be pushed even if
fixed. I'll just point out that if the environment variable
PIXMAN_DISABLE=fast is set, the patch does absolutely nothing (you can
verify this with the scale program). And setting this environment variable
is not supposed to change Pixman's behavior, only potentially its
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pixman