Skip to content

Commit f040bd2

Browse files
committed
agx: Don't adjust exposure limits for HDR input in reload_defaults
1 parent 1f0cb99 commit f040bd2

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

src/iop/agx.c

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "bauhaus/bauhaus.h"
2020
#include "common/colorspaces_inline_conversions.h"
2121
#include "common/custom_primaries.h"
22+
#include "common/image.h"
2223
#include "common/iop_profile.h"
2324
#include "common/math.h"
2425
#include "common/matrices.h"
@@ -1358,6 +1359,16 @@ static primaries_params_t _get_primaries_params(const dt_iop_agx_params_t *p)
13581359
return primaries_params;
13591360
}
13601361

1362+
static void _adjust_relative_exposure_from_exposure_params(dt_iop_module_t *self, dt_iop_agx_params_t *p)
1363+
{
1364+
if (!self || !p) return;
1365+
1366+
const float exposure = dt_dev_exposure_get_effective_exposure(self->dev);
1367+
1368+
p->range_black_relative_ev = -8.f + 0.5f * exposure;
1369+
p->range_white_relative_ev = 4.f + 0.8 * exposure;
1370+
}
1371+
13611372
static void _agx_tone_mapping(dt_aligned_pixel_t rgb_in_out,
13621373
const tone_mapping_params_t *params,
13631374
const dt_colormatrix_t rendering_to_xyz_transposed)
@@ -1489,15 +1500,8 @@ static void _read_exposure_params_callback(GtkWidget *widget,
14891500
dt_iop_agx_params_t *p = self->params;
14901501
if (g && p)
14911502
{
1492-
// exposure calculated by the exposure module, including all compensations (EXIF bias, highlight preservation, etc.).
1493-
const float exposure = dt_dev_exposure_get_effective_exposure(self->dev);
1494-
1495-
p->range_black_relative_ev = -8.f + 0.5f * exposure;
1496-
p->range_white_relative_ev = 4.f + 0.8 * exposure;
1497-
1503+
_adjust_relative_exposure_from_exposure_params(self, p);
14981504
dt_iop_gui_update(self);
1499-
//_update_pivot_exposure_slider_range(self);
1500-
15011505
dt_dev_add_history_item(darktable.develop, self, TRUE);
15021506
}
15031507
}
@@ -2151,7 +2155,8 @@ static GtkWidget* _create_basic_curve_controls_box(dt_iop_module_t *self,
21512155
gtk_widget_set_tooltip_text(slider, _("darken or brighten the pivot (linear output power)"));
21522156
dt_bauhaus_widget_set_quad_tooltip(slider, _("the average luminance of the selected region will be\n"
21532157
"used to set the pivot relative to mid-gray,\n"
2154-
"and the output will be adjusted based on the default mid-gray to mid-gray mapping"));
2158+
"and the output will be adjusted based on the default\n"
2159+
"mid-gray to mid-gray mapping"));
21552160

21562161
// curve_contrast_around_pivot
21572162
slider = dt_bauhaus_slider_from_params(section, "curve_contrast_around_pivot");
@@ -2953,10 +2958,12 @@ void reload_defaults(dt_iop_module_t *self)
29532958
{
29542959
dt_iop_agx_params_t *const p = self->default_params;
29552960
_set_scene_referred_default_params(p);
2956-
const float exposure = dt_dev_exposure_get_effective_exposure(self->dev);
29572961

2958-
p->range_black_relative_ev = -8.f + 0.5f * exposure;
2959-
p->range_white_relative_ev = 4.f + 0.8 * exposure;
2962+
// HDR is unbounded, no point in setting sensor-based relative exposure bounds
2963+
if (!dt_image_is_hdr(&self->dev->image_storage))
2964+
{
2965+
_adjust_relative_exposure_from_exposure_params(self, p);
2966+
}
29602967
}
29612968
}
29622969

0 commit comments

Comments
 (0)