From 7a0357549a0ffa0ea3ea56fa791a15a35368afe8 Mon Sep 17 00:00:00 2001 From: SiCong Li Date: Wed, 28 Jun 2017 15:27:02 +0100 Subject: COMPMID-424 Clean up validation tests for 2D spatial filter functions * Remove shape_to_valid_region_undefined_border * Remove hardcoded border size Change-Id: I3c64148d8f7ce7e960f21d88d3af43bb23501683 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79106 Reviewed-by: Moritz Pflanzer Tested-by: Kaizen Reviewed-by: Georgios Pinitas --- tests/validation/CL/Gaussian3x3.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tests/validation/CL/Gaussian3x3.cpp') diff --git a/tests/validation/CL/Gaussian3x3.cpp b/tests/validation/CL/Gaussian3x3.cpp index 5bf830b10d..2a526e8417 100644 --- a/tests/validation/CL/Gaussian3x3.cpp +++ b/tests/validation/CL/Gaussian3x3.cpp @@ -51,6 +51,9 @@ using namespace arm_compute::test::validation; namespace { +constexpr unsigned int filter_size = 3; /** Size of the kernel/filter in number of elements. */ +constexpr BorderSize border_size(filter_size / 2); /** Border size of the kernel/filter around its central element. */ + /** Compute CL gaussian3x3 filter. * * @param[in] shape Shape of the input and output tensors. @@ -106,7 +109,7 @@ BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * BorderMode // Validate valid region const ValidRegion src_valid_region = shape_to_valid_region(shape); - const ValidRegion dst_valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(1)); + const ValidRegion dst_valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, border_size); validate(src.info()->valid_region(), src_valid_region); validate(dst.info()->valid_region(), dst_valid_region); @@ -140,7 +143,7 @@ BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * BorderModes(), shape, border_mode RawTensor ref_dst = Reference::compute_reference_gaussian3x3(shape, border_mode, border_value); // Validate output - validate(CLAccessor(dst), ref_dst, shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(1))); + validate(CLAccessor(dst), ref_dst, shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, border_size)); } BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly")) @@ -157,7 +160,7 @@ BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * BorderModes(), shape, border_mode RawTensor ref_dst = Reference::compute_reference_gaussian3x3(shape, border_mode, border_value); // Validate output - validate(CLAccessor(dst), ref_dst, shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(1))); + validate(CLAccessor(dst), ref_dst, shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, border_size)); } BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1