[Pixman] [PATCH pixman] test: Added more demos and tests to .gitignore file

2015-04-29 Thread Bill Spitzak
Uses a wildcard to handle the majority which end in -test.

---
 .gitignore |   45 +
 1 file changed, 5 insertions(+), 40 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7da6b6f..a245b69 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,62 +26,27 @@ stamp-h?
 config.h
 config.h.in
 .*.swp
-demos/alpha-test
+demos/*-test
 demos/checkerboard
 demos/clip-in
-demos/clip-test
-demos/composite-test
-demos/conical-test
-demos/convolution-test
-demos/gradient-test
 demos/linear-gradient
 demos/quad2quad
-demos/radial-test
 demos/scale
-demos/screen-test
-demos/srgb-test
-demos/srgb-trap-test
-demos/trap-test
-demos/tri-test
 pixman/pixman-srgb.c
 pixman/pixman-version.h
-test/a1-trap-test
+test/*-test
 test/affine-bench
-test/affine-test
 test/alpha-loop
 test/alphamap
-test/alpha-test
-test/blitters-test
+test/check-formats
 test/clip-in
-test/clip-test
-test/combiner-test
 test/composite
-test/composite-test
-test/composite-traps-test
-test/convolution-test
-test/fetch-test
-test/glyph-test
-test/gradient-crash-test
-test/gradient-test
 test/infinite-loop
 test/lowlevel-blt-bench
-test/oob-test
-test/pdf-op-test
-test/prng-test
-test/radial-perf-test
-test/region-contains-test
-test/region-test
+test/radial-invalid
 test/region-translate
-test/region-translate-test
-test/rotate-test
-test/scaling-crash-test
-test/scaling-helpers-test
-test/scaling-test
-test/screen-test
-test/stress-test
+test/scaling-bench
 test/trap-crasher
-test/trap-test
-test/window-test
 *.pdb
 *.dll
 *.lib
-- 
1.7.9.5

___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


[Pixman] [PATCH pixman 07/15] pixman-filter: Speed up the BOX+BOX filter

2015-04-29 Thread Bill Spitzak
This is easy as the caller already intersected the two boxes, so
the width is the integral.
---
 pixman/pixman-filter.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 4aafa51..782f73d 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -182,6 +182,11 @@ integral (pixman_kernel_t reconstruct, double x1,
assert (width == 0.0);
return filters[sample].func (x2 / scale);
 }
+else if (reconstruct == PIXMAN_KERNEL_BOX  sample == PIXMAN_KERNEL_BOX)
+{
+   assert (width = 1.0);
+   return width;
+}
 else if (sample == PIXMAN_KERNEL_IMPULSE)
 {
assert (width == 0.0);
-- 
1.7.9.5

___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


[Pixman] [PATCH pixman 13/15] pixman-filter: refactor cubic polynominal and don't range check

2015-04-29 Thread Bill Spitzak
The other filters do not check for x being in range, so there is
no reason for cubic to do so.
---
 pixman/pixman-filter.c |   16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 7e10108..bf9dce3 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -109,18 +109,16 @@ general_cubic (double x, double B, double C)
 
 if (ax  1)
 {
-   return ((12 - 9 * B - 6 * C) * ax * ax * ax +
-   (-18 + 12 * B + 6 * C) * ax * ax + (6 - 2 * B)) / 6;
-}
-else if (ax = 1  ax  2)
-{
-   return ((-B - 6 * C) * ax * ax * ax +
-   (6 * B + 30 * C) * ax * ax + (-12 * B - 48 * C) *
-   ax + (8 * B + 24 * C)) / 6;
+   return (((12 - 9 * B - 6 * C) * ax +
+(-18 + 12 * B + 6 * C)) * ax * ax +
+   (6 - 2 * B)) / 6;
 }
 else
 {
-   return 0;
+   return -B - 6 * C) * ax +
+(6 * B + 30 * C)) * ax +
+   (-12 * B - 48 * C)) * ax +
+   (8 * B + 24 * C)) / 6;
 }
 }
 
-- 
1.7.9.5

___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


[Pixman] [PATCH pixman 01/15] demos/scale: Compute filter size using boundary of xformed ellipse, not rectangle

2015-04-29 Thread Bill Spitzak
This is much more accurate and less blurry. In particular the filtering does
not change as the image is rotated.
---
 demos/scale.c |   43 ++-
 1 file changed, 2 insertions(+), 41 deletions(-)

diff --git a/demos/scale.c b/demos/scale.c
index d00307e..71c7791 100644
--- a/demos/scale.c
+++ b/demos/scale.c
@@ -55,50 +55,11 @@ get_widget (app_t *app, const char *name)
 return widget;
 }
 
-static double
-min4 (double a, double b, double c, double d)
-{
-double m1, m2;
-
-m1 = MIN (a, b);
-m2 = MIN (c, d);
-return MIN (m1, m2);
-}
-
-static double
-max4 (double a, double b, double c, double d)
-{
-double m1, m2;
-
-m1 = MAX (a, b);
-m2 = MAX (c, d);
-return MAX (m1, m2);
-}
-
 static void
 compute_extents (pixman_f_transform_t *trans, double *sx, double *sy)
 {
-double min_x, max_x, min_y, max_y;
-pixman_f_vector_t v[4] =
-{
-   { { 1, 1, 1 } },
-   { { -1, 1, 1 } },
-   { { -1, -1, 1 } },
-   { { 1, -1, 1 } },
-};
-
-pixman_f_transform_point (trans, v[0]);
-pixman_f_transform_point (trans, v[1]);
-pixman_f_transform_point (trans, v[2]);
-pixman_f_transform_point (trans, v[3]);
-
-min_x = min4 (v[0].v[0], v[1].v[0], v[2].v[0], v[3].v[0]);
-max_x = max4 (v[0].v[0], v[1].v[0], v[2].v[0], v[3].v[0]);
-min_y = min4 (v[0].v[1], v[1].v[1], v[2].v[1], v[3].v[1]);
-max_y = max4 (v[0].v[1], v[1].v[1], v[2].v[1], v[3].v[1]);
-
-*sx = (max_x - min_x) / 2.0;
-*sy = (max_y - min_y) / 2.0;
+*sx = hypot (trans-m[0][0], trans-m[0][1]) / trans-m[2][2];
+*sy = hypot (trans-m[1][0], trans-m[1][1]) / trans-m[2][2];
 }
 
 typedef struct
-- 
1.7.9.5

___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


[Pixman] [PATCH pixman 11/15] pixman-filter: made IMPULSE.IMPULSE not produce a zero-wide filter

2015-04-29 Thread Bill Spitzak
With the other patch to put error on the center pixel, this produces
the same result as BOX.IMPULSE filter.
---
 pixman/pixman-filter.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 00126cd..64981cd 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -327,7 +327,9 @@ pixman_filter_create_separable_convolution (int 
*n_values,
 subsample_y = (1  subsample_bits_y);
 
 width = filter_width (reconstruct_x, sample_x, sx);
+if (width  1) width = 1;
 height = filter_width (reconstruct_y, sample_y, sy);
+if (height  1) height = 1;
 
 *n_values = 4 + width * subsample_x + height * subsample_y;
 
-- 
1.7.9.5

___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


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

2015-04-29 Thread Bill Spitzak
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.
---
 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 bf9dce3..7d7b381 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.7.9.5

___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


[Pixman] [PATCH pixman 02/15] demos/scale: Added pulldown to choose PIXMAN_FILTER_* value

2015-04-29 Thread Bill Spitzak
This allows testing of GOOD/BEST and to do comparisons between
the basic filters and PIXMAN_FILTER_SEPARABLE_CONVOLUTION settings.
---
 demos/scale.c  |   14 +-
 demos/scale.ui |   40 ++--
 2 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/demos/scale.c b/demos/scale.c
index 71c7791..203168f 100644
--- a/demos/scale.c
+++ b/demos/scale.c
@@ -68,6 +68,15 @@ typedef struct
 intvalue;
 } named_int_t;
 
+static const named_int_t filter_types[] =
+{
+{ Separable, PIXMAN_FILTER_SEPARABLE_CONVOLUTION },
+{ Nearest,   PIXMAN_FILTER_NEAREST },
+{ Bilinear,  PIXMAN_FILTER_BILINEAR },
+{ Good,  PIXMAN_FILTER_GOOD },
+{ Best,  PIXMAN_FILTER_BEST },
+};
+
 static const named_int_t filters[] =
 {
 { Box,   PIXMAN_KERNEL_BOX },
@@ -201,7 +210,9 @@ rescale (GtkWidget *may_be_null, app_t *app)
gtk_adjustment_get_value (app-subsample_adjustment),
gtk_adjustment_get_value (app-subsample_adjustment));
 
-pixman_image_set_filter (app-original, 
PIXMAN_FILTER_SEPARABLE_CONVOLUTION, params, n_params);
+pixman_image_set_filter (app-original,
+   get_value (app, filter_types, filter_combo_box),
+   params, n_params);
 
 pixman_image_set_repeat (
 app-original, get_value (app, repeats, repeat_combo_box));
@@ -343,6 +354,7 @@ app_new (pixman_image_t *original)
 widget = get_widget (app, drawing_area);
 g_signal_connect (widget, expose_event, G_CALLBACK (on_expose), app);
 
+set_up_combo_box (app, filter_combo_box, G_N_ELEMENTS (filter_types), 
filter_types);
 set_up_filter_box (app, reconstruct_x_combo_box);
 set_up_filter_box (app, reconstruct_y_combo_box);
 set_up_filter_box (app, sample_x_combo_box);
diff --git a/demos/scale.ui b/demos/scale.ui
index ee985dd..b62cbfb 100644
--- a/demos/scale.ui
+++ b/demos/scale.ui
@@ -191,12 +191,23 @@
 property name=column_spacing8/property
 property name=row_spacing6/property
 child
+  object class=GtkLabel id=labelF
+property name=visibleTrue/property
+property name=xalign1/property
+property name=label 
translatable=yeslt;bgt;Filter:lt;/bgt;/property
+property name=use_markupTrue/property
+  /object
+/child
+child
   object class=GtkLabel id=label4
 property name=visibleTrue/property
 property name=xalign1/property
 property name=label 
translatable=yeslt;bgt;Reconstruct X:lt;/bgt;/property
 property name=use_markupTrue/property
   /object
+  packing
+property name=top_attach1/property
+  /packing
 /child
 child
   object class=GtkLabel id=label5
@@ -206,7 +217,7 @@
 property name=use_markupTrue/property
   /object
   packing
-property name=top_attach1/property
+property name=top_attach2/property
   /packing
 /child
 child
@@ -217,7 +228,7 @@
 property name=use_markupTrue/property
   /object
   packing
-property name=top_attach2/property
+property name=top_attach3/property
   /packing
 /child
 child
@@ -228,7 +239,7 @@
 property name=use_markupTrue/property
   /object
   packing
-property name=top_attach3/property
+property name=top_attach4/property
   /packing
 /child
 child
@@ -239,7 +250,7 @@
 property name=use_markupTrue/property
   /object
   packing
-property name=top_attach4/property
+property name=top_attach5/property
   /packing
 /child
 child
@@ -250,7 +261,15 @@
 property name=use_markupTrue/property
   /object
   packing
-property name=top_attach5/property
+property name=top_attach6/property
+  /packing
+/child
+child
+  object class=GtkComboBox id=filter_combo_box
+  

[Pixman] [PATCH pixman 12/15] pixman-filter: Turn off subsampling when not necessary

2015-04-29 Thread Bill Spitzak
If sample is IMPULSE and reconstruct is BOX or IMPULSE the sub-pixel
position of the sample is not relevant, so only one subsample is needed.
---
 pixman/pixman-filter.c |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 64981cd..7e10108 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -230,6 +230,8 @@ filter_width (pixman_kernel_t reconstruct,
  pixman_kernel_t sample,
  double scale)
 {
+if (reconstruct == PIXMAN_KERNEL_BOX  sample == PIXMAN_KERNEL_IMPULSE)
+   return 0;
 return ceil (scale * filters[sample].width + filters[reconstruct].width);
 }
 
@@ -323,13 +325,13 @@ pixman_filter_create_separable_convolution (int   
  *n_values,
 int subsample_x, subsample_y;
 int width, height;
 
-subsample_x = (1  subsample_bits_x);
-subsample_y = (1  subsample_bits_y);
-
 width = filter_width (reconstruct_x, sample_x, sx);
-if (width  1) width = 1;
+if (width  1) { width = 1; subsample_bits_x = 0; }
 height = filter_width (reconstruct_y, sample_y, sy);
-if (height  1) height = 1;
+if (height  1) { height = 1; subsample_bits_y = 0; }
+
+subsample_x = (1  subsample_bits_x);
+subsample_y = (1  subsample_bits_y);
 
 *n_values = 4 + width * subsample_x + height * subsample_y;
 
-- 
1.7.9.5

___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


[Pixman] [PATCH pixman 05/15] pixman-filter: Correct Simpsons integration

2015-04-29 Thread Bill Spitzak
Simpsons uses cubic curve fitting, with 3 samples defining each cubic. This
makes the weights of the samples be in a pattern of 1,4,2,4,2...4,1, and then
dividing the result by 3.

The previous code was using weights of 1,2,6,6...6,2,1 which produced about 2x
the correct value, as it was still dividing by 3. The filter normalization
removed this error. Also this is effectively a linear interpolation except for
the ends.
---
 pixman/pixman-filter.c |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index 15f9069..7c1da0d 100644
--- a/pixman/pixman-filter.c
+++ b/pixman/pixman-filter.c
@@ -204,11 +204,14 @@ integral (pixman_kernel_t reconstruct, double x1,
{
double a1 = x1 + h * i;
double a2 = x2 + h * i;
+   s += 4 * SAMPLE(a1, a2);
+   }
 
-   s += 2 * SAMPLE (a1, a2);
-
-   if (i = 2  i  N_SEGMENTS - 1)
-   s += 4 * SAMPLE (a1, a2);
+   for (i = 2; i  N_SEGMENTS; i += 2)
+   {
+   double a1 = x1 + h * i;
+   double a2 = x2 + h * i;
+   s += 2 * SAMPLE(a1, a2);
}
 
s += SAMPLE (x1 + width, x2 + width);
-- 
1.7.9.5

___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman