Beatmup
|
Base class for image filters processing a given bitmap in a pixelwise fashion. More...
#include <pixelwise_filter.h>
Public Member Functions | |
virtual | ~PixelwiseFilter () |
virtual void | setInput (AbstractBitmap *input) |
virtual void | setOutput (AbstractBitmap *output) |
AbstractBitmap * | getInput () |
AbstractBitmap * | getOutput () |
ThreadIndex | getMaxThreads () const |
Gives the upper limint on the number of threads the task may be performed by. More... | |
Public Member Functions inherited from Beatmup::Object | |
virtual | ~Object () |
Protected Member Functions | |
virtual void | apply (int x, int y, msize nPix, TaskThread &thread)=0 |
Applies filtering to given pixel data. More... | |
virtual std::string | getGlslDeclarations () const |
Provides GLSL declarations used in the GLSL code. More... | |
virtual std::string | getGlslSourceCode () const =0 |
Provides GLSL source code of the filter. More... | |
virtual void | setup (bool useGpu) |
A callback run every time before the filter is applied to the image. More... | |
virtual bool | process (TaskThread &thread) final |
Executes the task on CPU within a given thread. More... | |
virtual bool | processOnGPU (GraphicPipeline &gpu, TaskThread &thread) final |
Executes the task on GPU. More... | |
virtual void | beforeProcessing (ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu) |
Instruction called before the task is executed. More... | |
virtual void | afterProcessing (ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted) |
Instruction called after the task is executed. More... | |
virtual TaskDeviceRequirement | getUsedDevices () const final |
Communicates devices (CPU and/or GPU) the task is run on. More... | |
PixelwiseFilter () | |
Protected Attributes | |
AbstractBitmap * | inputBitmap |
AbstractBitmap * | outputBitmap |
ImageShader * | shader |
Static Protected Attributes | |
static const std::string | GLSL_RGBA_INPUT |
Additional Inherited Members | |
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... | |
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) |
Base class for image filters processing a given bitmap in a pixelwise fashion.
Definition at line 33 of file pixelwise_filter.h.
|
protected |
Definition at line 27 of file pixelwise_filter.cpp.
|
virtual |
Definition at line 32 of file pixelwise_filter.cpp.
|
protectedpure virtual |
Applies filtering to given pixel data.
x | Horizontal position of the first pixel in image |
y | Vertical position of the first pixel in image |
nPix | Number of pixels to process |
thread | Calling thread descriptor |
Implemented in Beatmup::Filters::Sepia, and Beatmup::Filters::ColorMatrix.
|
protectedvirtual |
Provides GLSL declarations used in the GLSL code.
Reimplemented in Beatmup::Filters::ColorMatrix.
Definition at line 119 of file pixelwise_filter.cpp.
|
protectedpure virtual |
Provides GLSL source code of the filter.
Implemented in Beatmup::Filters::Sepia, and Beatmup::Filters::ColorMatrix.
|
protectedvirtual |
A callback run every time before the filter is applied to the image.
useGpu | If true , the filter will be run on GPU. |
Reimplemented in Beatmup::Filters::ColorMatrix.
Definition at line 124 of file pixelwise_filter.cpp.
|
finalprotectedvirtual |
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 92 of file pixelwise_filter.cpp.
|
finalprotectedvirtual |
Executes the task on GPU.
gpu | graphic pipeline instance |
thread | associated task execution context |
true
if the execution is finished correctly, false
otherwise Reimplemented from Beatmup::AbstractTask.
Definition at line 105 of file pixelwise_filter.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 45 of file pixelwise_filter.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 87 of file pixelwise_filter.cpp.
|
finalprotectedvirtual |
Communicates devices (CPU and/or GPU) the task is run on.
Reimplemented from Beatmup::AbstractTask.
Definition at line 112 of file pixelwise_filter.cpp.
|
inlinevirtual |
Definition at line 75 of file pixelwise_filter.h.
|
inlinevirtual |
Definition at line 76 of file pixelwise_filter.h.
|
inline |
Definition at line 78 of file pixelwise_filter.h.
|
inline |
Definition at line 79 of file pixelwise_filter.h.
|
virtual |
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 37 of file pixelwise_filter.cpp.
|
staticprotected |
Definition at line 35 of file pixelwise_filter.h.
|
protected |
Definition at line 37 of file pixelwise_filter.h.
|
protected |
Definition at line 37 of file pixelwise_filter.h.
|
protected |
Definition at line 38 of file pixelwise_filter.h.