summaryrefslogtreecommitdiffstats
path: root/qemu/pixman/test/scaling-helpers-test.c
diff options
context:
space:
mode:
authorRajithaY <rajithax.yerrumsetty@intel.com>2017-04-25 03:31:15 -0700
committerRajitha Yerrumchetty <rajithax.yerrumsetty@intel.com>2017-05-22 06:48:08 +0000
commitbb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch)
treeca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/pixman/test/scaling-helpers-test.c
parenta14b48d18a9ed03ec191cf16b162206998a895ce (diff)
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to kvmfornfv repo and make use of the updated latest qemu for the execution of all testcase Change-Id: I1280af507a857675c7f81d30c95255635667bdd7 Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/pixman/test/scaling-helpers-test.c')
-rw-r--r--qemu/pixman/test/scaling-helpers-test.c92
1 files changed, 0 insertions, 92 deletions
diff --git a/qemu/pixman/test/scaling-helpers-test.c b/qemu/pixman/test/scaling-helpers-test.c
deleted file mode 100644
index cd5ace0b2..000000000
--- a/qemu/pixman/test/scaling-helpers-test.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include "utils.h"
-#include "pixman-inlines.h"
-
-/* A trivial reference implementation for
- * 'bilinear_pad_repeat_get_scanline_bounds'
- */
-static void
-bilinear_pad_repeat_get_scanline_bounds_ref (int32_t source_image_width,
- pixman_fixed_t vx_,
- pixman_fixed_t unit_x,
- int32_t * left_pad,
- int32_t * left_tz,
- int32_t * width,
- int32_t * right_tz,
- int32_t * right_pad)
-{
- int w = *width;
- int64_t vx = vx_;
- *left_pad = 0;
- *left_tz = 0;
- *width = 0;
- *right_tz = 0;
- *right_pad = 0;
- while (--w >= 0)
- {
- if (vx < 0)
- {
- if (vx + pixman_fixed_1 < 0)
- *left_pad += 1;
- else
- *left_tz += 1;
- }
- else if (vx + pixman_fixed_1 >= pixman_int_to_fixed (source_image_width))
- {
- if (vx >= pixman_int_to_fixed (source_image_width))
- *right_pad += 1;
- else
- *right_tz += 1;
- }
- else
- {
- *width += 1;
- }
- vx += unit_x;
- }
-}
-
-int
-main (void)
-{
- int i;
- prng_srand (0);
- for (i = 0; i < 10000; i++)
- {
- int32_t left_pad1, left_tz1, width1, right_tz1, right_pad1;
- int32_t left_pad2, left_tz2, width2, right_tz2, right_pad2;
- pixman_fixed_t vx = prng_rand_n(10000 << 16) - (3000 << 16);
- int32_t width = prng_rand_n(10000);
- int32_t source_image_width = prng_rand_n(10000) + 1;
- pixman_fixed_t unit_x = prng_rand_n(10 << 16) + 1;
- width1 = width2 = width;
-
- bilinear_pad_repeat_get_scanline_bounds_ref (source_image_width,
- vx,
- unit_x,
- &left_pad1,
- &left_tz1,
- &width1,
- &right_tz1,
- &right_pad1);
-
- bilinear_pad_repeat_get_scanline_bounds (source_image_width,
- vx,
- unit_x,
- &left_pad2,
- &left_tz2,
- &width2,
- &right_tz2,
- &right_pad2);
-
- assert (left_pad1 == left_pad2);
- assert (left_tz1 == left_tz2);
- assert (width1 == width2);
- assert (right_tz1 == right_tz2);
- assert (right_pad1 == right_pad2);
- }
-
- return 0;
-}