diff options
author | Isabella Gottardi <isabella.gottardi@arm.com> | 2017-11-08 11:13:23 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | 43ce898014faabbe8ab1cdf714b7aad3d3c9b2a9 (patch) | |
tree | 43a2f75b86c39628878b5697a388fefeac77c7ed /tests/validation/CPP/Sobel.cpp | |
parent | c1294faa1d60274aa14567338fc2a449c70c1801 (diff) | |
download | ComputeLibrary-43ce898014faabbe8ab1cdf714b7aad3d3c9b2a9.tar.gz |
COMPMID-670 - Extend Sobel tests
Change-Id: Ibf15544e8624977815ee355071a038c07e1f01c2
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/94874
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'tests/validation/CPP/Sobel.cpp')
-rw-r--r-- | tests/validation/CPP/Sobel.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/tests/validation/CPP/Sobel.cpp b/tests/validation/CPP/Sobel.cpp index 314fbd4f8a..ff0e11d3a8 100644 --- a/tests/validation/CPP/Sobel.cpp +++ b/tests/validation/CPP/Sobel.cpp @@ -103,7 +103,7 @@ struct data_type<int> } // namespace template <typename T, typename U> -std::pair<SimpleTensor<T>, SimpleTensor<T>> sobel(const SimpleTensor<U> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value) +std::pair<SimpleTensor<T>, SimpleTensor<T>> sobel(const SimpleTensor<U> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value, GradientDimension gradient_dimension) { SimpleTensor<T> dst_x(src.shape(), data_type<T>::value, src.num_channels()); SimpleTensor<T> dst_y(src.shape(), data_type<T>::value, src.num_channels()); @@ -118,18 +118,34 @@ std::pair<SimpleTensor<T>, SimpleTensor<T>> sobel(const SimpleTensor<U> &src, in { continue; } - - apply_2d_spatial_filter(coord, src, dst_x, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).first, 1.f, border_mode, - constant_border_value); - apply_2d_spatial_filter(coord, src, dst_y, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).second, 1.f, border_mode, - constant_border_value); + switch(gradient_dimension) + { + case GradientDimension::GRAD_X: + apply_2d_spatial_filter(coord, src, dst_x, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).first, 1.f, border_mode, + constant_border_value); + break; + case GradientDimension::GRAD_Y: + apply_2d_spatial_filter(coord, src, dst_y, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).second, 1.f, border_mode, + constant_border_value); + break; + case GradientDimension::GRAD_XY: + apply_2d_spatial_filter(coord, src, dst_x, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).first, 1.f, border_mode, + constant_border_value); + apply_2d_spatial_filter(coord, src, dst_y, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).second, 1.f, border_mode, + constant_border_value); + break; + default: + ARM_COMPUTE_ERROR("Gradient dimension not supported"); + } } return std::make_pair(dst_x, dst_y); } -template std::pair<SimpleTensor<int16_t>, SimpleTensor<int16_t>> sobel(const SimpleTensor<uint8_t> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value); -template std::pair<SimpleTensor<int>, SimpleTensor<int>> sobel(const SimpleTensor<uint8_t> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value); +template std::pair<SimpleTensor<int16_t>, SimpleTensor<int16_t>> sobel(const SimpleTensor<uint8_t> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value, + GradientDimension gradient_dimension); +template std::pair<SimpleTensor<int>, SimpleTensor<int>> sobel(const SimpleTensor<uint8_t> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value, + GradientDimension gradient_dimension); } // namespace reference } // namespace validation } // namespace test |