From bcbc970f1f5b47f7314a5ad078820bc8a5edca94 Mon Sep 17 00:00:00 2001 From: Diego Lopez Recas Date: Mon, 18 Dec 2017 11:28:27 +0000 Subject: IVGCVSW-863 calculate_max_window..() family takes ValidRegion Change-Id: I91e39713ffa580e9d2213988ad3517a8a41bf4e8 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/114013 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- arm_compute/core/Helpers.inl | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'arm_compute/core/Helpers.inl') diff --git a/arm_compute/core/Helpers.inl b/arm_compute/core/Helpers.inl index 4121fb1e8d..6d0f8b0104 100644 --- a/arm_compute/core/Helpers.inl +++ b/arm_compute/core/Helpers.inl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016, 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -284,11 +284,14 @@ inline bool set_quantization_info_if_empty(ITensorInfo &info, QuantizationInfo q inline ValidRegion calculate_valid_region_scale(const ITensorInfo &src_info, const TensorShape &dst_shape, InterpolationPolicy policy, BorderSize border_size, bool border_undefined) { - const auto wr = static_cast(dst_shape[0]) / static_cast(src_info.tensor_shape()[0]); - const auto hr = static_cast(dst_shape[1]) / static_cast(src_info.tensor_shape()[1]); - Coordinates anchor; - anchor.set_num_dimensions(src_info.tensor_shape().num_dimensions()); - TensorShape new_dst_shape(dst_shape); + const auto wr = static_cast(dst_shape[0]) / static_cast(src_info.tensor_shape()[0]); + const auto hr = static_cast(dst_shape[1]) / static_cast(src_info.tensor_shape()[1]); + + ValidRegion valid_region{ Coordinates(), dst_shape, src_info.tensor_shape().num_dimensions() }; + + Coordinates &anchor = valid_region.anchor; + TensorShape &shape = valid_region.shape; + anchor.set(0, (policy == InterpolationPolicy::BILINEAR && border_undefined) ? ((static_cast(src_info.valid_region().anchor[0]) + border_size.left + 0.5f) * wr - 0.5f) : @@ -306,10 +309,10 @@ inline ValidRegion calculate_valid_region_scale(const ITensorInfo &src_info, con ((static_cast(src_info.valid_region().anchor[1]) + static_cast(src_info.valid_region().shape[1]) - 1) - 1 + 0.5f) * hr - 0.5f : ((static_cast(src_info.valid_region().anchor[1]) + static_cast(src_info.valid_region().shape[1])) + 0.5f) * hr - 0.5f; - new_dst_shape.set(0, shape_out_x - anchor[0]); - new_dst_shape.set(1, shape_out_y - anchor[1]); + shape.set(0, shape_out_x - anchor[0]); + shape.set(1, shape_out_y - anchor[1]); - return ValidRegion(std::move(anchor), std::move(new_dst_shape)); + return valid_region; } inline Coordinates index2coords(const TensorShape &shape, int index) -- cgit v1.2.1