Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/iop/profile_gamma.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2010-2024 darktable developers.
Copyright (C) 2010-2026 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -330,7 +330,7 @@ static void apply_auto_grey(dt_iop_module_t *self)
dt_iop_profilegamma_params_t *p = self->params;
dt_iop_profilegamma_gui_data_t *g = self->gui_data;

float grey = max3f(self->picked_color);
const float grey = max3f(self->picked_color);
p->grey_point = 100.f * grey;

++darktable.gui->reset;
Expand All @@ -346,10 +346,10 @@ static void apply_auto_black(dt_iop_module_t *self)
dt_iop_profilegamma_params_t *p = self->params;
dt_iop_profilegamma_gui_data_t *g = self->gui_data;

float noise = powf(2.0f, -16.0f);
const float noise = powf(2.0f, -16.0f);

// Black
float black = max3f(self->picked_color_min);
const float black = max3f(self->picked_color_min);
float EVmin = Log2Thres(black / (p->grey_point / 100.0f), noise);
EVmin *= (1.0f + p->security_factor / 100.0f);

Expand All @@ -368,13 +368,13 @@ static void apply_auto_dynamic_range(dt_iop_module_t *self)
dt_iop_profilegamma_params_t *p = self->params;
dt_iop_profilegamma_gui_data_t *g = self->gui_data;

float noise = powf(2.0f, -16.0f);
const float noise = powf(2.0f, -16.0f);

// Black
float EVmin = p->shadows_range;

// White
float white = max3f(self->picked_color_max);
const float white = max3f(self->picked_color_max);
float EVmax = Log2Thres(white / (p->grey_point / 100.0f), noise);
EVmax *= (1.0f + p->security_factor / 100.0f);

Expand All @@ -392,19 +392,19 @@ static void apply_autotune(dt_iop_module_t *self)
dt_iop_profilegamma_params_t *p = self->params;
dt_iop_profilegamma_gui_data_t *g = self->gui_data;

float noise = powf(2.0f, -16.0f);
const float noise = powf(2.0f, -16.0f);

// Grey
float grey = max3f(self->picked_color);
const float grey = max3f(self->picked_color);
p->grey_point = 100.f * grey;

// Black
float black = max3f(self->picked_color_min);
const float black = max3f(self->picked_color_min);
float EVmin = Log2Thres(black / (p->grey_point / 100.0f), noise);
EVmin *= (1.0f + p->security_factor / 100.0f);

// White
float white = max3f(self->picked_color_max);
const float white = max3f(self->picked_color_max);
float EVmax = Log2Thres(white / (p->grey_point / 100.0f), noise);
EVmax *= (1.0f + p->security_factor / 100.0f);

Expand Down Expand Up @@ -439,8 +439,8 @@ void gui_changed(dt_iop_module_t *self, GtkWidget *w, void *previous)
}
else if(w == g->security_factor)
{
float prev = *(float *)previous;
float ratio = (p->security_factor - prev) / (prev + 100.0f);
const float prev = *(float *)previous;
const float ratio = (p->security_factor - prev) / (prev + 100.0f);

float EVmin = p->shadows_range;
EVmin = EVmin + ratio * EVmin;
Expand Down
Loading