68 #define DISPLAY_BUFFER_CHANNELS 4
255 unsigned int rval = (key->
display << 16) | (key->
view % 0xffff);
304 cache_view_settings->
look = look;
307 cache_view_settings->
gamma = view_settings->
gamma;
309 cache_view_settings->
flag = view_settings->
flag;
319 cache_display_settings->
display = display;
343 *cache_handle =
NULL;
347 *cache_handle = cache_ibuf;
360 int view_flag = 1 << (view_settings->
view - 1);
362 int curve_mapping_timestamp = curve_mapping ? curve_mapping->
changed_timestamp : 0;
387 if (cache_data->
look != view_settings->
look ||
392 *cache_handle =
NULL;
399 return (
unsigned char *)cache_ibuf->
rect;
408 unsigned char *display_buffer,
414 int view_flag = 1 << (view_settings->
view - 1);
417 int curve_mapping_timestamp = curve_mapping ? curve_mapping->
changed_timestamp : 0;
426 cache_ibuf->
rect = (
unsigned int *)display_buffer;
434 cache_data->
look = view_settings->
look;
438 cache_data->
flag = view_settings->
flag;
444 *cache_handle = cache_ibuf;
451 ImBuf *cache_ibuf = cache_handle;
463 char *colorspace_name,
465 const char *backup_role)
467 OCIO_ConstColorSpaceRcPtr *ociocs;
471 if (!ociocs && backup_role) {
483 printf(
"Color management: Error could not find role %s role.\n", role);
489 int tot_colorspace, tot_display, tot_display_view, tot_looks;
490 int index, viewindex, viewindex2;
510 for (index = 0; index < tot_colorspace; index++) {
511 OCIO_ConstColorSpaceRcPtr *ocio_colorspace;
512 const char *description;
513 bool is_invertible, is_data;
531 for (index = 0; index < tot_display; index++) {
532 const char *displayname;
541 for (viewindex = 0; viewindex < tot_display_view; viewindex++, viewindex2++) {
542 const char *viewname;
566 for (index = 0; index < tot_looks; index++) {
567 OCIO_ConstLookRcPtr *ocio_look;
568 const char *process_space;
607 colorspace = colorspace_next;
629 display = display_next;
647 const char *ocio_env;
648 const char *configdir;
650 OCIO_ConstConfigRcPtr *config =
NULL;
656 if (ocio_env && ocio_env[0] !=
'\0') {
658 if (config !=
NULL) {
659 printf(
"Color management: Using %s as a configuration file\n", ocio_env);
663 if (config ==
NULL) {
673 char short_name[256];
674 BLI_get_short_name(short_name, configfile);
683 if (config ==
NULL) {
684 printf(
"Color management: using fallback mode for management\n");
699 printf(
"Color management: no displays/views in the config, using fallback mode instead\n");
751 return (look->
view[0] == 0 || (view_name &&
STREQ(look->
view, view_name)));
797 if (sima && sima->
image) {
799 *r_view_settings =
NULL;
812 const char *colorspace_name;
818 return colorspace_name;
828 if (colorspace_name) {
836 const char *view_transform,
840 const char *from_colorspace)
844 const float scale = (exposure == 0.0f) ? 1.0f :
powf(2.0f, exposure);
845 const float exponent = (gamma == 1.0f) ? 1.0f : 1.0f /
max_ff(FLT_EPSILON, gamma);
848 config, from_colorspace, view_transform, display, (use_look) ? look :
"", scale, exponent);
852 if (processor ==
NULL) {
859 return cpu_processor;
863 const char *to_colorspace)
866 OCIO_ConstProcessorRcPtr *processor;
885 if (processor !=
NULL) {
908 if (processor !=
NULL) {
930 OCIO_ConstProcessorRcPtr *processor =
NULL;
932 if (view_name && config) {
934 config, display->
name, view_name);
941 if (processor !=
NULL) {
962 OCIO_ConstProcessorRcPtr *processor =
NULL;
964 if (view_name && config) {
966 config, display->
name, view_name);
973 if (processor !=
NULL) {
994 if (default_view ==
NULL) {
996 if (display !=
NULL) {
1000 if (default_view !=
NULL) {
1010 view_settings->
flag = 0;
1011 view_settings->
gamma = 1.0f;
1018 if (channels == 1) {
1021 else if (channels == 2) {
1032 if (colorspace && colorspace[0] ==
'\0') {
1033 const char *role_colorspace;
1050 if (colorspace && colorspace->
is_data) {
1085 default_display->
name,
1093 "Color management: display \"%s\" used by %s not found, setting to default (\"%s\").\n",
1096 default_display->
name);
1099 default_display->
name,
1137 printf(
"Color management: %s view \"%s\" not found, setting default \"%s\".\n",
1140 default_view->
name);
1149 if (view_settings->
look[0] ==
'\0') {
1155 printf(
"Color management: %s look \"%s\" not found, setting default \"%s\".\n",
1157 view_settings->
look,
1158 default_look->
name);
1165 if (view_settings->
exposure == 0.0f && view_settings->
gamma == 0.0f) {
1167 view_settings->
gamma = 1.0f;
1174 if (colorspace_settings->
name[0] ==
'\0') {
1181 printf(
"Color management: %s colorspace \"%s\" not found, will use default instead.\n",
1183 colorspace_settings->
name);
1202 if (!default_display) {
1218 if (sequencer_colorspace_settings->
name[0] ==
'\0') {
1255 for (view_link = display->
views.
first; view_link; view_link = view_link->
next) {
1263 if (view_link ==
NULL && default_view) {
1287 printf(
"Unknown role was passed to %s\n", __func__);
1299 if (colorspace && colorspace->
is_data) {
1330 if (colorspace && colorspace->
is_data) {
1344 if (colorspace && colorspace->
is_data) {
1372 return (colorspace && colorspace->
is_data);
1382 bool is_scene_linear, is_srgb;
1409 return (colorspace && colorspace->
is_data);
1470 float dither = ibuf->
dither;
1473 size_t offset = ((size_t)channels) * start_line * ibuf->
x;
1512 float *linear_buffer,
1513 bool *is_straight_alpha)
1518 size_t buffer_size = ((size_t)channels) *
width *
height;
1520 bool is_data = handle->
is_data;
1536 for (i = 0, fp = linear_buffer, cp = byte_buffer; i != i_last;
1537 i++, fp += channels, cp += channels) {
1538 if (channels == 3) {
1541 else if (channels == 4) {
1545 BLI_assert(!
"Buffers of 3 or 4 channels are only supported here");
1549 if (!is_data && !is_data_display) {
1552 linear_buffer,
width,
height, channels, from_colorspace, to_colorspace,
false);
1555 *is_straight_alpha =
true;
1567 memcpy(linear_buffer, handle->
buffer, buffer_size *
sizeof(
float));
1569 if (!is_data && !is_data_display) {
1571 linear_buffer,
width,
height, channels, from_colorspace, to_colorspace, predivide);
1574 *is_straight_alpha =
false;
1583 memcpy(linear_buffer, handle->
buffer, buffer_size *
sizeof(
float));
1585 *is_straight_alpha =
false;
1598 float dither = handle->
dither;
1599 bool is_data = handle->
is_data;
1601 if (cm_processor ==
NULL) {
1602 if (display_buffer_byte && display_buffer_byte != handle->
byte_buffer) {
1614 if (display_buffer) {
1627 bool is_straight_alpha;
1629 "color conversion linear buffer");
1633 bool predivide = handle->
predivide && (is_straight_alpha ==
false);
1643 cm_processor, linear_buffer,
width,
height, channels, predivide);
1647 if (display_buffer_byte) {
1662 if (display_buffer) {
1663 memcpy(display_buffer, linear_buffer, ((
size_t)
width) *
height * channels *
sizeof(
float));
1665 if (is_straight_alpha && channels == 4) {
1670 for (i = 0, fp = display_buffer; i != i_last; i++, fp += channels) {
1684 unsigned char *byte_buffer,
1685 float *display_buffer,
1686 unsigned char *display_buffer_byte,
1695 init_data.display_buffer = display_buffer;
1696 init_data.display_buffer_byte = display_buffer_byte;
1728 view_settings->
exposure == 0.0f && view_settings->
gamma == 1.0f) {
1737 if (to_colorspace &&
STREQ(from_colorspace, to_colorspace)) {
1747 float *display_buffer,
1748 unsigned char *display_buffer_byte,
1753 bool skip_transform =
false;
1764 if (skip_transform ==
false) {
1770 (
unsigned char *)ibuf->
rect,
1772 display_buffer_byte,
1781 unsigned char *display_buffer,
1786 ibuf,
NULL, display_buffer, view_settings, display_settings);
1826 const int channels =
init_data->channels;
1828 const bool predivide =
init_data->predivide;
1829 const bool float_from_byte =
init_data->float_from_byte;
1831 const size_t offset = ((size_t)channels) * start_line *
width;
1860 const int channels = handle->
channels;
1863 const bool predivide = handle->
predivide;
1866 if (float_from_byte) {
1881 if (byte_buffer !=
NULL) {
1885 if (float_buffer !=
NULL) {
1895 float *float_buffer,
1900 const bool predivide,
1901 const bool float_from_byte)
1912 init_data.float_from_byte = float_from_byte;
1930 float *float_buffer,
1934 const char *from_colorspace,
1935 const char *to_colorspace,
1941 if (from_colorspace[0] ==
'\0') {
1945 if (
STREQ(from_colorspace, to_colorspace)) {
1956 byte_buffer, float_buffer,
width,
height, channels, cm_processor, predivide,
false);
1959 if (byte_buffer !=
NULL) {
1962 if (float_buffer !=
NULL) {
1964 cm_processor, float_buffer,
width,
height, channels, predivide);
1976 const char *from_colorspace,
1977 const char *to_colorspace,
1991 const char *from_colorspace,
1992 const char *to_colorspace,
2004 const char *from_colorspace,
2005 const char *to_colorspace)
2014 const char *from_colorspace,
2015 const char *to_colorspace)
2023 unsigned char *byte_buffer,
2027 const char *from_colorspace,
2028 const char *to_colorspace)
2040 float_buffer,
width,
height, channels, from_colorspace, to_colorspace,
true);
2043 unsigned char *byte_buffer,
2047 const char *from_colorspace,
2048 const char *to_colorspace)
2051 if (from_colorspace ==
NULL || from_colorspace[0] ==
'\0') {
2054 if (
STREQ(from_colorspace, to_colorspace)) {
2073 byte_buffer, float_buffer,
width,
height, channels, cm_processor,
false,
true);
2078 const char *from_colorspace,
2079 const char *to_colorspace)
2083 if (from_colorspace[0] ==
'\0') {
2087 if (
STREQ(from_colorspace, to_colorspace)) {
2106 OCIO_ConstCPUProcessorRcPtr *processor;
2110 printf(
"%s: perform conversion from unknown color space\n", __func__);
2116 if (processor !=
NULL) {
2124 OCIO_ConstCPUProcessorRcPtr *processor;
2128 printf(
"%s: perform conversion from unknown color space\n", __func__);
2134 if (processor !=
NULL) {
2143 OCIO_ConstCPUProcessorRcPtr *processor;
2147 printf(
"%s: perform conversion from unknown color space\n", __func__);
2153 if (processor !=
NULL) {
2170 OCIO_ConstCPUProcessorRcPtr *processor;
2174 printf(
"%s: perform conversion from unknown color space\n", __func__);
2180 if (processor !=
NULL) {
2181 OCIO_PackedImageDesc *img;
2188 (
size_t)channels *
sizeof(
float),
2189 (
size_t)channels *
sizeof(
float) *
width);
2207 const struct ImBuf *ibuf,
2208 const bool compress_as_srgb,
2209 const bool store_premultiplied)
2216 OCIO_ConstCPUProcessorRcPtr *processor =
NULL;
2223 const unsigned char *in_buffer = (
unsigned char *)ibuf->
rect;
2227 const size_t in_offset = (offset_y +
y) * ibuf->
x + offset_x;
2228 const size_t out_offset =
y *
width;
2229 const unsigned char *in = in_buffer + in_offset * 4;
2230 unsigned char *out = out_buffer + out_offset * 4;
2234 for (
int x = 0;
x <
width;
x++, in += 4, out += 4) {
2239 if (use_premultiply) {
2245 else if (use_premultiply) {
2247 for (
int x = 0;
x <
width;
x++, in += 4, out += 4) {
2248 out[0] = (in[0] * in[3]) >> 8;
2249 out[1] = (in[1] * in[3]) >> 8;
2250 out[2] = (in[2] * in[3]) >> 8;
2256 for (
int x = 0;
x <
width;
x++, in += 4, out += 4) {
2271 const struct ImBuf *ibuf,
2272 const bool store_premultiplied)
2277 const int in_channels = ibuf->
channels;
2281 const size_t in_offset = (offset_y +
y) * ibuf->
x + offset_x;
2282 const size_t out_offset =
y *
width;
2283 const float *in = in_buffer + in_offset * in_channels;
2284 float *out = out_buffer + out_offset * 4;
2286 if (in_channels == 1) {
2288 for (
int x = 0;
x <
width;
x++, in += 1, out += 4) {
2295 else if (in_channels == 3) {
2297 for (
int x = 0;
x <
width;
x++, in += 3, out += 4) {
2304 else if (in_channels == 4) {
2306 if (use_unpremultiply) {
2307 for (
int x = 0;
x <
width;
x++, in += 4, out += 4) {
2312 memcpy(out, in,
sizeof(
float[4]) *
width);
2336 if (processor !=
NULL) {
2363 if (processor !=
NULL) {
2404 if (processor !=
NULL) {
2414 if (processor !=
NULL) {
2421 const float pixel[4],
2436 const float pixel[3],
2455 if (!ibuf->
rect && make_byte) {
2460 ibuf, ibuf->
rect_float, (
unsigned char *)ibuf->
rect, view_settings, display_settings);
2483 bool save_as_render,
2484 bool allocate_result,
2489 ImBuf *colormanaged_ibuf = ibuf;
2490 bool do_colormanagement;
2501 do_colormanagement = save_as_render && (is_movie || !requires_linear_float);
2503 if (do_colormanagement || do_alpha_under) {
2504 if (allocate_result) {
2540 if (do_alpha_under) {
2541 float color[3] = {0, 0, 0};
2545 colormanaged_ibuf->
rect_float, colormanaged_ibuf->
x, colormanaged_ibuf->
y, color);
2548 if (colormanaged_ibuf->
rect) {
2550 colormanaged_ibuf->
x,
2551 colormanaged_ibuf->
y,
2556 if (do_colormanagement) {
2557 bool make_byte =
false;
2579 colormanaged_ibuf, view_settings, display_settings, make_byte);
2591 if (colormanaged_ibuf != ibuf) {
2595 return colormanaged_ibuf;
2600 unsigned char *display_buffer,
2609 size_t float_buffer_size = ((size_t)
width) *
height * channels *
sizeof(
float);
2610 float *display_buffer_float =
MEM_mallocN(float_buffer_size,
"byte_buffer_make_display_space");
2614 memcpy(display_buffer_float,
buffer, float_buffer_size);
2619 NULL, display_buffer_float,
width,
height, channels, cm_processor,
true,
false);
2622 display_buffer_float,
2647 void **cache_handle)
2649 unsigned char *display_buffer;
2656 *cache_handle =
NULL;
2658 if (!ibuf->
x || !ibuf->
y) {
2662 if (view_settings) {
2663 applied_view_settings = view_settings;
2669 applied_view_settings = &default_view_settings;
2677 return (
unsigned char *)ibuf->
rect;
2688 (
unsigned char *)ibuf->
rect,
2692 applied_view_settings,
2708 "imbuf display_buffer_flags");
2720 ibuf, &cache_view_settings, &cache_display_settings, cache_handle);
2722 if (display_buffer) {
2724 return display_buffer;
2728 display_buffer =
MEM_callocN(buffer_size,
"imbuf display buffer");
2731 ibuf, display_buffer, applied_view_settings, display_settings);
2734 ibuf, &cache_view_settings, &cache_display_settings, display_buffer, cache_handle);
2738 return display_buffer;
2753 float *linear_buffer,
2766 "display transform temp buffer");
2767 memcpy(
buffer, linear_buffer, (
size_t)channels *
width *
height *
sizeof(
float));
2808 const char *display_name;
2814 return display_name;
2821 if (display_name[0] ==
'\0') {
2836 index = last_display->
index;
2841 display->
index = index + 1;
2876 return display->
index;
2889 return display->
name;
2899 return display->
name;
2945 if (!name || name[0] ==
'\0') {
2958 view->index = index + 1;
2991 if (display ==
NULL) {
3051 for (i = (
int)strlen(description) - 1; i >= 0; i--) {
3052 if (
ELEM(description[i],
'\r',
'\n')) {
3053 description[i] =
'\0';
3060 for (i = 0, n = strlen(description); i < n; i++) {
3061 if (
ELEM(description[i],
'\r',
'\n')) {
3062 description[i] =
' ';
3068 const char *description,
3086 colorspace->
is_data = is_data;
3093 prev_space->
index = counter++;
3103 colorspace->
index = counter++;
3104 for (; prev_space; prev_space = prev_space->
next) {
3105 prev_space->
index = counter++;
3146 return colorspace->
index;
3159 return colorspace->
name;
3171 if (colorspace && colorspace->
is_data) {
3180 type->default_save_role);
3181 BLI_strncpy(colorspace_settings->
name, role_colorspace,
sizeof(colorspace_settings->
name));
3198 look->
index = index + 1;
3205 const char *separator_offset = strstr(look->
name,
" - ");
3206 if (separator_offset) {
3303 const char *display_name)
3311 for (display_view = display->
views.
first; display_view; display_view = display_view->
next) {
3321 const char *view_name)
3381 unsigned char *display_buffer,
3382 const float *linear_buffer,
3383 const unsigned char *byte_buffer,
3386 int linear_offset_x,
3387 int linear_offset_y,
3396 float dither = ibuf->
dither;
3398 float *display_buffer_float =
NULL;
3399 const int width = xmax - xmin;
3400 const int height = ymax - ymin;
3403 if (dither != 0.0f) {
3411 if (!cm_processor) {
3416 "display buffer for dither");
3420 for (
y = ymin;
y < ymax;
y++) {
3421 for (
x = xmin;
x < xmax;
x++) {
3422 size_t display_index = ((size_t)
y * display_stride +
x) * 4;
3423 size_t linear_index = ((size_t)(
y - linear_offset_y) * linear_stride +
3424 (
x - linear_offset_x)) *
3428 if (linear_buffer) {
3429 if (channels == 4) {
3430 copy_v4_v4(pixel, (
float *)linear_buffer + linear_index);
3432 else if (channels == 3) {
3433 copy_v3_v3(pixel, (
float *)linear_buffer + linear_index);
3436 else if (channels == 1) {
3437 pixel[0] = linear_buffer[linear_index];
3440 BLI_assert(!
"Unsupported number of channels in partial buffer update");
3443 else if (byte_buffer) {
3453 if (display_buffer_float) {
3454 size_t index = ((size_t)(
y - ymin) *
width + (
x - xmin)) * channels;
3456 if (channels == 4) {
3457 copy_v4_v4(display_buffer_float + index, pixel);
3459 else if (channels == 3) {
3460 copy_v3_v3(display_buffer_float + index, pixel);
3463 display_buffer_float[index] = pixel[0];
3467 if (channels == 4) {
3468 float pixel_straight[4];
3472 else if (channels == 3) {
3474 display_buffer[display_index + 3] = 255;
3477 display_buffer[display_index] = display_buffer[display_index + 1] =
3478 display_buffer[display_index + 2] = display_buffer[display_index + 3] =
3486 if (display_buffer_float) {
3501 for (i = ymin; i < ymax; i++) {
3502 size_t byte_offset = ((size_t)linear_stride * i + xmin) * 4;
3503 size_t display_offset = ((size_t)display_stride * i + xmin) * 4;
3506 display_buffer + display_offset, byte_buffer + byte_offset,
sizeof(
char[4]) *
width);
3511 if (display_buffer_float) {
3512 size_t display_index = ((size_t)ymin * display_stride + xmin) * channels;
3515 display_buffer_float,
3547 int ymin =
data->ymin + start_scanline;
3549 data->display_buffer,
3550 data->linear_buffer,
3552 data->display_stride,
3553 data->linear_stride,
3554 data->linear_offset_x,
3555 data->linear_offset_y,
3560 ymin + num_scanlines);
3565 const float *linear_buffer,
3566 const unsigned char *byte_buffer,
3580 void *cache_handle =
NULL;
3581 unsigned char *display_buffer =
NULL;
3582 int buffer_width = ibuf->
x;
3585 int view_flag, display_index;
3590 view_flag = 1 << (cache_view_settings.
view - 1);
3591 display_index = cache_display_settings.
display - 1;
3597 ibuf, &cache_view_settings, &cache_display_settings, &cache_handle);
3604 buffer_width = ibuf->
x;
3613 if (display_buffer) {
3615 bool skip_transform =
false;
3624 if (linear_buffer ==
NULL && byte_buffer !=
NULL) {
3628 if (!skip_transform) {
3635 data.display_buffer = display_buffer;
3636 data.linear_buffer = linear_buffer;
3637 data.byte_buffer = byte_buffer;
3638 data.display_stride = buffer_width;
3640 data.linear_offset_x = offset_x;
3641 data.linear_offset_y = offset_y;
3642 data.cm_processor = cm_processor;
3674 const float *linear_buffer,
3675 const unsigned char *byte_buffer,
3703 const float *linear_buffer,
3704 const unsigned char *byte_buffer,
3715 int width = xmax - xmin;
3716 int height = ymax - ymin;
3717 bool do_threads = (((size_t)
width) *
height >= 64 * 64);
3762 if (view_settings) {
3763 applied_view_settings = view_settings;
3767 applied_view_settings = &default_view_settings;
3771 if (display_space) {
3776 applied_view_settings->
look,
3780 applied_view_settings->
gamma,
3788 return cm_processor;
3792 const char *to_colorspace)
3804 if (processor !=
NULL) {
3809 return cm_processor;
3850 if (channels == 4) {
3853 else if (channels == 3) {
3856 else if (channels == 1) {
3863 !
"Incorrect number of channels passed to IMB_colormanagement_processor_apply_pixel");
3880 float *pixel =
buffer + channels * (((size_t)
y) *
width +
x);
3888 OCIO_PackedImageDesc *img;
3896 (
size_t)channels *
sizeof(
float),
3897 (
size_t)channels *
sizeof(
float) *
width);
3920 size_t offset = channels * (((size_t)
y) *
width +
x);
3950 curve_mapping, &curve_mapping_settings->
lut, &curve_mapping_settings->
lut_size);
3955 for (i = 0; i < 4; i++) {
3957 curve_mapping_settings->
range[i] = cuma->
range;
3980 if (!use_curve_mapping) {
3989 return curve_mapping_settings;
3998 if (use_curve_mapping) {
4006 curve_mapping_settings->
lut =
NULL;
4010 if (use_curve_mapping) {
4023 return curve_mapping_settings;
4050 bool do_overlay_merge)
4055 if (view_settings) {
4056 applied_view_settings = view_settings;
4062 applied_view_settings = &default_view_settings;
4067 applied_view_settings);
4075 const char *look = (use_look) ? applied_view_settings->
look :
"";
4076 const float exposure = applied_view_settings->
exposure;
4077 const float gamma = applied_view_settings->
gamma;
4078 const float scale = (exposure == 0.0f) ? 1.0f :
powf(2.0f, exposure);
4079 const float exponent = (gamma == 1.0f) ? 1.0f : 1.0f /
max_ff(FLT_EPSILON, gamma);
4089 curve_mapping_settings,
4108 view_settings, display_settings,
NULL, dither, predivide,
false);
4126 view_settings, display_settings, from_colorspace, dither, predivide,
false);
typedef float(TangentPoint)[2]
const char * BKE_appdir_folder_id(const int folder_id, const char *subfolder)
struct Scene * CTX_data_scene(const bContext *C)
struct SpaceImage * CTX_wm_space_image(const bContext *C)
bool BKE_imtype_requires_linear_float(const char imtype)
bool BKE_imtype_is_movie(const char imtype)
int BKE_image_imtype_to_ftype(const char imtype, struct ImbFormatOptions *r_options)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
struct LinkData * BLI_genericNodeN(void *data)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
MINLINE void straight_to_premul_v4(float color[4])
void BLI_init_srgb_conversion(void)
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])
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])
void mul_m3_v3(const float M[3][3], float r[3])
void copy_m3_m3(float m1[3][3], const float m2[3][3])
bool invert_m3_m3(float R[3][3], const float A[3][3])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void BLI_join_dirfile(char *__restrict dst, const size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL()
const char * BLI_getenv(const char *env) ATTR_NONNULL(1)
void BLI_rcti_union(struct rcti *rct1, const struct rcti *rct2)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
void BLI_thread_unlock(int type)
void BLI_thread_lock(int type)
#define BLI_MUTEX_INITIALIZER
void BLI_mutex_lock(ThreadMutex *mutex)
void BLI_mutex_unlock(ThreadMutex *mutex)
@ CUMA_EXTEND_EXTRAPOLATE
@ COLORMANAGE_VIEW_USE_CURVES
#define R_IMF_PLANES_RGBA
_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 type
_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 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 stride
@ COLOR_ROLE_DEFAULT_FLOAT
@ COLOR_ROLE_DEFAULT_BYTE
@ COLOR_ROLE_SCENE_LINEAR
@ COLOR_ROLE_COLOR_PICKING
@ COLOR_ROLE_DEFAULT_SEQUENCER
@ COLOR_ROLE_TEXTURE_PAINTING
#define MAX_COLORSPACE_NAME
Function declarations for filter.c.
struct ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
struct ImBuf * IMB_dupImBuf(const struct ImBuf *ibuf1)
void IMB_rect_from_float(struct ImBuf *ibuf)
void IMB_freeImBuf(struct ImBuf *ibuf)
void imb_freerectImBuf(struct ImBuf *ibuf)
void IMB_processor_apply_threaded(int buffer_lines, int handle_size, void *init_customdata, void(init_handle)(void *handle, int start_line, int tot_line, void *customdata), void *(do_thread)(void *))
void IMB_buffer_byte_from_byte(unsigned char *rect_to, const unsigned char *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_byte(float *rect_to, const unsigned char *rect_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from)
void IMB_processor_apply_threaded_scanlines(int total_scanlines, ScanlineThreadFunc do_thread, void *custom_data)
void IMB_buffer_byte_from_float(unsigned char *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)
bool IMB_alpha_affects_rgb(const struct ImBuf *ibuf)
void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[3])
void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3])
bool imb_addrectImBuf(struct ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
@ IB_DISPLAY_BUFFER_INVALID
@ IMB_COLORMANAGE_IS_DATA
@ IB_alphamode_channel_packed
struct MovieCache * IMB_moviecache_create(const char *name, int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp)
struct ImBuf * IMB_moviecache_get(struct MovieCache *cache, void *userkey)
void IMB_moviecache_put(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf)
void IMB_moviecache_free(struct MovieCache *cache)
Read Guarded memory(de)allocation.
static void init_data(ModifierData *md)
#define SEQ_ALL_BEGIN(ed, _seq)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
ColorManagedColorspaceSettings colorspace_settings
const char * IMB_colormanagement_colorspace_get_indexed_name(int index)
static char global_role_data[MAX_COLORSPACE_NAME]
static void * do_processor_transform_thread(void *handle_v)
ColorManagedView * colormanage_view_get_default(const ColorManagedDisplay *display)
static ListBase global_colorspaces
static void display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle, int height, float *linear_buffer, bool *is_straight_alpha)
void IMB_colormanagement_pixel_to_display_space_v3(float result[3], const float pixel[3], const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
unsigned char * IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, void **cache_handle)
void IMB_colormanagement_display_to_scene_linear_v3(float pixel[3], ColorManagedDisplay *display)
void IMB_colormanagement_processor_apply_byte(ColormanageProcessor *cm_processor, unsigned char *buffer, int width, int height, int channels)
void IMB_partial_display_buffer_update_threaded(struct ImBuf *ibuf, const float *linear_buffer, const unsigned char *byte_buffer, int stride, int offset_x, int offset_y, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, int xmin, int ymin, int xmax, int ymax)
static void display_buffer_init_handle(void *handle_v, int start_line, int tot_line, void *init_data_v)
bool IMB_colormanagement_space_is_data(ColorSpace *colorspace)
void IMB_colormanagement_colorspace_items_add(EnumPropertyItem **items, int *totitem)
float imbuf_luma_coefficients[3]
static void curve_mapping_to_ocio_settings(CurveMapping *curve_mapping, OCIO_CurveMappingSettings *curve_mapping_settings)
void IMB_colormanagement_processor_apply_pixel(struct ColormanageProcessor *cm_processor, float *pixel, int channels)
void colormanagement_init(void)
ColormanageProcessor * IMB_colormanagement_colorspace_processor_new(const char *from_colorspace, const char *to_colorspace)
struct ColormanageCache ColormanageCache
void colormanage_cache_free(ImBuf *ibuf)
static void curve_mapping_apply_pixel(CurveMapping *curve_mapping, float *pixel, int channels)
static float imbuf_xyz_to_linear_srgb[3][3]
void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, bool predivide)
void IMB_colormanagement_imbuf_to_byte_texture(unsigned char *out_buffer, const int offset_x, const int offset_y, const int width, const int height, const struct ImBuf *ibuf, const bool compress_as_srgb, const bool store_premultiplied)
const float * IMB_colormangement_get_xyz_to_rgb()
ColorManagedView * colormanage_view_get_named_for_display(const char *display_name, const char *name)
void IMB_colormanagement_assign_float_colorspace(ImBuf *ibuf, const char *name)
const char * IMB_colormanagement_get_rect_colorspace(ImBuf *ibuf)
static void colormanage_check_colorspace_settings(ColorManagedColorspaceSettings *colorspace_settings, const char *what)
bool IMB_colormanagement_space_is_srgb(ColorSpace *colorspace)
static OCIO_ConstProcessorRcPtr * create_colorspace_transform_processor(const char *from_colorspace, const char *to_colorspace)
void IMB_colormanagement_pixel_to_display_space_v4(float result[4], const float pixel[4], const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
static void colormanage_cachedata_set(ImBuf *ibuf, ColormanageCacheData *data)
static void colormanagement_imbuf_make_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, bool make_byte)
static void colormanage_role_color_space_name_get(OCIO_ConstConfigRcPtr *config, char *colorspace_name, const char *role, const char *backup_role)
bool IMB_colormanagement_space_is_scene_linear(ColorSpace *colorspace)
static OCIO_ConstCPUProcessorRcPtr * colorspace_to_scene_linear_cpu_processor(ColorSpace *colorspace)
void IMB_colormanagement_view_items_add(EnumPropertyItem **items, int *totitem, const char *display_name)
static unsigned char * colormanage_cache_get(ImBuf *ibuf, const ColormanageCacheViewSettings *view_settings, const ColormanageCacheDisplaySettings *display_settings, void **cache_handle)
static ColorSpace * display_transform_get_colorspace(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
static char global_role_default_sequencer[MAX_COLORSPACE_NAME]
static void * do_display_buffer_apply_thread(void *handle_v)
void IMB_colormanagement_check_is_data(ImBuf *ibuf, const char *name)
static void processor_transform_init_handle(void *handle_v, int start_line, int tot_line, void *init_data_v)
bool IMB_colormanagement_setup_glsl_draw(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, float dither, bool predivide)
static OCIO_ConstCPUProcessorRcPtr * colorspace_from_scene_linear_cpu_processor(ColorSpace *colorspace)
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], ColorSpace *colorspace)
void IMB_colormanagement_look_items_add(struct EnumPropertyItem **items, int *totitem, const char *view_name)
const char * IMB_colormanagement_view_get_default_name(const char *display_name)
ColorSpace * colormanage_colorspace_add(const char *name, const char *description, bool is_invertible, bool is_data)
static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffer, const float *linear_buffer, const unsigned char *byte_buffer, int display_stride, int linear_stride, int linear_offset_x, int linear_offset_y, ColormanageProcessor *cm_processor, const int xmin, const int ymin, const int xmax, const int ymax)
void IMB_colormanagement_imbuf_make_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
struct ProcessorTransformThread ProcessorTransformThread
const char * IMB_colormanagement_get_display_colorspace_name(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
void colormanagement_exit(void)
bool IMB_colormanagement_setup_glsl_draw_from_space_ctx(const bContext *C, struct ColorSpace *from_colorspace, float dither, bool predivide)
static pthread_mutex_t processor_lock
static bool is_ibuf_rect_in_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
static ColormanageCacheData * colormanage_cachedata_get(const ImBuf *ibuf)
static void imb_partial_display_buffer_update_ex(ImBuf *ibuf, const float *linear_buffer, const unsigned char *byte_buffer, int stride, int offset_x, int offset_y, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, int xmin, int ymin, int xmax, int ymax, bool do_threads)
struct PartialThreadData PartialThreadData
ColorManagedLook * colormanage_look_get_indexed(int index)
static struct MovieCache * colormanage_moviecache_get(const ImBuf *ibuf)
unsigned char * IMB_display_buffer_acquire_ctx(const bContext *C, ImBuf *ibuf, void **cache_handle)
void IMB_colormanagement_color_picking_to_scene_linear_v3(float pixel[3])
int IMB_colormanagement_view_get_named_index(const char *name)
static void colormanage_check_display_settings(ColorManagedDisplaySettings *display_settings, const char *what, const ColorManagedDisplay *default_display)
const char * colormanage_view_get_default_name(const ColorManagedDisplay *display)
void IMB_colormanagement_check_file_config(Main *bmain)
struct DisplayBufferThread DisplayBufferThread
struct ColormanageProcessor ColormanageProcessor
void IMB_colormanagement_transform_from_byte_threaded(float *float_buffer, unsigned char *byte_buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace)
bool IMB_colormanagement_space_name_is_data(const char *name)
static bool colormanage_hashcmp(const void *av, const void *bv)
void IMB_colormanagement_transform_from_byte(float *float_buffer, unsigned char *byte_buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace)
static void partial_buffer_update_rect_thread_do(void *data_v, int start_scanline, int num_scanlines)
void IMB_colormanagement_init_default_view_settings(ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
static bool colormanage_use_look(const char *look, const char *view_name)
void IMB_colormanagement_transform_threaded(float *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, bool predivide)
void IMB_colormanagement_validate_settings(const ColorManagedDisplaySettings *display_settings, ColorManagedViewSettings *view_settings)
static void colormanage_ensure_srgb_scene_linear_info(ColorSpace *colorspace)
void IMB_colormanagement_colorspace_from_ibuf_ftype(ColorManagedColorspaceSettings *colorspace_settings, ImBuf *ibuf)
void IMB_colormanagement_processor_apply_v3(ColormanageProcessor *cm_processor, float pixel[3])
static void colormanage_free_config(void)
void IMB_colormanagegent_copy_settings(ImBuf *ibuf_src, ImBuf *ibuf_dst)
void IMB_colormanagement_processor_apply(ColormanageProcessor *cm_processor, float *buffer, int width, int height, int channels, bool predivide)
void IMB_colormanagement_transform_byte_threaded(unsigned char *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace)
static int global_tot_view
bool IMB_colormanagement_setup_glsl_draw_ctx(const bContext *C, float dither, bool predivide)
bool IMB_colormanagement_support_glsl_draw(const ColorManagedViewSettings *UNUSED(view_settings))
static ImBuf * colormanage_cache_get_ibuf(ImBuf *ibuf, ColormanageCacheKey *key, void **cache_handle)
void IMB_display_buffer_release(void *cache_handle)
ColorManagedLook * colormanage_look_add(const char *name, const char *process_space, bool is_noop)
static void processor_transform_apply_threaded(unsigned char *byte_buffer, float *float_buffer, const int width, const int height, const int channels, ColormanageProcessor *cm_processor, const bool predivide, const bool float_from_byte)
void IMB_colormanagement_display_settings_from_ctx(const bContext *C, ColorManagedViewSettings **r_view_settings, ColorManagedDisplaySettings **r_display_settings)
ColorManagedLook * colormanage_look_get_named(const char *name)
static void colormanage_display_buffer_process(ImBuf *ibuf, unsigned char *display_buffer, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], ColorSpace *colorspace)
static void colormanage_cache_handle_release(void *cache_handle)
struct ColormanageCacheDisplaySettings ColormanageCacheDisplaySettings
static ListBase global_looks
static ListBase global_views
static OCIO_ConstCPUProcessorRcPtr * create_display_buffer_processor(const char *look, const char *view_transform, const char *display, float exposure, float gamma, const char *from_colorspace)
#define DISPLAY_BUFFER_CHANNELS
void IMB_colormanagement_assign_rect_colorspace(ImBuf *ibuf, const char *name)
const char * IMB_colormanagement_display_get_default_name(void)
void IMB_colormanagement_scene_linear_to_srgb_v3(float pixel[3])
void colormanage_imbuf_set_default_spaces(ImBuf *ibuf)
const char * IMB_colormanagement_display_get_none_name(void)
static void colormanage_description_strip(char *description)
const char * IMB_colormanagement_view_get_indexed_name(int index)
int IMB_colormanagement_look_get_named_index(const char *name)
const char * IMB_colormanagement_role_colorspace_name_get(int role)
ColorManagedDisplay * colormanage_display_get_named(const char *name)
float imbuf_rgb_to_xyz[3][3]
static void colormanage_display_settings_to_cache(ColormanageCacheDisplaySettings *cache_display_settings, const ColorManagedDisplaySettings *display_settings)
ColorManagedDisplay * colormanage_display_get_indexed(int index)
void colorspace_set_default_role(char *colorspace, int size, int role)
static ListBase global_displays
static bool colormanage_compatible_look(ColorManagedLook *look, const char *view_name)
bool IMB_colormanagement_setup_glsl_draw_from_space(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, struct ColorSpace *from_colorspace, float dither, bool predivide, bool do_overlay_merge)
static int global_tot_display
void IMB_colormanagement_transform_byte(unsigned char *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace)
ColorManagedDisplay * colormanage_display_get_default(void)
static float imbuf_linear_srgb_to_xyz[3][3]
ColorSpace * colormanage_colorspace_get_indexed(int index)
const char * colormanage_display_get_default_name(void)
void IMB_colormanagement_display_items_add(EnumPropertyItem **items, int *totitem)
struct ColormanageCacheData ColormanageCacheData
void IMB_colormanagement_finish_glsl_draw(void)
static int global_tot_colorspace
static char global_role_scene_linear[MAX_COLORSPACE_NAME]
static void colormanagement_view_item_add(EnumPropertyItem **items, int *totitem, ColorManagedView *view)
int IMB_colormanagement_colorspace_get_named_index(const char *name)
static void colormanagement_transform_ex(unsigned char *byte_buffer, float *float_buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, bool predivide, bool do_threaded)
void IMB_colormanagement_buffer_make_display_space(float *buffer, unsigned char *display_buffer, int width, int height, int channels, float dither, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
static char global_role_texture_painting[MAX_COLORSPACE_NAME]
ColorSpace * colormanage_colorspace_get_named(const char *name)
void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer, const unsigned char *byte_buffer, int stride, int offset_x, int offset_y, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, int xmin, int ymin, int xmax, int ymax)
void IMB_colormanagement_scene_linear_to_color_picking_v3(float pixel[3])
static void colormanage_settings_to_key(ColormanageCacheKey *key, const ColormanageCacheViewSettings *view_settings, const ColormanageCacheDisplaySettings *display_settings)
void colormanage_imbuf_make_linear(ImBuf *ibuf, const char *from_colorspace)
static unsigned int colormanage_hashhash(const void *key_v)
void IMB_display_buffer_transform_apply(unsigned char *display_buffer, float *linear_buffer, int width, int height, int channels, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, bool predivide)
float imbuf_xyz_to_rgb[3][3]
const char * IMB_colormanagement_get_float_colorspace(ImBuf *ibuf)
void IMB_colormanagement_processor_apply_v4_predivide(ColormanageProcessor *cm_processor, float pixel[4])
static OCIO_CurveMappingSettings * update_glsl_curve_mapping(const ColorManagedViewSettings *view_settings)
static void colormanage_display_buffer_process_ex(ImBuf *ibuf, float *display_buffer, unsigned char *display_buffer_byte, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
ImBuf * IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, bool save_as_render, bool allocate_result, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, ImageFormatData *image_format_data)
static void colormanage_cache_put(ImBuf *ibuf, const ColormanageCacheViewSettings *view_settings, const ColormanageCacheDisplaySettings *display_settings, unsigned char *display_buffer, void **cache_handle)
const char * IMB_colormanagement_look_get_indexed_name(int index)
struct DisplayBufferInitData DisplayBufferInitData
static int global_tot_looks
ColorManagedDisplay * IMB_colormanagement_display_get_named(const char *name)
static OCIO_ConstCPUProcessorRcPtr * display_to_scene_linear_processor(ColorManagedDisplay *display)
struct ProcessorTransformInit ProcessorTransformInitData
struct ColormanageCacheViewSettings ColormanageCacheViewSettings
static char global_role_default_byte[MAX_COLORSPACE_NAME]
static char global_role_default_float[MAX_COLORSPACE_NAME]
void IMB_colormanagement_processor_free(ColormanageProcessor *cm_processor)
const char * IMB_colormanagement_display_get_default_view_transform_name(struct ColorManagedDisplay *display)
void IMB_partial_display_buffer_update_delayed(ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax)
void IMB_colormanagement_transform_v4(float pixel[4], const char *from_colorspace, const char *to_colorspace)
ColorManagedDisplay * colormanage_display_add(const char *name)
void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], bool predivide, ColorSpace *colorspace)
const char * IMB_colormanagement_display_get_indexed_name(int index)
void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], ColorManagedDisplay *display)
static void colormanage_view_settings_to_cache(ImBuf *ibuf, ColormanageCacheViewSettings *cache_view_settings, const ColorManagedViewSettings *view_settings)
void IMB_colormanagement_transform(float *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, bool predivide)
void IMB_colormanagement_processor_apply_v4(ColormanageProcessor *cm_processor, float pixel[4])
int IMB_colormanagement_display_get_named_index(const char *name)
static char global_role_color_picking[MAX_COLORSPACE_NAME]
static void colormanage_check_view_settings(ColorManagedDisplaySettings *display_settings, ColorManagedViewSettings *view_settings, const char *what)
static void display_buffer_apply_threaded(ImBuf *ibuf, const float *buffer, unsigned char *byte_buffer, float *display_buffer, unsigned char *display_buffer_byte, ColormanageProcessor *cm_processor)
static void colormanage_load_config(OCIO_ConstConfigRcPtr *config)
struct ColormanageCacheKey ColormanageCacheKey
ColorManagedView * colormanage_view_get_named(const char *name)
void IMB_colormanagement_srgb_to_scene_linear_v3(float pixel[3])
ColorSpace * colormanage_colorspace_get_roled(int role)
ColorManagedView * colormanage_view_add(const char *name)
void IMB_colormanagement_imbuf_to_float_texture(float *out_buffer, const int offset_x, const int offset_y, const int width, const int height, const struct ImBuf *ibuf, const bool store_premultiplied)
ColorManagedView * colormanage_view_get_indexed(int index)
ColormanageProcessor * IMB_colormanagement_display_processor_new(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
static OCIO_ConstCPUProcessorRcPtr * display_from_scene_linear_processor(ColorManagedDisplay *display)
static struct MovieCache * colormanage_moviecache_ensure(ImBuf *ibuf)
const ImFileType * IMB_file_type_from_ibuf(const ImBuf *ibuf)
void IMB_premultiply_rect_float(float *rect_float, int channels, int w, int h)
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int 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_float_to_uchar_clamp(float val)
void OCIO_cpuProcessorApplyRGB(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel)
void OCIO_cpuProcessorApplyRGBA(OCIO_ConstCPUProcessorRcPtr *cpu_processor, float *pixel)
const char * OCIO_configGetDefaultView(OCIO_ConstConfigRcPtr *config, const char *display)
const char * OCIO_configGetColorSpaceNameByIndex(OCIO_ConstConfigRcPtr *config, int index)
OCIO_ConstCPUProcessorRcPtr * OCIO_processorGetCPUProcessor(OCIO_ConstProcessorRcPtr *processor)
OCIO_ConstConfigRcPtr * OCIO_getCurrentConfig(void)
void OCIO_lookRelease(OCIO_ConstLookRcPtr *look)
const char * OCIO_lookGetProcessSpace(OCIO_ConstLookRcPtr *look)
void OCIO_cpuProcessorApply(OCIO_ConstCPUProcessorRcPtr *cpu_processor, OCIO_PackedImageDesc *img)
void OCIO_gpuCacheFree(void)
void OCIO_colorSpaceIsBuiltin(OCIO_ConstConfigRcPtr *config, OCIO_ConstColorSpaceRcPtr *cs, bool *is_scene_linear, bool *is_srgb)
void OCIO_colorSpaceRelease(OCIO_ConstColorSpaceRcPtr *cs)
const char * OCIO_configGetView(OCIO_ConstConfigRcPtr *config, const char *display, int index)
OCIO_PackedImageDesc * OCIO_createOCIO_PackedImageDesc(float *data, long width, long height, long numChannels, long chanStrideBytes, long xStrideBytes, long yStrideBytes)
const char * OCIO_colorSpaceGetName(OCIO_ConstColorSpaceRcPtr *cs)
const char * OCIO_configGetLookNameByIndex(OCIO_ConstConfigRcPtr *config, int index)
void OCIO_cpuProcessorApply_predivide(OCIO_ConstCPUProcessorRcPtr *cpu_processor, OCIO_PackedImageDesc *img)
void OCIO_setCurrentConfig(const OCIO_ConstConfigRcPtr *config)
OCIO_ConstConfigRcPtr * OCIO_configCreateFallback(void)
int OCIO_configGetNumColorSpaces(OCIO_ConstConfigRcPtr *config)
void OCIO_gpuDisplayShaderUnbind(void)
void OCIO_configRelease(OCIO_ConstConfigRcPtr *config)
OCIO_ConstColorSpaceRcPtr * OCIO_configGetColorSpace(OCIO_ConstConfigRcPtr *config, const char *name)
OCIO_ConstProcessorRcPtr * OCIO_createDisplayProcessor(OCIO_ConstConfigRcPtr *config, const char *input, const char *view, const char *display, const char *look, const float scale, const float exponent)
int OCIO_configGetNumViews(OCIO_ConstConfigRcPtr *config, const char *display)
bool OCIO_gpuDisplayShaderBind(OCIO_ConstConfigRcPtr *config, const char *input, const char *view, const char *display, const char *look, OCIO_CurveMappingSettings *curve_mapping_settings, const float scale, const float exponent, const float dither, const bool use_predivide, const bool use_overlay)
const char * OCIO_colorSpaceGetDescription(OCIO_ConstColorSpaceRcPtr *cs)
void OCIO_cpuProcessorRelease(OCIO_ConstCPUProcessorRcPtr *cpu_processor)
OCIO_ConstProcessorRcPtr * OCIO_configGetProcessorWithNames(OCIO_ConstConfigRcPtr *config, const char *srcName, const char *dstName)
void OCIO_cpuProcessorApplyRGBA_predivide(OCIO_ConstCPUProcessorRcPtr *processor, float *pixel)
int OCIO_colorSpaceIsInvertible(OCIO_ConstColorSpaceRcPtr *cs)
OCIO_ConstConfigRcPtr * OCIO_configCreateFromEnv(void)
void OCIO_configGetXYZtoRGB(OCIO_ConstConfigRcPtr *config, float xyz_to_rgb[3][3])
bool OCIO_supportGPUShader()
void OCIO_PackedImageDescRelease(OCIO_PackedImageDesc *id)
const char * OCIO_configGetDisplayColorSpaceName(OCIO_ConstConfigRcPtr *config, const char *display, const char *view)
OCIO_ConstLookRcPtr * OCIO_configGetLook(OCIO_ConstConfigRcPtr *config, const char *name)
const char * OCIO_configGetDisplay(OCIO_ConstConfigRcPtr *config, int index)
int OCIO_configGetNumLooks(OCIO_ConstConfigRcPtr *config)
void OCIO_processorRelease(OCIO_ConstProcessorRcPtr *processor)
const char * OCIO_configGetDefaultDisplay(OCIO_ConstConfigRcPtr *config)
OCIO_ConstConfigRcPtr * OCIO_configCreateFromFile(const char *filename)
int OCIO_configGetNumDisplays(OCIO_ConstConfigRcPtr *config)
int OCIO_colorSpaceIsData(OCIO_ConstColorSpaceRcPtr *cs)
void OCIO_configGetDefaultLumaCoefs(OCIO_ConstConfigRcPtr *config, float *rgb)
#define OCIO_ROLE_COLOR_PICKING
#define OCIO_ROLE_TEXTURE_PAINT
#define OCIO_ROLE_DEFAULT_FLOAT
#define OCIO_ROLE_DEFAULT_SEQUENCER
#define OCIO_ROLE_DEFAULT_BYTE
static const float OCIO_XYZ_TO_LINEAR_SRGB[3][3]
#define OCIO_ROLE_SCENE_LINEAR
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
struct OCIO_ConstCPUProcessorRcPtr * to_scene_linear
char name[MAX_COLORSPACE_NAME]
struct ColorManagedDisplay * next
struct OCIO_ConstCPUProcessorRcPtr * from_scene_linear
char ui_name[MAX_COLORSPACE_NAME]
char view[MAX_COLORSPACE_NAME]
struct ColorManagedLook * next
char process_space[MAX_COLORSPACE_NAME]
char name[MAX_COLORSPACE_NAME]
struct CurveMapping * curve_mapping
char name[MAX_COLORSPACE_NAME]
struct OCIO_ConstCPUProcessorRcPtr * to_scene_linear
struct OCIO_ConstCPUProcessorRcPtr * from_scene_linear
char name[MAX_COLORSPACE_NAME]
char description[MAX_COLORSPACE_DESCRIPTION]
struct ColorSpace::@669 info
int curve_mapping_timestamp
CurveMapping * curve_mapping
CurveMapping * curve_mapping
struct MovieCache * moviecache
ColormanageCacheData * data
CurveMapping * curve_mapping
OCIO_ConstCPUProcessorRcPtr * cpu_processor
ColormanageProcessor * cm_processor
unsigned char * byte_buffer
const char * float_colorspace
const char * byte_colorspace
unsigned char * display_buffer_byte
const char * byte_colorspace
ColormanageProcessor * cm_processor
const char * float_colorspace
unsigned char * byte_buffer
unsigned char * display_buffer_byte
struct ColorSpace * rect_colorspace
ImbFormatOptions foptions
struct ColorSpace * float_colorspace
unsigned int * display_buffer_flags
struct ColormanageCache * colormanage_cache
ColorManagedColorspaceSettings colorspace_settings
int use_extend_extrapolate
ColormanageProcessor * cm_processor
const unsigned char * byte_buffer
unsigned char * display_buffer
const float * linear_buffer
ColorManagedViewSettings view_settings
ColorManagedColorspaceSettings sequencer_colorspace_settings
ColorManagedDisplaySettings display_settings
ColorManagedColorspaceSettings colorspace_settings
OCIO_ConstCPUProcessorRcPtr * cpu_processor_to
OCIO_ConstCPUProcessorRcPtr * cpu_processor_from
CurveMapping * orig_curve_mapping
int curve_mapping_timestamp
OCIO_CurveMappingSettings curve_mapping_settings
CurveMapping * curve_mapping