aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions/CLEqualizeHistogram.cpp
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2020-10-21 15:58:54 +0100
committerSang-Hoon Park <sang-hoon.park@arm.com>2020-11-07 08:07:22 +0000
commitbef7fa27b0d231a8649952f60808132d109b6345 (patch)
tree7543c66a473d90e28b4860986fad77afa5115043 /src/runtime/CL/functions/CLEqualizeHistogram.cpp
parentb9531540dadce8331a703c32456f3c9defdfefa9 (diff)
downloadComputeLibrary-bef7fa27b0d231a8649952f60808132d109b6345.tar.gz
COMPMID-3639: (3RDPARTY_UPDATE) Move CL kernels to src
Change-Id: I10d27db788e5086adae1841e3e2441cd9b76ef84 Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4310 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/CL/functions/CLEqualizeHistogram.cpp')
-rw-r--r--src/runtime/CL/functions/CLEqualizeHistogram.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/runtime/CL/functions/CLEqualizeHistogram.cpp b/src/runtime/CL/functions/CLEqualizeHistogram.cpp
index a1158a71a5..cc927a055b 100644
--- a/src/runtime/CL/functions/CLEqualizeHistogram.cpp
+++ b/src/runtime/CL/functions/CLEqualizeHistogram.cpp
@@ -28,6 +28,9 @@
#include "arm_compute/core/CL/OpenCL.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
+#include "src/core/CL/kernels/CLHistogramKernel.h"
+#include "src/core/CL/kernels/CLTableLookupKernel.h"
+#include "support/MemorySupport.h"
#include <algorithm>
#include <cmath>
@@ -83,10 +86,17 @@ void calculate_cum_dist_and_lut(CLDistribution1D &dist, CLDistribution1D &cum_di
} // namespace
CLEqualizeHistogram::CLEqualizeHistogram()
- : _histogram_kernel(), _border_histogram_kernel(), _map_histogram_kernel(), _hist(nr_bins, 0, max_range), _cum_dist(nr_bins, 0, max_range), _cd_lut(nr_bins, DataType::U8)
+ : _histogram_kernel(support::cpp14::make_unique<CLHistogramKernel>()),
+ _border_histogram_kernel(support::cpp14::make_unique<CLHistogramBorderKernel>()),
+ _map_histogram_kernel(support::cpp14::make_unique<CLTableLookupKernel>()),
+ _hist(nr_bins, 0, max_range),
+ _cum_dist(nr_bins, 0, max_range),
+ _cd_lut(nr_bins, DataType::U8)
{
}
+CLEqualizeHistogram::~CLEqualizeHistogram() = default;
+
void CLEqualizeHistogram::configure(const ICLImage *input, ICLImage *output)
{
configure(CLKernelLibrary::get().get_compile_context(), input, output);
@@ -94,22 +104,22 @@ void CLEqualizeHistogram::configure(const ICLImage *input, ICLImage *output)
void CLEqualizeHistogram::configure(const CLCompileContext &compile_context, const ICLImage *input, ICLImage *output)
{
- _histogram_kernel.configure(compile_context, input, &_hist);
- _border_histogram_kernel.configure(compile_context, input, &_hist);
- _map_histogram_kernel.configure(compile_context, input, &_cd_lut, output);
+ _histogram_kernel->configure(compile_context, input, &_hist);
+ _border_histogram_kernel->configure(compile_context, input, &_hist);
+ _map_histogram_kernel->configure(compile_context, input, &_cd_lut, output);
}
void CLEqualizeHistogram::run()
{
// Calculate histogram of input.
- CLScheduler::get().enqueue(_histogram_kernel, false);
+ CLScheduler::get().enqueue(*_histogram_kernel, false);
// Calculate remaining pixels when image is not multiple of the elements of histogram kernel
- CLScheduler::get().enqueue(_border_histogram_kernel, false);
+ CLScheduler::get().enqueue(*_border_histogram_kernel, false);
// Calculate cumulative distribution of histogram and create LUT.
calculate_cum_dist_and_lut(_hist, _cum_dist, _cd_lut);
// Map input to output using created LUT.
- CLScheduler::get().enqueue(_map_histogram_kernel);
+ CLScheduler::get().enqueue(*_map_histogram_kernel);
}