Beatmup
|
Measures the difference between two bitmaps. More...
#include <metric.h>
Public Types | |
enum class | Norm { L1 , L2 } |
Norm (distance) to measure between two images. More... | |
Public Types inherited from Beatmup::AbstractTask | |
enum class | TaskDeviceRequirement { CPU_ONLY , GPU_OR_CPU , GPU_ONLY } |
Specifies which device (CPU and/or GPU) is used to run the task. More... | |
Public Member Functions | |
Metric () | |
void | setBitmaps (AbstractBitmap *bitmap1, AbstractBitmap *bitmap2) |
Sets input images. More... | |
void | setBitmaps (AbstractBitmap *bitmap1, const IntRectangle &roi1, AbstractBitmap *bitmap2, const IntRectangle &roi2) |
Sets input images and rectangular regions delimiting the measurement areas. More... | |
void | setNorm (Norm norm) |
Specifies the norm to use in the measurement. More... | |
double | getResult () const |
Public Member Functions inherited from Beatmup::AbstractTask | |
virtual bool | processOnGPU (GraphicPipeline &gpu, TaskThread &thread) |
Executes the task on GPU. More... | |
virtual TaskDeviceRequirement | getUsedDevices () const |
Communicates devices (CPU and/or GPU) the task is run on. More... | |
Public Member Functions inherited from Beatmup::Object | |
virtual | ~Object () |
Static Public Member Functions | |
static float | psnr (AbstractBitmap &bitmap1, AbstractBitmap &bitmap2) |
Static Public Member Functions inherited from Beatmup::AbstractTask | |
static ThreadIndex | validThreadCount (int number) |
Valid thread count from a given integer value. More... | |
Private Member Functions | |
ThreadIndex | getMaxThreads () const |
Gives the upper limint on the number of threads the task may be performed by. More... | |
void | beforeProcessing (ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu) |
Instruction called before the task is executed. More... | |
void | afterProcessing (ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted) |
Instruction called after the task is executed. More... | |
bool | process (TaskThread &thread) |
Executes the task on CPU within a given thread. More... | |
Private Member Functions inherited from Beatmup::BitmapContentLock | |
BitmapContentLock () | |
~BitmapContentLock () | |
void | readLock (GraphicPipeline *gpu, AbstractBitmap *bitmap, ProcessingTarget target) |
Locks content of a bitmap for reading using a specific processing target device. More... | |
void | writeLock (GraphicPipeline *gpu, AbstractBitmap *bitmap, ProcessingTarget target) |
Locks content of a bitmap for writing using a specific processing target device. More... | |
void | unlock (AbstractBitmap *bitmap) |
Drops a lock to the bitmap. More... | |
void | unlockAll () |
Unlocks all the locked bitmaps unconditionally. More... | |
template<const ProcessingTarget target> | |
void | lock (GraphicPipeline *gpu, AbstractBitmap *input, AbstractBitmap *output) |
void | lock (GraphicPipeline *gpu, ProcessingTarget target, AbstractBitmap *input, AbstractBitmap *output) |
template<const ProcessingTarget target> | |
void | lock (GraphicPipeline *gpu, std::initializer_list< AbstractBitmap * > read, std::initializer_list< AbstractBitmap * > write) |
template<typename ... Args> | |
void | unlock (AbstractBitmap *first, Args ... others) |
Private Attributes | |
AbstractBitmap * | bitmap [2] |
IntRectangle | roi [2] |
Norm | norm |
std::vector< double > | results |
double | result |
|
strong |
Metric::Metric | ( | ) |
Definition at line 68 of file metric.cpp.
|
inlineprivatevirtual |
Gives the upper limint on the number of threads the task may be performed by.
The actual number of threads running a specific task may be less or equal to the returned value, depending on the number of workers in ThreadPool running the task.
Reimplemented from Beatmup::AbstractTask.
Definition at line 46 of file metric.h.
|
privatevirtual |
Instruction called before the task is executed.
threadCount | Number of threads used to perform the task |
target | Device used to perform the task |
gpu | A graphic pipeline instance; may be null. |
Reimplemented from Beatmup::AbstractTask.
Definition at line 90 of file metric.cpp.
|
privatevirtual |
Instruction called after the task is executed.
threadCount | Number of threads used to perform the task |
gpu | GPU to be used to execute the task; may be null. |
aborted | true if the task was aborted |
Reimplemented from Beatmup::AbstractTask.
Definition at line 101 of file metric.cpp.
|
privatevirtual |
Executes the task on CPU within a given thread.
Generally called by multiple threads.
thread | associated task execution context |
true
if the execution is finished correctly, false
otherwise Implements Beatmup::AbstractTask.
Definition at line 120 of file metric.cpp.
void Metric::setBitmaps | ( | AbstractBitmap * | bitmap1, |
AbstractBitmap * | bitmap2 | ||
) |
Sets input images.
Definition at line 72 of file metric.cpp.
void Metric::setBitmaps | ( | AbstractBitmap * | bitmap1, |
const IntRectangle & | roi1, | ||
AbstractBitmap * | bitmap2, | ||
const IntRectangle & | roi2 | ||
) |
|
inline |
|
inline |
|
static |
Definition at line 139 of file metric.cpp.
|
private |
|
private |