67 #define USHORTTOFLOAT(val) ((float)val / 65535.0f)
95 const float *rect_from,
109 float inv_width = 1.0f /
width;
110 float inv_height = 1.0f /
height;
121 float t =
y * inv_height;
123 if (channels_from == 1) {
125 const float *
from = rect_from + ((size_t)stride_from) *
y;
126 uchar *to = rect_to + ((size_t)stride_to) *
y * 4;
132 else if (channels_from == 3) {
134 const float *
from = rect_from + ((size_t)stride_from) *
y * 3;
135 uchar *to = rect_to + ((size_t)stride_to) *
y * 4;
137 if (profile_to == profile_from) {
161 else if (channels_from == 4) {
163 const float *
from = rect_from + ((size_t)stride_from) *
y * 4;
164 uchar *to = rect_to + ((size_t)stride_to) *
y * 4;
166 if (profile_to == profile_from) {
170 if (dither && predivide) {
181 else if (predivide) {
195 unsigned short us[4];
198 if (dither && predivide) {
211 else if (predivide) {
227 if (dither && predivide) {
239 else if (predivide) {
261 const float *rect_from,
273 float inv_width = 1.0f /
width, inv_height = 1.0f /
height;
280 float t =
y * inv_height;
282 if (channels_from == 1) {
284 const float *
from = rect_from + ((size_t)stride_from) *
y;
285 uchar *to = rect_to + ((size_t)stride_to) *
y * 4;
293 else if (channels_from == 3) {
295 const float *
from = rect_from + ((size_t)stride_from) *
y * 3;
296 uchar *to = rect_to + ((size_t)stride_to) *
y * 4;
305 else if (channels_from == 4) {
307 const float *
from = rect_from + ((size_t)stride_from) *
y * 4;
308 uchar *to = rect_to + ((size_t)stride_to) *
y * 4;
312 if (dither && predivide) {
327 else if (predivide) {
351 const uchar *rect_from,
369 const uchar *
from = rect_from + ((size_t)stride_from) *
y * 4;
370 float *to = rect_to + ((size_t)stride_to) *
y * 4;
372 if (profile_to == profile_from) {
410 const float *rect_from,
426 if (channels_from == 1) {
429 const float *
from = rect_from + ((size_t)stride_from) *
y;
430 float *to = rect_to + ((size_t)stride_to) *
y * 4;
433 to[0] = to[1] = to[2] = to[3] =
from[0];
437 else if (channels_from == 3) {
440 const float *
from = rect_from + ((size_t)stride_from) *
y * 3;
441 float *to = rect_to + ((size_t)stride_to) *
y * 4;
443 if (profile_to == profile_from) {
466 else if (channels_from == 4) {
469 const float *
from = rect_from + ((size_t)stride_from) *
y * 4;
470 float *to = rect_to + ((size_t)stride_to) *
y * 4;
472 if (profile_to == profile_from) {
474 memcpy(to,
from,
sizeof(
float) * ((
size_t)4) *
width);
520 const int num_scanlines = 1;
522 size_t offset_from = ((size_t)scanline) *
data->stride_from *
data->channels_from;
523 size_t offset_to = ((size_t)scanline) *
data->stride_to *
data->channels_from;
525 data->rect_from + offset_from,
537 const float *rect_from,
561 data.rect_to = rect_to;
562 data.rect_from = rect_from;
563 data.channels_from = channels_from;
564 data.profile_to = profile_to;
565 data.profile_from = profile_from;
566 data.predivide = predivide;
568 data.stride_to = stride_to;
569 data.stride_from = stride_from;
575 const float *rect_from,
585 if (channels_from == 1) {
588 const float *
from = rect_from + ((size_t)stride_from) *
y;
589 float *to = rect_to + ((size_t)stride_to) *
y * 4;
593 to[0] = to[1] = to[2] = to[3] =
from[0];
598 else if (channels_from == 3) {
601 const float *
from = rect_from + ((size_t)stride_from) *
y * 3;
602 float *to = rect_to + ((size_t)stride_to) *
y * 4;
612 else if (channels_from == 4) {
615 const float *
from = rect_from + ((size_t)stride_from) *
y * 4;
616 float *to = rect_to + ((size_t)stride_to) *
y * 4;
628 const uchar *rect_from,
646 const uchar *
from = rect_from + ((size_t)stride_from) *
y * 4;
647 uchar *to = rect_to + ((size_t)stride_to) *
y * 4;
649 if (profile_to == profile_from) {
724 buffer, ibuf->
x, ibuf->
y, ibuf->
channels, from_colorspace, to_colorspace, predivide);
752 const rcti *region_to_update)
755 "Destination buffer should have a float buffer assigned.");
757 BLI_assert_msg(dst->
x ==
src->x,
"Source and destination buffer should have the same dimension");
758 BLI_assert_msg(dst->
y ==
src->y,
"Source and destination buffer should have the same dimension");
761 "Region to update should be clipped to the given buffers.");
763 "Region to update should be clipped to the given buffers.");
765 "Region to update should be clipped to the given buffers.");
767 "Region to update should be clipped to the given buffers.");
770 rect_float += (region_to_update->
xmin + region_to_update->
ymin * dst->
x) * 4;
771 unsigned char *rect = (
unsigned char *)
src->rect;
772 rect += (region_to_update->
xmin + region_to_update->
ymin * dst->
x) * 4;
788 float *float_ptr = rect_float;
789 for (
int i = 0; i < region_height; i++) {
791 float_ptr, region_width, 1, dst->
channels,
src->rect_colorspace,
false);
792 float_ptr += 4 * dst->
x;
797 float_ptr = rect_float;
798 for (
int i = 0; i < region_height; i++) {
800 float_ptr += 4 * dst->
x;
819 if (rect_float ==
NULL) {
823 if (rect_float ==
NULL) {
833 rcti region_to_update;
892 unsigned char *rct = (
unsigned char *)ibuf->
rect;
909 hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rct_fl, rct_fl + 1, rct_fl + 2);
#define BLI_assert_msg(a, msg)
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4])
MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
MINLINE void premul_to_straight_v4(float color[4])
MINLINE void straight_to_premul_v4(float color[4])
MINLINE void linearrgb_to_srgb_ushort4(unsigned short srgb[4], const float linear[4])
MINLINE void linearrgb_to_srgb_predivide_v4(float srgb[4], const float linear[4])
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4])
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
MINLINE void premul_to_straight_v4_v4(float straight[4], const float premul[4])
MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
MINLINE void linearrgb_to_srgb_v4(float srgb[4], const float linear[4])
void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
MINLINE void srgb_to_linearrgb_predivide_v4(float linear[4], const float srgb[4])
MINLINE float dither_random_value(float s, float t)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
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
_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 GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, bool predivide)
@ COLOR_ROLE_DEFAULT_BYTE
@ COLOR_ROLE_SCENE_LINEAR
BLI_INLINE unsigned char IMB_colormanagement_get_luminance_byte(const unsigned char[3])
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
const char * IMB_colormanagement_role_colorspace_name_get(int role)
void IMB_colormanagement_transform(float *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, bool predivide)
Function declarations for filter.c.
void IMB_processor_apply_threaded_scanlines(int total_scanlines, ScanlineThreadFunc do_thread, void *custom_data)
size_t IMB_get_rect_len(const struct ImBuf *ibuf)
Get the length of the rect of the given image buffer in terms of pixels.
bool imb_addrectImBuf(struct ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
#define IB_PROFILE_LINEAR_RGB
@ IB_alphamode_channel_packed
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void IMB_buffer_float_from_float_mask(float *rect_to, const float *rect_from, int channels_from, int width, int height, int stride_to, int stride_from, char *mask)
#define USHORTTOFLOAT(val)
void IMB_float_from_rect_ex(struct ImBuf *dst, const struct ImBuf *src, const rcti *region_to_update)
void IMB_rect_from_float(ImBuf *ibuf)
void IMB_buffer_byte_from_float(uchar *rect_to, const float *rect_from, int channels_from, float dither, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from)
MINLINE void ushort_to_byte_dither_v4(uchar b[4], const unsigned short us[4], DitherContext *di, float s, float t)
MINLINE void float_to_byte_dither_v4(uchar b[4], const float f[4], DitherContext *di, float s, float t)
void IMB_buffer_byte_from_float_mask(uchar *rect_to, const float *rect_from, int channels_from, float dither, bool predivide, int width, int height, int stride_to, int stride_from, char *mask)
bool IMB_alpha_affects_rgb(const ImBuf *ibuf)
static DitherContext * create_dither_context(float dither)
void IMB_buffer_float_from_float(float *rect_to, const float *rect_from, int channels_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from)
struct FloatToFloatThreadData FloatToFloatThreadData
void IMB_buffer_float_premultiply(float *buf, int width, int height)
void IMB_color_to_bw(ImBuf *ibuf)
struct DitherContext DitherContext
void IMB_buffer_float_from_byte(float *rect_to, const uchar *rect_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from)
void IMB_buffer_float_from_float_threaded(float *rect_to, const float *rect_from, int channels_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from)
void IMB_buffer_float_unpremultiply(float *buf, int width, int height)
void IMB_saturation(ImBuf *ibuf, float sat)
MINLINE unsigned char ftochar(float value)
MINLINE void ushort_to_byte_v4(uchar b[4], const unsigned short us[4])
static void imb_buffer_float_from_float_thread_do(void *data_v, int scanline)
void IMB_buffer_byte_from_byte(uchar *rect_to, const uchar *rect_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from)
static void clear_dither_context(DitherContext *di)
void IMB_float_from_rect(ImBuf *ibuf)
SyclQueue void void * src
void IMB_unpremultiply_rect_float(float *rect_float, int channels, int w, int h)
void IMB_premultiply_rect_float(float *rect_float, int channels, int w, int h)
ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
MINLINE unsigned char unit_ushort_to_uchar(unsigned short val)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken rgb("rgb", pxr::TfToken::Immortal)
char name[MAX_COLORSPACE_NAME]
struct ColorSpace * rect_colorspace
struct ColorSpace * float_colorspace