diff options
Diffstat (limited to 'src/runtime')
-rw-r--r-- | src/runtime/CL/functions/CLCropResize.cpp | 2 | ||||
-rw-r--r-- | src/runtime/CL/functions/CLGaussianPyramid.cpp | 2 | ||||
-rw-r--r-- | src/runtime/CL/functions/CLLaplacianReconstruct.cpp | 2 | ||||
-rw-r--r-- | src/runtime/CL/functions/CLScale.cpp | 37 | ||||
-rw-r--r-- | src/runtime/CL/tuners/BifrostTuner.cpp | 4 | ||||
-rw-r--r-- | src/runtime/GLES_COMPUTE/functions/GCScale.cpp | 15 | ||||
-rw-r--r-- | src/runtime/NEON/functions/NECropResize.cpp | 4 | ||||
-rw-r--r-- | src/runtime/NEON/functions/NEGaussianPyramid.cpp | 2 | ||||
-rw-r--r-- | src/runtime/NEON/functions/NELaplacianReconstruct.cpp | 2 | ||||
-rw-r--r-- | src/runtime/NEON/functions/NEScale.cpp | 5 |
10 files changed, 48 insertions, 27 deletions
diff --git a/src/runtime/CL/functions/CLCropResize.cpp b/src/runtime/CL/functions/CLCropResize.cpp index 17fc80e146..aa6f1f913d 100644 --- a/src/runtime/CL/functions/CLCropResize.cpp +++ b/src/runtime/CL/functions/CLCropResize.cpp @@ -135,7 +135,7 @@ void CLCropResize::configure(const CLCompileContext &compile_context, const ICLT configure_crop(_input, _boxes, _box_ind, _crop_results[num_box].get(), num_box, start, end, batch_index); auto scale_kernel = support::cpp14::make_unique<CLScale>(); - scale_kernel->configure(compile_context, _crop_results[num_box].get(), _scaled_results[num_box].get(), _method, BorderMode::CONSTANT, PixelValue(_extrapolation_value), SamplingPolicy::TOP_LEFT); + scale_kernel->configure(compile_context, _crop_results[num_box].get(), _scaled_results[num_box].get(), ScaleKernelInfo{ _method, BorderMode::CONSTANT, PixelValue(_extrapolation_value), SamplingPolicy::TOP_LEFT }); _scale.emplace_back(std::move(scale_kernel)); Window win = calculate_max_window(*_output->info()); diff --git a/src/runtime/CL/functions/CLGaussianPyramid.cpp b/src/runtime/CL/functions/CLGaussianPyramid.cpp index 1ac98787ac..5dd1aacef1 100644 --- a/src/runtime/CL/functions/CLGaussianPyramid.cpp +++ b/src/runtime/CL/functions/CLGaussianPyramid.cpp @@ -175,7 +175,7 @@ void CLGaussianPyramidOrb::configure(const CLCompileContext &compile_context, IC _gauss5x5[i].configure(compile_context, _pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i), border_mode, constant_border_value); /* Configure scale image kernel */ - _scale_nearest[i].configure(compile_context, _tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, SamplingPolicy::CENTER); + _scale_nearest[i].configure(compile_context, _tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), ScaleKernelInfo{ InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, PixelValue(), SamplingPolicy::CENTER }); } _tmp.allocate(); diff --git a/src/runtime/CL/functions/CLLaplacianReconstruct.cpp b/src/runtime/CL/functions/CLLaplacianReconstruct.cpp index ea6a3f9a98..113a2b9e54 100644 --- a/src/runtime/CL/functions/CLLaplacianReconstruct.cpp +++ b/src/runtime/CL/functions/CLLaplacianReconstruct.cpp @@ -77,7 +77,7 @@ void CLLaplacianReconstruct::configure(const CLCompileContext &compile_context, // 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(compile_context, _tmp_pyr.get_pyramid_level(l + 1), _tmp_pyr.get_pyramid_level(l), arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, constant_border_value); + _scalef[l].configure(compile_context, _tmp_pyr.get_pyramid_level(l + 1), _tmp_pyr.get_pyramid_level(l), ScaleKernelInfo{ arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, constant_border_value }); _addf[l].configure(compile_context, _tmp_pyr.get_pyramid_level(l), pyramid->get_pyramid_level(l), _tmp_pyr.get_pyramid_level(l), ConvertPolicy::SATURATE); } diff --git a/src/runtime/CL/functions/CLScale.cpp b/src/runtime/CL/functions/CLScale.cpp index a9395bdc3d..7e58b76f8d 100644 --- a/src/runtime/CL/functions/CLScale.cpp +++ b/src/runtime/CL/functions/CLScale.cpp @@ -30,38 +30,53 @@ #include "arm_compute/runtime/CL/CLScheduler.h" #include "support/MemorySupport.h" -using namespace arm_compute; +namespace arm_compute +{ +void CLScale::configure(ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info) +{ + configure(CLKernelLibrary::get().get_compile_context(), input, output, info); +} void CLScale::configure(ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value, SamplingPolicy sampling_policy, bool use_padding, bool align_corners) { - configure(CLKernelLibrary::get().get_compile_context(), input, output, policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners); + configure(CLKernelLibrary::get().get_compile_context(), input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners }); } -void CLScale::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value, - SamplingPolicy sampling_policy, bool use_padding, bool align_corners) +void CLScale::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info) { - ARM_COMPUTE_UNUSED(use_padding); auto k = arm_compute::support::cpp14::make_unique<CLScaleKernel>(); k->set_target(CLScheduler::get().target()); - k->configure(compile_context, input, output, policy, border_mode, sampling_policy, align_corners); + k->configure(compile_context, input, output, info); _kernel = std::move(k); // Tune kernels CLScheduler::get().tune_kernel_static(*_kernel); + auto border_mode_to_use = info.border_mode; // In the case of NHWC we can't have undefined border mode as this would require to access elements outside z dimension, // so we treat it like border constant. - if(border_mode == BorderMode::UNDEFINED && input->info()->data_layout() == DataLayout::NHWC) + if(info.border_mode == BorderMode::UNDEFINED && input->info()->data_layout() == DataLayout::NHWC) { - border_mode = BorderMode::CONSTANT; + border_mode_to_use = BorderMode::CONSTANT; } - _border_handler.configure(compile_context, input, _kernel->border_size(), border_mode, constant_border_value); + _border_handler.configure(compile_context, input, _kernel->border_size(), border_mode_to_use, info.constant_border_value); +} + +void CLScale::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value, + SamplingPolicy sampling_policy, bool use_padding, bool align_corners) +{ + configure(compile_context, input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners }); } Status CLScale::validate(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value, SamplingPolicy sampling_policy, bool use_padding, bool align_corners) { - ARM_COMPUTE_UNUSED(constant_border_value, use_padding); - return CLScaleKernel::validate(input, output, policy, border_mode, sampling_policy, align_corners); + return CLScale::validate(input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners }); +} + +Status CLScale::validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info) +{ + return CLScaleKernel::validate(input, output, info); } +} // namespace arm_compute diff --git a/src/runtime/CL/tuners/BifrostTuner.cpp b/src/runtime/CL/tuners/BifrostTuner.cpp index 5b23baaed3..3df09ebd74 100644 --- a/src/runtime/CL/tuners/BifrostTuner.cpp +++ b/src/runtime/CL/tuners/BifrostTuner.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 ARM Limited. + * Copyright (c) 2018-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -255,7 +255,7 @@ void tune_scale_kernel(CLScaleKernel &k) cl::NDRange lws_hint = k.lws_hint(); const GPUTarget gpu_target = k.get_target(); const DataType dt = k.input()->info()->data_type(); - const InterpolationPolicy interpolation = k._interpolationPolicy; + const InterpolationPolicy interpolation = k.get_interpolation_policy(); // Configure the local work size for Bifrost, interpolation (bilinear) and datatype F32. // The value are obtained via exhaustive autotuning. diff --git a/src/runtime/GLES_COMPUTE/functions/GCScale.cpp b/src/runtime/GLES_COMPUTE/functions/GCScale.cpp index f245c3ecd0..2902252017 100644 --- a/src/runtime/GLES_COMPUTE/functions/GCScale.cpp +++ b/src/runtime/GLES_COMPUTE/functions/GCScale.cpp @@ -29,14 +29,19 @@ #include "arm_compute/core/Validate.h" #include "support/MemorySupport.h" -using namespace arm_compute; - +namespace arm_compute +{ void GCScale::configure(IGCTensor *input, IGCTensor *output, InterpolationPolicy policy, BorderMode border_mode, PixelValue constant_border_value, SamplingPolicy sampling_policy, bool use_padding, bool align_corners) { - ARM_COMPUTE_UNUSED(use_padding, align_corners); + configure(input, output, ScaleKernelInfo{ policy, border_mode, constant_border_value, sampling_policy, use_padding, align_corners }); +} + +void GCScale::configure(IGCTensor *input, IGCTensor *output, const ScaleKernelInfo &info) +{ auto k = arm_compute::support::cpp14::make_unique<GCScaleKernel>(); - k->configure(input, output, policy, border_mode == BorderMode::UNDEFINED, sampling_policy); + k->configure(input, output, info); _kernel = std::move(k); - _border_handler.configure(input, _kernel->border_size(), border_mode, constant_border_value); + _border_handler.configure(input, _kernel->border_size(), info.border_mode, info.constant_border_value); } +} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NECropResize.cpp b/src/runtime/NEON/functions/NECropResize.cpp index cc39d0284e..3a7ff52a89 100644 --- a/src/runtime/NEON/functions/NECropResize.cpp +++ b/src/runtime/NEON/functions/NECropResize.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 ARM Limited. + * Copyright (c) 2019-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -111,7 +111,7 @@ void NECropResize::run() NEScheduler::get().schedule(_crop[i].get(), Window::DimZ); // Scale the cropped image. - _scale[i]->configure(_crop_results[i].get(), _scaled_results[i].get(), _method, BorderMode::CONSTANT, PixelValue(_extrapolation_value), SamplingPolicy::TOP_LEFT, false); + _scale[i]->configure(_crop_results[i].get(), _scaled_results[i].get(), ScaleKernelInfo{ _method, BorderMode::CONSTANT, PixelValue(_extrapolation_value), SamplingPolicy::TOP_LEFT, false }); _scaled_results[i]->allocator()->allocate(); _scale[i]->run(); diff --git a/src/runtime/NEON/functions/NEGaussianPyramid.cpp b/src/runtime/NEON/functions/NEGaussianPyramid.cpp index d08bf1e282..478828efc0 100644 --- a/src/runtime/NEON/functions/NEGaussianPyramid.cpp +++ b/src/runtime/NEON/functions/NEGaussianPyramid.cpp @@ -168,7 +168,7 @@ void NEGaussianPyramidOrb::configure(const ITensor *input, IPyramid *pyramid, Bo _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), InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED); + _scale_nearest[i].configure(_tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), ScaleKernelInfo{ InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED }); } _tmp.allocate(); diff --git a/src/runtime/NEON/functions/NELaplacianReconstruct.cpp b/src/runtime/NEON/functions/NELaplacianReconstruct.cpp index 9f7588edb0..997659ade5 100644 --- a/src/runtime/NEON/functions/NELaplacianReconstruct.cpp +++ b/src/runtime/NEON/functions/NELaplacianReconstruct.cpp @@ -73,7 +73,7 @@ void NELaplacianReconstruct::configure(const IPyramid *pyramid, ITensor *input, // 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), arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR, border_mode, constant_border_value); + _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 }); _addf[l].configure(_tmp_pyr.get_pyramid_level(l), pyramid->get_pyramid_level(l), _tmp_pyr.get_pyramid_level(l), ConvertPolicy::SATURATE); } diff --git a/src/runtime/NEON/functions/NEScale.cpp b/src/runtime/NEON/functions/NEScale.cpp index a5d3ac76a5..170b2ee3eb 100644 --- a/src/runtime/NEON/functions/NEScale.cpp +++ b/src/runtime/NEON/functions/NEScale.cpp @@ -37,8 +37,8 @@ #include <cstddef> #include <utility> -using namespace arm_compute; - +namespace arm_compute +{ namespace { void precompute_dx_dy_offsets(ITensor *dx, ITensor *dy, ITensor *offsets, float wr, float hr, size_t input_element_size, SamplingPolicy sampling_policy) @@ -237,3 +237,4 @@ void NEScale::run() } NEScheduler::get().schedule(&_scale_kernel, Window::DimY); } +} // namespace arm_compute |