diff options
author | John Richardson <john.richardson@arm.com> | 2018-03-22 13:48:41 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:52:54 +0000 |
commit | 2d008a476f5f09f63574990a93e8bf606ae5629e (patch) | |
tree | 8737a091ff12dabeb711b38984e321921b19173b /tests/Utils.h | |
parent | e0078dde6e1d41ed59cfcb4120aab8630a4213b7 (diff) | |
download | ComputeLibrary-2d008a476f5f09f63574990a93e8bf606ae5629e.tar.gz |
COMPMID-586: Port LaplacianPyramid to new validation
Change-Id: Ic746d5f297eb354e63cefa8c682b03fc339be81d
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/128409
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: John Richardson <john.richardson@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/Utils.h')
-rw-r--r-- | tests/Utils.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/Utils.h b/tests/Utils.h index 7d960dd08f..d0eebb1204 100644 --- a/tests/Utils.h +++ b/tests/Utils.h @@ -306,6 +306,38 @@ inline ValidRegion shape_to_valid_region_gaussian_pyramid_half(const TensorShape return valid_region; } +/** Create a valid region for Laplacian Pyramid based on tensor shape and valid region at level "i - 1" and border mode + * + * @note The border size is 2 in case of Laplacian Pyramid + * + * @param[in] a_shape Shape used at level "i - 1" of Laplacian Pyramid + * @param[in] a_valid_region Valid region used at level "i - 1" of Laplacian Pyramid + * @param[in] border_undefined (Optional) Boolean indicating if the border mode is undefined. + * + * return The valid region for the level "i" of Laplacian Pyramid + */ +inline ValidRegion shape_to_valid_region_laplacian_pyramid(const TensorShape &a_shape, const ValidRegion &a_valid_region, bool border_undefined = false) +{ + ValidRegion valid_region = shape_to_valid_region_gaussian_pyramid_half(a_shape, a_valid_region, border_undefined); + + if(border_undefined) + { + const BorderSize gaussian5x5_border(2); + + auto border_left = static_cast<int>(gaussian5x5_border.left); + auto border_right = static_cast<int>(gaussian5x5_border.right); + auto border_top = static_cast<int>(gaussian5x5_border.top); + auto border_bottom = static_cast<int>(gaussian5x5_border.bottom); + + valid_region.anchor.set(0, valid_region.anchor[0] + border_left); + valid_region.anchor.set(1, valid_region.anchor[1] + border_top); + valid_region.shape.set(0, std::max(0, static_cast<int>(valid_region.shape[0]) - border_right - border_left)); + valid_region.shape.set(1, std::max(0, static_cast<int>(valid_region.shape[1]) - border_top - border_bottom)); + } + + return valid_region; +} + /** Write the value after casting the pointer according to @p data_type. * * @warning The type of the value must match the specified data type. |