20 #include "../basic_types.h" 
   21 #include "../memory.h" 
   22 #include "../bitmap/internal_bitmap.h" 
   23 #include "../gpu/pipeline.h" 
   24 #include "../gpu/program.h" 
   25 #include "../gpu/texture_handler.h" 
   26 #include "../utils/fixed_point.h" 
   27 #include "../utils/string_utils.h" 
   84                 return dim[0] == 0 || 
dim[1] == 0 || 
dim[2] == 0;
 
  291                 class InvalidChannelNumber : 
public Exception {
 
  293                     InvalidChannelNumber(
int channel): 
Exception(
"Invalid channel number / number of channels: %d", channel) {}
 
  295                 if (channel % 4 != 0)
 
  296                     throw InvalidChannelNumber(channel);
 
  336                 View(
View&& view, 
const int firstChannel, 
const int numChannels);
 
  382                 inline operator bool()
 const { 
return storage != 
nullptr; }
 
  508                 inline void fill(T begin, T limit) {
 
  510                     const float factor = 1.0f / 255;
 
  511                     for (T it = begin; it != limit && i < 
ptrSize; ++i) {
 
  513                         if (it == limit) 
return;
 
  515                         if (it == limit) 
return;
 
  517                         if (it == limit) 
return;
 
A very basic class for any image.
 
Basic class: task and memory management, any kind of static data.
 
Base class for all exceptions.
 
TextureFormat
Texture format, specifies how the texture should be interpreted on the shader side.
 
Internal low-level GPU control API.
 
Bitmap whose memory is managed by the Beatmup engine.
 
Operation 3D input/output size.
 
Size operator+(int scalar) const
 
Size operator*(const Size &size) const
 
Size operator-(int scalar) const
 
bool operator==(const Size &size) const
 
Size operator+(const Size &size) const
 
Size operator*(int scalar) const
 
Size getOrigin(Size kernel, Size stride, Padding padding) const
Computes operation origin in function of operation kernel, padding and stride, assuming that the curr...
 
Padding
Zero padding specification.
 
@ SAME
operation output size matches its input size for unit strides
 
Size operator-(const Size &size) const
 
Size operator/(const Size &size) const
 
Size operator/(int scalar) const
 
int operator[](int di) const
 
bool operator!=(const Size &size) const
 
Size transform(Size kernel, Size stride, Padding padding, int depth=0) const
Computes operation output size in function of operation kernel, padding, stride and depth,...
 
Size(const Size &size, int depth)
 
Binding of different input/output storages/texture handlers to a GLSL program.
 
Binder(GraphicPipeline &gpu)
 
GL::handle_t outputTexture
 
bool begin(GL::Program &program, Storage::View &output, int channel)
Starts binding things to a program.
 
void operator()(Storage::View &input, const char *name)
Binds a storage (all of its textures) to a uniform sampler array variable.
 
InconsistentStorageState(const char *message)
 
Scans a storageview in RAM for further computations on CPU.
 
Scanner(Storage::View &view)
 
uint8_t sample_t[4]
four unsigned 8-bit scalars
 
Scanner & operator++()
Advances pointer by one pixel in scanline order (along the horizontal axis).
 
sample_t * data
the texture data pointer
 
sample_t ** ptr
pointers at current position per channel
 
void move(int x, int y)
Sets the pointer to a specific spatial position.
 
void fill(T begin, T limit)
Extracts the content of feature maps at the current position.
 
void unbind()
Unbinds the current view from the scanner.
 
Storage::View * view
a view to sample
 
void bind(Storage::View &view)
Binds a view to the scanner.
 
TextureHandler representation of a pack of 4 channels from a non-empty View.
 
const int getHeight() const
Height of the texture in pixels.
 
const GL::TextureHandler::TextureFormat getTextureFormat() const
Returns the texture format specifying how the shader must interpret the data.
 
const int getWidth() const
Width of the texture in pixels.
 
const int getDepth() const
Depth of the texture in pixels.
 
void prepare(GraphicPipeline &gpu)
Prepares (eventually uploads) texture data on GPU.
 
Maps a 3D tensor onto a storage.
 
int getTextureHeight() const
Returns height in pixels of all the textures.
 
View & operator=(View &&)
 
IntPoint getChannelOrigin(int channel) const
Returns origin in pixels of a given channel within the texture containing it.
 
InternalBitmap * getImage(Context &ctx, GraphicPipeline &gpu, int channel) const
 
const Storage & getStorage() const
 
std::vector< Channel > channels
channels of the view
 
IntPoint getTextureSize() const
 
IntPoint getSpatialSize() const
Returns the spatial size (width and height) of the storage in pixels.
 
int getChannelTextureNumber(int channel) const
Returns number of the texture containing a given channel.
 
int getNumberOfTextures() const
Returns total number of textures in the storage view.
 
int getTextureWidth() const
Returns width in pixels of all the textures.
 
std::vector< int > textures
indices of textures in the storage
 
3D tensor stored in a set of textures.
 
bool isUpToDate(ProcessingTarget target) const
Checks if the storage is up to date for a given processing target (CPU or GPU).
 
int getTextureWidth() const
Returns width in pixels of all the textures.
 
void push(GraphicPipeline &gpu, const void *data)
 
static void checkChannelNumber(int channel)
Checks whether a channel number points to the first channel in a texture.
 
int getNumberOfTextures() const
Returns total number of textures in the storage.
 
InternalBitmap * getImage(Context &ctx, GraphicPipeline &gpu, int channel) const
Converts a feature channel into a bitmap for debugging purposes.
 
AlignedMemory memory
data storage in RAM
 
const int pad
padding in pixels added along width and height dimensions
 
Size getSize() const
Returns storage size in pixels.
 
const AlignedMemory & getMemory() const
 
int getTextureHeight() const
Returns height in pixels of all the textures.
 
int getPadding() const
Returns storage padding.
 
void free()
Deferred storage disposal: the textures are put into the GPU recycle bin associated with the context.
 
AlignedMemory & getMemory()
Returns the storage memory, if allocated in RAM (for CPU).
 
size_t getMemorySize() const
 
Storage(const Storage &)=delete
disabling copying constructor
 
int packY
number of blocks of 4 channels per texture (spatial packing)
 
bool isAllocated() const
Returns true if the storage is allocated.
 
int getChannelTextureNumber(int channel) const
Returns number of texture containing a given channel.
 
IntPoint getChannelOrigin(int channel) const
Returns origin in pixels of a given channel within the texture containing it.
 
void allocate()
Allocates the storage in RAM.
 
void pull(GraphicPipeline &gpu)
Pulls storage data from GPU memory to RAM.
 
Beatmup object base class
 
#define BEATMUP_ASSERT_DEBUG(C)
 
unsigned int handle_t
A reference to a GPU resource.
 
Size::Padding paddingFromString(const std::string &str)
Returns a zero padding value from a string.
 
CustomPoint< int > IntPoint
 
std::string to_string(Beatmup::NNets::ActivationFunction function)
 
bool dirty
if true, the texture needs to be cleared before use
 
int channelIdx
channel number in its corresponding storage
 
int textureIdx
texture number in the current view
 
return(jlong) new Beatmup jlong jstring name
 
jobject jlong jint jint y
 
layer getMapping().setCenterPosition(Beatmup jlong jfloat factor
 
JNIEnv jobject jstring str