From d8b03dd029261091e34dd8831d546299c60ce094 Mon Sep 17 00:00:00 2001 From: Pablo Tello Date: Tue, 7 Aug 2018 11:23:54 +0100 Subject: MLCE-13: Sanitizing matrix argument in the Warp. This changes help to prevent errors like passing a matrix with less elements than required into the warp functions. Change-Id: I863f933a5e0568258717cffed3a20788d3d03083 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/143044 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- tests/validation/fixtures/WarpPerspectiveFixture.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tests/validation/fixtures/WarpPerspectiveFixture.h') diff --git a/tests/validation/fixtures/WarpPerspectiveFixture.h b/tests/validation/fixtures/WarpPerspectiveFixture.h index c804fa6da7..0eba97c47c 100644 --- a/tests/validation/fixtures/WarpPerspectiveFixture.h +++ b/tests/validation/fixtures/WarpPerspectiveFixture.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -64,8 +64,8 @@ public: std::array matrix = { { 0 } }; fill_warp_matrix<9>(matrix); - _target = compute_target(input_shape, vmask_shape, matrix.data(), policy, border_mode, constant_border_value, data_type); - _reference = compute_reference(input_shape, vmask_shape, matrix.data(), policy, border_mode, constant_border_value, data_type); + _target = compute_target(input_shape, vmask_shape, matrix, policy, border_mode, constant_border_value, data_type); + _reference = compute_reference(input_shape, vmask_shape, matrix, policy, border_mode, constant_border_value, data_type); } protected: @@ -75,7 +75,8 @@ protected: library->fill_tensor_uniform(tensor, 0); } - TensorType compute_target(const TensorShape &shape, const TensorShape &vmask_shape, const float *matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value, + TensorType compute_target(const TensorShape &shape, const TensorShape &vmask_shape, const std::array &matrix, InterpolationPolicy policy, BorderMode border_mode, + uint8_t constant_border_value, DataType data_type) { // Create tensors @@ -105,7 +106,8 @@ protected: return dst; } - SimpleTensor compute_reference(const TensorShape &shape, const TensorShape &vmask_shape, const float *matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value, + SimpleTensor compute_reference(const TensorShape &shape, const TensorShape &vmask_shape, const std::array &matrix, InterpolationPolicy policy, BorderMode border_mode, + uint8_t constant_border_value, DataType data_type) { ARM_COMPUTE_ERROR_ON(data_type != DataType::U8); @@ -120,7 +122,7 @@ protected: fill(src); // Compute reference - return reference::warp_perspective(src, _valid_mask, matrix, policy, border_mode, constant_border_value); + return reference::warp_perspective(src, _valid_mask, matrix.data(), policy, border_mode, constant_border_value); } TensorType _target{}; -- cgit v1.2.1