From 3021edfb5e72ef4cd91dbc754ce6ac55388ebc4e Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Mon, 18 Sep 2017 17:55:22 +0100 Subject: COMPMID-417: Fix NEGaussianPyramidOrb. Change-Id: I9e89136a926f33cc591784d4e7785618bba7b0b2 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/88116 Reviewed-by: Pablo Tello Tested-by: Kaizen --- .../runtime/NEON/functions/NEGaussianPyramid.h | 5 ++--- arm_compute/runtime/NEON/functions/NEScale.h | 6 +----- src/runtime/NEON/functions/NEGaussianPyramid.cpp | 22 +++++----------------- src/runtime/NEON/functions/NEScale.cpp | 15 ++------------- 4 files changed, 10 insertions(+), 38 deletions(-) diff --git a/arm_compute/runtime/NEON/functions/NEGaussianPyramid.h b/arm_compute/runtime/NEON/functions/NEGaussianPyramid.h index 5f0a67ea05..b4ed56a0c3 100644 --- a/arm_compute/runtime/NEON/functions/NEGaussianPyramid.h +++ b/arm_compute/runtime/NEON/functions/NEGaussianPyramid.h @@ -26,10 +26,10 @@ #include "arm_compute/core/IPyramid.h" #include "arm_compute/core/NEON/kernels/NEGaussianPyramidKernel.h" -#include "arm_compute/core/NEON/kernels/NEScaleKernel.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/IFunction.h" #include "arm_compute/runtime/NEON/functions/NEGaussian5x5.h" +#include "arm_compute/runtime/NEON/functions/NEScale.h" #include "arm_compute/runtime/Pyramid.h" #include "arm_compute/runtime/Tensor.h" @@ -114,9 +114,8 @@ public: void run() override; private: - std::unique_ptr _offsets; std::unique_ptr _gaus5x5; - std::unique_ptr _scale_nearest; + std::unique_ptr _scale_nearest; }; } #endif /*__ARM_COMPUTE_NEGAUSSIANPYRAMID_H__ */ diff --git a/arm_compute/runtime/NEON/functions/NEScale.h b/arm_compute/runtime/NEON/functions/NEScale.h index 91cda066e7..00a368eb72 100644 --- a/arm_compute/runtime/NEON/functions/NEScale.h +++ b/arm_compute/runtime/NEON/functions/NEScale.h @@ -28,12 +28,9 @@ #include "arm_compute/core/NEON/kernels/NEScaleKernel.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/IMemoryManager.h" -#include "arm_compute/runtime/MemoryGroup.h" #include "arm_compute/runtime/Tensor.h" #include -#include namespace arm_compute { @@ -47,7 +44,7 @@ public: * * Initialize NEScale */ - NEScale(std::shared_ptr memory_manager = nullptr); + NEScale(); /** Initialize the function's source, destination, interpolation type and border_mode. * * @param[in, out] input Source tensor. Data type supported: U8. (Written to only for @p border_mode != UNDEFINED) @@ -62,7 +59,6 @@ public: void run() override; private: - MemoryGroup _memory_group; /**< Function memory group */ Tensor _offsets; /**< Offset to access the element with NEAREST interpolation or the top-left element with BILINEAR interpolation in the input tensor */ Tensor _dx; /**< Element's distance between the X real coordinate and the smallest X following integer */ Tensor _dy; /**< Element's distance between the Y real coordinate and the smallest Y following integer */ diff --git a/src/runtime/NEON/functions/NEGaussianPyramid.cpp b/src/runtime/NEON/functions/NEGaussianPyramid.cpp index 90bd5842eb..84ea0ca058 100644 --- a/src/runtime/NEON/functions/NEGaussianPyramid.cpp +++ b/src/runtime/NEON/functions/NEGaussianPyramid.cpp @@ -116,8 +116,7 @@ void NEGaussianPyramidHalf::run() } NEGaussianPyramidOrb::NEGaussianPyramidOrb() // NOLINT - : _offsets(), - _gaus5x5(), + : _gaus5x5(), _scale_nearest() { } @@ -140,29 +139,18 @@ void NEGaussianPyramidOrb::configure(const ITensor *input, IPyramid *pyramid, Bo if(num_levels > 1) { _gaus5x5 = arm_compute::support::cpp14::make_unique(num_levels - 1); - _scale_nearest = arm_compute::support::cpp14::make_unique(num_levels - 1); - _offsets = arm_compute::support::cpp14::make_unique(num_levels - 1); + _scale_nearest = arm_compute::support::cpp14::make_unique(num_levels - 1); PyramidInfo pyramid_info(num_levels - 1, SCALE_PYRAMID_ORB, pyramid->info()->tensor_shape(), Format::U8); _tmp.init(pyramid_info); for(unsigned int i = 0; i < num_levels - 1; ++i) { - const size_t width = _pyramid->get_pyramid_level(i + 1)->info()->dimension(0); - const size_t height = _pyramid->get_pyramid_level(i + 1)->info()->dimension(1); - - /* Allocate Image for the offsets used by NEAREST interpolation */ - TensorInfo tensor_info(TensorShape(width, height), Format::S32); - _offsets[i].allocator()->init(tensor_info); - /* Configure gaussian 5x5 */ _gaus5x5[i].configure(_pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i), border_mode, constant_border_value); - /* Configure scale image kernel */ - _scale_nearest[i].configure(_tmp.get_pyramid_level(i), nullptr, nullptr, _offsets.get() + i, _pyramid->get_pyramid_level(i + 1), InterpolationPolicy::NEAREST_NEIGHBOR, - border_mode == BorderMode::UNDEFINED); - - _offsets[i].allocator()->allocate(); + /* Configure scale */ + _scale_nearest[i].configure(_tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED); } _tmp.allocate(); @@ -182,6 +170,6 @@ void NEGaussianPyramidOrb::run() for(unsigned int i = 0; i < num_levels - 1; ++i) { _gaus5x5[i].run(); - NEScheduler::get().schedule(_scale_nearest.get() + i, Window::DimY); + _scale_nearest[i].run(); } } diff --git a/src/runtime/NEON/functions/NEScale.cpp b/src/runtime/NEON/functions/NEScale.cpp index 6c5ac3c45b..0b17e80ee7 100644 --- a/src/runtime/NEON/functions/NEScale.cpp +++ b/src/runtime/NEON/functions/NEScale.cpp @@ -86,9 +86,8 @@ void precompute_dx_dy_offsets(ITensor *dx, ITensor *dy, ITensor *offsets, float } } // namespace -NEScale::NEScale(std::shared_ptr memory_manager) // NOLINT - : _memory_group(std::move(memory_manager)), - _offsets(), +NEScale::NEScale() // NOLINT + : _offsets(), _dx(), _dy(), _scale_kernel(), @@ -131,7 +130,6 @@ void NEScale::configure(ITensor *input, ITensor *output, InterpolationPolicy pol { TensorInfo tensor_info_offsets(shape, Format::S32); _offsets.allocator()->init(tensor_info_offsets); - _memory_group.manage(&_offsets); _scale_kernel.configure(input, nullptr, nullptr, &_offsets, output, policy, border_undefined); @@ -151,11 +149,6 @@ void NEScale::configure(ITensor *input, ITensor *output, InterpolationPolicy pol _dx.allocator()->init(tensor_info_dxdy); _dy.allocator()->init(tensor_info_dxdy); - // Manage intermediate buffers - _memory_group.manage(&_offsets); - _memory_group.manage(&_dx); - _memory_group.manage(&_dy); - _scale_kernel.configure(input, &_dx, &_dy, &_offsets, output, policy, border_undefined); // Allocate once the configure methods have been called @@ -181,10 +174,6 @@ void NEScale::configure(ITensor *input, ITensor *output, InterpolationPolicy pol void NEScale::run() { - _memory_group.acquire(); - NEScheduler::get().schedule(&_border_handler, Window::DimZ); NEScheduler::get().schedule(&_scale_kernel, Window::DimY); - - _memory_group.release(); } -- cgit v1.2.1