56 float clipminx, clipminy, clipmaxx, clipmaxy;
63 clipminx =
min_ff(minx, maxx);
64 clipminy =
min_ff(miny, maxy);
65 clipmaxx =
max_ff(minx, maxx);
66 clipmaxy =
max_ff(miny, maxy);
74 for (a = 0; a < tot; a++) {
75 if (default_handle_type ==
HD_VECT) {
86 cumap->
cm[a].
curve = MEM_new_array<CurveMapPoint>(2,
"curve points");
103 cumap = MEM_new<CurveMapping>(
"new curvemap");
130 for (a = 0; a <
CM_TOT; a++) {
150 if (cumap->
cm[from_idx].
curve) {
152 MEM_dupalloc(cumap->
cm[from_idx].
curve));
154 if (cumap->
cm[from_idx].
table) {
156 MEM_dupalloc(cumap->
cm[from_idx].
table));
170 for (a = 0; a <
CM_TOT; a++) {
186 const float white[3],
191 for (a = 0; a < 3; a++) {
192 const float delta =
max_ff(white[a] - black[a], 1e-5f);
193 r_bwmul[a] = 1.0f / delta;
198 const float black[3],
199 const float white[3])
218 int a,
b, removed = 0;
225 cmp = MEM_new_array<CurveMapPoint>(
size_t(cuma->
totpoint),
"curve points");
228 for (a = 0,
b = 0; a < cuma->
totpoint; a++) {
229 if (&cuma->
curve[a] != point) {
238 MEM_delete(cuma->
curve);
241 return (removed != 0);
247 int a,
b, removed = 0;
250 cmp[0] = cuma->
curve[0];
251 for (a = 1,
b = 1; a < cuma->
totpoint - 1; a++) {
262 MEM_delete(cuma->
curve);
274 bool foundloc =
false;
275 for (
int i_new = 0, i_old = 0; i_new < cuma->
totpoint; i_new++) {
276 if ((foundloc ==
false) && ((i_new + 1 == cuma->
totpoint) || (
x < cuma->curve[i_new].x))) {
277 new_path[i_new].
x =
x;
278 new_path[i_new].
y =
y;
282 new_pt = &new_path[i_new];
285 new_path[i_new].
x = cuma->
curve[i_old].
x;
286 new_path[i_new].
y = cuma->
curve[i_old].
y;
295 MEM_delete(cuma->
curve);
296 cuma->
curve = new_path;
304 MEM_delete(cuma->
curve);
338 cuma->
curve = MEM_new_array<CurveMapPoint>(cuma->
totpoint,
"curve points");
340 for (
int i = 0; i < cuma->
totpoint; i++) {
367 cuma->
curve[1].
y = 0.5625;
371 cuma->
curve[3].
y = 0.0625;
406 for (
int i = 0; i < cuma->
totpoint; i++) {
417 cuma->
curve[2].
x = 0.6765;
418 cuma->
curve[2].
y = 0.7364;
419 cuma->
curve[3].
x = 0.8582;
420 cuma->
curve[3].
y = 0.5133;
422 cuma->
curve[4].
y = 0.2547;
435 cuma->
curve[4].
x = 0.9375;
448 cuma->
curve[0].
y = 0.025f;
450 cuma->
curve[1].
y = 0.135f;
451 cuma->
curve[2].
x = 0.298f;
460 cuma->
curve[5].
y = 0.135f;
462 cuma->
curve[6].
y = 0.025f;
466 cuma->
curve[0].
y = 0.025f;
472 cuma->
curve[2].
y = 0.025f;
495 for (i = 0; i < cuma->
totpoint; i++) {
496 newpoints[i].
x = 1.0f - cuma->
curve[last - i].
x;
497 newpoints[i].
y = cuma->
curve[last - i].
y;
499 MEM_delete(cuma->
curve);
500 cuma->
curve = newpoints;
504 const int num_points = cuma->
totpoint * 2 - 1;
505 CurveMapPoint *new_points = MEM_new_array<CurveMapPoint>(
size_t(num_points),
506 "curve symmetric points");
507 for (
int i = 0; i < cuma->
totpoint; i++) {
508 const int src_last_point = cuma->
totpoint - i - 1;
509 const int dst_last_point = num_points - i - 1;
510 new_points[i] = cuma->
curve[src_last_point];
511 new_points[i].
x = (1.0f - cuma->
curve[src_last_point].
x) * 0.5f;
512 new_points[dst_last_point] = new_points[i];
513 new_points[dst_last_point].
x = 0.5f + cuma->
curve[src_last_point].
x * 0.5f;
516 MEM_delete(cuma->
curve);
517 cuma->
curve = new_points;
521 MEM_delete(cuma->
table);
522 cuma->
table =
nullptr;
529 for (
int i = 1;; i++) {
531 int idx = (i & 1) ? (i_last - k) : (i_last + k);
533 if (idx < 0 || idx >= cuma->
totpoint) {
534 if (i_last - k < 0 && i_last + k >= cuma->
totpoint) {
551 for (a = 0; a < cuma->
totpoint; a++) {
575#define p2_h1 ((p2) - 3)
576#define p2_h2 ((p2) + 3)
578 const float *p1, *p3;
581 float len, len_a, len_b;
582 float dvec_a[2], dvec_b[2];
584 if (bezt->
h1 == 0 && bezt->
h2 == 0) {
590 if (prev ==
nullptr) {
592 pt[0] = 2.0f * p2[0] - p3[0];
593 pt[1] = 2.0f * p2[1] - p3[1];
600 if (next ==
nullptr) {
602 pt[0] = 2.0f * p2[0] - p1[0];
603 pt[1] = 2.0f * p2[1] - p1[1];
625 tvec[0] = dvec_b[0] / len_b + dvec_a[0] / len_a;
626 tvec[1] = dvec_b[1] / len_b + dvec_a[1] / len_a;
636 const float ydiff1 = prev->vec[1][1] - bezt->
vec[1][1];
637 const float ydiff2 = next->
vec[1][1] - bezt->
vec[1][1];
638 if ((ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f)) {
639 bezt->
vec[0][1] = bezt->
vec[1][1];
642 if (ydiff1 <= 0.0f) {
643 bezt->
vec[0][1] = std::max(prev->vec[1][1], bezt->
vec[0][1]);
646 bezt->
vec[0][1] = std::min(prev->vec[1][1], bezt->
vec[0][1]);
656 const float ydiff1 = prev->vec[1][1] - bezt->
vec[1][1];
657 const float ydiff2 = next->
vec[1][1] - bezt->
vec[1][1];
658 if ((ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f)) {
659 bezt->
vec[2][1] = bezt->
vec[1][1];
662 if (ydiff1 <= 0.0f) {
663 bezt->
vec[2][1] = std::min(next->
vec[1][1], bezt->
vec[2][1]);
666 bezt->
vec[2][1] = std::max(next->
vec[1][1], bezt->
vec[2][1]);
690 const float first[2],
699 if (cuma->
ext_in[0] == 0.0f) {
700 return first[1] + cuma->
ext_in[1] * 10000.0f;
703 return first[1] + cuma->
ext_in[1] * (
x - first[0]) / cuma->
ext_in[0];
711 if (cuma->
ext_out[0] == 0.0f) {
712 return last[1] - cuma->
ext_out[1] * 10000.0f;
726 start[1][0], start[2][0], end[0][0], end[1][0], point,
CM_RESOL - 1,
sizeof(
float[2]));
728 start[1][1], start[2][1], end[0][1], end[1][1], point + 1,
CM_RESOL - 1,
sizeof(
float[2]));
743 if (cuma->
curve ==
nullptr) {
759 for (
int a = 0; a < bezt_totpoint; a++) {
762 bezt[a].
vec[1][0] = cmp[a].
x;
763 bezt[a].
vec[1][1] = cmp[a].
y;
791 BezTriple bezt_pre = bezt[bezt_totpoint - 1];
799 bezt_pre.
h1 = bezt_pre.
h2 = bezt[bezt_totpoint - 1].
h2;
800 bezt_pre.
vec[1][0] = bezt[bezt_totpoint - 1].
vec[1][0] - table_range;
801 bezt_pre.
vec[1][1] = bezt[bezt_totpoint - 1].
vec[1][1];
803 bezt_post.
h1 = bezt_post.
h2 = bezt[0].
h1;
804 bezt_post.
vec[1][0] = bezt[0].
vec[1][0] + table_range;
805 bezt_post.
vec[1][1] = bezt[0].
vec[1][1];
807 bezt_prev = &bezt_pre;
808 bezt_post_ptr = &bezt_post;
812 bezt_post_ptr =
nullptr;
816 for (
int a = 0; a < bezt_totpoint; a++) {
817 bezt_next = (a != bezt_totpoint - 1) ? &bezt[a + 1] : bezt_post_ptr;
819 bezt_prev = &bezt[a];
823 bezt_pre.
vec[0][0] = bezt[bezt_totpoint - 1].
vec[0][0] - table_range;
824 bezt_pre.
vec[0][1] = bezt[bezt_totpoint - 1].
vec[0][1];
825 bezt_pre.
vec[2][0] = bezt[bezt_totpoint - 1].
vec[2][0] - table_range;
826 bezt_pre.
vec[2][1] = bezt[bezt_totpoint - 1].
vec[2][1];
828 bezt_post.
vec[0][0] = bezt[0].
vec[0][0] + table_range;
829 bezt_post.
vec[0][1] = bezt[0].
vec[0][1];
830 bezt_post.
vec[2][0] = bezt[0].
vec[2][0] + table_range;
831 bezt_post.
vec[2][1] = bezt[0].
vec[2][1];
835 if (bezt_totpoint > 2 && !use_wrapping) {
836 float hlen, nlen, vec[3];
840 hlen =
len_v3v3(bezt[0].vec[1], bezt[0].vec[2]);
843 vec[0] = std::max(vec[0], bezt[0].vec[1][0]);
853 int a = bezt_totpoint - 1;
856 hlen =
len_v3v3(bezt[a].vec[1], bezt[a].vec[0]);
859 vec[0] = std::min(vec[0], bezt[a].vec[1][0]);
873 MEM_delete(cuma->
table);
876 const int totpoint = use_wrapping ? (bezt_totpoint + 1) *
CM_RESOL :
879 float *point = allpoints;
888 for (
int a = 0; a < bezt_totpoint - 1; a++, point += 2 *
CM_RESOL) {
899 cuma->
ext_in[0] = bezt[0].
vec[0][0] - bezt[0].
vec[1][0];
900 cuma->
ext_in[1] = bezt[0].
vec[0][1] - bezt[0].
vec[1][1];
903 cuma->
ext_in[0] /= ext_in_range;
904 cuma->
ext_in[1] /= ext_in_range;
906 int out_a = bezt_totpoint - 1;
907 cuma->
ext_out[0] = bezt[out_a].
vec[1][0] - bezt[out_a].
vec[2][0];
908 cuma->
ext_out[1] = bezt[out_a].
vec[1][1] - bezt[out_a].
vec[2][1];
911 cuma->
ext_out[0] /= ext_out_range;
912 cuma->
ext_out[1] /= ext_out_range;
918 cuma->
range = 1.0f / range;
921 float *firstpoint = allpoints;
922 float *lastpoint = allpoints + 2 * (totpoint - 1);
927 for (
int a = 0; a <=
CM_TABLE; a++) {
932 while (cur_x >= point[0] && point != lastpoint) {
936 if ((point == firstpoint || (point == lastpoint && cur_x >= point[0])) && !use_wrapping) {
948 float fac1 = point[0] - point[-2];
949 float fac2 = point[0] - cur_x;
956 cmp[a].
y = fac1 * point[-1] + (1.0f - fac1) * point[1];
960 MEM_delete(allpoints);
972 for (a = 0; a < 3; a++) {
973 MEM_delete(cumap->
cm[a].
table);
989 for (a = 0; a < 3; a++) {
990 if (cumap->
cm[a].
table ==
nullptr) {
994 cumap->
cm[a].
table = MEM_new_array<CurveMapPoint>(
CM_TABLE + 1,
"premul table");
999 if (cumap->
cm[3].
table ==
nullptr) {
1004 for (a = 0; a < 3; a++) {
1026 for (
int i = 0; i < cuma->
totpoint; i++) {
1040 for (
int i = 0; i < cuma->
totpoint; i++) {
1055 float dx = 0.0f, dy = 0.0f;
1062 for (a = 0; a < cuma->
totpoint; a++) {
1067 else if (cmp[a].
x > clipr->
xmax) {
1073 else if (cmp[a].
y > clipr->
ymax) {
1078 for (a = 0; a < cuma->
totpoint; a++) {
1096 std::stable_sort(cuma->
curve,
1101 if (rem_doubles && cuma->
totpoint > 2) {
1102 for (a = 0; a < cuma->
totpoint - 1; a++) {
1103 dx = cmp[a].
x - cmp[a + 1].
x;
1104 dy = cmp[a].
y - cmp[a + 1].
y;
1105 if (
sqrtf(dx * dx + dy * dy) < thresh) {
1136 int a, cur = cumap->
cur;
1138 for (a = 0; a <
CM_TOT; a++) {
1174 return (1.0f - fi) * cuma->
table[i].
y + (fi)*cuma->
table[i + 1].
y;
1184 if (val < cumap->clipr.ymin) {
1204 const float vecin[3])
1248 const CurveMap *curve_map = curve_mapping->
cm + 3;
1260 const float scaling_ratio = (new_max - new_min) / (maximum - minimum);
1261 const float new_median = new_min + (median - minimum) * scaling_ratio;
1264 const float3 median_or_min =
float3(input.x == minimum ? new_min : new_median,
1265 input.y == minimum ? new_min : new_median,
1266 input.z == minimum ? new_min : new_median);
1267 return float3(input.x == maximum ? new_max : median_or_min.x,
1268 input.y == maximum ? new_max : median_or_min.y,
1269 input.z == maximum ? new_max : median_or_min.z);
1274 const float vecin[3],
1275 const float black[3],
1276 const float bwmul[3])
1278 const float r = (vecin[0] - black[0]) * bwmul[0];
1279 const float g = (vecin[1] - black[1]) * bwmul[1];
1280 const float b = (vecin[2] - black[2]) * bwmul[2];
1281 const float balanced_color[3] = {r, g,
b};
1283 switch (cumap->
tone) {
1301 const float vecin[3])
1307 uchar vecout_byte[3],
1308 const uchar vecin_byte[3])
1310 float vecin[3], vecout[3];
1312 vecin[0] =
float(vecin_byte[0]) / 255.0f;
1313 vecin[1] =
float(vecin_byte[1]) / 255.0f;
1314 vecin[2] =
float(vecin_byte[2]) / 255.0f;
1325 if (cumap->
black[0] != 0.0f) {
1328 if (cumap->
black[1] != 0.0f) {
1331 if (cumap->
black[2] != 0.0f) {
1334 if (cumap->
white[0] != 1.0f) {
1337 if (cumap->
white[1] != 1.0f) {
1340 if (cumap->
white[2] != 1.0f) {
1344 for (
int a = 0; a <
CM_TOT; a++) {
1350 if (cumap->
cm[a].
curve[0].
x != 0.0f) {
1353 if (cumap->
cm[a].
curve[0].
y != 0.0f) {
1356 if (cumap->
cm[a].
curve[1].
x != 1.0f) {
1359 if (cumap->
cm[a].
curve[1].
y != 1.0f) {
1369 for (
int i = 0; i <
CM_TOT; i++) {
1377 for (
int i = 0; i <
CM_TOT; i++) {
1378 const CurveMap *curve_map = &curve_mapping->
cm[i];
1384 float start_slopes[
CM_TOT],
1385 float end_slopes[
CM_TOT])
1387 float range_dividers[
CM_TOT];
1389 for (
int i = 0; i <
CM_TOT; i++) {
1390 const CurveMap *curve_map = &curve_mapping->
cm[i];
1393 start_slopes[i] = 0.0f;
1394 end_slopes[i] = 0.0f;
1398 if (curve_map->
ext_in[0] != 0.0f) {
1399 start_slopes[i] = curve_map->
ext_in[1] / (curve_map->
ext_in[0] * range_dividers[i]);
1402 start_slopes[i] = 1e8f;
1405 if (curve_map->
ext_out[0] != 0.0f) {
1406 end_slopes[i] = curve_map->
ext_out[1] / (curve_map->
ext_out[0] * range_dividers[i]);
1409 end_slopes[i] = 1e8f;
1432 if (curve_map->
curve[0].
x != 0 || curve_map->
curve[0].
y != 0) {
1435 if (curve_map->
curve[1].
x != 0 || curve_map->
curve[1].
y != 0) {
1445 if (cumap ==
nullptr) {
1449 for (a = 0; a <
CM_TOT; a++) {
1450 if (cumap->
cm[a].
table ==
nullptr) {
1463 for (a = 0; a < *size; a++) {
1465 (*array)[a * 4 + 0] = cumap->
cm[0].
table[a].
y;
1477 for (a = 0; a < *size; a++) {
1479 (*array)[a * 4 + 0] = cumap->
cm[0].
table[a].
y;
1482 (*array)[a * 4 + 1] = cumap->
cm[1].
table[a].
y;
1485 (*array)[a * 4 + 2] = cumap->
cm[2].
table[a].
y;
1488 (*array)[a * 4 + 3] = cumap->
cm[3].
table[a].
y;
1516 shallow_cumap.
cm[i].
range = 0;
1521 shallow_cumap.
cm[i].
table =
nullptr;
1532 for (
int a = 0; a <
CM_TOT; a++) {
1542 for (
int a = 0; a <
CM_TOT; a++) {
1551#define INV_255 (1.0f / 255.0f)
1555 int bin = int((f * 255.0f) + 0.5f);
1568 const float position_rgb[3],
1569 const float position_ycc[3],
1570 const float color_rgb[3])
1572 const float3 clamped =
float3(std::min(position_rgb[0], 1.0f),
1573 std::min(position_rgb[1], 1.0f),
1574 std::min(position_rgb[2], 1.0f));
1575 const float3 yuv = yuv_matrix * clamped;
1579 int color_idx = (idx / 2) * 3;
1581 rgb_to_hsv(color_rgb[0], color_rgb[1], color_rgb[2], &hsv[0], &hsv[1], &hsv[2]);
1592 if (cm_processor_colors) {
1600 scopes->
waveform_1[idx + 1] = std::min(position_rgb[0], 1.0f);
1602 scopes->
waveform_2[idx + 1] = std::min(position_rgb[1], 1.0f);
1604 scopes->
waveform_3[idx + 1] = std::min(position_rgb[2], 1.0f);
1608 scopes->
waveform_1[idx + 1] = std::min(position_ycc[0], 1.0f);
1614 scopes->
waveform_1[idx + 1] = std::min(position_ycc[0], 1.0f);
1616 scopes->
waveform_2[idx + 1] = std::min(position_ycc[1], 1.0f);
1618 scopes->
waveform_3[idx + 1] = std::min(position_ycc[2], 1.0f);
1630 int x1 =
roundf(hist->
co[0][0] * ibuf->
x);
1631 int x2 =
roundf(hist->
co[1][0] * ibuf->
x);
1632 int y1 =
roundf(hist->
co[0][1] * ibuf->
y);
1633 int y2 =
roundf(hist->
co[1][1] * ibuf->
y);
1635 std::optional<ColormanageProcessor> cm_processor;
1651 for (i = 0; i < 256; i++) {
1652 x = int(0.5f + x1 +
float(i) * (x2 - x1) / 255.0f);
1653 y = int(0.5f + y1 +
float(i) * (y2 - y1) / 255.0f);
1667 cm_processor->apply_v4(rgba);
1671 cm_processor->apply_v3(rgba);
1687 hist->
data_r[i] = rgba[0];
1688 hist->
data_g[i] = rgba[1];
1689 hist->
data_b[i] = rgba[2];
1690 hist->
data_a[i] = rgba[3];
1693 cp = cp + 4 * (
y * ibuf->
x +
x);
1739 const int ycc_mode =
data->ycc_mode;
1747 float *
min = data_chunk->
min;
1748 float *
max = data_chunk->
max;
1750 const float *rf =
nullptr;
1751 const uchar *rc =
nullptr;
1752 const int rows_per_sample_line = ibuf->
y / scopes->
sample_lines;
1753 const int savedlines =
y / rows_per_sample_line;
1754 const bool do_sample_line = (savedlines < scopes->
sample_lines) &&
1755 (
y % rows_per_sample_line) == 0;
1756 const int channels = (
data->float_data) ? ibuf->
channels : 4;
1758 if (
data->float_data) {
1759 rf =
data->float_data + size_t(
y) * ibuf->
x * channels;
1762 rc =
data->byte_data + size_t(
y) * ibuf->
x * channels;
1765 for (
int x = 0;
x < ibuf->
x;
x++) {
1766 float rgba[4], luma;
1768 if (
data->float_data) {
1796 float position_rgba[4];
1798 if (cm_processor_positions) {
1799 cm_processor_positions->
apply_v4(position_rgba);
1806 float position_ycc[3];
1807 if (ycc_mode == -1) {
1829 if (do_sample_line) {
1831 const int idx = 2 * (ibuf->
x * savedlines +
x);
1834 cm_processor_colors,
1846 void *__restrict chunk_join,
1847 void *__restrict chunk)
1858 const uint *bin_r_c = data_chunk->
bin_r;
1859 const uint *bin_g_c = data_chunk->
bin_g;
1860 const uint *bin_b_c = data_chunk->
bin_b;
1861 const uint *bin_a_c = data_chunk->
bin_a;
1863 const float *
min = data_chunk->
min;
1864 const float *
max = data_chunk->
max;
1866 for (
int b = 256;
b--;) {
1867 bin_lum[
b] += bin_lum_c[
b];
1868 bin_r[
b] += bin_r_c[
b];
1869 bin_g[
b] += bin_g_c[
b];
1870 bin_b[
b] += bin_b_c[
b];
1871 bin_a[
b] += bin_a_c[
b];
1874 for (
int c = 3; c--;) {
1875 join_chunk->
min[c] = std::min(
min[c], join_chunk->
min[c]);
1876 join_chunk->
max[c] = std::max(
max[c], join_chunk->
max[c]);
1886 uint nl, na, nr, ng, nb;
1887 double divl, diva, divr, divg, divb;
1889 std::optional<ColormanageProcessor> cm_processor_positions;
1890 std::optional<ColormanageProcessor> cm_processor_colors;
1896 if (scopes->
ok == 1) {
1939 for (a = 0; a < 3; a++) {
1940 scopes->
minmax[a][0] = 25500.0f;
1941 scopes->
minmax[a][1] = -25500.0f;
1963 "waveform point channel 1");
1965 "waveform point channel 2");
1967 "waveform point channel 3");
1969 "vectorscope point channel");
1971 "vectorscope color channel");
1983 data.scopes = scopes;
1985 data.cm_processor_positions = (cm_processor_positions) ? &cm_processor_positions.value() :
1987 data.cm_processor_colors = (cm_processor_colors) ? &cm_processor_colors.value() :
nullptr;
1992 data.ycc_mode = ycc_mode;
2006 nl = na = nr = nb = ng = 0;
2007 for (a = 0; a < 256; a++) {
2008 nl = std::max(data_chunk.
bin_lum[a], nl);
2009 nr = std::max(data_chunk.
bin_r[a], nr);
2010 ng = std::max(data_chunk.
bin_g[a], ng);
2011 nb = std::max(data_chunk.
bin_b[a], nb);
2012 na = std::max(data_chunk.
bin_a[a], na);
2014 divl = nl ? 1.0 / double(nl) : 1.0;
2015 diva = na ? 1.0 / double(na) : 1.0;
2016 divr = nr ? 1.0 / double(nr) : 1.0;
2017 divg = ng ? 1.0 / double(ng) : 1.0;
2018 divb = nb ? 1.0 / double(nb) : 1.0;
2020 for (a = 0; a < 256; a++) {
2074 const char *view_transform)
2080 if (!view_transform) {
2090 view_settings->
gamma = 1.0f;
2093 view_settings->
tint = 10.0f;
2118 new_settings->
flag = settings->
flag;
2122 new_settings->
tint = settings->
tint;
#define BLI_YCC_JFIF_0_255
#define BLI_YCC_ITU_BT601
#define BLI_YCC_ITU_BT709
#define STRNCPY_UTF8(dst, src)
#define BLO_read_struct(reader, struct_name, ptr_p)
Read Blender memory allocation and freeing.
#define INIT_MINMAX(min, max)
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
static ColormanageProcessor display_processor_new(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, ColorManagedDisplaySpace display_space=DISPLAY_SPACE_DRAW, bool inverse=false, const char *from_colorspace=nullptr)
void apply_v3(float pixel[3]) const
void apply_v4(float pixel[4]) const
static std::optional< ColormanageProcessor > display_processor_for_imbuf(const ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, ColorManagedDisplaySpace display_space=DISPLAY_SPACE_DRAW)
constexpr IndexRange()=default
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
VecBase< float, 2 > float2
internal::ShallowDataConstRef< T > shallow_copy(const T &other)
T reduce_max(const VecBase< T, Size > &a)
T reduce_min(const VecBase< T, Size > &a)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
T min(const T &a, const T &b)
T max(const T &a, const T &b)
MINLINE float min_ff(float a, float b)
CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static void save_sample_line(Scopes *scopes, ColormanageProcessor *cm_processor_colors, const float3x3 &yuv_matrix, const int idx, const float fx, const float position_rgb[3], const float position_ycc[3], const float color_rgb[3])
CurveMapping * BKE_curvemapping_copy(const CurveMapping *cumap)
void BKE_curvemap_remove(CurveMap *cuma, short flag)
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
void BKE_curvemapping_evaluate3F(const CurveMapping *cumap, float vecout[3], const float vecin[3])
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
void BKE_curvemapping_evaluateRGBF(const CurveMapping *cumap, float vecout[3], const float vecin[3])
static float3 evaluate_film_like(const CurveMapping *curve_mapping, float3 input)
const char * IMB_colormanagement_display_get_default_view_transform_name(const ColorManagedDisplay *display)
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
bool BKE_curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
static void calchandle_curvemap(BezTriple *bezt, const BezTriple *prev, const BezTriple *next)
void BKE_color_managed_view_settings_copy_keep_curve_mapping(ColorManagedViewSettings *new_settings, const ColorManagedViewSettings *settings)
void BKE_curvemapping_copy_data(CurveMapping *target, const CurveMapping *cumap)
void BKE_color_managed_view_settings_init(ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, const char *view_transform)
void BKE_color_managed_colorspace_settings_copy(ColorManagedColorspaceSettings *colorspace_settings, const ColorManagedColorspaceSettings *settings)
float BKE_curvemap_evaluateF(const CurveMapping *cumap, const CurveMap *cuma, float value)
void BKE_curvemapping_blend_write(BlendWriter *writer, const CurveMapping *cumap)
void BKE_curvemapping_curves_blend_write(BlendWriter *writer, const CurveMapping *cumap)
@ SCOPES_WAVEFRM_RGB_PARADE
@ SCOPES_WAVEFRM_YCC_JPEG
BLI_INLINE unsigned char IMB_colormanagement_get_luminance_byte(const unsigned char rgb[3])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
void BKE_curvemapping_copy_data_single(CurveMapping *target, const CurveMapping *cumap, int to_idx, int from_idx, bool make_copy)
void BKE_color_managed_display_settings_init(ColorManagedDisplaySettings *settings)
@ CURVE_PRESET_CONSTANT_MEDIAN
MINLINE int max_ii(int a, int b)
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
void BKE_color_managed_view_settings_blend_read_data(BlendDataReader *reader, ColorManagedViewSettings *settings)
void BKE_curvemapping_premultiply(CurveMapping *cumap, bool restore)
void BKE_curvemapping_free(CurveMapping *cumap)
void BKE_color_managed_view_settings_copy(ColorManagedViewSettings *new_settings, const ColorManagedViewSettings *settings)
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void mul_v2_v2(float r[2], const float a[2])
void BKE_curvemap_activate_nearest_point(struct CurveMap *cuma, const int i_last)
static void curvemap_make_table(const CurveMapping *cumap, CurveMap *cuma)
MINLINE void sub_v3_v3(float r[3], const float a[3])
void rgb_to_ycc(float r, float g, float b, float *r_y, float *r_cb, float *r_cr, int colorspace)
void BKE_curvemapping_init(CurveMapping *cumap)
void BKE_curvemapping_evaluate_premulRGB(const CurveMapping *cumap, unsigned char vecout_byte[3], const unsigned char vecin_byte[3])
void BKE_curvemapping_blend_read(BlendDataReader *reader, CurveMapping *cumap)
BLI_INLINE int get_bin_float(float f)
void BKE_curvemapping_free_data_single(CurveMapping *cumap, int index)
static void curve_eval_bezier_point(float start[3][3], float end[3][3], float *point)
void BKE_color_managed_display_settings_copy(ColorManagedDisplaySettings *new_settings, const ColorManagedDisplaySettings *settings)
ocio::ScopeInfo IMB_colormanagement_get_scope_info(const ColorManagedDisplaySettings *display_settings, const ColorManagedViewSettings *view_settings)
BMesh const char void * data
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
void BKE_curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, CurveMapSlopeType slope)
void IMB_colormanagement_validate_settings(const ColorManagedDisplaySettings *display_settings, ColorManagedViewSettings *view_settings)
void BKE_curvemapping_changed(CurveMapping *cumap, bool rem_doubles)
static void scopes_update_reduce(const void *__restrict, void *__restrict chunk_join, void *__restrict chunk)
void BKE_curvemapping_reset_view(CurveMapping *cumap)
void BKE_curvemapping_set_black_white_ex(const float black[3], const float white[3], float r_bwmul[3])
void BKE_curve_correct_bezpart(const float v1[2], float v2[2], float v3[2], const float v4[2])
void BKE_curvemapping_table_RGBA(const CurveMapping *cumap, float **array, int *size)
CurveMapPoint * BKE_curvemap_active_get(CurveMap *cuma)
void BKE_scopes_free(Scopes *scopes)
int BKE_curvemapping_num_channels(const CurveMapping *cumap)
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
static void scopes_update_cb(void *__restrict userdata, const int y, const TaskParallelTLS *__restrict tls)
void BKE_color_managed_colorspace_settings_init(ColorManagedColorspaceSettings *colorspace_settings)
void BKE_curvemapping_compute_slopes(const CurveMapping *curve_mapping, float start_slopes[4], float end_slopes[4])
MatBase< float, 3, 3 > float3x3
void BKE_curvemapping_changed_all(CurveMapping *cumap)
void BKE_curvemapping_set_black_white(CurveMapping *cumap, const float black[3], const float white[3])
void BKE_curvemapping_set_defaults(CurveMapping *cumap, int tot, float minx, float miny, float maxx, float maxy, eBezTriple_Handle default_handle_type)
void BKE_curvemap_translate_selection(CurveMap *cuma, const blender::float2 &offset)
void BLO_read_array_and_validate_size(BlendDataReader *reader, T **ptr_p, SizeT *array_size, const int elems=1)
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
void BKE_curvemapping_evaluate_premulRGBF(const CurveMapping *cumap, float vecout[3], const float vecin[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void BKE_curvemapping_free_data(CurveMapping *cumap)
void BKE_scopes_new(Scopes *scopes)
MINLINE void copy_v3_fl(float r[3], float f)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
MINLINE float max_ff(float a, float b)
const char * IMB_colormanagement_display_get_default_name()
void BKE_scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
bool BKE_color_managed_colorspace_settings_equals(const ColorManagedColorspaceSettings *settings1, const ColorManagedColorspaceSettings *settings2)
CurveMapPoint * BKE_curvemap_insert(CurveMap *cuma, float x, float y)
void BKE_curvemapping_compute_range_dividers(const CurveMapping *curve_mapping, float dividers[4])
bool BKE_curvemapping_is_map_identity(const CurveMapping *curve_mapping, int index)
void BKE_color_managed_view_settings_free(ColorManagedViewSettings *settings)
@ COLORMANAGE_DISPLAY_EMULATION_AUTO
const ColorManagedDisplay * IMB_colormanagement_display_get_named(const char *name)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void BKE_curvemap_handle_set(CurveMap *cuma, int type)
void BKE_color_managed_view_settings_blend_write(BlendWriter *writer, const ColorManagedViewSettings *settings)
MINLINE float len_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
VecBase< float, 3 > float3
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride)
static float curvemap_calc_extend(const CurveMapping *cumap, const CurveMap *cuma, float x, const float first[2], const float last[2])
void BKE_curvemapping_get_range_minimums(const CurveMapping *curve_mapping, float minimums[4])
MINLINE void zero_v2(float r[2])
float BKE_curvemapping_evaluateF(const CurveMapping *cumap, int cur, float value)
void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
bool BKE_curvemapping_RGBA_does_something(const CurveMapping *cumap)
MINLINE int compare_ff(float a, float b, float max_diff)
void BKE_curvemapping_table_F(const CurveMapping *cumap, float **array, int *size)
void BKE_curvemapping_evaluate_premulRGBF_ex(const CurveMapping *cumap, float vecout[3], const float vecin[3], const float black[3], const float bwmul[3])
ocio::Display ColorManagedDisplay
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
MINLINE void madd_v2_v2v2fl(float r[2], const float a[2], const float b[2], float f)
@ CUMA_EXTEND_EXTRAPOLATE
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
void write_struct(const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct_array(const int64_t array_size, const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
eColorManageDisplay_Emulation emulation
struct CurveMapping * curve_mapping
eColorManageView_Flag flag
eCurveMapPoint_Flag default_handle_type
CurveMapPoint * premultable
const uint8_t * byte_data() const
uint8_t * byte_data_for_write()
const float * float_data() const
float * float_data_for_write()
ColormanageProcessor * cm_processor_colors
ColormanageProcessor * cm_processor_positions
eScopes_WaveformMode wavefrm_mode
TaskParallelReduceFunc func_reduce
size_t userdata_chunk_size
blender::float3x3 yuv_matrix
blender::float3 luma_coefficients