[Pixman] [PATCH v9 14/15] pixman-filter: Added big comment to filter
spitzak at gmail.com
spitzak at gmail.com
Fri Jan 22 01:42:12 PST 2016
From: Bill Spitzak <spitzak at gmail.com>
v9: Described arguments and more filter combinations, fixed some errors.
v8: first version
Signed-off-by: Bill Spitzak <spitzak at gmail.com>
---
pixman/pixman-filter.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 45 insertions(+), 1 deletion(-)
diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 639d5e6..74819fe 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -378,7 +378,51 @@ filter_width(pixman_kernel_t reconstruct, pixman_kernel_t sample,
}
/* Create the parameter list for a SEPARABLE_CONVOLUTION filter
- * with the given kernels and scale parameters
+ *
+ * Returns pointer to the block of numbers
+ *
+ * n_values: pointer to integer to store size of the block
+ *
+ * scale_x/y: amount to stretch the sample filter. Note that scale
+ * is the inverse of how the image is being scaled, if the image is
+ * being made smaller, the filter gets larger.
+ *
+ * reconstruct_x/y: filter that is not scaled.
+ *
+ * sample_x/y: filter that is scaled. Resoult is convolved with reconstruct filter.
+ *
+ * subsample_bits_x/y: If positive there are 2^n subpixel positions computed for
+ * the filter. If negative then -n (rounded up to the next power of 2) positions
+ * are calculated when scale==1, but fewer are computed for larger scales and
+ * more for smaller scales.
+ *
+ * Some interesting reconstruct.sample combinations:
+ *
+ * IMPULSE.x - Uses the sample function only. This is what many other pieces of
+ * software do. Does not work for scale < 1.0.
+ *
+ * BOX.x - For scale < 1.0 this produces square pixels. For scale > 1.0 this
+ * approaches IMPULSE.x as scale gets larger.
+ *
+ * x.IMPULSE - Uses the reconstruct function only, scale is ignored.
+ *
+ * BOX.BOX, LINEAR.IMPULSE, IMPULSE.LINEAR - at scale==1 these all match and
+ * also produce same result as bilinear filtering.
+ *
+ * BOX.BOX - Produces a trapazoid-shape. Narrowest possible filter with antialiasing.
+ * Matches a lot of other software, some call it "box", others call it "linear"
+ *
+ * BOX.LINEAR - At scale==1 this is what some software calls a Quadratic filter
+ *
+ * IMPULSE.LINEAR - Some software calls this "linear" or "triangle". Not a good filter.
+ *
+ * LINEAR.LINEAR - non-negative cubic. What some software calls "cubic interpolation".
+ *
+ * IMPULSE.LANCZOS2 - Close to what a lot of other software calls "cubic interpolation"
+ *
+ * IMPULSE.CUBIC - Called "Mitchell" in other software
+ *
+ * IMPULSE.GAUSSIAN - Best removal of aliasing but usually considered too blurry
*/
PIXMAN_EXPORT pixman_fixed_t *
pixman_filter_create_separable_convolution (int *n_values,
--
1.9.1
More information about the Pixman
mailing list