Beatmup
|
A binary pixelwise operation on images. More...
#include <operator.h>
Public Types | |
enum class | Operation { NONE , ADD , MULTIPLY } |
Binary operation specification. 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 | |
BitmapBinaryOperation () | |
void | setOperand1 (AbstractBitmap *op1) |
void | setOperand2 (AbstractBitmap *op2) |
void | setOutput (AbstractBitmap *output) |
void | setOperation (const Operation operation) |
void | setCropSize (int width, int height) |
void | setOp1Origin (const IntPoint origin) |
void | setOp2Origin (const IntPoint origin) |
void | setOutputOrigin (const IntPoint origin) |
void | resetCrop () |
int | getCropWidth () const |
int | getCropHeight () const |
const IntPoint | getOp1Origin () const |
const IntPoint | getOp2Origin () const |
const IntPoint | getOutputOrigin () 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 () |
Protected Member Functions | |
virtual bool | process (TaskThread &thread) |
Executes the task on CPU within a given thread. More... | |
virtual void | beforeProcessing (ThreadIndex, ProcessingTarget target, GraphicPipeline *) |
Instruction called before the task is executed. More... | |
virtual void | afterProcessing (ThreadIndex, GraphicPipeline *, bool) |
Instruction called after the task is executed. More... | |
virtual ThreadIndex | getMaxThreads () const |
Gives the upper limint on the number of threads the task may be performed by. More... | |
Private Attributes | |
const int | MIN_PIXEL_COUNT_PER_THREAD = 1000 |
minimum number of pixels per worker More... | |
AbstractBitmap * | op1 |
AbstractBitmap * | op2 |
AbstractBitmap * | output |
input and output bitmaps More... | |
Operation | operation |
IntPoint | op1Origin |
IntPoint | op2Origin |
IntPoint | outputOrigin |
int | cropWidth |
int | cropHeight |
Additional Inherited Members | |
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 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) |
A binary pixelwise operation on images.
Evaluates expression O = op(L, R) for bitmaps L, R, O and a given pixelwise operation op. Allows to select the operating area in all the three bitmaps.
Definition at line 30 of file operator.h.
|
strong |
Binary operation specification.
Enumerator | |
---|---|
NONE | bypass; the output bitmap remains unchanged |
ADD | the input images are added |
MULTIPLY | the input images are multiplied |
Definition at line 35 of file operator.h.
BitmapBinaryOperation::BitmapBinaryOperation | ( | ) |
Definition at line 156 of file operator.cpp.
|
protectedvirtual |
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 240 of file operator.cpp.
|
protectedvirtual |
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 217 of file operator.cpp.
|
protectedvirtual |
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 235 of file operator.cpp.
|
protectedvirtual |
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 212 of file operator.cpp.
void BitmapBinaryOperation::setOperand1 | ( | AbstractBitmap * | op1 | ) |
Definition at line 162 of file operator.cpp.
void BitmapBinaryOperation::setOperand2 | ( | AbstractBitmap * | op2 | ) |
Definition at line 167 of file operator.cpp.
void BitmapBinaryOperation::setOutput | ( | AbstractBitmap * | output | ) |
Definition at line 172 of file operator.cpp.
void BitmapBinaryOperation::setOperation | ( | const Operation | operation | ) |
Definition at line 177 of file operator.cpp.
void BitmapBinaryOperation::setCropSize | ( | int | width, |
int | height | ||
) |
Definition at line 182 of file operator.cpp.
void BitmapBinaryOperation::setOp1Origin | ( | const IntPoint | origin | ) |
Definition at line 188 of file operator.cpp.
void BitmapBinaryOperation::setOp2Origin | ( | const IntPoint | origin | ) |
Definition at line 193 of file operator.cpp.
void BitmapBinaryOperation::setOutputOrigin | ( | const IntPoint | origin | ) |
Definition at line 198 of file operator.cpp.
void BitmapBinaryOperation::resetCrop | ( | ) |
Definition at line 203 of file operator.cpp.
|
inline |
Definition at line 68 of file operator.h.
|
inline |
Definition at line 69 of file operator.h.
|
inline |
Definition at line 70 of file operator.h.
|
inline |
Definition at line 71 of file operator.h.
|
inline |
Definition at line 72 of file operator.h.
|
private |
minimum number of pixels per worker
Definition at line 42 of file operator.h.
|
private |
Definition at line 44 of file operator.h.
|
private |
Definition at line 44 of file operator.h.
|
private |
input and output bitmaps
Definition at line 44 of file operator.h.
|
private |
Definition at line 45 of file operator.h.
|
private |
Definition at line 46 of file operator.h.
|
private |
Definition at line 46 of file operator.h.
|
private |
Definition at line 46 of file operator.h.
|
private |
Definition at line 47 of file operator.h.
|
private |
Definition at line 47 of file operator.h.