From 2876d8d3dd6a71cb9eb3ac93e5b9c18b71a452da Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Fri, 4 Sep 2015 03:09:20 +0100 Subject: [PATCH] affine-bench: remove 8e margin from COVER area Patch "Remove the 8e extra safety margin in COVER_CLIP analysis" reduced the required image area for setting the COVER flags in pixman.c:analyze_extent(). Do the same reduction in affine-bench. Leaving the old calculations in place would be very confusing for anyone reading the code. Also add a comment that explains how affine-bench wants to hit the COVER paths. This explains why the intricate extent calculations are copied from pixman.c. [Pekka: split patch, change comments, write commit message] Signed-off-by: Pekka Paalanen Reviewed-by: Ben Avison --- test/affine-bench.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/test/affine-bench.c b/test/affine-bench.c index 9e0121e..86bf46e 100644 --- a/test/affine-bench.c +++ b/test/affine-bench.c @@ -395,14 +395,26 @@ main (int argc, char *argv[]) return EXIT_FAILURE; } + /* Compute required extents for source and mask image so they qualify + * for COVER fast paths and get the flags in pixman.c:analyze_extent(). + * These computations are for FAST_PATH_SAMPLES_COVER_CLIP_BILINEAR, + * but at the same time they also allow COVER_CLIP_NEAREST. + */ compute_transformed_extents (&binfo.transform, &dest_box, &transformed); - /* The source area is expanded by a tiny bit (8/65536th pixel) - * to match the calculation of the COVER_CLIP flags in analyze_extent() + xmin = pixman_fixed_to_int (transformed.x1 - pixman_fixed_1 / 2); + ymin = pixman_fixed_to_int (transformed.y1 - pixman_fixed_1 / 2); + xmax = pixman_fixed_to_int (transformed.x2 + pixman_fixed_1 / 2); + ymax = pixman_fixed_to_int (transformed.y2 + pixman_fixed_1 / 2); + /* Note: + * The upper limits can be reduced to the following when fetchers + * are guaranteed to not access pixels with zero weight. This concerns + * particularly all bilinear samplers. + * + * xmax = pixman_fixed_to_int (transformed.x2 + pixman_fixed_1 / 2 - pixman_fixed_e); + * ymax = pixman_fixed_to_int (transformed.y2 + pixman_fixed_1 / 2 - pixman_fixed_e); + * This is equivalent to subtracting 0.5 and rounding up, rather than + * subtracting 0.5, rounding down and adding 1. */ - xmin = pixman_fixed_to_int (transformed.x1 - 8 * pixman_fixed_e - pixman_fixed_1 / 2); - ymin = pixman_fixed_to_int (transformed.y1 - 8 * pixman_fixed_e - pixman_fixed_1 / 2); - xmax = pixman_fixed_to_int (transformed.x2 + 8 * pixman_fixed_e + pixman_fixed_1 / 2); - ymax = pixman_fixed_to_int (transformed.y2 + 8 * pixman_fixed_e + pixman_fixed_1 / 2); binfo.src_x = -xmin; binfo.src_y = -ymin; -- 2.34.1