diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/CL/kernels/CLScaleKernel.cpp | 65 | ||||
-rw-r--r-- | src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp | 22 | ||||
-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 |
12 files changed, 92 insertions, 70 deletions
diff --git a/src/core/CL/kernels/CLScaleKernel.cpp b/src/core/CL/kernels/CLScaleKernel.cpp index e19da32ac3..872ba5b6cc 100644 --- a/src/core/CL/kernels/CLScaleKernel.cpp +++ b/src/core/CL/kernels/CLScaleKernel.cpp @@ -60,7 +60,7 @@ inline std::pair<float, float> calculate_scale_factors(const ITensorInfo &input, return std::make_pair(wr, hr); } -Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, SamplingPolicy sampling_policy, bool align_corners) +Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info) { ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(input); ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED, DataType::U8, DataType::S16, DataType::F16, DataType::F32); @@ -68,9 +68,9 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, I ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(input, output); ARM_COMPUTE_RETURN_ERROR_ON(output == input); - ARM_COMPUTE_RETURN_ERROR_ON(align_corners && !is_align_corners_allowed(sampling_policy)); + ARM_COMPUTE_RETURN_ERROR_ON(info.align_corners && !is_align_corners_allowed(info.sampling_policy)); - if(align_corners) + if(info.align_corners) { // For bilinear method with aligned corners, the resize ratio will // be calculated by (input_size - 1)/(output_size - 1). Belows are @@ -90,14 +90,14 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, I float wr = 0.f; float hr = 0.f; - std::tie(wr, hr) = calculate_scale_factors(*input, *output, align_corners); + std::tie(wr, hr) = calculate_scale_factors(*input, *output, info.align_corners); - ARM_COMPUTE_RETURN_ERROR_ON(policy == InterpolationPolicy::AREA && (wr > 1.f || hr > 1.f)); + ARM_COMPUTE_RETURN_ERROR_ON(info.interpolation_policy == InterpolationPolicy::AREA && (wr > 1.f || hr > 1.f)); return Status{}; } -std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITensorInfo *output, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy, BorderSize &border) +std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITensorInfo *output, const ScaleKernelInfo &info, BorderSize &border) { Window win{}; bool window_changed{}; @@ -108,7 +108,7 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITen { case DataLayout::NCHW: { - if(border_mode == BorderMode::UNDEFINED) + if(info.border_mode == BorderMode::UNDEFINED) { border = BorderSize(0); } @@ -124,9 +124,9 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITen output_access.set_valid_region(win, calculate_valid_region_scale(*(input), output->tensor_shape(), - policy, - sampling_policy, - border_mode == BorderMode::UNDEFINED)); + info.interpolation_policy, + info.sampling_policy, + info.border_mode == BorderMode::UNDEFINED)); window_changed = update_window_and_padding(win, input_access, output_access); } @@ -158,13 +158,12 @@ BorderSize CLScaleKernel::border_size() const return BorderSize(1); } -Status CLScaleKernel::validate(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, - BorderMode border_mode, SamplingPolicy sampling_policy, bool align_corners) +Status CLScaleKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const ScaleKernelInfo &info) { BorderSize border = BorderSize(1); - ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, policy, sampling_policy, align_corners)); - ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get(), policy, border_mode, sampling_policy, border).first); + ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, info)); + ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get(), info, border).first); return Status{}; } @@ -179,27 +178,26 @@ const ICLTensor *CLScaleKernel::output() const return _output; } -void CLScaleKernel::configure(const ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy, bool align_corners) +void CLScaleKernel::configure(const ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info) { - configure(CLKernelLibrary::get().get_compile_context(), input, output, policy, border_mode, sampling_policy, align_corners); + configure(CLKernelLibrary::get().get_compile_context(), input, output, info); } -void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy, - bool align_corners) +void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const ScaleKernelInfo &info) { - ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), policy, sampling_policy, align_corners)); + ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), info)); - _input = input; - _output = output; - _interpolationPolicy = policy; - _data_layout = input->info()->data_layout(); - _align_corners = align_corners; + _input = input; + _output = output; + _interpolation_policy = info.interpolation_policy; + _data_layout = input->info()->data_layout(); + _align_corners = info.align_corners; float wr = 0.f; float hr = 0.f; std::tie(wr, hr) = calculate_scale_factors(*input->info(), *output->info(), _align_corners); - const bool call_quantized_kernel = is_data_type_quantized_asymmetric(input->info()->data_type()) && policy == InterpolationPolicy::BILINEAR; + const bool call_quantized_kernel = is_data_type_quantized_asymmetric(input->info()->data_type()) && _interpolation_policy == InterpolationPolicy::BILINEAR; const int idx_width = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::WIDTH); const int idx_height = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::HEIGHT); @@ -208,14 +206,15 @@ void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICL // Compute actual border size BorderSize border = border_size(); + auto interpolation_policy_to_use = _interpolation_policy; // Area interpolation behaves as Nearest Neighbour in case of up-sampling - if(policy == InterpolationPolicy::AREA && wr <= 1.f && hr <= 1.f) + if(_interpolation_policy == InterpolationPolicy::AREA && wr <= 1.f && hr <= 1.f) { - policy = InterpolationPolicy::NEAREST_NEIGHBOR; + interpolation_policy_to_use = InterpolationPolicy::NEAREST_NEIGHBOR; } // Configure kernel window - auto win_config = validate_and_configure_window(input->info(), output->info(), policy, border_mode, sampling_policy, border); + auto win_config = validate_and_configure_window(input->info(), output->info(), info, border); ARM_COMPUTE_ERROR_THROW_ON(win_config.first); ICLKernel::configure_internal(win_config.second); @@ -223,9 +222,9 @@ void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICL CLBuildOptions build_opts; build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(input->info()->data_type())); build_opts.add_option("-DBORDER_SIZE=" + support::cpp11::to_string(border.right)); - build_opts.add_option_if(border_mode == BorderMode::REPLICATE, "-DBORDER_MODE_REPLICATE"); + build_opts.add_option_if(info.border_mode == BorderMode::REPLICATE, "-DBORDER_MODE_REPLICATE"); build_opts.add_option_if(is_nhwc, "-DDEPTH_OUT=" + support::cpp11::to_string(output->info()->dimension(2))); - build_opts.add_option_if_else(sampling_policy == SamplingPolicy::CENTER, "-DSAMPLING_POLICY_CENTER", "-DSAMPLING_POLICY_TOP_LEFT"); + build_opts.add_option_if_else(info.sampling_policy == SamplingPolicy::CENTER, "-DSAMPLING_POLICY_CENTER", "-DSAMPLING_POLICY_TOP_LEFT"); if(call_quantized_kernel) { const UniformQuantizationInfo qinfo = input->info()->quantization_info().uniform(); @@ -233,7 +232,7 @@ void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICL build_opts.add_option("-DOFFSET=" + support::cpp11::to_string(qinfo.offset)); } - std::string interpolation_name = string_from_interpolation_policy(policy); + std::string interpolation_name = string_from_interpolation_policy(interpolation_policy_to_use); std::transform(interpolation_name.begin(), interpolation_name.end(), interpolation_name.begin(), ::tolower); std::string kernel_name = "scale_" + interpolation_name; kernel_name += call_quantized_kernel ? "_quantized_" : "_"; @@ -252,8 +251,8 @@ void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICL // Set config_id for enabling LWS tuning _config_id = "scale_"; - _config_id += (border_mode == BorderMode::REPLICATE ? "Bord_rep" : ""); - _config_id += (sampling_policy == SamplingPolicy::CENTER ? "center" : "topleft"); + _config_id += (info.border_mode == BorderMode::REPLICATE ? "Bord_rep" : ""); + _config_id += (info.sampling_policy == SamplingPolicy::CENTER ? "center" : "topleft"); _config_id += (is_nhwc ? "nhwc" : "nchw"); _config_id += "_"; _config_id += support::cpp11::to_string(output->info()->dimension(0)); diff --git a/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp b/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp index a85a0e7e98..8c268ca374 100644 --- a/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp +++ b/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp @@ -45,13 +45,13 @@ BorderSize GCScaleKernel::border_size() const return BorderSize(1); } -void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, InterpolationPolicy policy, bool border_undefined, SamplingPolicy sampling_policy) +void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, const ScaleKernelInfo &info) { ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F16); ARM_COMPUTE_ERROR_ON_NULLPTR(output); ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); ARM_COMPUTE_ERROR_ON(output == input); - ARM_COMPUTE_ERROR_ON(policy != InterpolationPolicy::NEAREST_NEIGHBOR); + ARM_COMPUTE_ERROR_ON(info.interpolation_policy != InterpolationPolicy::NEAREST_NEIGHBOR); _input = input; _output = output; @@ -61,16 +61,18 @@ void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, Interpo const auto hr = static_cast<float>(input->info()->dimension(1)) / static_cast<float>(output->info()->dimension(1)); // Compute actual border size - BorderSize border = border_undefined ? BorderSize(0) : border_size(); + const bool border_undefined = info.border_mode == BorderMode::UNDEFINED; + BorderSize border = border_undefined ? BorderSize(0) : border_size(); // Area interpolation behaves as Nearest Neighbour in case of up-sampling - if(policy == InterpolationPolicy::AREA && wr <= 1.f && hr <= 1.f) + auto interpolation_policy_to_use = info.interpolation_policy; + if(interpolation_policy_to_use == InterpolationPolicy::AREA && wr <= 1.f && hr <= 1.f) { - policy = InterpolationPolicy::NEAREST_NEIGHBOR; + interpolation_policy_to_use = InterpolationPolicy::NEAREST_NEIGHBOR; } else { - ARM_COMPUTE_ERROR_ON(policy == InterpolationPolicy::AREA); + ARM_COMPUTE_ERROR_ON(interpolation_policy_to_use == InterpolationPolicy::AREA); } // Create kernel @@ -81,7 +83,7 @@ void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, Interpo build_opts.emplace("#define DATA_TYPE_FP16"); build_opts.emplace("#define BORDER_SIZE " + support::cpp11::to_string(border.right)); - if(sampling_policy == SamplingPolicy::TOP_LEFT) + if(info.sampling_policy == SamplingPolicy::TOP_LEFT) { build_opts.emplace("#define SAMPLING_POLICY_TOP_LEFT"); } @@ -106,7 +108,7 @@ void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, Interpo build_opts.emplace("#define SCALE_NEAREST_GENERIC"); } - std::string interpolation_name = string_from_interpolation_policy(policy); // NOLINT + std::string interpolation_name = string_from_interpolation_policy(interpolation_policy_to_use); // NOLINT std::transform(interpolation_name.begin(), interpolation_name.end(), interpolation_name.begin(), ::tolower); std::string kernel_name = "scale_" + interpolation_name; _kernel = GCKernelLibrary::get().create_kernel(kernel_name, build_opts); @@ -130,8 +132,8 @@ void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, Interpo output_access.set_valid_region(win, calculate_valid_region_scale(*(input->info()), output->info()->tensor_shape(), - policy, - sampling_policy, + info.interpolation_policy, + info.sampling_policy, border_undefined)); IGCKernel::configure(win); 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 |