summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-11-22 10:17:56 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-12-08 10:50:51 -0500
commit68760d3fe1351cb745aedcada7d765edc08bbe8b (patch)
treebc1b403aab8edf860dca51cff6e38b94211f312e
parent6fd480b17c8398c217e4c11e826c82dbb8288006 (diff)
rounding.txt: Describe how SEPARABLE_CONVOLUTION filter works
Add some notes on how to compute the convolution matrices to be used with the SEPARABLE_CONVOLUTION filter.
-rw-r--r--pixman/rounding.txt33
1 files changed, 33 insertions, 0 deletions
diff --git a/pixman/rounding.txt b/pixman/rounding.txt
index 1a19f45..b52b084 100644
--- a/pixman/rounding.txt
+++ b/pixman/rounding.txt
@@ -132,3 +132,36 @@ And so the final formula for the index k of x0 in the image is:
Computing the result is then simply a matter of convolving all the
pixels starting at k with all the samples in the matrix.
+
+
+--- SEPARABLE_CONVOLUTION
+
+For this filter, x is first rounded to one of n regularly spaced
+subpixel positions. This subpixel position determines which of n
+convolution matrices is being used.
+
+Then, as in a regular convolution filter, the first pixel to be used
+is determined:
+
+ k = floor (x - (width - 1) / 2.0 - e)
+
+and then the image pixels starting there are convolved with the chosen
+matrix. If we write x = xi + frac, where xi is an integer, we get
+
+ k = xi + floor (frac - (width - 1) / 2.0 - e)
+
+so the location of k relative to x is given by:
+
+ (k + 0.5 - x) = xi + floor (frac - (width - 1) / 2.0 - e) + 0.5 - x
+
+ = floor (frac - (width - 1) / 2.0 - e) + 0.5 - frac
+
+which means the contents of the matrix corresponding to (frac) should
+contain width samplings of the function, with the first sample at:
+
+ floor (frac - (width - 1) / 2.0 - e) + 0.5 - frac
+
+This filter is called separable because each of the k x k convolution
+matrices is specified with two k-wide vectors, one for each dimension,
+where each entry in the matrix is computed as the product of the
+corresponding entries in the vectors.