aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/CPP/Utils.h
diff options
context:
space:
mode:
authorDaniil Efremov <daniil.efremov@xored.com>2017-11-14 21:25:34 +0700
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit7a49c7993a8b2c670f7caa90e3fbe8a5f1c03078 (patch)
treee043cff3fe7d9f9d014ecc5c2c2348d03f9dcaa4 /tests/validation/CPP/Utils.h
parent50fbc6f0a1e781d4f9f83d1e4ea2588390facea2 (diff)
downloadComputeLibrary-7a49c7993a8b2c670f7caa90e3fbe8a5f1c03078.tar.gz
COMPMID-661: issue# 23 Scale border fix (#26)
Changes in CL and reference in terms of border handling. Change-Id: I5bed95b1f4c308629d7113455dc8a55d74500bcd Reviewed-on: http://mpd-gerrit.cambridge.arm.com/95742 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/validation/CPP/Utils.h')
-rw-r--r--tests/validation/CPP/Utils.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/validation/CPP/Utils.h b/tests/validation/CPP/Utils.h
index 0733411462..2aa77c6ff7 100644
--- a/tests/validation/CPP/Utils.h
+++ b/tests/validation/CPP/Utils.h
@@ -41,6 +41,21 @@ namespace test
{
namespace validation
{
+/** Checks if a pixel has valid coordinates
+ *
+ * @param x X coordinate
+ * @param y Y coordinate
+ * @param width Width of the image
+ * @param height Height of the image
+ * @param border_size Border size
+ *
+ * @return True if pixel is valid else false
+ */
+inline bool is_valid_pixel_index(int x, int y, int width, int height, int border_size)
+{
+ return ((x >= -border_size) && (y >= -border_size) && (x < (width + border_size)) && (y < height + border_size));
+}
+
// Return a tensor element at a specified coordinate with different border modes
template <typename T>
T tensor_elem_at(const SimpleTensor<T> &src, Coordinates coord, BorderMode border_mode, T constant_border_value)