Compute Library
 21.02
NEHistogram Class Reference

Basic function to run NEHistogramKernel. More...

#include <NEHistogram.h>

Collaboration diagram for NEHistogram:
[legend]

Public Member Functions

 NEHistogram ()
 Default Constructor. More...
 
 NEHistogram (const NEHistogram &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEHistogramoperator= (const NEHistogram &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEHistogram (NEHistogram &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
NEHistogramoperator= (NEHistogram &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
 ~NEHistogram ()
 Default destructor. More...
 
void configure (const IImage *input, IDistribution1D *output)
 Initialise the kernel's inputs. More...
 
void run () override
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from IFunction
virtual ~IFunction ()=default
 Destructor. More...
 
virtual void prepare ()
 Prepare the function for executing. More...
 

Detailed Description

Basic function to run NEHistogramKernel.

Deprecated:
This function is deprecated and is intended to be removed in 21.05 release

Definition at line 46 of file NEHistogram.h.

Constructor & Destructor Documentation

◆ NEHistogram() [1/3]

Default Constructor.

Definition at line 38 of file NEHistogram.cpp.

39  : _histogram_kernel(), _local_hist(), _window_lut(window_lut_default_size), _local_hist_size(0)
40 {
41 }

◆ NEHistogram() [2/3]

NEHistogram ( const NEHistogram )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ NEHistogram() [3/3]

NEHistogram ( NEHistogram &&  )
delete

Prevent instances of this class from being moved (As this class contains non movable objects)

◆ ~NEHistogram()

~NEHistogram ( )
default

Default destructor.

Member Function Documentation

◆ configure()

void configure ( const IImage input,
IDistribution1D output 
)

Initialise the kernel's inputs.

Parameters
[in]inputInput image. Data type supported: U8.
[out]outputOutput distribution.

Definition at line 43 of file NEHistogram.cpp.

References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D, Scheduler::get(), IDistribution1D::num_bins(), and IScheduler::num_threads().

44 {
46  ARM_COMPUTE_ERROR_ON(nullptr == output);
47 
48  // Allocate space for threads local histograms
49  _local_hist_size = output->num_bins() * NEScheduler::get().num_threads();
50  _local_hist.resize(_local_hist_size);
51 
52  // Configure kernel
53  _histogram_kernel = std::make_unique<NEHistogramKernel>();
54  _histogram_kernel->configure(input, output, _local_hist.data(), _window_lut.data());
55 }
#define ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(t)
Definition: Validate.h:856
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
virtual unsigned int num_threads() const =0
Returns the number of threads that the SingleThreadScheduler has in his pool.
static IScheduler & get()
Access the scheduler singleton.
Definition: Scheduler.cpp:94

◆ operator=() [1/2]

NEHistogram& operator= ( const NEHistogram )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

NEHistogram& operator= ( NEHistogram &&  )
delete

Prevent instances of this class from being moved (As this class contains non movable objects)

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For Neon kernels:

  • Multi-threading is used for the kernels which are parallelisable.
  • By default std::thread::hardware_concurrency() threads are used.
Note
CPPScheduler::set_num_threads() can be used to manually set the number of threads

For OpenCL kernels:

  • All the kernels are enqueued on the queue associated with CLScheduler.
  • The queue is then flushed.
Note
The function will not block until the kernels are executed. It is the user's responsibility to wait.
Will call prepare() on first run if hasn't been done

Implements IFunction.

Definition at line 57 of file NEHistogram.cpp.

References Window::DimY, Scheduler::get(), and IScheduler::schedule().

58 {
59  // Calculate histogram of input.
60  NEScheduler::get().schedule(_histogram_kernel.get(), Window::DimY);
61 }
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
Definition: Window.h:45
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
static IScheduler & get()
Access the scheduler singleton.
Definition: Scheduler.cpp:94

The documentation for this class was generated from the following files: