From: Siarhei Siamashka <siarhei.siamas...@nokia.com>

The upcoming optimization which is going to be able to replace BILINEAR filter
with NEAREST where appropriate needs to analyze the transformation matrix
and not to make any mistakes.

The changes to affine-test include:
1. Higher chance of using the same scale factor for x and y axes. This can help
   to stress some special cases (for example the case when both x and y scale
   factors are integer). The same applies to x/y translation.
2. Introduced a small chance for "corrupting" transformation matrix by flipping
   random bits. This supposedly can help to identify the cases when some of the
   fast paths or other code logic is wrongly activated due to insufficient 
checks.
---
 test/affine-test.c |   36 ++++++++++++++++++++++++++++++------
 1 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/test/affine-test.c b/test/affine-test.c
index ed8000c..ddeca56 100644
--- a/test/affine-test.c
+++ b/test/affine-test.c
@@ -100,13 +100,22 @@ test_composite (int      testnum,
 
     pixman_transform_init_identity (&transform);
     
-    if (lcg_rand_n (8) > 0)
+    if (lcg_rand_n (3) > 0)
     {
-       scale_x = -32768 * 3 + lcg_rand_N (65536 * 5);
-       scale_y = -32768 * 3 + lcg_rand_N (65536 * 5);
-       translate_x = lcg_rand_N (65536);
-       translate_y = lcg_rand_N (65536);
+       scale_x = -65536 * 3 + lcg_rand_N (65536 * 6);
+       if (lcg_rand_n (2))
+           scale_y = -65536 * 3 + lcg_rand_N (65536 * 6);
+       else
+           scale_y = scale_x;
        pixman_transform_init_scale (&transform, scale_x, scale_y);
+    }
+    if (lcg_rand_n (3) > 0)
+    {
+       translate_x = -65536 * 3 + lcg_rand_N (6 * 65536);
+       if (lcg_rand_n (2))
+           translate_y = -65536 * 3 + lcg_rand_N (6 * 65536);
+       else
+           translate_y = translate_x;
        pixman_transform_translate (&transform, NULL, translate_x, translate_y);
     }
 
@@ -144,6 +153,21 @@ test_composite (int      testnum,
        pixman_transform_translate (&transform, NULL, tx, ty);
     }
 
+    if (lcg_rand_n (8) == 0)
+    {
+       /* Flip random bits */
+       int maxflipcount = 8;
+       while (maxflipcount--)
+       {
+           int i = lcg_rand_n (2);
+           int j = lcg_rand_n (3);
+           int bitnum = lcg_rand_n (32);
+           transform.matrix[i][j] ^= 1 << bitnum;
+           if (lcg_rand_n (2))
+               break;
+       }
+    }
+
     pixman_image_set_transform (src_img, &transform);
     
     switch (lcg_rand_n (4))
@@ -282,6 +306,6 @@ main (int argc, const char *argv[])
 {
     pixman_disable_out_of_bounds_workaround ();
 
-    return fuzzer_test_main ("affine", 8000000, 0x4B5D1852,
+    return fuzzer_test_main ("affine", 8000000, 0x02A33034,
                             test_composite, argc, argv);
 }
-- 
1.6.0.6

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

Reply via email to