67#define DT_GUI_CURVE_EDITOR_INSET DT_PIXEL_APPLY_DPI(1)
179 return _(
"filmic (legacy)");
194 return _(
"this module is deprecated. better use filmic rgb module instead.");
211 const int new_version)
213 if(old_version == 1 && new_version == 3)
215 typedef struct dt_iop_filmic_params_v1_t
217 float grey_point_source;
218 float black_point_source;
219 float white_point_source;
220 float security_factor;
221 float grey_point_target;
222 float black_point_target;
223 float white_point_target;
225 float latitude_stops;
230 } dt_iop_filmic_params_v1_t;
232 dt_iop_filmic_params_v1_t *o = (dt_iop_filmic_params_v1_t *)old_params;
238 n->grey_point_source = o->grey_point_source;
239 n->white_point_source = o->white_point_source;
240 n->black_point_source = o->black_point_source;
241 n->security_factor = o->security_factor;
242 n->grey_point_target = o->grey_point_target;
243 n->black_point_target = o->black_point_target;
244 n->white_point_target = o->white_point_target;
245 n->output_power = o->output_power;
246 n->latitude_stops = o->latitude_stops;
247 n->contrast = o->contrast;
248 n->saturation = o->saturation;
249 n->balance = o->balance;
250 n->interpolator = o->interpolator;
251 n->preserve_color = 0;
252 n->global_saturation = 100;
256 if (old_version == 2 && new_version == 3)
258 typedef struct dt_iop_filmic_params_v2_t
260 float grey_point_source;
261 float black_point_source;
262 float white_point_source;
263 float security_factor;
264 float grey_point_target;
265 float black_point_target;
266 float white_point_target;
268 float latitude_stops;
274 } dt_iop_filmic_params_v2_t;
276 dt_iop_filmic_params_v2_t *o = (dt_iop_filmic_params_v2_t *)old_params;
282 n->grey_point_source = o->grey_point_source;
283 n->white_point_source = o->white_point_source;
284 n->black_point_source = o->black_point_source;
285 n->security_factor = o->security_factor;
286 n->grey_point_target = o->grey_point_target;
287 n->black_point_target = o->black_point_target;
288 n->white_point_target = o->white_point_target;
289 n->output_power = o->output_power;
290 n->latitude_stops = o->latitude_stops;
291 n->contrast = o->contrast;
292 n->saturation = o->saturation;
293 n->balance = o->balance;
294 n->interpolator = o->interpolator;
295 n->preserve_color = o->preserve_color;
296 n->global_saturation = 100;
305 memset(&
p, 0,
sizeof(
p));
311 p.output_power = 2.2f;
312 p.white_point_target = 100.0f;
313 p.black_point_target = 0.0f;
314 p.grey_point_target = 18.0f;
317 p.security_factor = 0.0f;
319 p.preserve_color = 1;
321 p.saturation = 60.0f;
322 p.global_saturation = 70.0f;
325 p.grey_point_source = 25.4f;
326 p.latitude_stops = 2.25f;
327 p.white_point_source = 1.95f;
328 p.black_point_source = -7.05f;
333 p.grey_point_source = 18.0f;
334 p.latitude_stops = 2.75f;
335 p.white_point_source = 2.45f;
336 p.black_point_source = -7.55f;
341 p.grey_point_source = 12.77f;
342 p.latitude_stops = 3.0f;
343 p.white_point_source = 2.95f;
344 p.black_point_source = -8.05f;
349 p.grey_point_source = 9.0f;
350 p.latitude_stops = 3.5f;
351 p.white_point_source = 3.45f;
352 p.black_point_source = -8.55f;
357 p.grey_point_source = 6.38f;
358 p.latitude_stops = 3.75f;
359 p.white_point_source = 3.95f;
360 p.black_point_source = -9.05f;
365 p.grey_point_source = 4.5f;
366 p.latitude_stops = 4.25f;
367 p.white_point_source = 4.45f;
368 p.black_point_source = -9.55f;
373 p.grey_point_source = 3.19f;
374 p.latitude_stops = 4.50f;
375 p.white_point_source = 4.95f;
376 p.black_point_source = -10.05f;
381 p.grey_point_source = 2.25f;
382 p.latitude_stops = 5.0f;
383 p.white_point_source = 5.45f;
384 p.black_point_source = -10.55f;
389 p.grey_point_source = 1.125f;
390 p.latitude_stops = 6.0f;
391 p.white_point_source = 6.45f;
392 p.black_point_source = -11.55f;
399 return expf(- (
x *
x) / (2.0f * std * std)) / (std * powf(2.0f *
M_PI, 0.5f));
404 const void *
const ivoid,
void *
const ovoid)
418 const float EPS = powf(2.0f, -16);
427 float *in = ((
float *)ivoid) +
k;
436 float concavity, luma;
443 for(
int c = 0; c < 3; c++)
445 rgb[c] = luma + saturation * (
rgb[c] - luma);
456 for (
int c = 0; c < 3; ++c) ratios[c] =
rgb[c] /
max;
461 max = CLAMP(
max, 0.0f, 1.0f);
464 index = CLAMP(
max * 0x10000ul, 0, 0xffff);
466 concavity = data->
grad_2[index];
469 for (
int c = 0; c < 3; ++c)
rgb[c] = ratios[c] *
max;
477 for(
int c = 0; c < 3; c++)
482 rgb[c] = CLAMP(
rgb[c], 0.0f, 1.0f);
485 index[c] = CLAMP(
rgb[c] * 0x10000ul, 0, 0xffff);
490 concavity = data->
grad_2[(int)CLAMP(
XYZ[1] * 0x10000ul, 0, 0xffff)];
493 for(
int c = 0; c < 3; c++)
rgb[c] = data->
table[index[c]];
500 for(
int c = 0; c < 3; c++)
503 rgb[c] = luma + concavity * (
rgb[c] - luma);
511 dt_prophotorgb_to_Lab(
rgb,
out);
528 const int devid = pipe->
devid;
534 cl_mem dev_table = NULL;
535 cl_mem diff_table = NULL;
543 const float dynamic_range =
d->dynamic_range;
544 const float shadows_range =
d->black_source;
545 const float grey =
d->grey_source;
546 const float contrast =
d->contrast;
547 const float power =
d->output_power;
548 const int preserve_color =
d->preserve_color;
549 const float saturation =
d->global_saturation / 100.0f;
566 if(err != CL_SUCCESS)
goto error;
581 if (
p->latitude_stops > (
p->white_point_source -
p->black_point_source) * 0.99f)
585 p->latitude_stops = (
p->white_point_source -
p->black_point_source) * 0.99f;
601 const float grey =
XYZ[1];
602 const float prev_grey =
p->grey_point_source;
603 p->grey_point_source = 100.f * grey;
604 const float grey_var =
Log2(prev_grey /
p->grey_point_source);
605 p->black_point_source =
p->black_point_source - grey_var;
606 p->white_point_source =
p->white_point_source + grey_var;
615 gtk_widget_queue_draw(self->
widget);
624 const float noise = powf(2.0f, -16.0f);
629 const float black =
XYZ[1];
630 float EVmin =
Log2Thres(black / (
p->grey_point_source / 100.0f),
noise);
631 EVmin *= (1.0f +
p->security_factor / 100.0f);
633 p->black_point_source = EVmin;
642 gtk_widget_queue_draw(self->
widget);
652 const float noise = powf(2.0f, -16.0f);
657 const float white =
XYZ[1];
658 float EVmax =
Log2Thres(white / (
p->grey_point_source / 100.0f),
noise);
659 EVmax *= (1.0f +
p->security_factor / 100.0f);
661 p->white_point_source = EVmax;
670 gtk_widget_queue_draw(self->
widget);
680 float previous =
p->security_factor;
682 float ratio = (
p->security_factor - previous) / (previous + 100.0f);
684 float EVmin =
p->black_point_source;
685 EVmin = EVmin + ratio * EVmin;
687 float EVmax =
p->white_point_source;
688 EVmax = EVmax + ratio * EVmax;
690 p->white_point_source = EVmax;
691 p->black_point_source = EVmin;
703 gtk_widget_queue_draw(self->
widget);
711 const float noise = powf(2.0f, -16.0f);
716 const float grey =
XYZ[1];
717 p->grey_point_source = 100.f * grey;
721 const float black =
XYZ[1];
722 float EVmin =
Log2Thres(black / (
p->grey_point_source / 100.0f),
noise);
723 EVmin *= (1.0f +
p->security_factor / 100.0f);
727 const float white =
XYZ[1];
728 float EVmax =
Log2Thres(white / (
p->grey_point_source / 100.0f),
noise);
729 EVmax *= (1.0f +
p->security_factor / 100.0f);
731 p->black_point_source = EVmin;
732 p->white_point_source = EVmax;
743 gtk_widget_queue_draw(self->
widget);
749 if (picker ==
g->grey_point_source)
751 else if(picker ==
g->black_point_source)
753 else if(picker ==
g->white_point_source)
755 else if(picker ==
g->auto_button)
758 fprintf(stderr,
"[filmic] unknown color picker\n");
767 float prev_grey =
p->grey_point_source;
770 float grey_var =
Log2(prev_grey /
p->grey_point_source);
771 p->black_point_source =
p->black_point_source - grey_var;
772 p->white_point_source =
p->white_point_source + grey_var;
782 gtk_widget_queue_draw(self->
widget);
798 gtk_widget_queue_draw(self->
widget);
814 gtk_widget_queue_draw(self->
widget);
825 gtk_widget_queue_draw(self->
widget);
841 gtk_widget_queue_draw(self->
widget);
852 gtk_widget_queue_draw(self->
widget);
883 gtk_widget_queue_draw(self->
widget);
894 gtk_widget_queue_draw(self->
widget);
905 gtk_widget_queue_draw(self->
widget);
916 gtk_widget_queue_draw(self->
widget);
956 gtk_widget_queue_draw(self->
widget);
963 p->preserve_color = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
972 const float white_source =
p->white_point_source;
973 const float black_source =
p->black_point_source;
974 const float dynamic_range = white_source - black_source;
977 const float black_log = 0.0f;
978 const float grey_log = fabsf(
p->black_point_source) / dynamic_range;
979 const float white_log = 1.0f;
982 const float black_display = CLAMP(
p->black_point_target, 0.0f,
p->grey_point_target) / 100.0f;
983 const float grey_display = powf(CLAMP(
p->grey_point_target,
p->black_point_target,
p->white_point_target) / 100.0f, 1.0f / (
p->output_power));
984 const float white_display = CLAMP(
p->white_point_target,
p->grey_point_target, 100.0f) / 100.0f;
986 const float latitude = CLAMP(
p->latitude_stops, 0.01f, dynamic_range * 0.99f);
987 const float balance = CLAMP(
p->balance, -50.0f, 50.0f) / 100.0f;
989 const float contrast =
p->contrast;
993 float toe_log = grey_log - latitude/dynamic_range * fabsf(black_source/dynamic_range);
994 float shoulder_log = grey_log + latitude/dynamic_range * white_source/dynamic_range;
998 float linear_intercept = grey_display - (contrast * grey_log);
1001 float toe_display = (toe_log * contrast + linear_intercept);
1002 float shoulder_display = (shoulder_log * contrast + linear_intercept);
1005 const float norm = powf(powf(contrast, 2.0f) + 1.0f, 0.5f);
1008 const float coeff = -(dynamic_range - latitude) / dynamic_range * balance;
1010 toe_display +=
coeff * contrast /norm;
1011 shoulder_display +=
coeff * contrast /norm;
1012 toe_log +=
coeff /norm;
1013 shoulder_log +=
coeff /norm;
1016 toe_log = CLAMP(toe_log, 0.0f, grey_log);
1017 shoulder_log = CLAMP(shoulder_log, grey_log, 1.0f);
1018 toe_display = CLAMP(toe_display, black_display, grey_display);
1019 shoulder_display = CLAMP(shoulder_display, grey_display, white_display);
1032 int TOE_LOST =
FALSE;
1033 int SHOULDER_LOST =
FALSE;
1035 if ((toe_log == grey_log && toe_display == grey_display) || (toe_log == 0.0f && toe_display == black_display))
1039 if ((shoulder_log == grey_log && shoulder_display == grey_display) || (shoulder_log == 1.0f && shoulder_display == white_display))
1041 SHOULDER_LOST =
TRUE;
1046 if (SHOULDER_LOST && !TOE_LOST)
1049 nodes_data->
nodes = 4;
1050 nodes_data->
x[0] = black_log;
1051 nodes_data->
x[1] = toe_log;
1052 nodes_data->
x[2] = grey_log;
1053 nodes_data->
x[3] = white_log;
1055 nodes_data->
y[0] = black_display;
1056 nodes_data->
y[1] = toe_display;
1057 nodes_data->
y[2] = grey_display;
1058 nodes_data->
y[3] = white_display;
1062 d->latitude_min = toe_log;
1063 d->latitude_max = white_log;
1069 else if (TOE_LOST && !SHOULDER_LOST)
1072 nodes_data->
nodes = 4;
1074 nodes_data->
x[0] = black_log;
1075 nodes_data->
x[1] = grey_log;
1076 nodes_data->
x[2] = shoulder_log;
1077 nodes_data->
x[3] = white_log;
1079 nodes_data->
y[0] = black_display;
1080 nodes_data->
y[1] = grey_display;
1081 nodes_data->
y[2] = shoulder_display;
1082 nodes_data->
y[3] = white_display;
1086 d->latitude_min = black_log;
1087 d->latitude_max = shoulder_log;
1093 else if (TOE_LOST && SHOULDER_LOST)
1096 nodes_data->
nodes = 3;
1098 nodes_data->
x[0] = black_log;
1099 nodes_data->
x[1] = grey_log;
1100 nodes_data->
x[2] = white_log;
1102 nodes_data->
y[0] = black_display;
1103 nodes_data->
y[1] = grey_display;
1104 nodes_data->
y[2] = white_display;
1108 d->latitude_min = black_log;
1109 d->latitude_max = white_log;
1118 nodes_data->
nodes = 4;
1120 nodes_data->
x[0] = black_log;
1121 nodes_data->
x[1] = toe_log;
1123 nodes_data->
x[2] = shoulder_log;
1124 nodes_data->
x[3] = white_log;
1126 nodes_data->
y[0] = black_display;
1127 nodes_data->
y[1] = toe_display;
1129 nodes_data->
y[2] = shoulder_display;
1130 nodes_data->
y[3] = white_display;
1134 d->latitude_min = toe_log;
1135 d->latitude_max = shoulder_log;
1141 if (
p->interpolator != 3)
1173 for(
int k = 0;
k < res;
k++) table[
k] = (table[
k] + table_temp[
k]) / 2.0f;
1184 d->preserve_color =
p->preserve_color;
1187 const float white_source =
p->white_point_source;
1188 const float grey_source =
p->grey_point_source / 100.0f;
1189 const float black_source =
p->black_point_source;
1190 const float dynamic_range = white_source - black_source;
1193 const float grey_log = fabsf(
p->black_point_source) / dynamic_range;
1196 const float grey_display = powf(
p->grey_point_target / 100.0f, 1.0f / (
p->output_power));
1198 float contrast =
p->contrast;
1199 if (contrast < grey_display / grey_log)
1202 contrast = 1.0001f * grey_display / grey_log;
1206 d->dynamic_range = dynamic_range;
1207 d->black_source = black_source;
1208 d->grey_source = grey_source;
1209 d->output_power =
p->output_power;
1210 d->saturation =
p->saturation;
1211 d->global_saturation =
p->global_saturation;
1212 d->contrast = contrast;
1223 const float latitude =
d->latitude_max -
d->latitude_min;
1224 const float center = (
d->latitude_max +
d->latitude_min)/2.0f;
1225 const float saturation =
d->saturation / 100.0f;
1226 const float sigma = saturation * saturation * latitude * latitude;
1228 for(
int k = 0;
k < 65536;
k++)
1230 const float x = ((float)
k) / 65536.0f;
1233 d->grad_2[
k] = expf(-0.5f * (center -
x) * (center -
x) /
sigma);
1237 d->grad_2[
k] = 0.0f;
1278 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
g->preserve_color),
p->preserve_color);
1281 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
g->extra_toggle)));
1283 gtk_widget_queue_draw(self->
widget);
1289 module->params = calloc(1, sizeof(dt_iop_filmic_params_t));
1290 module->default_params = calloc(1, sizeof(dt_iop_filmic_params_t));
1291 module->default_enabled = 0;
1292 module->params_size = sizeof(dt_iop_filmic_params_t);
1293 module->gui_data = NULL;
1297 .grey_point_source = 18,
1298 .black_point_source = -8.65,
1299 .white_point_source = 2.45,
1300 .security_factor = 0.0,
1301 .grey_point_target = 18.0,
1302 .black_point_target = 0.0,
1303 .white_point_target = 100.0,
1304 .output_power = 2.2,
1305 .latitude_stops = 2.0,
1307 .saturation = 100.0,
1308 .global_saturation = 100.0,
1311 .preserve_color = 0,
1317 const int program = 22;
1345 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
g->extra_toggle),
FALSE);
1357 GtkAllocation allocation;
1358 gtk_widget_get_allocation(widget, &allocation);
1359 int width = allocation.width,
height = allocation.height;
1361 cairo_t *cr = cairo_create(cst);
1364 cairo_set_source_rgb(cr, .2, .2, .2);
1367 cairo_translate(cr, inset, inset);
1371 cairo_set_source_rgb(cr, .3, .3, .3);
1377 cairo_set_source_rgb(cr, .1, .1, .1);
1381 const float DR = (
p->white_point_source -
p->black_point_source);
1382 const float grey = -
p->black_point_source / DR;
1383 int rescale =
FALSE;
1387 b =
Log2( 1.0f / (-1 + powf(2.0f, a)));
1388 d = - powf(2.0f, b);
1390 if (grey > powf(
p->grey_point_target / 100.0f,
p->output_power))
1396 for (
int i = 0;
i < 50; ++
i)
1398 a =
Log2((0.5f -
d) / (1.0f -
d)) / (grey - 1.0f);
1399 b =
Log2( 1.0f / (-1 + powf(2.0f, a)));
1400 d = - powf(2.0f, b);
1404 const float gamma = (logf(
p->grey_point_target / 100.0f) / logf(0.5f)) /
p->output_power;
1408 cairo_set_source_rgb(cr, 0.9, 0.9, 0.9);
1410 for(
int k = 0;
k < nodes_data->
nodes;
k++)
1416 const float x = (rescale) ? powf(2.0f, (
double)a * nodes_data->
x[
k] + b) +
d : nodes_data->
x[
k];
1417 const float y = powf(nodes_data->
y[
k], 1.0f / gamma);
1420 cairo_stroke_preserve(cr);
1428 cairo_set_source_rgb(cr, .9, .9, .9);
1429 cairo_move_to(cr, 0,
height * (1.0 - c->table[0]));
1431 for(
int k = 1;
k < 256;
k++)
1437 const float x = (rescale) ? powf(2.0f, (
double)a *
k / 255.0f + b) +
d :
k / 255.0f;
1438 const float y = powf(c->table[
k], 1.0f / gamma);
1439 cairo_line_to(cr,
x *
width, (
double)
height * (1.0 - y));
1443 cairo_set_source_surface(crf, cst, 0, 0);
1445 cairo_surface_destroy(cst);
1453 const gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
g->extra_toggle));
1467 g->area = GTK_DRAWING_AREA(gtk_drawing_area_new());
1468 gtk_widget_set_hexpand(GTK_WIDGET(
g->area),
TRUE);
1469 gtk_widget_set_tooltip_text(GTK_WIDGET(
g->area), _(
"read-only graph, use the parameters below to set the nodes"));
1470 gtk_box_pack_start(GTK_BOX(self->
widget),
1472 "plugins/darkroom/filmic/graphheight", 200, 100),
1482 gtk_box_pack_start(GTK_BOX(self->
widget),
g->grey_point_source,
TRUE,
TRUE, 0);
1484 gtk_widget_set_tooltip_text(
g->grey_point_source, _(
"adjust to match the average luminance of the subject.\n"
1485 "except in back-lighting situations, this should be around 18%."));
1493 gtk_box_pack_start(GTK_BOX(self->
widget),
g->white_point_source,
TRUE,
TRUE, 0);
1495 gtk_widget_set_tooltip_text(
g->white_point_source, _(
"number of stops between middle gray and pure white.\n"
1496 "this is a reading a lightmeter would give you on the scene.\n"
1497 "adjust so highlights clipping is avoided"));
1505 gtk_box_pack_start(GTK_BOX(self->
widget),
g->black_point_source,
TRUE,
TRUE, 0);
1507 gtk_widget_set_tooltip_text(
g->black_point_source, _(
"number of stops between middle gray and pure black.\n"
1508 "this is a reading a lightmeter would give you on the scene.\n"
1509 "increase to get more contrast.\ndecrease to recover more details in low-lights."));
1516 gtk_box_pack_start(GTK_BOX(self->
widget),
g->security_factor,
TRUE,
TRUE, 0);
1518 gtk_widget_set_tooltip_text(
g->security_factor, _(
"enlarge or shrink the computed dynamic range.\n"
1519 "useful in conjunction with \"auto tune levels\"."));
1526 gtk_widget_set_tooltip_text(
g->auto_button, _(
"try to optimize the settings with some guessing.\n"
1527 "this will fit the luminance range inside the histogram bounds.\n"
1528 "works better for landscapes and evenly-lit pictures\nbut fails for high-keys and low-keys." ));
1529 gtk_box_pack_start(GTK_BOX(self->
widget),
g->auto_button,
TRUE,
TRUE, 0);
1537 gtk_box_pack_start(GTK_BOX(self->
widget),
g->contrast,
TRUE,
TRUE, 0);
1538 gtk_widget_set_tooltip_text(
g->contrast, _(
"slope of the linear part of the curve\n"
1539 "affects mostly the mid-tones"));
1540 g_signal_connect(G_OBJECT(
g->contrast),
"value-changed", G_CALLBACK(
contrast_callback), self);
1547 gtk_box_pack_start(GTK_BOX(self->
widget),
g->latitude_stops,
TRUE,
TRUE, 0);
1548 gtk_widget_set_tooltip_text(
g->latitude_stops, _(
"width of the linear domain in the middle of the curve.\n"
1549 "increase to get more contrast at the extreme luminances.\n"
1550 "this has no effect on mid-tones."));
1558 gtk_widget_set_tooltip_text(
g->balance, _(
"slides the latitude along the slope\nto give more room to shadows or highlights.\n"
1559 "use it if you need to protect the details\nat one extremity of the histogram."));
1560 g_signal_connect(G_OBJECT(
g->balance),
"value-changed", G_CALLBACK(
balance_callback), self);
1567 gtk_box_pack_start(GTK_BOX(self->
widget),
g->global_saturation,
TRUE,
TRUE, 0);
1568 gtk_widget_set_tooltip_text(
g->global_saturation, _(
"desaturates the input of the module globally.\n"
1569 "you need to set this value below 100%\nif the chrominance preservation is enabled."));
1577 gtk_box_pack_start(GTK_BOX(self->
widget),
g->saturation,
TRUE,
TRUE, 0);
1578 gtk_widget_set_tooltip_text(
g->saturation, _(
"desaturates the output of the module\nspecifically at extreme luminances.\n"
1579 "decrease if shadows and/or highlights are over-saturated."));
1580 g_signal_connect(G_OBJECT(
g->saturation),
"value-changed", G_CALLBACK(
saturation_callback), self);
1593 gtk_box_pack_start(GTK_BOX(self->
widget),
g->interpolator ,
TRUE,
TRUE, 0);
1594 gtk_widget_set_tooltip_text(
g->interpolator, _(
"change this method if you see reversed contrast or faded blacks"));
1598 g->preserve_color = gtk_check_button_new_with_label(_(
"preserve the chrominance"));
1599 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(
g->preserve_color),
p->preserve_color);
1600 gtk_widget_set_tooltip_text(
g->preserve_color, _(
"ensure the original color are preserved.\n"
1601 "may reinforce chromatic aberrations.\n"
1602 "you need to manually tune the saturation when using this mode."));
1603 gtk_box_pack_start(GTK_BOX(self->
widget),
g->preserve_color ,
TRUE,
TRUE, 0);
1613 gtk_box_pack_start(GTK_BOX(destdisp_head), destdisp,
TRUE,
TRUE, 0);
1614 gtk_box_pack_start(GTK_BOX(destdisp_head),
g->extra_toggle,
FALSE,
FALSE, 0);
1615 gtk_widget_set_visible(extra_options,
FALSE);
1626 gtk_box_pack_start(GTK_BOX(extra_options),
g->black_point_target,
FALSE,
FALSE, 0);
1628 gtk_widget_set_tooltip_text(
g->black_point_target, _(
"luminance of output pure black, "
1629 "this should be 0%\nexcept if you want a faded look"));
1635 gtk_box_pack_start(GTK_BOX(extra_options),
g->grey_point_target,
FALSE,
FALSE, 0);
1637 gtk_widget_set_tooltip_text(
g->grey_point_target, _(
"middle gray value of the target display or color space.\n"
1638 "you should never touch that unless you know what you are doing."));
1644 gtk_box_pack_start(GTK_BOX(extra_options),
g->white_point_target,
FALSE,
FALSE, 0);
1646 gtk_widget_set_tooltip_text(
g->white_point_target, _(
"luminance of output pure white, "
1647 "this should be 100%\nexcept if you want a faded look"));
1653 gtk_box_pack_start(GTK_BOX(extra_options),
g->output_power,
FALSE,
FALSE, 0);
1654 gtk_widget_set_tooltip_text(
g->output_power, _(
"power or gamma of the transfer function\nof the display or color space.\n"
1655 "you should never touch that unless you know what you are doing."));
static void error(char *msg)
void dt_bauhaus_slider_set_soft_range(GtkWidget *widget, float soft_min, float soft_max)
float dt_bauhaus_slider_get(GtkWidget *widget)
int dt_bauhaus_combobox_get(GtkWidget *widget)
void dt_bauhaus_slider_set(GtkWidget *widget, float pos)
void dt_bauhaus_combobox_set(GtkWidget *widget, const int pos)
void dt_bauhaus_widget_set_label(GtkWidget *widget, const char *label)
GtkWidget * dt_bauhaus_slider_new_with_range(dt_bauhaus_t *bh, dt_gui_module_t *self, float min, float max, float step, float defval, int digits)
GtkWidget * dt_bauhaus_combobox_new(dt_bauhaus_t *bh, dt_gui_module_t *self)
void dt_bauhaus_slider_set_format(GtkWidget *widget, const char *format)
void dt_bauhaus_combobox_add(GtkWidget *widget, const char *text)
@ DEVELOP_BLEND_CS_RGB_DISPLAY
static const dt_aligned_pixel_simd_t const dt_adaptation_t const float p
void dt_iop_color_picker_reset(dt_iop_module_t *module, gboolean keep)
GtkWidget * dt_color_picker_new(dt_iop_module_t *module, dt_iop_color_picker_kind_t kind, GtkWidget *w)
dt_prophotorgb_to_XYZ(rgb, XYZ)
static dt_aligned_pixel_t rgb
dt_XYZ_to_prophotorgb(XYZ, rgb)
static dt_aligned_pixel_t XYZ
const dt_colormatrix_t dt_aligned_pixel_t out
void dt_print(dt_debug_thread_t thread, const char *msg,...)
#define dt_free_align(ptr)
static void * dt_calloc_align(size_t size)
#define DT_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)
#define __DT_CLONE_TARGETS__
#define __OMP_PARALLEL_FOR_SIMD__(...)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#define dt_dev_add_history_item(dev, module, enable, redraw)
@ DT_DEV_PIXELPIPE_DISPLAY_MASK
static void dt_draw_curve_calc_values(dt_draw_curve_t *c, const float min, const float max, const int res, float *x, float *y)
static void dt_draw_grid(cairo_t *cr, const int num, const int left, const int top, const int right, const int bottom)
static void dt_draw_curve_destroy(dt_draw_curve_t *c)
static int dt_draw_curve_add_point(dt_draw_curve_t *c, const float x, const float y)
static dt_draw_curve_t * dt_draw_curve_new(const float min, const float max, unsigned int type)
void dtgtk_cairo_paint_solid_arrow(cairo_t *cr, gint x, int y, gint w, gint h, gint flags, void *data)
void dtgtk_expander_set_expanded(GtkDarktableExpander *expander, gboolean expanded)
GtkWidget * dtgtk_expander_new(GtkWidget *header, GtkWidget *body)
#define DTGTK_EXPANDER(obj)
static void preserve_color_callback(GtkWidget *widget, dt_iop_module_t *self)
void init(dt_iop_module_t *module)
static void white_point_target_callback(GtkWidget *slider, gpointer user_data)
void gui_reset(dt_iop_module_t *self)
static void sanitize_latitude(dt_iop_filmic_params_t *p, dt_iop_filmic_gui_data_t *g)
static void contrast_callback(GtkWidget *slider, gpointer user_data)
static void interpolator_callback(GtkWidget *widget, dt_iop_module_t *self)
static gboolean dt_iop_tonecurve_draw(GtkWidget *widget, cairo_t *crf, gpointer user_data)
static void output_power_callback(GtkWidget *slider, gpointer user_data)
static void latitude_stops_callback(GtkWidget *slider, gpointer user_data)
void gui_update(dt_iop_module_t *self)
Refresh GUI controls from current params and configuration.
__DT_CLONE_TARGETS__ int process(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid)
#define DT_GUI_CURVE_EDITOR_INSET
static void security_threshold_callback(GtkWidget *slider, gpointer user_data)
static void apply_autotune(dt_iop_module_t *self)
void cleanup(dt_iop_module_t *module)
static void balance_callback(GtkWidget *slider, gpointer user_data)
void gui_init(dt_iop_module_t *self)
static void grey_point_target_callback(GtkWidget *slider, gpointer user_data)
static void grey_point_source_callback(GtkWidget *slider, gpointer user_data)
void commit_params(dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
static float gaussian(float x, float std)
void cleanup_global(dt_iop_module_so_t *module)
static void _extra_options_button_changed(GtkDarktableToggleButton *widget, gpointer user_data)
void cleanup_pipe(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
int default_colorspace(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
void input_format(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc)
static void apply_auto_white_point_source(dt_iop_module_t *self)
static void global_saturation_callback(GtkWidget *slider, gpointer user_data)
void init_presets(dt_iop_module_so_t *self)
static void saturation_callback(GtkWidget *slider, gpointer user_data)
static void black_point_target_callback(GtkWidget *slider, gpointer user_data)
void init_pipe(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
static void white_point_source_callback(GtkWidget *slider, gpointer user_data)
static void black_point_source_callback(GtkWidget *slider, gpointer user_data)
void compute_curve_lut(dt_iop_filmic_params_t *p, float *table, float *table_temp, int res, dt_iop_filmic_data_t *d, dt_iop_filmic_nodes_t *nodes_data)
static void apply_auto_black(dt_iop_module_t *self)
void init_global(dt_iop_module_so_t *module)
const char * deprecated_msg()
int process_cl(struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out)
static void apply_auto_grey(dt_iop_module_t *self)
void color_picker_apply(dt_iop_module_t *self, GtkWidget *picker, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
int legacy_params(dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version)
GtkWidget * dt_ui_resizable_drawing_area(GtkWidget *area, char *config_str, int default_height, int min_height)
Make a self-drawing widget (typically a GtkDrawingArea graph or scope) vertically resizable.
static cairo_surface_t * dt_cairo_image_surface_create(cairo_format_t format, int width, int height)
static GtkWidget * dt_ui_section_label_new(const gchar *str)
#define DT_GUI_BOX_SPACING
#define DT_PIXEL_APPLY_DPI(value)
void dt_gui_presets_add_generic(const char *name, dt_dev_operation_t op, const int32_t version, const void *params, const int32_t params_size, const int32_t enabled, const dt_develop_blend_colorspace_t blend_cst)
@ IOP_FLAGS_INCLUDE_IN_STYLES
@ IOP_FLAGS_SUPPORTS_BLENDING
#define IOP_GUI_ALLOC(module)
const float *const const float coeff[3]
float *const restrict const size_t k
float *const restrict const size_t const size_t ch
static float fastlog2(float x)
static float Log2(float x)
static float Log2Thres(float x, float Thres)
float dt_aligned_pixel_t[4]
int dt_opencl_enqueue_kernel_2d(const int dev, const int kernel, const size_t *sizes)
int dt_opencl_create_kernel(const int prog, const char *name)
void dt_opencl_free_kernel(const int kernel)
int dt_opencl_set_kernel_arg(const int dev, const int kernel, const int num, const size_t size, const void *arg)
void * dt_opencl_copy_host_to_device(const int devid, void *host, const int width, const int height, const int bpp)
void dt_opencl_release_mem_object(cl_mem mem)
struct _GtkWidget GtkWidget
struct dt_gui_gtk_t * gui
struct dt_bauhaus_t * bauhaus
struct dt_develop_t * develop
struct dt_iop_module_t *void * data
dt_iop_buffer_type_t datatype
float table_temp[0x10000]
GtkWidget * extra_expander
GtkWidget * preserve_color
GtkWidget * black_point_target
GtkWidget * global_saturation
GtkWidget * black_point_source
GtkWidget * white_point_target
GtkWidget * grey_point_source
GtkWidget * white_point_source
GtkWidget * grey_point_target
GtkWidget * security_factor
GtkWidget * latitude_stops
GModule *dt_dev_operation_t op
dt_iop_global_data_t * data
dt_iop_params_t * default_params
dt_iop_gui_data_t * gui_data
dt_iop_global_data_t * global_data
dt_aligned_pixel_t picked_color_min
dt_aligned_pixel_t picked_color_max
dt_aligned_pixel_t picked_color
Region of interest passed through the pixelpipe.