Compute Library
 21.02
NEMinMaxLocation Class Reference

Basic function to execute min and max location. More...

#include <NEMinMaxLocation.h>

Collaboration diagram for NEMinMaxLocation:
[legend]

Public Member Functions

 NEMinMaxLocation ()
 Constructor. More...
 
 NEMinMaxLocation (const NEMinMaxLocation &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEMinMaxLocationoperator= (const NEMinMaxLocation &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEMinMaxLocation (NEMinMaxLocation &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
NEMinMaxLocationoperator= (NEMinMaxLocation &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
 ~NEMinMaxLocation ()
 Default destructor. More...
 
void configure (const IImage *input, void *min, void *max, ICoordinates2DArray *min_loc=nullptr, ICoordinates2DArray *max_loc=nullptr, uint32_t *min_count=nullptr, uint32_t *max_count=nullptr)
 Initialise the kernel's inputs and outputs. 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 execute min and max location.

This function calls the following Neon kernels:

  1. NEMinMaxKernel
  2. NEMinMaxLocationKernel
Deprecated:
This function is deprecated and is intended to be removed in 21.05 release

Definition at line 49 of file NEMinMaxLocation.h.

Constructor & Destructor Documentation

◆ NEMinMaxLocation() [1/3]

Constructor.

Definition at line 33 of file NEMinMaxLocation.cpp.

34  : _min_max(), _min_max_loc()
35 {
36 }

◆ NEMinMaxLocation() [2/3]

NEMinMaxLocation ( const NEMinMaxLocation )
delete

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

◆ NEMinMaxLocation() [3/3]

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

◆ ~NEMinMaxLocation()

~NEMinMaxLocation ( )
default

Default destructor.

Member Function Documentation

◆ configure()

void configure ( const IImage input,
void *  min,
void *  max,
ICoordinates2DArray min_loc = nullptr,
ICoordinates2DArray max_loc = nullptr,
uint32_t *  min_count = nullptr,
uint32_t *  max_count = nullptr 
)

Initialise the kernel's inputs and outputs.

Parameters
[in]inputInput image. Data types supported: U8/S16/F32.
[out]minMinimum value of image. Data types supported: S32 if input type is U8/S16, F32 if input type is F32.
[out]maxMaximum value of image. Data types supported: S32 if input type is U8/S16, F32 if input type is F32.
[out]min_loc(Optional) Array of minimum value locations.
[out]max_loc(Optional) Array of maximum value locations.
[out]min_count(Optional) Number of minimum value encounters.
[out]max_count(Optional) Number of maximum value encounters.

Definition at line 38 of file NEMinMaxLocation.cpp.

39 {
40  _min_max = std::make_unique<NEMinMaxKernel>();
41  _min_max->configure(input, min, max);
42 
43  _min_max_loc = std::make_unique<NEMinMaxLocationKernel>();
44  _min_max_loc->configure(input, min, max, min_loc, max_loc, min_count, max_count);
45 }

◆ operator=() [1/2]

NEMinMaxLocation& operator= ( const NEMinMaxLocation )
delete

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

◆ operator=() [2/2]

NEMinMaxLocation& operator= ( NEMinMaxLocation &&  )
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 47 of file NEMinMaxLocation.cpp.

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

48 {
49  _min_max->reset();
50 
51  /* Run min max kernel */
52  NEScheduler::get().schedule(_min_max.get(), Window::DimY);
53 
54  /* Run min max location */
55  NEScheduler::get().schedule(_min_max_loc.get(), Window::DimY);
56 }
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: