98 bool is_a_single_elem_;
106 int to_positive_x_stride_;
109 int to_positive_y_stride_;
151 return is_a_single_elem_;
156 BLI_assert(is_a_single_elem_ ? index < num_channels_ :
158 return buffer_[index];
163 BLI_assert(is_a_single_elem_ ? index < num_channels_ :
165 return buffer_[index];
201 if (!has_coords(
x,
y)) {
217 if (x <= rect_.xmin - 1.0f || x >= rect_.
xmax || y <= rect_.ymin - 1.0f || y >= rect_.
ymax) {
222 if (is_a_single_elem_) {
223 if (
x >= rect_.
xmin && x < rect_.xmax - 1.0f && y >= rect_.
ymin &&
y < rect_.
ymax - 1.0f) {
230 const float rel_x = get_relative_x(
x);
231 float single_x = 0.0f;
235 else if (rel_x > last_x) {
236 single_x = rel_x - last_x;
240 const float rel_y = get_relative_y(
y);
241 float single_y = 0.0f;
245 else if (rel_y > last_y) {
246 single_y = rel_y - last_y;
283 BLI_assert(has_coords(
x,
y) && channel >= 0 && channel < num_channels_);
292 BLI_assert(has_coords(
x,
y) && channel >= 0 && channel < num_channels_);
325 return num_channels_;
330 return num_channels_ *
sizeof(
float);
491 if (clip_x || clip_y) {
493 memset(
result, 0, num_channels_ *
sizeof(
float));
519 BLI_assert(offset < this->buffer_len() * num_channels_);
542 if (is_a_single_elem_) {
543 memcpy(
result, buffer_,
sizeof(
float) * num_channels_);
558 void readEWA(
float *
result,
const float uv[2],
const float derivatives[2][2]);
579 int to_channel_offset);
586 int to_channel_offset);
594 int to_channel_offset);
603 int to_channel_offset);
609 int to_channel_offset,
610 bool ensure_linear_space =
false);
612 const rcti &src_area,
617 int to_channel_offset,
618 bool ensure_linear_space =
false);
621 void fill(
const rcti &
area,
int channel_offset,
const float *value,
int value_size);
665 const int buffer_len()
const
670 void clear_elem(
float *
out)
const
672 memset(
out, 0, num_channels_ *
sizeof(
float));
675 template<
typename T>
T get_relative_x(
T x)
const
677 return x - rect_.
xmin;
680 template<
typename T>
T get_relative_y(
T y)
const
682 return y - rect_.
ymin;
685 template<
typename T>
bool has_coords(
T x,
T y)
const
687 return has_x(
x) && has_y(
y);
690 template<
typename T>
bool has_x(
T x)
const
695 template<
typename T>
bool has_y(
T y)
const
703 int floor_x(
float x)
const
705 return (
int)(
x + to_positive_x_stride_) - to_positive_x_stride_;
708 int floor_y(
float y)
const
710 return (
int)(
y + to_positive_y_stride_) - to_positive_y_stride_;
716 int to_channel_offset);
724 int to_channel_offset);
726 #ifdef WITH_CXX_GUARDEDALLOC
727 MEM_CXX_CLASS_ALLOC_FUNCS(
"COM:MemoryBuffer")
typedef float(TangentPoint)[2]
void BLI_bilinear_interpolation_fl(const float *buffer, float *output, int width, int height, int components, float u, float v)
void BLI_bilinear_interpolation_wrap_fl(const float *buffer, float *output, int width, int height, int components, float u, float v, bool wrap_x, bool wrap_y)
void copy_vn_fl(float *array_tar, int size, float val)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
a MemoryBuffer contains access to the data of a chunk
void read(float *result, int x, int y, MemoryBufferExtend extend_x=MemoryBufferExtend::Clip, MemoryBufferExtend extend_y=MemoryBufferExtend::Clip)
float * release_ownership_buffer()
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 wrap_pixel(int &x, int &y, MemoryBufferExtend extend_x, MemoryBufferExtend extend_y)
MemoryBuffer(MemoryProxy *memory_proxy, const rcti &rect, MemoryBufferState state)
construct new temporarily MemoryBuffer for an area
void read_elem_checked(int x, int y, float *out) const
bool is_temporarily() const
is this MemoryBuffer a temporarily buffer (based on an area, not on a chunk)
BufferArea< const float > get_buffer_area(const rcti &area) const
~MemoryBuffer()
destructor
float & operator[](int index)
BufferRange< const float > as_range() const
BufferRange< float > as_range()
const float & get_value(int x, int y, int channel) const
float get_max_value() const
void copy_from(const MemoryBuffer *src, const rcti &area)
const rcti & get_rect() const
get the rect of this MemoryBuffer
uint8_t get_num_channels() const
float * get_elem(int x, int y)
MemoryBuffer * inflate() const
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 read_elem_checked(float x, float y, float *out) const
const int get_width() const
get the width of this MemoryBuffer
intptr_t get_coords_offset(int x, int y) const
const int get_height() const
get the height of this MemoryBuffer
const float * get_row_end(int y) const
void write_pixel(int x, int y, const float color[4])
bool is_a_single_elem() const
void read_elem_bilinear(float x, float y, float *out) const
BufferArea< float > get_buffer_area(const rcti &area)
const float & operator[](int index) const
const float * get_elem(int x, int y) const
int get_memory_width() const
float * get_buffer()
get the data of this MemoryBuffer
void read_elem(int x, int y, float *out) const
void fill(const rcti &area, const float *value)
void fill_from(const MemoryBuffer &src)
add the content from other_buffer to this MemoryBuffer
void wrap_pixel(float &x, float &y, MemoryBufferExtend extend_x, MemoryBufferExtend extend_y) const
void read_bilinear(float *result, float x, float y, MemoryBufferExtend extend_x=MemoryBufferExtend::Clip, MemoryBufferExtend extend_y=MemoryBufferExtend::Clip) const
void readEWA(float *result, const float uv[2], const float derivatives[2][2])
float & get_value(int x, int y, int channel)
int get_memory_height() const
uint8_t get_elem_bytes_len() const
void apply_processor(ColormanageProcessor &processor, const rcti area)
Apply a color processor on the given area.
void add_pixel(int x, int y, const float color[4])
void copy_from(const struct ImBuf *src, const rcti &area, bool ensure_linear_space=false)
void read_elem_sampled(float x, float y, PixelSampler sampler, float *out) const
void read_no_check(float *result, int x, int y, MemoryBufferExtend extend_x=MemoryBufferExtend::Clip, MemoryBufferExtend extend_y=MemoryBufferExtend::Clip)
BuffersIterator< float > iterate_with(Span< MemoryBuffer * > inputs)
void clear()
clear the buffer. Make all pixels black transparent.
void read_elem_filtered(float x, float y, float dx[2], float dy[2], float *out) const
A MemoryProxy is a unique identifier for a memory buffer. A single MemoryProxy is used among all chun...
SyclQueue void void * src
depth_tx sampler(1, ImageType::FLOAT_2D, "combined_tx") .sampler(2
MemoryBufferState
state of a memory buffer
@ Temporary
chunk is consolidated from other chunks. special state.
@ Default
memory has been allocated on creator device and CPU machine, but kernel has not been executed
DataType
possible data types for sockets
ccl_global float * buffer
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
static void area(int d1, int d2, int e1, int e2, float weights[2])
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static bNodeSocketTemplate inputs[]