Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Castilla <manzanillawork@gmail.com>2021-06-23 18:21:17 +0300
committerManuel Castilla <manzanillawork@gmail.com>2021-06-23 18:46:53 +0300
commit35db01325f41da34e5a71d2b28cc717cddbdb996 (patch)
tree923bfa9c71e1eda1f1fc25c01a7ebbd0382f0d49 /source/blender/compositor/intern/COM_MemoryBuffer.h
parent8f4d99159404621a9063f4bd155a519baf51f313 (diff)
Compositor: Full frame Image node
Adds full frame implementation to Image node operations. Mostly refactored into buffer utility methods for reuse in other operations. No functional changes. 1.8x faster than tiled fallback. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D11559
Diffstat (limited to 'source/blender/compositor/intern/COM_MemoryBuffer.h')
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.h75
1 files changed, 74 insertions, 1 deletions
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h
index 045dc996e3e..575bb2fe383 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.h
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.h
@@ -106,6 +106,11 @@ class MemoryBuffer {
*/
bool m_is_a_single_elem;
+ /**
+ * Whether MemoryBuffer owns buffer data.
+ */
+ bool owns_data_;
+
public:
/**
* \brief construct new temporarily MemoryBuffer for an area
@@ -117,6 +122,11 @@ class MemoryBuffer {
*/
MemoryBuffer(DataType datatype, const rcti &rect, bool is_a_single_elem = false);
+ MemoryBuffer(
+ float *buffer, int num_channels, int width, int height, bool is_a_single_elem = false);
+
+ MemoryBuffer(float *buffer, int num_channels, const rcti &rect, bool is_a_single_elem = false);
+
/**
* Copy constructor
*/
@@ -223,7 +233,7 @@ class MemoryBuffer {
return is_a_single_elem() ? 1 : getHeight();
}
- uint8_t get_num_channels()
+ uint8_t get_num_channels() const
{
return this->m_num_channels;
}
@@ -404,6 +414,53 @@ class MemoryBuffer {
return this->m_state == MemoryBufferState::Temporary;
}
+ void copy_from(const MemoryBuffer *src, const rcti &area);
+ void copy_from(const MemoryBuffer *src, const rcti &area, int to_x, int to_y);
+ void copy_from(const MemoryBuffer *src,
+ const rcti &area,
+ int channel_offset,
+ int elem_size,
+ int to_channel_offset);
+ void copy_from(const MemoryBuffer *src,
+ const rcti &area,
+ int channel_offset,
+ int elem_size,
+ int to_x,
+ int to_y,
+ int to_channel_offset);
+ void copy_from(const uchar *src, const rcti &area);
+ void copy_from(const uchar *src,
+ const rcti &area,
+ int channel_offset,
+ int elem_size,
+ int elem_stride,
+ int to_channel_offset);
+ void copy_from(const uchar *src,
+ const rcti &area,
+ int channel_offset,
+ int elem_size,
+ int elem_stride,
+ int to_x,
+ int to_y,
+ int to_channel_offset);
+ void copy_from(const struct ImBuf *src, const rcti &area, bool ensure_linear_space = false);
+ void copy_from(const struct ImBuf *src,
+ const rcti &area,
+ int channel_offset,
+ int elem_size,
+ int to_channel_offset,
+ bool ensure_linear_space = false);
+ void copy_from(const struct ImBuf *src,
+ const rcti &src_area,
+ int channel_offset,
+ int elem_size,
+ int to_x,
+ int to_y,
+ int to_channel_offset,
+ bool ensure_linear_space = false);
+
+ void fill(const rcti &area, const float *value);
+ void fill(const rcti &area, int channel_offset, const float *value, int value_size);
/**
* \brief add the content from otherBuffer to this MemoryBuffer
* \param otherBuffer: source buffer
@@ -452,6 +509,22 @@ class MemoryBuffer {
return get_memory_width() * get_memory_height();
}
+ void copy_single_elem_from(const MemoryBuffer *src,
+ int channel_offset,
+ int elem_size,
+ const int to_channel_offset);
+ void copy_rows_from(const MemoryBuffer *src,
+ const rcti &src_area,
+ const int to_x,
+ const int to_y);
+ void copy_elems_from(const MemoryBuffer *src,
+ const rcti &area,
+ const int channel_offset,
+ const int elem_size,
+ const int to_x,
+ const int to_y,
+ const int to_channel_offset);
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("COM:MemoryBuffer")
#endif