From 27e67f0b2047cfa2f011f9e242e3068d9e106b39 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Tue, 16 Feb 2021 11:34:39 +0000 Subject: Remove Compute Vision Neon support Resolves COMPMID-4150 Change-Id: I316e8ab97de796666c71eadfde894715fcf4a1aa Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5141 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- .../NEON/functions/NEAbsoluteDifference.cpp | 40 --- src/runtime/NEON/functions/NEAccumulate.cpp | 67 ----- src/runtime/NEON/functions/NEBox3x3.cpp | 52 ---- src/runtime/NEON/functions/NECannyEdge.cpp | 196 --------------- src/runtime/NEON/functions/NEChannelCombine.cpp | 44 ---- src/runtime/NEON/functions/NEChannelExtract.cpp | 44 ---- src/runtime/NEON/functions/NEColorConvert.cpp | 58 ----- src/runtime/NEON/functions/NEDerivative.cpp | 59 ----- src/runtime/NEON/functions/NEDilate.cpp | 43 ---- src/runtime/NEON/functions/NEEqualizeHistogram.cpp | 73 ------ src/runtime/NEON/functions/NEErode.cpp | 44 ---- src/runtime/NEON/functions/NEFastCorners.cpp | 116 --------- src/runtime/NEON/functions/NEGaussian3x3.cpp | 44 ---- src/runtime/NEON/functions/NEGaussian5x5.cpp | 74 ------ src/runtime/NEON/functions/NEGaussianPyramid.cpp | 202 --------------- src/runtime/NEON/functions/NEHOGDescriptor.cpp | 116 --------- src/runtime/NEON/functions/NEHOGDetector.cpp | 38 --- src/runtime/NEON/functions/NEHOGGradient.cpp | 94 ------- src/runtime/NEON/functions/NEHOGMultiDetection.cpp | 270 --------------------- src/runtime/NEON/functions/NEHarrisCorners.cpp | 217 ----------------- src/runtime/NEON/functions/NEHistogram.cpp | 62 ----- src/runtime/NEON/functions/NEIntegralImage.cpp | 46 ---- src/runtime/NEON/functions/NELaplacianPyramid.cpp | 112 --------- .../NEON/functions/NELaplacianReconstruct.cpp | 106 -------- src/runtime/NEON/functions/NEMagnitude.cpp | 50 ---- src/runtime/NEON/functions/NEMeanStdDev.cpp | 56 ----- src/runtime/NEON/functions/NEMedian3x3.cpp | 44 ---- src/runtime/NEON/functions/NEMinMaxLocation.cpp | 57 ----- src/runtime/NEON/functions/NENonLinearFilter.cpp | 46 ---- src/runtime/NEON/functions/NEOpticalFlow.cpp | 143 ----------- src/runtime/NEON/functions/NEPhase.cpp | 47 ---- src/runtime/NEON/functions/NERemap.cpp | 55 ----- src/runtime/NEON/functions/NEScharr3x3.cpp | 43 ---- src/runtime/NEON/functions/NESobel3x3.cpp | 44 ---- src/runtime/NEON/functions/NESobel5x5.cpp | 97 -------- src/runtime/NEON/functions/NESobel7x7.cpp | 96 -------- src/runtime/NEON/functions/NETableLookup.cpp | 37 --- src/runtime/NEON/functions/NEThreshold.cpp | 43 ---- src/runtime/NEON/functions/NEWarpAffine.cpp | 64 ----- src/runtime/NEON/functions/NEWarpPerspective.cpp | 65 ----- 40 files changed, 3204 deletions(-) delete mode 100644 src/runtime/NEON/functions/NEAbsoluteDifference.cpp delete mode 100644 src/runtime/NEON/functions/NEAccumulate.cpp delete mode 100644 src/runtime/NEON/functions/NEBox3x3.cpp delete mode 100644 src/runtime/NEON/functions/NECannyEdge.cpp delete mode 100644 src/runtime/NEON/functions/NEChannelCombine.cpp delete mode 100644 src/runtime/NEON/functions/NEChannelExtract.cpp delete mode 100644 src/runtime/NEON/functions/NEColorConvert.cpp delete mode 100644 src/runtime/NEON/functions/NEDerivative.cpp delete mode 100644 src/runtime/NEON/functions/NEDilate.cpp delete mode 100644 src/runtime/NEON/functions/NEEqualizeHistogram.cpp delete mode 100644 src/runtime/NEON/functions/NEErode.cpp delete mode 100644 src/runtime/NEON/functions/NEFastCorners.cpp delete mode 100644 src/runtime/NEON/functions/NEGaussian3x3.cpp delete mode 100644 src/runtime/NEON/functions/NEGaussian5x5.cpp delete mode 100644 src/runtime/NEON/functions/NEGaussianPyramid.cpp delete mode 100644 src/runtime/NEON/functions/NEHOGDescriptor.cpp delete mode 100644 src/runtime/NEON/functions/NEHOGDetector.cpp delete mode 100644 src/runtime/NEON/functions/NEHOGGradient.cpp delete mode 100644 src/runtime/NEON/functions/NEHOGMultiDetection.cpp delete mode 100644 src/runtime/NEON/functions/NEHarrisCorners.cpp delete mode 100644 src/runtime/NEON/functions/NEHistogram.cpp delete mode 100644 src/runtime/NEON/functions/NEIntegralImage.cpp delete mode 100644 src/runtime/NEON/functions/NELaplacianPyramid.cpp delete mode 100644 src/runtime/NEON/functions/NELaplacianReconstruct.cpp delete mode 100644 src/runtime/NEON/functions/NEMagnitude.cpp delete mode 100644 src/runtime/NEON/functions/NEMeanStdDev.cpp delete mode 100644 src/runtime/NEON/functions/NEMedian3x3.cpp delete mode 100644 src/runtime/NEON/functions/NEMinMaxLocation.cpp delete mode 100644 src/runtime/NEON/functions/NENonLinearFilter.cpp delete mode 100644 src/runtime/NEON/functions/NEOpticalFlow.cpp delete mode 100644 src/runtime/NEON/functions/NEPhase.cpp delete mode 100644 src/runtime/NEON/functions/NERemap.cpp delete mode 100644 src/runtime/NEON/functions/NEScharr3x3.cpp delete mode 100644 src/runtime/NEON/functions/NESobel3x3.cpp delete mode 100644 src/runtime/NEON/functions/NESobel5x5.cpp delete mode 100644 src/runtime/NEON/functions/NESobel7x7.cpp delete mode 100644 src/runtime/NEON/functions/NETableLookup.cpp delete mode 100644 src/runtime/NEON/functions/NEThreshold.cpp delete mode 100644 src/runtime/NEON/functions/NEWarpAffine.cpp delete mode 100644 src/runtime/NEON/functions/NEWarpPerspective.cpp (limited to 'src/runtime') diff --git a/src/runtime/NEON/functions/NEAbsoluteDifference.cpp b/src/runtime/NEON/functions/NEAbsoluteDifference.cpp deleted file mode 100644 index 1c37af980e..0000000000 --- a/src/runtime/NEON/functions/NEAbsoluteDifference.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEAbsoluteDifference.h" - -#include "src/core/NEON/kernels/NEAbsoluteDifferenceKernel.h" - -#include - -namespace arm_compute -{ -NEAbsoluteDifference::~NEAbsoluteDifference() = default; - -void NEAbsoluteDifference::configure(const ITensor *input1, const ITensor *input2, ITensor *output) -{ - auto k = std::make_unique(); - k->configure(input1, input2, output); - _kernel = std::move(k); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEAccumulate.cpp b/src/runtime/NEON/functions/NEAccumulate.cpp deleted file mode 100644 index b81ec24a39..0000000000 --- a/src/runtime/NEON/functions/NEAccumulate.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEAccumulate.h" - -#include "src/core/NEON/kernels/NEAccumulateKernel.h" - -#include - -namespace arm_compute -{ -NEAccumulate::~NEAccumulate() = default; - -void NEAccumulate::configure(const ITensor *input, ITensor *output) -{ - auto k = std::make_unique(); - k->configure(input, output); - _kernel = std::move(k); -} - -NEAccumulateWeighted::~NEAccumulateWeighted() = default; - -void NEAccumulateWeighted::configure(const ITensor *input, float alpha, ITensor *output, bool use_fp16) -{ - if(use_fp16) - { - auto k = std::make_unique(); - k->configure(input, alpha, output); - _kernel = std::move(k); - } - else - { - auto k = std::make_unique(); - k->configure(input, alpha, output); - _kernel = std::move(k); - } -} - -NEAccumulateSquared::~NEAccumulateSquared() = default; - -void NEAccumulateSquared::configure(const ITensor *input, uint32_t shift, ITensor *output) -{ - auto k = std::make_unique(); - k->configure(input, shift, output); - _kernel = std::move(k); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEBox3x3.cpp b/src/runtime/NEON/functions/NEBox3x3.cpp deleted file mode 100644 index ee40e2c475..0000000000 --- a/src/runtime/NEON/functions/NEBox3x3.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEBox3x3.h" - -#include "arm_compute/core/PixelValue.h" -#include "src/core/NEON/kernels/NEBox3x3Kernel.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" - -#include - -namespace arm_compute -{ -void NEBox3x3::configure(ITensor *input, ITensor *output, BorderMode border_mode, uint8_t constant_border_value, bool use_fp16) -{ - if(use_fp16) - { - auto k = std::make_unique(); - k->configure(input, output, border_mode == BorderMode::UNDEFINED); - _kernel = std::move(k); - } - else - { - auto k = std::make_unique(); - k->configure(input, output, border_mode == BorderMode::UNDEFINED); - _kernel = std::move(k); - } - auto b = std::make_unique(); - b->configure(input, _kernel->border_size(), border_mode, PixelValue(constant_border_value)); - _border_handler = std::move(b); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NECannyEdge.cpp b/src/runtime/NEON/functions/NECannyEdge.cpp deleted file mode 100644 index 52bc81e001..0000000000 --- a/src/runtime/NEON/functions/NECannyEdge.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NECannyEdge.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "arm_compute/runtime/NEON/functions/NESobel3x3.h" -#include "arm_compute/runtime/NEON/functions/NESobel5x5.h" -#include "arm_compute/runtime/NEON/functions/NESobel7x7.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "src/core/NEON/kernels/NECannyEdgeKernel.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NESobel5x5Kernel.h" -#include "src/core/NEON/kernels/NESobel7x7Kernel.h" - -#include -#include -#include - -namespace arm_compute -{ -NECannyEdge::~NECannyEdge() = default; - -NECannyEdge::NECannyEdge(std::shared_ptr memory_manager) // NOLINT - : _memory_group(std::move(memory_manager)), - _sobel(), - _gradient(), - _non_max_suppr(), - _edge_trace(), - _border_mag_gradient(), - _border_edge_trace(), - _gx(), - _gy(), - _magnitude(), - _phase(), - _nonmax(), - _output(nullptr) -{ -} - -void NECannyEdge::configure(ITensor *input, ITensor *output, int32_t upper_thr, int32_t lower_thr, int32_t gradient_size, int32_t norm_type, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON((1 != norm_type) && (2 != norm_type)); - ARM_COMPUTE_ERROR_ON((gradient_size != 3) && (gradient_size != 5) && (gradient_size != 7)); - ARM_COMPUTE_ERROR_ON((lower_thr < 0) || (lower_thr >= upper_thr)); - - _output = output; - - const TensorShape &shape = input->info()->tensor_shape(); - TensorInfo gradient_info; - TensorInfo magnitude_info; - - // Initialize images - if(gradient_size < 7) - { - gradient_info.init(shape, Format::S16); - magnitude_info.init(shape, Format::U16); - } - else - { - gradient_info.init(shape, Format::S32); - magnitude_info.init(shape, Format::U32); - } - - _gx.allocator()->init(gradient_info); - _gy.allocator()->init(gradient_info); - _magnitude.allocator()->init(magnitude_info); - - TensorInfo info(shape, Format::U8); - _phase.allocator()->init(info); - _nonmax.allocator()->init(info); - - // Manage intermediate buffers - _memory_group.manage(&_gx); - _memory_group.manage(&_gy); - - // Configure/Init sobelNxN - if(gradient_size == 3) - { - auto k = std::make_unique(); - k->configure(input, &_gx, &_gy, border_mode, constant_border_value); - _sobel = std::move(k); - } - else if(gradient_size == 5) - { - auto k = std::make_unique(); - k->configure(input, &_gx, &_gy, border_mode, constant_border_value); - _sobel = std::move(k); - } - else if(gradient_size == 7) - { - auto k = std::make_unique(); - k->configure(input, &_gx, &_gy, border_mode, constant_border_value); - _sobel = std::move(k); - } - else - { - ARM_COMPUTE_ERROR_VAR("Gradient size %+" PRId32 " not supported\n", gradient_size); - } - - // Manage intermediate buffers - _memory_group.manage(&_magnitude); - _memory_group.manage(&_phase); - - // Configure gradient - auto k = std::make_unique(); - k->configure(&_gx, &_gy, &_magnitude, &_phase, norm_type); - _gradient = std::move(k); - - // Allocate intermediate tensors - _gx.allocator()->allocate(); - _gy.allocator()->allocate(); - - // Manage intermediate buffers - _memory_group.manage(&_nonmax); - - // Configure non-maxima suppression - _non_max_suppr = std::make_unique(); - _non_max_suppr->configure(&_magnitude, &_phase, &_nonmax, upper_thr, lower_thr, border_mode == BorderMode::UNDEFINED); - - // Fill border around magnitude image as non-maxima suppression will access - // it. If border mode is undefined filling the border is a nop. - _border_mag_gradient = std::make_unique(); - _border_mag_gradient->configure(&_magnitude, _non_max_suppr->border_size(), border_mode, constant_border_value); - - // Allocate intermediate tensors - _phase.allocator()->allocate(); - _magnitude.allocator()->allocate(); - - // Configure edge tracing - _edge_trace = std::make_unique(); - _edge_trace->configure(&_nonmax, output); - - // Fill border with "No edge" to stop recursion in edge trace - _border_edge_trace = std::make_unique(); - _border_edge_trace->configure(&_nonmax, _edge_trace->border_size(), BorderMode::CONSTANT, static_cast(0.f)); - - // Allocate intermediate tensors - _nonmax.allocator()->allocate(); -} - -void NECannyEdge::run() -{ - ARM_COMPUTE_ERROR_ON_MSG(_sobel == nullptr, "Unconfigured function"); - - MemoryGroupResourceScope scope_mg(_memory_group); - - // Run sobelNxN - _sobel->run(); - - // Run gradient - NEScheduler::get().schedule(_gradient.get(), Window::DimY); - - // Fill border before non-maxima suppression. Nop for border mode undefined. - NEScheduler::get().schedule(_border_mag_gradient.get(), Window::DimZ); - - // Run non-maxima suppression - NEScheduler::get().schedule(_non_max_suppr.get(), Window::DimY); - - ARM_COMPUTE_ERROR_ON(_output->buffer() == nullptr); - std::fill_n(_output->buffer(), _output->info()->total_size(), 0); - - // Fill border before edge trace - NEScheduler::get().schedule(_border_edge_trace.get(), Window::DimZ); - - // Run edge tracing - NEScheduler::get().schedule(_edge_trace.get(), Window::DimY); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEChannelCombine.cpp b/src/runtime/NEON/functions/NEChannelCombine.cpp deleted file mode 100644 index b566153bf4..0000000000 --- a/src/runtime/NEON/functions/NEChannelCombine.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEChannelCombine.h" - -#include "src/core/NEON/kernels/NEChannelCombineKernel.h" - -#include - -using namespace arm_compute; - -void NEChannelCombine::configure(const ITensor *plane0, const ITensor *plane1, const ITensor *plane2, const ITensor *plane3, ITensor *output) -{ - auto k = std::make_unique(); - k->configure(plane0, plane1, plane2, plane3, output); - _kernel = std::move(k); -} - -void NEChannelCombine::configure(const IImage *plane0, const IImage *plane1, const IImage *plane2, IMultiImage *output) -{ - auto k = std::make_unique(); - k->configure(plane0, plane1, plane2, output); - _kernel = std::move(k); -} diff --git a/src/runtime/NEON/functions/NEChannelExtract.cpp b/src/runtime/NEON/functions/NEChannelExtract.cpp deleted file mode 100644 index a43dc28896..0000000000 --- a/src/runtime/NEON/functions/NEChannelExtract.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEChannelExtract.h" - -#include "src/core/NEON/kernels/NEChannelExtractKernel.h" - -#include - -using namespace arm_compute; - -void NEChannelExtract::configure(const ITensor *input, Channel channel, ITensor *output) -{ - auto k = std::make_unique(); - k->configure(input, channel, output); - _kernel = std::move(k); -} - -void NEChannelExtract::configure(const IMultiImage *input, Channel channel, IImage *output) -{ - auto k = std::make_unique(); - k->configure(input, channel, output); - _kernel = std::move(k); -} diff --git a/src/runtime/NEON/functions/NEColorConvert.cpp b/src/runtime/NEON/functions/NEColorConvert.cpp deleted file mode 100644 index c7c9cdd923..0000000000 --- a/src/runtime/NEON/functions/NEColorConvert.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEColorConvert.h" - -#include "src/core/NEON/kernels/NEColorConvertKernel.h" - -#include - -using namespace arm_compute; - -void NEColorConvert::configure(const ITensor *input, ITensor *output) -{ - auto k = std::make_unique(); - k->configure(input, output); - _kernel = std::move(k); -} - -void NEColorConvert::configure(const IMultiImage *input, IImage *output) -{ - auto k = std::make_unique(); - k->configure(input, output); - _kernel = std::move(k); -} - -void NEColorConvert::configure(const IImage *input, IMultiImage *output) -{ - auto k = std::make_unique(); - k->configure(input, output); - _kernel = std::move(k); -} - -void NEColorConvert::configure(const IMultiImage *input, IMultiImage *output) -{ - auto k = std::make_unique(); - k->configure(input, output); - _kernel = std::move(k); -} diff --git a/src/runtime/NEON/functions/NEDerivative.cpp b/src/runtime/NEON/functions/NEDerivative.cpp deleted file mode 100644 index 8ef42123db..0000000000 --- a/src/runtime/NEON/functions/NEDerivative.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEDerivative.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/PixelValue.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "src/core/NEON/kernels/NEDerivativeKernel.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" - -namespace arm_compute -{ -NEDerivative::~NEDerivative() = default; - -NEDerivative::NEDerivative() - : _kernel(), _border_handler() -{ -} - -void NEDerivative::configure(ITensor *input, ITensor *output_x, ITensor *output_y, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON((output_x == nullptr) && (output_y == nullptr)); - - _kernel = std::make_unique(); - _border_handler = std::make_unique(); - - _kernel->configure(input, output_x, output_y, border_mode == BorderMode::UNDEFINED); - _border_handler->configure(input, BorderSize(1), border_mode, PixelValue(constant_border_value)); -} - -void NEDerivative::run() -{ - NEScheduler::get().schedule(_border_handler.get(), Window::DimZ); - NEScheduler::get().schedule(_kernel.get(), Window::DimY); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEDilate.cpp b/src/runtime/NEON/functions/NEDilate.cpp deleted file mode 100644 index 56523abd8a..0000000000 --- a/src/runtime/NEON/functions/NEDilate.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEDilate.h" - -#include "arm_compute/core/PixelValue.h" -#include "src/core/NEON/kernels/NEDilateKernel.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" - -#include - -using namespace arm_compute; - -void NEDilate::configure(ITensor *input, ITensor *output, BorderMode border_mode, uint8_t constant_border_value) -{ - auto k = std::make_unique(); - k->configure(input, output, border_mode == BorderMode::UNDEFINED); - _kernel = std::move(k); - - auto b = std::make_unique(); - b->configure(input, _kernel->border_size(), border_mode, PixelValue(constant_border_value)); - _border_handler = std::move(b); -} diff --git a/src/runtime/NEON/functions/NEEqualizeHistogram.cpp b/src/runtime/NEON/functions/NEEqualizeHistogram.cpp deleted file mode 100644 index 0b83b7dac7..0000000000 --- a/src/runtime/NEON/functions/NEEqualizeHistogram.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEEqualizeHistogram.h" - -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "src/core/NEON/kernels/NECumulativeDistributionKernel.h" -#include "src/core/NEON/kernels/NEHistogramKernel.h" -#include "src/core/NEON/kernels/NEHistogramKernel.h" -#include "src/core/NEON/kernels/NETableLookupKernel.h" - -namespace arm_compute -{ -NEEqualizeHistogram::~NEEqualizeHistogram() = default; - -NEEqualizeHistogram::NEEqualizeHistogram() - : _histogram_kernel(), _cd_histogram_kernel(), _map_histogram_kernel(), _hist(nr_bins, 0, max_range), _cum_dist(nr_bins, 0, max_range), _cd_lut(nr_bins, DataType::U8) -{ -} - -void NEEqualizeHistogram::configure(const IImage *input, IImage *output) -{ - ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(input); - ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(output); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::U8); - - _histogram_kernel = std::make_unique(); - _cd_histogram_kernel = std::make_unique(); - _map_histogram_kernel = std::make_unique(); - - // Configure kernels - _histogram_kernel->configure(input, &_hist); - _cd_histogram_kernel->configure(input, &_hist, &_cum_dist, &_cd_lut); - _map_histogram_kernel->configure(input, &_cd_lut, output); -} - -void NEEqualizeHistogram::run() -{ - // Calculate histogram of input. - NEScheduler::get().schedule(_histogram_kernel.get(), Window::DimY); - - // Calculate cumulative distribution of histogram and create LUT. - NEScheduler::get().schedule(_cd_histogram_kernel.get(), Window::DimY); - - // Map input to output using created LUT. - NEScheduler::get().schedule(_map_histogram_kernel.get(), Window::DimY); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEErode.cpp b/src/runtime/NEON/functions/NEErode.cpp deleted file mode 100644 index 83e266140a..0000000000 --- a/src/runtime/NEON/functions/NEErode.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEErode.h" - -#include "arm_compute/core/PixelValue.h" -#include "src/core/NEON/kernels/NEErodeKernel.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" - -#include - -namespace arm_compute -{ -void NEErode::configure(ITensor *input, ITensor *output, BorderMode border_mode, uint8_t constant_border_value) -{ - auto k = std::make_unique(); - k->configure(input, output, border_mode == BorderMode::UNDEFINED); - _kernel = std::move(k); - - auto b = std::make_unique(); - b->configure(input, _kernel->border_size(), border_mode, PixelValue(constant_border_value)); - _border_handler = std::move(b); -} -} // namespace arm_compute \ No newline at end of file diff --git a/src/runtime/NEON/functions/NEFastCorners.cpp b/src/runtime/NEON/functions/NEFastCorners.cpp deleted file mode 100644 index 5164d80947..0000000000 --- a/src/runtime/NEON/functions/NEFastCorners.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEFastCorners.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/PixelValue.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/Array.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "src/core/NEON/kernels/NEFastCornersKernel.h" -#include "src/core/NEON/kernels/NEFillArrayKernel.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NENonMaximaSuppression3x3Kernel.h" - -namespace arm_compute -{ -NEFastCorners::~NEFastCorners() = default; - -NEFastCorners::NEFastCorners(std::shared_ptr memory_manager) - : _memory_group(std::move(memory_manager)), - _fast_corners_kernel(), - _border_handler(), - _nonmax_kernel(), - _fill_kernel(), - _output(), - _suppressed(), - _non_max(false) -{ -} - -void NEFastCorners::configure(IImage *input, float threshold, bool nonmax_suppression, KeyPointArray *corners, - BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(input); - ARM_COMPUTE_ERROR_ON(BorderMode::UNDEFINED != border_mode); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON(nullptr == corners); - ARM_COMPUTE_ERROR_ON(threshold < 1 && threshold > 255); - - _non_max = nonmax_suppression; - - TensorInfo tensor_info(input->info()->tensor_shape(), Format::U8); - _output.allocator()->init(tensor_info); - _memory_group.manage(&_output); - - _fast_corners_kernel = std::make_unique(); - _border_handler = std::make_unique(); - _fill_kernel = std::make_unique(); - // If border is UNDEFINED _fast_corners_kernel will operate in xwindow (3, - // width - 3) and ywindow (3, height -3) so the output image will leave the - // pixels on the borders unchanged. This is reflected in the valid region - // of the output. The non maxima suppression is only run on the valid - // pixels. - _fast_corners_kernel->configure(input, &_output, threshold, nonmax_suppression, BorderMode::UNDEFINED == border_mode); - _border_handler->configure(input, _fast_corners_kernel->border_size(), border_mode, constant_border_value); - - if(!_non_max) - { - _fill_kernel->configure(&_output, 1 /* we keep all texels >0 */, corners); - } - else - { - _suppressed.allocator()->init(tensor_info); - _memory_group.manage(&_suppressed); - _nonmax_kernel = std::make_unique(); - _nonmax_kernel->configure(&_output, &_suppressed, BorderMode::UNDEFINED == border_mode); - _fill_kernel->configure(&_suppressed, 1 /* we keep all texels >0 */, corners); - - // Allocate intermediate tensors - _suppressed.allocator()->allocate(); - } - - // Allocate intermediate tensors - _output.allocator()->allocate(); -} - -void NEFastCorners::run() -{ - NEScheduler::get().schedule(_border_handler.get(), Window::DimZ); - - MemoryGroupResourceScope scope_mg(_memory_group); - - NEScheduler::get().schedule(_fast_corners_kernel.get(), Window::DimY); - - if(_non_max) - { - NEScheduler::get().schedule(_nonmax_kernel.get(), Window::DimY); - } - - NEScheduler::get().schedule(_fill_kernel.get(), Window::DimY); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEGaussian3x3.cpp b/src/runtime/NEON/functions/NEGaussian3x3.cpp deleted file mode 100644 index 93e813c052..0000000000 --- a/src/runtime/NEON/functions/NEGaussian3x3.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEGaussian3x3.h" - -#include "arm_compute/core/PixelValue.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEGaussian3x3Kernel.h" - -#include - -namespace arm_compute -{ -void NEGaussian3x3::configure(ITensor *input, ITensor *output, BorderMode border_mode, uint8_t constant_border_value) -{ - auto k = std::make_unique(); - k->configure(input, output, border_mode == BorderMode::UNDEFINED); - _kernel = std::move(k); - - auto b = std::make_unique(); - b->configure(input, _kernel->border_size(), border_mode, PixelValue(constant_border_value)); - _border_handler = std::move(b); -} -} // namespace arm_compute \ No newline at end of file diff --git a/src/runtime/NEON/functions/NEGaussian5x5.cpp b/src/runtime/NEON/functions/NEGaussian5x5.cpp deleted file mode 100644 index ed7e83b937..0000000000 --- a/src/runtime/NEON/functions/NEGaussian5x5.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEGaussian5x5.h" - -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/PixelValue.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEGaussian5x5Kernel.h" - -namespace arm_compute -{ -NEGaussian5x5::~NEGaussian5x5() = default; - -NEGaussian5x5::NEGaussian5x5(std::shared_ptr memory_manager) - : _memory_group(std::move(memory_manager)), _kernel_hor(), _kernel_vert(), _tmp(), _border_handler() -{ -} - -void NEGaussian5x5::configure(ITensor *input, ITensor *output, BorderMode border_mode, uint8_t constant_border_value) -{ - // Init temporary buffer - TensorInfo tensor_info(input->info()->tensor_shape(), 1, DataType::S16); - _tmp.allocator()->init(tensor_info); - - // Manage intermediate buffers - _memory_group.manage(&_tmp); - - _kernel_hor = std::make_unique(); - _kernel_vert = std::make_unique(); - _border_handler = std::make_unique(); - - // Create and configure kernels for the two passes - _kernel_hor->configure(input, &_tmp, border_mode == BorderMode::UNDEFINED); - _kernel_vert->configure(&_tmp, output, border_mode == BorderMode::UNDEFINED); - - _tmp.allocator()->allocate(); - - _border_handler->configure(input, _kernel_hor->border_size(), border_mode, PixelValue(constant_border_value)); -} - -void NEGaussian5x5::run() -{ - NEScheduler::get().schedule(_border_handler.get(), Window::DimZ); - - MemoryGroupResourceScope scope_mg(_memory_group); - - NEScheduler::get().schedule(_kernel_hor.get(), Window::DimY); - NEScheduler::get().schedule(_kernel_vert.get(), Window::DimY); -} -} // namespace arm_compute \ No newline at end of file diff --git a/src/runtime/NEON/functions/NEGaussianPyramid.cpp b/src/runtime/NEON/functions/NEGaussianPyramid.cpp deleted file mode 100644 index c9a36fc466..0000000000 --- a/src/runtime/NEON/functions/NEGaussianPyramid.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEGaussianPyramid.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/PixelValue.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "arm_compute/runtime/Pyramid.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEGaussian5x5Kernel.h" -#include "src/core/NEON/kernels/NEGaussianPyramidKernel.h" -#include "src/core/NEON/kernels/NEScaleKernel.h" - -#include - -using namespace arm_compute; - -NEGaussianPyramid::NEGaussianPyramid() - : _input(nullptr), _pyramid(nullptr), _tmp() -{ -} - -NEGaussianPyramidHalf::~NEGaussianPyramidHalf() = default; - -NEGaussianPyramidHalf::NEGaussianPyramidHalf() // NOLINT - : _horizontal_border_handler(), - _vertical_border_handler(), - _horizontal_reduction(), - _vertical_reduction() -{ -} - -void NEGaussianPyramidHalf::configure(const ITensor *input, IPyramid *pyramid, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON(nullptr == pyramid); - ARM_COMPUTE_ERROR_ON(input->info()->num_dimensions() != pyramid->get_pyramid_level(0)->info()->num_dimensions()); - ARM_COMPUTE_ERROR_ON(input->info()->dimension(0) != pyramid->info()->width()); - ARM_COMPUTE_ERROR_ON(input->info()->dimension(1) != pyramid->info()->height()); - ARM_COMPUTE_ERROR_ON(SCALE_PYRAMID_HALF != pyramid->info()->scale()); - - // Constant value to use for vertical fill border when the border mode is CONSTANT - const uint16_t pixel_value_u16 = static_cast(constant_border_value) * 2 + static_cast(constant_border_value) * 8 + static_cast(constant_border_value) * 6; - - /* 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; - - if(num_levels > 1) - { - // Apply half scale to the X dimension of the tensor shape - TensorShape tensor_shape = pyramid->info()->tensor_shape(); - tensor_shape.set(0, (pyramid->info()->width() + 1) * SCALE_PYRAMID_HALF); - - PyramidInfo pyramid_info(num_levels - 1, SCALE_PYRAMID_HALF, tensor_shape, Format::S16); - _tmp.init(pyramid_info); - - _horizontal_reduction.clear(); - _vertical_reduction.clear(); - _horizontal_border_handler.clear(); - _vertical_border_handler.clear(); - - _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 */ - _horizontal_reduction[i] = std::make_unique(); - _horizontal_reduction[i]->configure(_pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i)); - - /* Configure vertical kernel */ - _vertical_reduction[i] = std::make_unique(); - _vertical_reduction[i]->configure(_tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1)); - - /* Configure border */ - _horizontal_border_handler[i] = std::make_unique(); - _horizontal_border_handler[i]->configure(_pyramid->get_pyramid_level(i), _horizontal_reduction[i]->border_size(), border_mode, PixelValue(constant_border_value)); - - /* Configure border */ - _vertical_border_handler[i] = std::make_unique(); - _vertical_border_handler[i]->configure(_tmp.get_pyramid_level(i), _vertical_reduction[i]->border_size(), border_mode, PixelValue(pixel_value_u16)); - } - - _tmp.allocate(); - } -} - -void NEGaussianPyramidHalf::run() -{ - ARM_COMPUTE_ERROR_ON_MSG(_pyramid == nullptr, "Unconfigured function"); - - /* Get number of pyramid 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); - } -} - -NEGaussianPyramidOrb::~NEGaussianPyramidOrb() = default; - -NEGaussianPyramidOrb::NEGaussianPyramidOrb() // NOLINT - : _gaus5x5(), - _scale_nearest() -{ -} - -void NEGaussianPyramidOrb::configure(const ITensor *input, IPyramid *pyramid, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON(nullptr == pyramid); - ARM_COMPUTE_ERROR_ON(input->info()->num_dimensions() != pyramid->get_pyramid_level(0)->info()->num_dimensions()); - ARM_COMPUTE_ERROR_ON(input->info()->dimension(0) != pyramid->info()->width()); - ARM_COMPUTE_ERROR_ON(input->info()->dimension(1) != pyramid->info()->height()); - ARM_COMPUTE_ERROR_ON(SCALE_PYRAMID_ORB != pyramid->info()->scale()); - - /* 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(size_t i = 0; i < num_levels - 1; ++i) - { - /* Configure gaussian 5x5 */ - _gaus5x5[i].configure(_pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i), border_mode, constant_border_value); - - /* Configure scale */ - _scale_nearest[i].configure(_tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), ScaleKernelInfo{ InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED, PixelValue(), SamplingPolicy::CENTER, false }); - } - - _tmp.allocate(); - } -} - -void NEGaussianPyramidOrb::run() -{ - ARM_COMPUTE_ERROR_ON_MSG(_pyramid == nullptr, "Unconfigured function"); - - /* Get number of pyramid levels */ - const size_t 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) - { - _gaus5x5[i].run(); - _scale_nearest[i].run(); - } -} diff --git a/src/runtime/NEON/functions/NEHOGDescriptor.cpp b/src/runtime/NEON/functions/NEHOGDescriptor.cpp deleted file mode 100644 index bb125a1eae..0000000000 --- a/src/runtime/NEON/functions/NEHOGDescriptor.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEHOGDescriptor.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/HOGInfo.h" -#include "arm_compute/core/Size2D.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "src/core/NEON/kernels/NEDerivativeKernel.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEHOGDescriptorKernel.h" - -namespace arm_compute -{ -NEHOGDescriptor::~NEHOGDescriptor() = default; - -NEHOGDescriptor::NEHOGDescriptor(std::shared_ptr memory_manager) - : _memory_group(std::move(memory_manager)), _gradient(), _orient_bin(), _block_norm(), _mag(), _phase(), _hog_space() -{ -} - -void NEHOGDescriptor::configure(ITensor *input, ITensor *output, const IHOG *hog, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON(nullptr == output); - ARM_COMPUTE_ERROR_ON(nullptr == hog); - - const HOGInfo *hog_info = hog->info(); - const size_t width = input->info()->dimension(Window::DimX); - const size_t height = input->info()->dimension(Window::DimY); - const size_t num_bins = hog_info->num_bins(); - - Size2D cell_size = hog_info->cell_size(); - - // Calculate number of cells along the x and y directions for the hog_space - const size_t num_cells_x = width / cell_size.width; - const size_t num_cells_y = height / cell_size.height; - - // TensorShape of the input image - const TensorShape &shape_img = input->info()->tensor_shape(); - - // TensorShape of the hog space - TensorShape shape_hog_space = input->info()->tensor_shape(); - shape_hog_space.set(Window::DimX, num_cells_x); - shape_hog_space.set(Window::DimY, num_cells_y); - - // Allocate memory for magnitude, phase and hog space - TensorInfo info_mag(shape_img, Format::S16); - _mag.allocator()->init(info_mag); - - TensorInfo info_phase(shape_img, Format::U8); - _phase.allocator()->init(info_phase); - - TensorInfo info_space(shape_hog_space, num_bins, DataType::F32); - _hog_space.allocator()->init(info_space); - - // Manage intermediate buffers - _memory_group.manage(&_mag); - _memory_group.manage(&_phase); - - // Initialise gradient kernel - _gradient.configure(input, &_mag, &_phase, hog_info->phase_type(), border_mode, constant_border_value); - - // Manage intermediate buffers - _memory_group.manage(&_hog_space); - - // Initialise orientation binning kernel - _orient_bin = std::make_unique(); - _orient_bin->configure(&_mag, &_phase, &_hog_space, hog->info()); - - // Initialize HOG norm kernel - _block_norm = std::make_unique(); - _block_norm->configure(&_hog_space, output, hog->info()); - - // Allocate intermediate tensors - _mag.allocator()->allocate(); - _phase.allocator()->allocate(); - _hog_space.allocator()->allocate(); -} - -void NEHOGDescriptor::run() -{ - MemoryGroupResourceScope scope_mg(_memory_group); - - // Run gradient - _gradient.run(); - - // Run orientation binning kernel - NEScheduler::get().schedule(_orient_bin.get(), Window::DimY); - - // Run block normalization kernel - NEScheduler::get().schedule(_block_norm.get(), Window::DimY); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEHOGDetector.cpp b/src/runtime/NEON/functions/NEHOGDetector.cpp deleted file mode 100644 index 3eda1b0ce0..0000000000 --- a/src/runtime/NEON/functions/NEHOGDetector.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEHOGDetector.h" - -#include "src/core/NEON/kernels/NEHOGDetectorKernel.h" - -namespace arm_compute -{ -NEHOGDetector::~NEHOGDetector() = default; - -void NEHOGDetector::configure(const ITensor *input, const IHOG *hog, IDetectionWindowArray *detection_windows, const Size2D &detection_window_stride, float threshold, size_t idx_class) -{ - auto k = std::make_unique(); - k->configure(input, hog, detection_windows, detection_window_stride, threshold, idx_class); - _kernel = std::move(k); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEHOGGradient.cpp b/src/runtime/NEON/functions/NEHOGGradient.cpp deleted file mode 100644 index f5a47735a9..0000000000 --- a/src/runtime/NEON/functions/NEHOGGradient.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEHOGGradient.h" - -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "src/core/NEON/kernels/NEDerivativeKernel.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEMagnitudePhaseKernel.h" - -namespace arm_compute -{ -NEHOGGradient::~NEHOGGradient() = default; - -NEHOGGradient::NEHOGGradient(std::shared_ptr memory_manager) // NOLINT - : _memory_group(std::move(memory_manager)), - _derivative(), - _mag_phase(nullptr), - _gx(), - _gy() -{ -} - -void NEHOGGradient::configure(ITensor *input, ITensor *output_magnitude, ITensor *output_phase, PhaseType phase_type, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output_magnitude, 1, DataType::S16); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output_phase, 1, DataType::U8); - - const TensorShape &shape_img = input->info()->tensor_shape(); - - // Allocate image memory - TensorInfo info(shape_img, Format::S16); - _gx.allocator()->init(info); - _gy.allocator()->init(info); - - // Manage intermediate buffers - _memory_group.manage(&_gx); - _memory_group.manage(&_gy); - - // Initialise derivate kernel - _derivative.configure(input, &_gx, &_gy, border_mode, constant_border_value); - - // Initialise magnitude/phase kernel - if(PhaseType::UNSIGNED == phase_type) - { - auto k = std::make_unique>(); - k->configure(&_gx, &_gy, output_magnitude, output_phase); - _mag_phase = std::move(k); - } - else - { - auto k = std::make_unique>(); - k->configure(&_gx, &_gy, output_magnitude, output_phase); - _mag_phase = std::move(k); - } - - // Allocate intermediate tensors - _gx.allocator()->allocate(); - _gy.allocator()->allocate(); -} - -void NEHOGGradient::run() -{ - MemoryGroupResourceScope scope_mg(_memory_group); - - // Run derivative - _derivative.run(); - - // Run magnitude/phase kernel - NEScheduler::get().schedule(_mag_phase.get(), Window::DimY); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEHOGMultiDetection.cpp b/src/runtime/NEON/functions/NEHOGMultiDetection.cpp deleted file mode 100644 index 3e41faad43..0000000000 --- a/src/runtime/NEON/functions/NEHOGMultiDetection.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEHOGMultiDetection.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "arm_compute/runtime/Tensor.h" -#include "src/core/NEON/kernels/NEDerivativeKernel.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEHOGDescriptorKernel.h" - -namespace arm_compute -{ -NEHOGMultiDetection::~NEHOGMultiDetection() = default; - -NEHOGMultiDetection::NEHOGMultiDetection(std::shared_ptr memory_manager) // NOLINT - : _memory_group(std::move(memory_manager)), - _gradient_kernel(), - _orient_bin_kernel(), - _block_norm_kernel(), - _hog_detect_kernel(), - _non_maxima_kernel(), - _hog_space(), - _hog_norm_space(), - _detection_windows(), - _mag(), - _phase(), - _non_maxima_suppression(false), - _num_orient_bin_kernel(0), - _num_block_norm_kernel(0), - _num_hog_detect_kernel(0) -{ -} - -void NEHOGMultiDetection::configure(ITensor *input, const IMultiHOG *multi_hog, IDetectionWindowArray *detection_windows, const ISize2DArray *detection_window_strides, BorderMode border_mode, - uint8_t constant_border_value, float threshold, bool non_maxima_suppression, float min_distance) -{ - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON_INVALID_MULTI_HOG(multi_hog); - ARM_COMPUTE_ERROR_ON(nullptr == detection_windows); - ARM_COMPUTE_ERROR_ON(detection_window_strides->num_values() != multi_hog->num_models()); - - const size_t width = input->info()->dimension(Window::DimX); - const size_t height = input->info()->dimension(Window::DimY); - const TensorShape &shape_img = input->info()->tensor_shape(); - const size_t num_models = multi_hog->num_models(); - PhaseType phase_type = multi_hog->model(0)->info()->phase_type(); - - size_t prev_num_bins = multi_hog->model(0)->info()->num_bins(); - Size2D prev_cell_size = multi_hog->model(0)->info()->cell_size(); - Size2D prev_block_size = multi_hog->model(0)->info()->block_size(); - Size2D prev_block_stride = multi_hog->model(0)->info()->block_stride(); - - /* Check if NEHOGOrientationBinningKernel and NEHOGBlockNormalizationKernel kernels can be skipped for a specific HOG data-object - * - * 1) NEHOGOrientationBinningKernel and NEHOGBlockNormalizationKernel are skipped if the cell size and the number of bins don't change. - * Since "multi_hog" is sorted,it is enough to check the HOG descriptors at level "ith" and level "(i-1)th - * 2) NEHOGBlockNormalizationKernel is skipped if the cell size, the number of bins and block size do not change. - * Since "multi_hog" is sorted,it is enough to check the HOG descriptors at level "ith" and level "(i-1)th - * - * @note Since the orientation binning and block normalization kernels can be skipped, we need to keep track of the input to process for each kernel - * with "input_orient_bin", "input_hog_detect" and "input_block_norm" - */ - std::vector input_orient_bin; - std::vector input_hog_detect; - std::vector> input_block_norm; - - input_orient_bin.push_back(0); - input_hog_detect.push_back(0); - input_block_norm.emplace_back(0, 0); - - for(size_t i = 1; i < num_models; ++i) - { - size_t cur_num_bins = multi_hog->model(i)->info()->num_bins(); - Size2D cur_cell_size = multi_hog->model(i)->info()->cell_size(); - Size2D cur_block_size = multi_hog->model(i)->info()->block_size(); - Size2D cur_block_stride = multi_hog->model(i)->info()->block_stride(); - - if((cur_num_bins != prev_num_bins) || (cur_cell_size.width != prev_cell_size.width) || (cur_cell_size.height != prev_cell_size.height)) - { - prev_num_bins = cur_num_bins; - prev_cell_size = cur_cell_size; - prev_block_size = cur_block_size; - prev_block_stride = cur_block_stride; - - // Compute orientation binning and block normalization kernels. Update input to process - input_orient_bin.push_back(i); - input_block_norm.emplace_back(i, input_orient_bin.size() - 1); - } - else if((cur_block_size.width != prev_block_size.width) || (cur_block_size.height != prev_block_size.height) || (cur_block_stride.width != prev_block_stride.width) - || (cur_block_stride.height != prev_block_stride.height)) - { - prev_block_size = cur_block_size; - prev_block_stride = cur_block_stride; - - // Compute block normalization kernel. Update input to process - input_block_norm.emplace_back(i, input_orient_bin.size() - 1); - } - - // Update input to process for hog detector kernel - input_hog_detect.push_back(input_block_norm.size() - 1); - } - - _detection_windows = detection_windows; - _non_maxima_suppression = non_maxima_suppression; - _num_orient_bin_kernel = input_orient_bin.size(); // Number of NEHOGOrientationBinningKernel kernels to compute - _num_block_norm_kernel = input_block_norm.size(); // Number of NEHOGBlockNormalizationKernel kernels to compute - _num_hog_detect_kernel = input_hog_detect.size(); // Number of NEHOGDetector functions to compute - - _orient_bin_kernel.clear(); - _block_norm_kernel.clear(); - _hog_detect_kernel.clear(); - _hog_space.clear(); - _hog_norm_space.clear(); - - _orient_bin_kernel.resize(_num_orient_bin_kernel); - _block_norm_kernel.resize(_num_block_norm_kernel); - _hog_detect_kernel.resize(_num_hog_detect_kernel); - _hog_space.resize(_num_orient_bin_kernel); - _hog_norm_space.resize(_num_block_norm_kernel); - _non_maxima_kernel = CPPDetectionWindowNonMaximaSuppressionKernel(); - - // Allocate tensors for magnitude and phase - TensorInfo info_mag(shape_img, Format::S16); - _mag.allocator()->init(info_mag); - - TensorInfo info_phase(shape_img, Format::U8); - _phase.allocator()->init(info_phase); - - // Manage intermediate buffers - _memory_group.manage(&_mag); - _memory_group.manage(&_phase); - - // Initialise gradient kernel - _gradient_kernel.configure(input, &_mag, &_phase, phase_type, border_mode, constant_border_value); - - // Configure NETensor for the HOG space and orientation binning kernel - for(size_t i = 0; i < _num_orient_bin_kernel; ++i) - { - const size_t idx_multi_hog = input_orient_bin[i]; - - // Get the corresponding cell size and number of bins - const Size2D &cell = multi_hog->model(idx_multi_hog)->info()->cell_size(); - const size_t num_bins = multi_hog->model(idx_multi_hog)->info()->num_bins(); - - // Calculate number of cells along the x and y directions for the hog_space - const size_t num_cells_x = width / cell.width; - const size_t num_cells_y = height / cell.height; - - // TensorShape of hog space - TensorShape shape_hog_space = input->info()->tensor_shape(); - shape_hog_space.set(Window::DimX, num_cells_x); - shape_hog_space.set(Window::DimY, num_cells_y); - - // Allocate HOG space - TensorInfo info_space(shape_hog_space, num_bins, DataType::F32); - _hog_space[i].allocator()->init(info_space); - - // Manage intermediate buffers - _memory_group.manage(&_hog_space[i]); - - // Initialise orientation binning kernel - _orient_bin_kernel[i].configure(&_mag, &_phase, &_hog_space[i], multi_hog->model(idx_multi_hog)->info()); - } - - // Allocate intermediate tensors - _mag.allocator()->allocate(); - _phase.allocator()->allocate(); - - // Configure NETensor for the normalized HOG space and block normalization kernel - for(size_t i = 0; i < _num_block_norm_kernel; ++i) - { - const size_t idx_multi_hog = input_block_norm[i].first; - const size_t idx_orient_bin = input_block_norm[i].second; - - // Allocate normalized HOG space - TensorInfo tensor_info(*(multi_hog->model(idx_multi_hog)->info()), width, height); - _hog_norm_space[i].allocator()->init(tensor_info); - - // Manage intermediate buffers - _memory_group.manage(&_hog_norm_space[i]); - - // Initialize block normalization kernel - _block_norm_kernel[i].configure(&_hog_space[idx_orient_bin], &_hog_norm_space[i], multi_hog->model(idx_multi_hog)->info()); - } - - // Allocate intermediate tensors - for(size_t i = 0; i < _num_orient_bin_kernel; ++i) - { - _hog_space[i].allocator()->allocate(); - } - - // Configure HOG detector kernel - for(size_t i = 0; i < _num_hog_detect_kernel; ++i) - { - const size_t idx_block_norm = input_hog_detect[i]; - - _hog_detect_kernel[i].configure(&_hog_norm_space[idx_block_norm], multi_hog->model(i), detection_windows, detection_window_strides->at(i), threshold, i); - } - - // Configure non maxima suppression kernel - _non_maxima_kernel.configure(_detection_windows, min_distance); - - // Allocate intermediate tensors - for(size_t i = 0; i < _num_block_norm_kernel; ++i) - { - _hog_norm_space[i].allocator()->allocate(); - } -} - -void NEHOGMultiDetection::run() -{ - ARM_COMPUTE_ERROR_ON_MSG(_detection_windows == nullptr, "Unconfigured function"); - - MemoryGroupResourceScope scope_mg(_memory_group); - - // Reset detection window - _detection_windows->clear(); - - // Run gradient - _gradient_kernel.run(); - - // Run orientation binning kernel - for(auto &kernel : _orient_bin_kernel) - { - NEScheduler::get().schedule(&kernel, Window::DimY); - } - - // Run block normalization kernel - for(auto &kernel : _block_norm_kernel) - { - NEScheduler::get().schedule(&kernel, Window::DimY); - } - - // Run HOG detector kernel - for(auto &kernel : _hog_detect_kernel) - { - kernel.run(); - } - - // Run non-maxima suppression kernel if enabled - if(_non_maxima_suppression) - { - NEScheduler::get().schedule(&_non_maxima_kernel, Window::DimY); - } -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEHarrisCorners.cpp b/src/runtime/NEON/functions/NEHarrisCorners.cpp deleted file mode 100644 index 6b15596f8a..0000000000 --- a/src/runtime/NEON/functions/NEHarrisCorners.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEHarrisCorners.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/Array.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "arm_compute/runtime/NEON/functions/NESobel3x3.h" -#include "arm_compute/runtime/NEON/functions/NESobel5x5.h" -#include "arm_compute/runtime/NEON/functions/NESobel7x7.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEHarrisCornersKernel.h" -#include "src/core/NEON/kernels/NESobel5x5Kernel.h" -#include "src/core/NEON/kernels/NESobel7x7Kernel.h" - -#include -#include - -namespace arm_compute -{ -NEHarrisCorners::~NEHarrisCorners() = default; - -NEHarrisCorners::NEHarrisCorners(std::shared_ptr memory_manager) // NOLINT - : _memory_group(std::move(memory_manager)), - _sobel(), - _harris_score(), - _non_max_suppr(), - _candidates(), - _sort_euclidean(), - _border_gx(), - _border_gy(), - _gx(), - _gy(), - _score(), - _nonmax(), - _corners_list(), - _num_corner_candidates(0) -{ -} - -void NEHarrisCorners::configure(IImage *input, float threshold, float min_dist, - float sensitivity, int32_t gradient_size, int32_t block_size, KeyPointArray *corners, - BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(input); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON(!(block_size == 3 || block_size == 5 || block_size == 7)); - - const TensorShape shape = input->info()->tensor_shape(); - TensorInfo tensor_info_gxgy; - - if(gradient_size < 7) - { - tensor_info_gxgy.init(shape, Format::S16); - } - else - { - tensor_info_gxgy.init(shape, Format::S32); - } - - _gx.allocator()->init(tensor_info_gxgy); - _gy.allocator()->init(tensor_info_gxgy); - - // Manage intermediate buffers - _memory_group.manage(&_gx); - _memory_group.manage(&_gy); - - TensorInfo tensor_info_score(shape, Format::F32); - _score.allocator()->init(tensor_info_score); - _nonmax.allocator()->init(tensor_info_score); - - _corners_list.resize(shape.x() * shape.y()); - - // Set/init Sobel kernel accordingly with gradient_size - switch(gradient_size) - { - case 3: - { - auto k = std::make_unique(); - k->configure(input, &_gx, &_gy, border_mode, constant_border_value); - _sobel = std::move(k); - break; - } - case 5: - { - auto k = std::make_unique(); - k->configure(input, &_gx, &_gy, border_mode, constant_border_value); - _sobel = std::move(k); - break; - } - case 7: - { - auto k = std::make_unique(); - k->configure(input, &_gx, &_gy, border_mode, constant_border_value); - _sobel = std::move(k); - break; - } - default: - ARM_COMPUTE_ERROR("Gradient size not implemented"); - } - - // Normalization factor - const float norm_factor = 1.0f / (255.0f * pow(4.0f, gradient_size / 2) * block_size); - - // Manage intermediate buffers - _memory_group.manage(&_score); - - // Set/init Harris Score kernel accordingly with block_size - switch(block_size) - { - case 3: - { - auto k = std::make_unique>(); - k->configure(&_gx, &_gy, &_score, norm_factor, threshold, sensitivity, border_mode == BorderMode::UNDEFINED); - _harris_score = std::move(k); - } - break; - case 5: - { - auto k = std::make_unique>(); - k->configure(&_gx, &_gy, &_score, norm_factor, threshold, sensitivity, border_mode == BorderMode::UNDEFINED); - _harris_score = std::move(k); - } - break; - case 7: - { - auto k = std::make_unique>(); - k->configure(&_gx, &_gy, &_score, norm_factor, threshold, sensitivity, border_mode == BorderMode::UNDEFINED); - _harris_score = std::move(k); - } - default: - break; - } - - // Configure border filling before harris score - _border_gx = std::make_unique(); - _border_gy = std::make_unique(); - _border_gx->configure(&_gx, _harris_score->border_size(), border_mode, constant_border_value); - _border_gy->configure(&_gy, _harris_score->border_size(), border_mode, constant_border_value); - - // Allocate once all the configure methods have been called - _gx.allocator()->allocate(); - _gy.allocator()->allocate(); - - // Manage intermediate buffers - _memory_group.manage(&_nonmax); - - // Init non-maxima suppression function - _non_max_suppr.configure(&_score, &_nonmax, border_mode); - - // Allocate once all the configure methods have been called - _score.allocator()->allocate(); - - // Init corner candidates kernel - _candidates.configure(&_nonmax, _corners_list.data(), &_num_corner_candidates); - - // Allocate once all the configure methods have been called - _nonmax.allocator()->allocate(); - - // Init euclidean distance - _sort_euclidean.configure(_corners_list.data(), corners, &_num_corner_candidates, min_dist); -} - -void NEHarrisCorners::run() -{ - ARM_COMPUTE_ERROR_ON_MSG(_sobel == nullptr, "Unconfigured function"); - - MemoryGroupResourceScope scope_mg(_memory_group); - - // Init to 0 number of corner candidates - _num_corner_candidates = 0; - - // Run Sobel kernel - _sobel->run(); - - // Fill border before harris score kernel - NEScheduler::get().schedule(_border_gx.get(), Window::DimZ); - NEScheduler::get().schedule(_border_gy.get(), Window::DimZ); - - // Run harris score kernel - NEScheduler::get().schedule(_harris_score.get(), Window::DimY); - - // Run non-maxima suppression - _non_max_suppr.run(); - - // Run corner candidate kernel - NEScheduler::get().schedule(&_candidates, Window::DimY); - - // Run sort & euclidean distance - NEScheduler::get().schedule(&_sort_euclidean, Window::DimY); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEHistogram.cpp b/src/runtime/NEON/functions/NEHistogram.cpp deleted file mode 100644 index 1b093d60e5..0000000000 --- a/src/runtime/NEON/functions/NEHistogram.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEHistogram.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/IDistribution1D.h" -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "src/core/NEON/kernels/NEHistogramKernel.h" - -namespace arm_compute -{ -NEHistogram::~NEHistogram() = default; - -NEHistogram::NEHistogram() - : _histogram_kernel(), _local_hist(), _window_lut(window_lut_default_size), _local_hist_size(0) -{ -} - -void NEHistogram::configure(const IImage *input, IDistribution1D *output) -{ - ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(input); - ARM_COMPUTE_ERROR_ON(nullptr == output); - - // Allocate space for threads local histograms - _local_hist_size = output->num_bins() * NEScheduler::get().num_threads(); - _local_hist.resize(_local_hist_size); - - // Configure kernel - _histogram_kernel = std::make_unique(); - _histogram_kernel->configure(input, output, _local_hist.data(), _window_lut.data()); -} - -void NEHistogram::run() -{ - // Calculate histogram of input. - NEScheduler::get().schedule(_histogram_kernel.get(), Window::DimY); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEIntegralImage.cpp b/src/runtime/NEON/functions/NEIntegralImage.cpp deleted file mode 100644 index 38f04247f6..0000000000 --- a/src/runtime/NEON/functions/NEIntegralImage.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEIntegralImage.h" - -#include "arm_compute/core/Types.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEIntegralImageKernel.h" - -#include - -namespace arm_compute -{ -NEIntegralImage::~NEIntegralImage() = default; - -void NEIntegralImage::configure(const ITensor *input, ITensor *output) -{ - auto k = std::make_unique(); - k->configure(input, output); - _kernel = std::move(k); - - auto b = std::make_unique(); - b->configure(output, _kernel->border_size(), BorderMode::CONSTANT, PixelValue()); - _border_handler = std::move(b); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NELaplacianPyramid.cpp b/src/runtime/NEON/functions/NELaplacianPyramid.cpp deleted file mode 100644 index a2651dbf36..0000000000 --- a/src/runtime/NEON/functions/NELaplacianPyramid.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NELaplacianPyramid.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/IPyramid.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/NEON/functions/NEArithmeticSubtraction.h" -#include "arm_compute/runtime/NEON/functions/NEDepthConvertLayer.h" -#include "arm_compute/runtime/NEON/functions/NEGaussianPyramid.h" -#include "arm_compute/runtime/Tensor.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEGaussian5x5Kernel.h" -#include "src/core/NEON/kernels/NEGaussianPyramidKernel.h" - -namespace arm_compute -{ -NELaplacianPyramid::~NELaplacianPyramid() = default; - -NELaplacianPyramid::NELaplacianPyramid() // NOLINT - : _num_levels(0), - _gaussian_pyr_function(), - _convf(), - _subf(), - _gauss_pyr(), - _conv_pyr(), - _depth_function() -{ -} - -void NELaplacianPyramid::run() -{ - ARM_COMPUTE_ERROR_ON_MSG(0 == _num_levels, "Unconfigured function"); - - // Compute Gaussian Pyramid - _gaussian_pyr_function.run(); - - for(unsigned int i = 0; i < _num_levels; ++i) - { - // Apply Gaussian filter to gaussian pyramid image - _convf[i].run(); - } - - for(unsigned int i = 0; i < _num_levels; ++i) - { - // Compute laplacian image - _subf[i].run(); - } - - _depth_function.run(); -} - -void NELaplacianPyramid::configure(const ITensor *input, IPyramid *pyramid, ITensor *output, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON(nullptr == pyramid); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::S16); - ARM_COMPUTE_ERROR_ON(0 == pyramid->info()->num_levels()); - ARM_COMPUTE_ERROR_ON(input->info()->dimension(0) != pyramid->info()->width()); - ARM_COMPUTE_ERROR_ON(input->info()->dimension(1) != pyramid->info()->height()); - ARM_COMPUTE_ERROR_ON(output->info()->dimension(0) != pyramid->get_pyramid_level(pyramid->info()->num_levels() - 1)->info()->dimension(0)); - ARM_COMPUTE_ERROR_ON(output->info()->dimension(1) != pyramid->get_pyramid_level(pyramid->info()->num_levels() - 1)->info()->dimension(1)); - - _num_levels = pyramid->info()->num_levels(); - - // Create and initialize the gaussian pyramid and the convoluted pyramid - PyramidInfo pyramid_info; - pyramid_info.init(_num_levels, 0.5f, pyramid->info()->tensor_shape(), arm_compute::Format::U8); - - _gauss_pyr.init(pyramid_info); - _conv_pyr.init(pyramid_info); - - // Create Gaussian Pyramid function - _gaussian_pyr_function.configure(input, &_gauss_pyr, border_mode, constant_border_value); - - _convf.resize(_num_levels); - _subf.resize(_num_levels); - - for(unsigned int i = 0; i < _num_levels; ++i) - { - _convf[i].configure(_gauss_pyr.get_pyramid_level(i), _conv_pyr.get_pyramid_level(i), border_mode, constant_border_value); - _subf[i].configure(_gauss_pyr.get_pyramid_level(i), _conv_pyr.get_pyramid_level(i), pyramid->get_pyramid_level(i), ConvertPolicy::WRAP); - } - - _depth_function.configure(_conv_pyr.get_pyramid_level(_num_levels - 1), output, ConvertPolicy::WRAP, 0); - - _gauss_pyr.allocate(); - _conv_pyr.allocate(); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NELaplacianReconstruct.cpp b/src/runtime/NEON/functions/NELaplacianReconstruct.cpp deleted file mode 100644 index a50e7ccbef..0000000000 --- a/src/runtime/NEON/functions/NELaplacianReconstruct.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NELaplacianReconstruct.h" - -#include "arm_compute/core/CPP/ICPPKernel.h" -#include "arm_compute/core/Error.h" -#include "arm_compute/core/IPyramid.h" -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Validate.h" - -#include - -namespace arm_compute -{ -NELaplacianReconstruct::~NELaplacianReconstruct() = default; - -NELaplacianReconstruct::NELaplacianReconstruct() // NOLINT - : _tmp_pyr(), - _addf(), - _scalef(), - _depthf() -{ -} - -void NELaplacianReconstruct::configure(const IPyramid *pyramid, ITensor *input, ITensor *output, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON(nullptr == pyramid); - ARM_COMPUTE_ERROR_ON(input == output); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::S16); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON(input->info()->num_dimensions() != pyramid->get_pyramid_level(0)->info()->num_dimensions()); - ARM_COMPUTE_ERROR_ON(output->info()->num_dimensions() != pyramid->get_pyramid_level(0)->info()->num_dimensions()); - ARM_COMPUTE_ERROR_ON(output->info()->dimension(0) != pyramid->get_pyramid_level(0)->info()->dimension(0)); - ARM_COMPUTE_ERROR_ON(output->info()->dimension(1) != pyramid->get_pyramid_level(0)->info()->dimension(1)); - ARM_COMPUTE_ERROR_ON(input->info()->dimension(0) != pyramid->get_pyramid_level(pyramid->info()->num_levels() - 1)->info()->dimension(0)); - ARM_COMPUTE_ERROR_ON(input->info()->dimension(1) != pyramid->get_pyramid_level(pyramid->info()->num_levels() - 1)->info()->dimension(1)); - - const size_t num_levels = pyramid->info()->num_levels(); - - // Create and initialize the tmp pyramid: I(n-2) = upsample( input + Laplace(n-1) ) - PyramidInfo pyramid_info; - pyramid_info.init(num_levels, 0.5f, output->info()->tensor_shape(), arm_compute::Format::S16); - - _tmp_pyr.init(pyramid_info); - - // Allocate add and scale functions. Level 0 does not need to be scaled. - _addf.resize(num_levels); - _scalef.resize(num_levels - 1); - - const size_t last_level = num_levels - 1; - - _addf[last_level].configure(input, pyramid->get_pyramid_level(last_level), _tmp_pyr.get_pyramid_level(last_level), ConvertPolicy::SATURATE); - - // Scale levels n-1 to 1, and add levels n-2 to 0 - for(size_t l = 0; l < last_level; ++l) - { - _scalef[l].configure(_tmp_pyr.get_pyramid_level(l + 1), _tmp_pyr.get_pyramid_level(l), ScaleKernelInfo{ arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, constant_border_value, SamplingPolicy::CENTER, false }); - _addf[l].configure(_tmp_pyr.get_pyramid_level(l), pyramid->get_pyramid_level(l), _tmp_pyr.get_pyramid_level(l), ConvertPolicy::SATURATE); - } - - // Convert level 0 from S16 to U8 - _depthf.configure(_tmp_pyr.get_pyramid_level(0), output, ConvertPolicy::SATURATE, 0); - - _tmp_pyr.allocate(); -} - -void NELaplacianReconstruct::run() -{ - ARM_COMPUTE_ERROR_ON_MSG(_addf.empty(), "Unconfigured function"); - - const size_t last_level = _tmp_pyr.info()->num_levels() - 1; - - _addf[last_level].run(); - - // Run l = [last_level - 1, 0] - for(size_t l = last_level; l-- > 0;) - { - _scalef[l].run(); - _addf[l].run(); - } - - _depthf.run(); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEMagnitude.cpp b/src/runtime/NEON/functions/NEMagnitude.cpp deleted file mode 100644 index 34d9a7fb0b..0000000000 --- a/src/runtime/NEON/functions/NEMagnitude.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEMagnitude.h" - -#include "arm_compute/core/Types.h" -#include "src/core/NEON/kernels/NEMagnitudePhaseKernel.h" - -#include - -namespace arm_compute -{ -NEMagnitude::~NEMagnitude() = default; - -void NEMagnitude::configure(const ITensor *input1, const ITensor *input2, ITensor *output, MagnitudeType mag_type) -{ - if(mag_type == MagnitudeType::L1NORM) - { - auto k = std::make_unique>(); - k->configure(input1, input2, output, nullptr); - _kernel = std::move(k); - } - else - { - auto k = std::make_unique>(); - k->configure(input1, input2, output, nullptr); - _kernel = std::move(k); - } -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEMeanStdDev.cpp b/src/runtime/NEON/functions/NEMeanStdDev.cpp deleted file mode 100644 index 6e2d7fc81d..0000000000 --- a/src/runtime/NEON/functions/NEMeanStdDev.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEMeanStdDev.h" - -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEMeanStdDevKernel.h" - -namespace arm_compute -{ -NEMeanStdDev::~NEMeanStdDev() = default; - -NEMeanStdDev::NEMeanStdDev() - : _mean_stddev_kernel(), _fill_border_kernel(), _global_sum(0), _global_sum_squared(0) -{ -} - -void NEMeanStdDev::configure(IImage *input, float *mean, float *stddev) -{ - _mean_stddev_kernel = std::make_unique(); - _fill_border_kernel = std::make_unique(); - - _mean_stddev_kernel->configure(input, mean, &_global_sum, stddev, &_global_sum_squared); - _fill_border_kernel->configure(input, _mean_stddev_kernel->border_size(), BorderMode::CONSTANT, PixelValue(static_cast(0))); -} - -void NEMeanStdDev::run() -{ - _global_sum = 0; - _global_sum_squared = 0; - - NEScheduler::get().schedule(_fill_border_kernel.get(), Window::DimZ); - NEScheduler::get().schedule(_mean_stddev_kernel.get(), Window::DimY); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEMedian3x3.cpp b/src/runtime/NEON/functions/NEMedian3x3.cpp deleted file mode 100644 index 4d117783ed..0000000000 --- a/src/runtime/NEON/functions/NEMedian3x3.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEMedian3x3.h" - -#include "arm_compute/core/PixelValue.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEMedian3x3Kernel.h" - -#include - -namespace arm_compute -{ -void NEMedian3x3::configure(ITensor *input, ITensor *output, BorderMode border_mode, uint8_t constant_border_value) -{ - auto k = std::make_unique(); - k->configure(input, output, border_mode == BorderMode::UNDEFINED); - _kernel = std::move(k); - - auto b = std::make_unique(); - b->configure(input, _kernel->border_size(), border_mode, PixelValue(constant_border_value)); - _border_handler = std::move(b); -} -} // namespace arm_compute \ No newline at end of file diff --git a/src/runtime/NEON/functions/NEMinMaxLocation.cpp b/src/runtime/NEON/functions/NEMinMaxLocation.cpp deleted file mode 100644 index ffbc33bc2e..0000000000 --- a/src/runtime/NEON/functions/NEMinMaxLocation.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEMinMaxLocation.h" - -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "src/core/NEON/kernels/NEMinMaxLocationKernel.h" - -namespace arm_compute -{ -NEMinMaxLocation::~NEMinMaxLocation() = default; - -NEMinMaxLocation::NEMinMaxLocation() - : _min_max(), _min_max_loc() -{ -} - -void NEMinMaxLocation::configure(const IImage *input, void *min, void *max, ICoordinates2DArray *min_loc, ICoordinates2DArray *max_loc, uint32_t *min_count, uint32_t *max_count) -{ - _min_max = std::make_unique(); - _min_max->configure(input, min, max); - - _min_max_loc = std::make_unique(); - _min_max_loc->configure(input, min, max, min_loc, max_loc, min_count, max_count); -} - -void NEMinMaxLocation::run() -{ - _min_max->reset(); - - /* Run min max kernel */ - NEScheduler::get().schedule(_min_max.get(), Window::DimY); - - /* Run min max location */ - NEScheduler::get().schedule(_min_max_loc.get(), Window::DimY); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NENonLinearFilter.cpp b/src/runtime/NEON/functions/NENonLinearFilter.cpp deleted file mode 100644 index f3acabfa6d..0000000000 --- a/src/runtime/NEON/functions/NENonLinearFilter.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NENonLinearFilter.h" - -#include "arm_compute/core/PixelValue.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NENonLinearFilterKernel.h" - -#include - -namespace arm_compute -{ -void NENonLinearFilter::configure(ITensor *input, ITensor *output, NonLinearFilterFunction function, unsigned int mask_size, MatrixPattern pattern, const uint8_t *mask, - BorderMode border_mode, - uint8_t constant_border_value) -{ - auto k = std::make_unique(); - k->configure(input, output, function, mask_size, pattern, mask, border_mode == BorderMode::UNDEFINED); - _kernel = std::move(k); - - auto b = std::make_unique(); - b->configure(input, _kernel->border_size(), border_mode, PixelValue(constant_border_value)); - _border_handler = std::move(b); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEOpticalFlow.cpp b/src/runtime/NEON/functions/NEOpticalFlow.cpp deleted file mode 100644 index a868208aaf..0000000000 --- a/src/runtime/NEON/functions/NEOpticalFlow.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEOpticalFlow.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Window.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "arm_compute/runtime/NEON/functions/NEScharr3x3.h" -#include "arm_compute/runtime/Pyramid.h" -#include "arm_compute/runtime/Tensor.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NELKTrackerKernel.h" - -namespace arm_compute -{ -NEOpticalFlow::~NEOpticalFlow() = default; - -NEOpticalFlow::NEOpticalFlow(std::shared_ptr memory_manager) // NOLINT - : _memory_group(std::move(memory_manager)), - _func_scharr(), - _kernel_tracker(), - _scharr_gx(), - _scharr_gy(), - _new_points(nullptr), - _new_points_estimates(nullptr), - _old_points(nullptr), - _new_points_internal(), - _old_points_internal(), - _num_levels(0) -{ -} - -void NEOpticalFlow::configure(const Pyramid *old_pyramid, const Pyramid *new_pyramid, const IKeyPointArray *old_points, const IKeyPointArray *new_points_estimates, - IKeyPointArray *new_points, Termination termination, float epsilon, unsigned int num_iterations, size_t window_dimension, - bool use_initial_estimate, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON(nullptr == old_pyramid); - ARM_COMPUTE_ERROR_ON(nullptr == new_pyramid); - ARM_COMPUTE_ERROR_ON(nullptr == old_points); - ARM_COMPUTE_ERROR_ON(nullptr == new_points_estimates); - ARM_COMPUTE_ERROR_ON(nullptr == new_points); - ARM_COMPUTE_ERROR_ON(old_pyramid->info()->num_levels() != new_pyramid->info()->num_levels()); - ARM_COMPUTE_ERROR_ON(0 == old_pyramid->info()->num_levels()); - ARM_COMPUTE_ERROR_ON(old_pyramid->info()->width() != new_pyramid->info()->width()); - ARM_COMPUTE_ERROR_ON(old_pyramid->info()->height() != new_pyramid->info()->height()); - ARM_COMPUTE_ERROR_ON(use_initial_estimate && old_points->num_values() != new_points_estimates->num_values()); - - _num_levels = old_pyramid->info()->num_levels(); - _old_points = old_points; - _new_points = new_points; - _new_points_estimates = new_points_estimates; - - const float pyr_scale = old_pyramid->info()->scale(); - - _func_scharr.clear(); - _kernel_tracker.clear(); - _scharr_gx.clear(); - _scharr_gy.clear(); - - _func_scharr.resize(_num_levels); - _kernel_tracker.resize(_num_levels); - _scharr_gx.resize(_num_levels); - _scharr_gy.resize(_num_levels); - - _old_points_internal = LKInternalKeypointArray(old_points->num_values()); - _new_points_internal = LKInternalKeypointArray(old_points->num_values()); - _new_points->resize(old_points->num_values()); - - for(unsigned int i = 0; i < _num_levels; ++i) - { - // Get images from the ith level of old and right pyramid - IImage *old_ith_input = old_pyramid->get_pyramid_level(i); - IImage *new_ith_input = new_pyramid->get_pyramid_level(i); - - // Get width and height of images - const unsigned int width_ith = old_ith_input->info()->dimension(0); - const unsigned int height_ith = new_ith_input->info()->dimension(1); - - TensorInfo tensor_info(TensorShape(width_ith, height_ith), Format::S16); - - _scharr_gx[i].allocator()->init(tensor_info); - _scharr_gy[i].allocator()->init(tensor_info); - - // Manage intermediate buffers - _memory_group.manage(&_scharr_gx[i]); - _memory_group.manage(&_scharr_gy[i]); - - // Init Scharr kernel - _func_scharr[i].configure(old_ith_input, &_scharr_gx[i], &_scharr_gy[i], border_mode, constant_border_value); - - // Init Lucas-Kanade kernel - _kernel_tracker[i] = std::make_unique(); - _kernel_tracker[i]->configure(old_ith_input, new_ith_input, &_scharr_gx[i], &_scharr_gy[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(); - } -} - -void NEOpticalFlow::run() -{ - ARM_COMPUTE_ERROR_ON_MSG(_num_levels == 0, "Unconfigured function"); - - MemoryGroupResourceScope scope_mg(_memory_group); - - for(unsigned int level = _num_levels; level > 0; --level) - { - // Run Scharr kernel - _func_scharr[level - 1].run(); - - // Run Lucas-Kanade kernel - NEScheduler::get().schedule(_kernel_tracker[level - 1].get(), Window::DimX); - } -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEPhase.cpp b/src/runtime/NEON/functions/NEPhase.cpp deleted file mode 100644 index 3b69a10e7f..0000000000 --- a/src/runtime/NEON/functions/NEPhase.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEPhase.h" - -#include "src/core/NEON/kernels/NEMagnitudePhaseKernel.h" - -#include - -namespace arm_compute -{ -void NEPhase::configure(const ITensor *input1, const ITensor *input2, ITensor *output, PhaseType phase_type) -{ - if(phase_type == PhaseType::UNSIGNED) - { - auto k = std::make_unique>(); - k->configure(input1, input2, nullptr, output); - _kernel = std::move(k); - } - else - { - auto k = std::make_unique>(); - k->configure(input1, input2, nullptr, output); - _kernel = std::move(k); - } -} -} // namespace arm_compute \ No newline at end of file diff --git a/src/runtime/NEON/functions/NERemap.cpp b/src/runtime/NEON/functions/NERemap.cpp deleted file mode 100644 index f2f57aa599..0000000000 --- a/src/runtime/NEON/functions/NERemap.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NERemap.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/PixelValue.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NERemapKernel.h" - -#include - -namespace arm_compute -{ -void NERemap::configure(ITensor *input, const ITensor *map_x, const ITensor *map_y, ITensor *output, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(map_x, 1, DataType::F32); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(map_y, 1, DataType::F32); - ARM_COMPUTE_ERROR_ON_MSG(policy == InterpolationPolicy::AREA, "Area interpolation is not supported"); - - auto k = std::make_unique(); - k->configure(input, map_x, map_y, output, policy); - _kernel = std::move(k); - - auto b = std::make_unique(); - b->configure(input, _kernel->border_size(), border_mode, PixelValue(constant_border_value)); - _border_handler = std::move(b); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEScharr3x3.cpp b/src/runtime/NEON/functions/NEScharr3x3.cpp deleted file mode 100644 index 414e9470ea..0000000000 --- a/src/runtime/NEON/functions/NEScharr3x3.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEScharr3x3.h" - -#include "arm_compute/core/PixelValue.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEScharr3x3Kernel.h" - -#include - -using namespace arm_compute; - -void NEScharr3x3::configure(ITensor *input, ITensor *output_x, ITensor *output_y, BorderMode border_mode, uint8_t constant_border_value) -{ - auto k = std::make_unique(); - k->configure(input, output_x, output_y, border_mode == BorderMode::UNDEFINED); - _kernel = std::move(k); - - auto b = std::make_unique(); - b->configure(input, _kernel->border_size(), border_mode, PixelValue(constant_border_value)); - _border_handler = std::move(b); -} diff --git a/src/runtime/NEON/functions/NESobel3x3.cpp b/src/runtime/NEON/functions/NESobel3x3.cpp deleted file mode 100644 index 1a57bc3fc6..0000000000 --- a/src/runtime/NEON/functions/NESobel3x3.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NESobel3x3.h" - -#include "arm_compute/core/PixelValue.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NESobel3x3Kernel.h" - -#include - -namespace arm_compute -{ -void NESobel3x3::configure(ITensor *input, ITensor *output_x, ITensor *output_y, BorderMode border_mode, uint8_t constant_border_value) -{ - auto k = std::make_unique(); - k->configure(input, output_x, output_y, border_mode == BorderMode::UNDEFINED); - _kernel = std::move(k); - - auto b = std::make_unique(); - b->configure(input, _kernel->border_size(), border_mode, PixelValue(constant_border_value)); - _border_handler = std::move(b); -} -} // namespace arm_compute \ No newline at end of file diff --git a/src/runtime/NEON/functions/NESobel5x5.cpp b/src/runtime/NEON/functions/NESobel5x5.cpp deleted file mode 100644 index e587981fa9..0000000000 --- a/src/runtime/NEON/functions/NESobel5x5.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NESobel5x5.h" - -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/PixelValue.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NESobel5x5Kernel.h" - -namespace arm_compute -{ -NESobel5x5::~NESobel5x5() = default; - -NESobel5x5::NESobel5x5(std::shared_ptr memory_manager) - : _memory_group(std::move(memory_manager)), _sobel_hor(), _sobel_vert(), _tmp_x(), _tmp_y(), _border_handler() -{ -} - -void NESobel5x5::configure(ITensor *input, ITensor *output_x, ITensor *output_y, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - - const bool run_sobel_x = output_x != nullptr; - const bool run_sobel_y = output_y != nullptr; - - TensorInfo tensor_info(input->info()->tensor_shape(), Format::S16); - - _sobel_hor = std::make_unique(); - _sobel_vert = std::make_unique(); - _border_handler = std::make_unique(); - - if(run_sobel_x && run_sobel_y) - { - _tmp_x.allocator()->init(tensor_info); - _tmp_y.allocator()->init(tensor_info); - _memory_group.manage(&_tmp_x); - _memory_group.manage(&_tmp_y); - _sobel_hor->configure(input, &_tmp_x, &_tmp_y, border_mode == BorderMode::UNDEFINED); - _sobel_vert->configure(&_tmp_x, &_tmp_y, output_x, output_y, border_mode == BorderMode::UNDEFINED); - _tmp_x.allocator()->allocate(); - _tmp_y.allocator()->allocate(); - } - else if(run_sobel_x) - { - _tmp_x.allocator()->init(tensor_info); - _memory_group.manage(&_tmp_x); - _sobel_hor->configure(input, &_tmp_x, nullptr, border_mode == BorderMode::UNDEFINED); - _sobel_vert->configure(&_tmp_x, nullptr, output_x, nullptr, border_mode == BorderMode::UNDEFINED); - _tmp_x.allocator()->allocate(); - } - else if(run_sobel_y) - { - _tmp_y.allocator()->init(tensor_info); - _memory_group.manage(&_tmp_y); - _sobel_hor->configure(input, nullptr, &_tmp_y, border_mode == BorderMode::UNDEFINED); - _sobel_vert->configure(nullptr, &_tmp_y, nullptr, output_y, border_mode == BorderMode::UNDEFINED); - _tmp_y.allocator()->allocate(); - } - - _border_handler->configure(input, _sobel_hor->border_size(), border_mode, PixelValue(constant_border_value)); -} - -void NESobel5x5::run() -{ - NEScheduler::get().schedule(_border_handler.get(), Window::DimZ); - - MemoryGroupResourceScope scope_mg(_memory_group); - - NEScheduler::get().schedule(_sobel_hor.get(), Window::DimY); - NEScheduler::get().schedule(_sobel_vert.get(), Window::DimY); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NESobel7x7.cpp b/src/runtime/NEON/functions/NESobel7x7.cpp deleted file mode 100644 index 7b1a975951..0000000000 --- a/src/runtime/NEON/functions/NESobel7x7.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NESobel7x7.h" - -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/PixelValue.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/Validate.h" -#include "arm_compute/runtime/NEON/NEScheduler.h" -#include "arm_compute/runtime/TensorAllocator.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NESobel7x7Kernel.h" - -namespace arm_compute -{ -NESobel7x7::~NESobel7x7() = default; - -NESobel7x7::NESobel7x7(std::shared_ptr memory_manager) - : _memory_group(std::move(memory_manager)), _sobel_hor(), _sobel_vert(), _tmp_x(), _tmp_y(), _border_handler() -{ -} - -void NESobel7x7::configure(ITensor *input, ITensor *output_x, ITensor *output_y, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - - const bool run_sobel_x = output_x != nullptr; - const bool run_sobel_y = output_y != nullptr; - - TensorInfo tensor_info(input->info()->tensor_shape(), Format::S32); - _sobel_hor = std::make_unique(); - _sobel_vert = std::make_unique(); - _border_handler = std::make_unique(); - - if(run_sobel_x && run_sobel_y) - { - _tmp_x.allocator()->init(tensor_info); - _tmp_y.allocator()->init(tensor_info); - _memory_group.manage(&_tmp_x); - _memory_group.manage(&_tmp_y); - _sobel_hor->configure(input, &_tmp_x, &_tmp_y, border_mode == BorderMode::UNDEFINED); - _sobel_vert->configure(&_tmp_x, &_tmp_y, output_x, output_y, border_mode == BorderMode::UNDEFINED); - _tmp_x.allocator()->allocate(); - _tmp_y.allocator()->allocate(); - } - else if(run_sobel_x) - { - _tmp_x.allocator()->init(tensor_info); - _memory_group.manage(&_tmp_x); - _sobel_hor->configure(input, &_tmp_x, nullptr, border_mode == BorderMode::UNDEFINED); - _sobel_vert->configure(&_tmp_x, nullptr, output_x, nullptr, border_mode == BorderMode::UNDEFINED); - _tmp_x.allocator()->allocate(); - } - else if(run_sobel_y) - { - _tmp_y.allocator()->init(tensor_info); - _memory_group.manage(&_tmp_y); - _sobel_hor->configure(input, nullptr, &_tmp_y, border_mode == BorderMode::UNDEFINED); - _sobel_vert->configure(nullptr, &_tmp_y, nullptr, output_y, border_mode == BorderMode::UNDEFINED); - _tmp_y.allocator()->allocate(); - } - - _border_handler->configure(input, _sobel_hor->border_size(), border_mode, PixelValue(constant_border_value)); -} - -void NESobel7x7::run() -{ - NEScheduler::get().schedule(_border_handler.get(), Window::DimZ); - - MemoryGroupResourceScope scope_mg(_memory_group); - - NEScheduler::get().schedule(_sobel_hor.get(), Window::DimY); - NEScheduler::get().schedule(_sobel_vert.get(), Window::DimY); -} -} // namespace arm_compute \ No newline at end of file diff --git a/src/runtime/NEON/functions/NETableLookup.cpp b/src/runtime/NEON/functions/NETableLookup.cpp deleted file mode 100644 index fde3908c81..0000000000 --- a/src/runtime/NEON/functions/NETableLookup.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NETableLookup.h" - -#include "src/core/NEON/kernels/NETableLookupKernel.h" - -#include - -using namespace arm_compute; - -void NETableLookup::configure(const ITensor *input, const ILut *lut, ITensor *output) -{ - auto k = std::make_unique(); - k->configure(input, lut, output); - _kernel = std::move(k); -} diff --git a/src/runtime/NEON/functions/NEThreshold.cpp b/src/runtime/NEON/functions/NEThreshold.cpp deleted file mode 100644 index 2aa6ea897a..0000000000 --- a/src/runtime/NEON/functions/NEThreshold.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016-2021 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEThreshold.h" - -#include "src/core/NEON/kernels/NEThresholdKernel.h" - -#include - -namespace arm_compute -{ -void NEThreshold::configure(const ITensor *input, ITensor *output, const ThresholdKernelInfo &info) -{ - auto k = std::make_unique(); - k->configure(input, output, info); - _kernel = std::move(k); -} - -Status NEThreshold::validate(const ITensorInfo *input, const ITensorInfo *output, const ThresholdKernelInfo &info) -{ - return NEThresholdKernel::validate(input, output, info); -} -} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEWarpAffine.cpp b/src/runtime/NEON/functions/NEWarpAffine.cpp deleted file mode 100644 index 1e8907b895..0000000000 --- a/src/runtime/NEON/functions/NEWarpAffine.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEWarpAffine.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/Validate.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEWarpKernel.h" - -#include - -using namespace arm_compute; - -void NEWarpAffine::configure(ITensor *input, ITensor *output, const std::array &matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::U8); - - switch(policy) - { - case InterpolationPolicy::NEAREST_NEIGHBOR: - { - auto k = std::make_unique>(); - k->configure(input, output, matrix, border_mode, constant_border_value); - _kernel = std::move(k); - break; - } - case InterpolationPolicy::BILINEAR: - { - auto k = std::make_unique>(); - k->configure(input, output, matrix, border_mode, constant_border_value); - _kernel = std::move(k); - break; - } - case InterpolationPolicy::AREA: - default: - ARM_COMPUTE_ERROR("Interpolation type not supported"); - } - - auto b = std::make_unique(); - b->configure(input, _kernel->border_size(), border_mode, constant_border_value); - _border_handler = std::move(b); -} diff --git a/src/runtime/NEON/functions/NEWarpPerspective.cpp b/src/runtime/NEON/functions/NEWarpPerspective.cpp deleted file mode 100644 index d546da89b8..0000000000 --- a/src/runtime/NEON/functions/NEWarpPerspective.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2016-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "arm_compute/runtime/NEON/functions/NEWarpPerspective.h" - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/Validate.h" -#include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEWarpKernel.h" - -#include - -namespace arm_compute -{ -void NEWarpPerspective::configure(ITensor *input, ITensor *output, const std::array &matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value) -{ - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::U8); - - switch(policy) - { - case InterpolationPolicy::NEAREST_NEIGHBOR: - { - auto k = std::make_unique>(); - k->configure(input, output, matrix, border_mode, constant_border_value); - _kernel = std::move(k); - break; - } - case InterpolationPolicy::BILINEAR: - { - auto k = std::make_unique>(); - k->configure(input, output, matrix, border_mode, constant_border_value); - _kernel = std::move(k); - break; - } - case InterpolationPolicy::AREA: - default: - ARM_COMPUTE_ERROR("Interpolation type not supported"); - } - - auto b = std::make_unique(); - b->configure(input, _kernel->border_size(), border_mode, constant_border_value); - _border_handler = std::move(b); -} -} // namespace arm_compute -- cgit v1.2.1