aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/NEON/functions/NEGaussianPyramid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/NEON/functions/NEGaussianPyramid.cpp')
-rw-r--r--src/runtime/NEON/functions/NEGaussianPyramid.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/runtime/NEON/functions/NEGaussianPyramid.cpp b/src/runtime/NEON/functions/NEGaussianPyramid.cpp
index 0dbcb1234f..fbf8812cdd 100644
--- a/src/runtime/NEON/functions/NEGaussianPyramid.cpp
+++ b/src/runtime/NEON/functions/NEGaussianPyramid.cpp
@@ -68,6 +68,7 @@ void NEGaussianPyramidHalf::configure(const ITensor *input, IPyramid *pyramid, B
/* Get number of pyramid levels */
const size_t num_levels = pyramid->info()->num_levels();
+ const size_t num_stages = num_levels - 1;
_input = input;
_pyramid = pyramid;
@@ -81,33 +82,29 @@ void NEGaussianPyramidHalf::configure(const ITensor *input, IPyramid *pyramid, B
PyramidInfo pyramid_info(num_levels - 1, SCALE_PYRAMID_HALF, tensor_shape, Format::S16);
_tmp.init(pyramid_info);
- _horizontal_reduction.reserve(num_levels);
- _vertical_reduction.reserve(num_levels);
- _horizontal_border_handler.reserve(num_levels);
- _vertical_border_handler.reserve(num_levels);
+ _horizontal_reduction.clear();
+ _vertical_reduction.clear();
+ _horizontal_border_handler.clear();
+ _vertical_border_handler.clear();
- for(unsigned int i = 0; i < num_levels - 1; ++i)
+ _horizontal_reduction.resize(num_stages);
+ _vertical_reduction.resize(num_stages);
+ _horizontal_border_handler.resize(num_stages);
+ _vertical_border_handler.resize(num_stages);
+
+ for(size_t i = 0; i < num_stages; ++i)
{
/* Configure horizontal kernel */
- auto horizontal_kernel = support::cpp14::make_unique<NEGaussianPyramidHorKernel>();
- horizontal_kernel->configure(_pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i));
+ _horizontal_reduction[i].configure(_pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i));
/* Configure vertical kernel */
- auto vertical_kernel = support::cpp14::make_unique<NEGaussianPyramidVertKernel>();
- vertical_kernel->configure(_tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1));
+ _vertical_reduction[i].configure(_tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1));
/* Configure border */
- auto horizontal_border_kernel = support::cpp14::make_unique<NEFillBorderKernel>();
- horizontal_border_kernel->configure(_pyramid->get_pyramid_level(i), horizontal_kernel->border_size(), border_mode, PixelValue(constant_border_value));
+ _horizontal_border_handler[i].configure(_pyramid->get_pyramid_level(i), _horizontal_reduction[i].border_size(), border_mode, PixelValue(constant_border_value));
/* Configure border */
- auto vertical_border_kernel = support::cpp14::make_unique<NEFillBorderKernel>();
- vertical_border_kernel->configure(_tmp.get_pyramid_level(i), vertical_kernel->border_size(), border_mode, PixelValue(pixel_value_u16));
-
- _vertical_border_handler.emplace_back(std::move(vertical_border_kernel));
- _horizontal_border_handler.emplace_back(std::move(horizontal_border_kernel));
- _vertical_reduction.emplace_back(std::move(vertical_kernel));
- _horizontal_reduction.emplace_back(std::move(horizontal_kernel));
+ _vertical_border_handler[i].configure(_tmp.get_pyramid_level(i), _vertical_reduction[i].border_size(), border_mode, PixelValue(pixel_value_u16));
}
_tmp.allocate();
@@ -119,17 +116,17 @@ void NEGaussianPyramidHalf::run()
ARM_COMPUTE_ERROR_ON_MSG(_pyramid == nullptr, "Unconfigured function");
/* Get number of pyramid levels */
- const size_t num_levels = _pyramid->info()->num_levels();
+ const unsigned int num_levels = _pyramid->info()->num_levels();
/* The first level of the pyramid has the input image */
_pyramid->get_pyramid_level(0)->copy_from(*_input);
for(unsigned int i = 0; i < num_levels - 1; ++i)
{
- NEScheduler::get().schedule(_horizontal_border_handler[i].get(), Window::DimZ);
- NEScheduler::get().schedule(_horizontal_reduction[i].get(), Window::DimY);
- NEScheduler::get().schedule(_vertical_border_handler[i].get(), Window::DimZ);
- NEScheduler::get().schedule(_vertical_reduction[i].get(), Window::DimY);
+ NEScheduler::get().schedule(&_horizontal_border_handler[i], Window::DimZ);
+ NEScheduler::get().schedule(&_horizontal_reduction[i], Window::DimY);
+ NEScheduler::get().schedule(&_vertical_border_handler[i], Window::DimZ);
+ NEScheduler::get().schedule(&_vertical_reduction[i], Window::DimY);
}
}
@@ -150,26 +147,29 @@ void NEGaussianPyramidOrb::configure(const ITensor *input, IPyramid *pyramid, Bo
/* Get number of pyramid levels */
const size_t num_levels = pyramid->info()->num_levels();
+ const size_t num_stages = num_levels - 1;
_input = input;
_pyramid = pyramid;
+ _gaus5x5.clear();
+ _scale_nearest.clear();
+
+ _gaus5x5.resize(num_stages);
+ _scale_nearest.resize(num_stages);
+
if(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)
+ for(size_t i = 0; i < num_levels - 1; ++i)
{
/* Configure gaussian 5x5 */
- auto gaus5x5_kernel = support::cpp14::make_unique<NEGaussian5x5>();
- gaus5x5_kernel->configure(_pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i), border_mode, constant_border_value);
- _gaus5x5.emplace_back(std::move(gaus5x5_kernel));
+ _gaus5x5[i].configure(_pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i), border_mode, constant_border_value);
/* Configure scale */
- auto scale_kernel = support::cpp14::make_unique<NEScale>();
- scale_kernel->configure(_tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED);
- _scale_nearest.emplace_back(std::move(scale_kernel));
+ _scale_nearest[i].configure(_tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED);
}
_tmp.allocate();
@@ -188,7 +188,7 @@ void NEGaussianPyramidOrb::run()
for(unsigned int i = 0; i < num_levels - 1; ++i)
{
- _gaus5x5[i].get()->run();
- _scale_nearest[i].get()->run();
+ _gaus5x5[i].run();
+ _scale_nearest[i].run();
}
}