aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/Window.inl
diff options
context:
space:
mode:
authorAnthony Barbier <anthony.barbier@arm.com>2018-06-04 14:09:09 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:52:54 +0000
commit7d920f4ce6e9b7b0f6d03fcac2c9598122de5404 (patch)
treea4326027f67b4e8fd256e1047d35677552897e46 /arm_compute/core/Window.inl
parentb95e2106d2e935cb8542f8b9600a2c95ee1c4a5d (diff)
downloadComputeLibrary-7d920f4ce6e9b7b0f6d03fcac2c9598122de5404.tar.gz
COMPMID-1246 Fixed Window::scale()
- There used to be two problems with scale(): - The first argument of ceil_to_multiple was promoted to float which broke the function (For example ceil_to_multiple( 24.0, 8 ) will return 31. - "End - start" needs to be a multiple of step, not "end" (e.g start=1, end =5, step =4 is a valid dimension) The reason it didn't break before is because Window::scale() was only used on windows used by iterators, and therefore the "end" value is not used in that context. Change-Id: I1798db73014294ac82eed53c74eec3d4b8cb7d59 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/133967 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'arm_compute/core/Window.inl')
-rw-r--r--arm_compute/core/Window.inl11
1 files changed, 7 insertions, 4 deletions
diff --git a/arm_compute/core/Window.inl b/arm_compute/core/Window.inl
index 18d454a0cb..8401227eee 100644
--- a/arm_compute/core/Window.inl
+++ b/arm_compute/core/Window.inl
@@ -134,10 +134,13 @@ inline void Window::adjust(size_t dimension, int adjust_value, bool is_at_start)
inline void Window::scale(size_t dimension, float scale_value)
{
ARM_COMPUTE_ERROR_ON(dimension >= Coordinates::num_max_dimensions);
- Window::Dimension &d = _dims[dimension];
- const int scaled_step = d.step() * scale_value;
- const int scaled_end = ceil_to_multiple(d.end() * scale_value, scaled_step);
- d = Window::Dimension(d.start() * scale_value, scaled_end, scaled_step);
+ Window::Dimension &d = _dims[dimension];
+ const int scaled_step = d.step() * scale_value;
+ const int scaled_start = d.start() * scale_value;
+ const int scaled_diff = (d.end() - d.start()) * scale_value;
+ const int scaled_end = scaled_start + ceil_to_multiple(scaled_diff, scaled_step);
+
+ d = Window::Dimension(scaled_start, scaled_end, scaled_step);
}
inline void Window::set_dimension_step(size_t dimension, int step)