23 #ifndef BEATMUP_OPENGLVERSION_GLES20
34 input(nullptr), output(nullptr),
mode(
Mode::CUBIC), cubicParameter(DEFAULT_CUBIC_PARAMETER), convnet(nullptr),
35 isUsingEs31IfAvailable(false)
80 static const int MIN_PIXELS_PER_THREAD = 1000;
96 "input and output rectangular areas not matching the corresponding bitmaps are not supported when using GPU"
106 "input and/or output bitmaps contexts do not match the BitmapRecycler context");
109 "convnet resampling is only applicable for 2x upsampling"
112 #ifndef BEATMUP_OPENGLVERSION_GLES20
121 #ifndef BEATMUP_OPENGLVERSION_GLES20
140 BitmapProcessing::pipeline<Kernels::NearestNeighborResampling>(
147 BitmapProcessing::pipeline<Kernels::BoxResampling>(
154 BitmapProcessing::pipeline<Kernels::BilinearResampling>(
161 BitmapProcessing::pipeline<Kernels::BicubicResampling>(
A very basic class for any image.
Context & getContext() const
const ImageResolution getSize() const
Returns the bitmap resolution within ImageResolution object.
static ThreadIndex validThreadCount(int number)
Valid thread count from a given integer value.
TaskDeviceRequirement
Specifies which device (CPU and/or GPU) is used to run the task.
@ CPU_ONLY
this task does not use GPU
@ GPU_ONLY
this task requires GPU, otherwise it cannot run
void unlock(AbstractBitmap *bitmap)
Drops a lock to the bitmap.
void lock(GraphicPipeline *gpu, AbstractBitmap *input, AbstractBitmap *output)
void setOutput(AbstractBitmap *output)
Sets the output image.
virtual void beforeProcessing(ThreadIndex, ProcessingTarget target, GraphicPipeline *)
Instruction called before the task is executed.
void setInput(AbstractBitmap *input)
Sets the image to process.
AbstractBitmap * output
input and output bitmaps
virtual ThreadIndex getMaxThreads() const
Gives the upper limint on the number of threads the task may be performed by.
virtual TaskDeviceRequirement getUsedDevices() const
Communicates devices (CPU and/or GPU) the task is run on.
BitmapResampler(Context &context)
Creates a resampler.
void setCubicParameter(float alpha)
Sets cubic interpolation parameter ("alpha").
Mode
Resampling mode (algorithm) specification.
@ CONVNET
upsampling x2 using a convolutional neural network
@ NEAREST_NEIGHBOR
zero-order: usual nearest neighbor
@ LINEAR
first order: bilinear interpolation
@ CUBIC
third order: bicubic interpolation
@ BOX
"0.5-order": anti-aliasing box filter; identical to nearest neighbor when upsampling
bool isUsingEs31IfAvailable
if true, uses OpenGL ES 3.1 backend when available instead ES 2.0
virtual void afterProcessing(ThreadIndex, GraphicPipeline *, bool)
Instruction called after the task is executed.
virtual bool process(TaskThread &thread)
Executes the task on CPU within a given thread.
void setInputRect(const IntRectangle &rect)
Specifies a rectangular working area in the input bitmap.
virtual bool processOnGPU(GraphicPipeline &gpu, TaskThread &thread)
Executes the task on GPU.
void setOutputRect(const IntRectangle &rect)
Specifies a rectangular working area in the output bitmap.
X2UpsamplingNetwork * convnet
convnet instance
void setMode(Mode mode)
Sets the resampling algorithm to use.
static const float DEFAULT_CUBIC_PARAMETER
Context & context
a context managing intermediate bitmaps
Basic class: task and memory management, any kind of static data.
GL::RecycleBin * getGpuRecycleBin() const
void limit(const CustomRectangle &frame)
Truncates a rectangle to a limiting frame.
numeric getArea() const
Computes the rectangle area.
void normalize()
Flips corners coordinates guaranteeing that it has a non negative area, i.e.
x2 image upsampler using a convolutional neural network.
x2 image upsampler using a convolutional neural network.
virtual const int getHeight() const =0
Height of the texture in pixels.
virtual const int getWidth() const =0
Width of the texture in pixels.
Internal low-level GPU control API.
IntRectangle halfOpenedRectangle() const
static void insanity(const char *message)
static void check(const bool condition, const std::string &message)
virtual bool usesEs31Backend() const =0
virtual void process(GraphicPipeline &gpu, GL::TextureHandler &input, AbstractBitmap &output)=0
unsigned char ThreadIndex
number of threads / thread index
CustomRectangle< int > IntRectangle
CustomPoint< numeric > min(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
Beatmup::IntRectangle rect(x1, y1, x2, y2)