diff options
Diffstat (limited to 'tests/validation/CL/Sobel3x3.cpp')
-rw-r--r-- | tests/validation/CL/Sobel3x3.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/tests/validation/CL/Sobel3x3.cpp b/tests/validation/CL/Sobel3x3.cpp index 382e296180..fbd7185a48 100644 --- a/tests/validation/CL/Sobel3x3.cpp +++ b/tests/validation/CL/Sobel3x3.cpp @@ -53,6 +53,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 Sobel 3x3 function. * * @param[in] shape Shape of the input and output tensors. @@ -121,11 +124,7 @@ BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * BorderMode // Validate valid region const ValidRegion src_valid_region = shape_to_valid_region(shape); - ValidRegion dst_valid_region = shape_to_valid_region(shape); - if(border_mode == BorderMode::UNDEFINED) - { - dst_valid_region = shape_to_valid_region_undefined_border(shape, 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_x.info()->valid_region(), dst_valid_region); @@ -169,11 +168,7 @@ BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * BorderModes(), shape, border_mode std::pair<RawTensor, RawTensor> ref_dst = Reference::compute_reference_sobel_3x3(shape, border_mode, constant_border_value); // Calculate valid region - ValidRegion valid_region = shape_to_valid_region(shape); - if(border_mode == BorderMode::UNDEFINED) - { - valid_region = shape_to_valid_region_undefined_border(shape, BorderSize(1)); - } + const ValidRegion valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, border_size); // Validate output validate(CLAccessor(dst.first), ref_dst.first, valid_region); @@ -200,11 +195,7 @@ BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * BorderModes(), shape, border_mode std::pair<RawTensor, RawTensor> ref_dst = Reference::compute_reference_sobel_3x3(shape, border_mode, constant_border_value); // Calculate valid region - ValidRegion valid_region = shape_to_valid_region(shape); - if(border_mode == BorderMode::UNDEFINED) - { - valid_region = shape_to_valid_region_undefined_border(shape, BorderSize(1)); - } + const ValidRegion valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, border_size); // Validate output validate(CLAccessor(dst.first), ref_dst.first, valid_region); |