From 299fdd31bd8e1add3ac557a5e630de55b1b6659c Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Wed, 1 May 2019 13:03:59 +0100 Subject: COMPMID-2177 Fix clang warnings Change-Id: I4beacfd714ee3ed771fd174cce5d8009a2961380 Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/1065 Reviewed-by: Giuseppe Rossini Tested-by: Arm Jenkins --- src/runtime/NEON/functions/NEOpticalFlow.cpp | 47 +++++++++++++++++----------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'src/runtime/NEON/functions/NEOpticalFlow.cpp') diff --git a/src/runtime/NEON/functions/NEOpticalFlow.cpp b/src/runtime/NEON/functions/NEOpticalFlow.cpp index db77629ef2..0df01c677d 100644 --- a/src/runtime/NEON/functions/NEOpticalFlow.cpp +++ b/src/runtime/NEON/functions/NEOpticalFlow.cpp @@ -74,10 +74,10 @@ void NEOpticalFlow::configure(const Pyramid *old_pyramid, const Pyramid *new_pyr const float pyr_scale = old_pyramid->info()->scale(); - _func_scharr = arm_compute::support::cpp14::make_unique(_num_levels); - _kernel_tracker = arm_compute::support::cpp14::make_unique(_num_levels); - _scharr_gx = arm_compute::support::cpp14::make_unique(_num_levels); - _scharr_gy = arm_compute::support::cpp14::make_unique(_num_levels); + _func_scharr.reserve(_num_levels); + _kernel_tracker.reserve(_num_levels); + _scharr_gx.reserve(_num_levels); + _scharr_gy.reserve(_num_levels); _old_points_internal = LKInternalKeypointArray(old_points->num_values()); _new_points_internal = LKInternalKeypointArray(old_points->num_values()); @@ -95,25 +95,34 @@ void NEOpticalFlow::configure(const Pyramid *old_pyramid, const Pyramid *new_pyr TensorInfo tensor_info(TensorShape(width_ith, height_ith), Format::S16); - _scharr_gx[i].allocator()->init(tensor_info); - _scharr_gy[i].allocator()->init(tensor_info); + auto scharr_gx = support::cpp14::make_unique(); + auto scharr_gy = support::cpp14::make_unique(); + scharr_gx->allocator()->init(tensor_info); + scharr_gy->allocator()->init(tensor_info); // Manage intermediate buffers - _memory_group.manage(_scharr_gx.get() + i); - _memory_group.manage(_scharr_gy.get() + i); + _memory_group.manage(scharr_gx.get()); + _memory_group.manage(scharr_gy.get()); // Init Scharr kernel - _func_scharr[i].configure(old_ith_input, _scharr_gx.get() + i, _scharr_gy.get() + i, border_mode, constant_border_value); + auto func_scharr = support::cpp14::make_unique(); + func_scharr->configure(old_ith_input, scharr_gx.get(), scharr_gy.get(), border_mode, constant_border_value); // Init Lucas-Kanade kernel - _kernel_tracker[i].configure(old_ith_input, new_ith_input, _scharr_gx.get() + i, _scharr_gy.get() + i, - old_points, new_points_estimates, new_points, - &_old_points_internal, &_new_points_internal, - termination, use_initial_estimate, epsilon, num_iterations, window_dimension, - i, _num_levels, pyr_scale); - - _scharr_gx[i].allocator()->allocate(); - _scharr_gy[i].allocator()->allocate(); + auto kernel_tracker = support::cpp14::make_unique(); + kernel_tracker->configure(old_ith_input, new_ith_input, scharr_gx.get(), scharr_gy.get(), + old_points, new_points_estimates, new_points, + &_old_points_internal, &_new_points_internal, + termination, use_initial_estimate, epsilon, num_iterations, window_dimension, + i, _num_levels, pyr_scale); + + scharr_gx->allocator()->allocate(); + scharr_gy->allocator()->allocate(); + + _func_scharr.emplace_back(std::move(func_scharr)); + _kernel_tracker.emplace_back(std::move(kernel_tracker)); + _scharr_gx.emplace_back(std::move(scharr_gx)); + _scharr_gy.emplace_back(std::move(scharr_gy)); } } @@ -126,9 +135,9 @@ void NEOpticalFlow::run() for(unsigned int level = _num_levels; level > 0; --level) { // Run Scharr kernel - _func_scharr[level - 1].run(); + _func_scharr[level - 1].get()->run(); // Run Lucas-Kanade kernel - NEScheduler::get().schedule(_kernel_tracker.get() + level - 1, Window::DimX); + NEScheduler::get().schedule(_kernel_tracker[level - 1].get(), Window::DimX); } } -- cgit v1.2.1