|
19 | 19 | #include "bauhaus/bauhaus.h" |
20 | 20 | #include "common/colorspaces_inline_conversions.h" |
21 | 21 | #include "common/custom_primaries.h" |
| 22 | +#include "common/image.h" |
22 | 23 | #include "common/iop_profile.h" |
23 | 24 | #include "common/math.h" |
24 | 25 | #include "common/matrices.h" |
@@ -1358,6 +1359,16 @@ static primaries_params_t _get_primaries_params(const dt_iop_agx_params_t *p) |
1358 | 1359 | return primaries_params; |
1359 | 1360 | } |
1360 | 1361 |
|
| 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 | + |
1361 | 1372 | static void _agx_tone_mapping(dt_aligned_pixel_t rgb_in_out, |
1362 | 1373 | const tone_mapping_params_t *params, |
1363 | 1374 | const dt_colormatrix_t rendering_to_xyz_transposed) |
@@ -1489,15 +1500,8 @@ static void _read_exposure_params_callback(GtkWidget *widget, |
1489 | 1500 | dt_iop_agx_params_t *p = self->params; |
1490 | 1501 | if (g && p) |
1491 | 1502 | { |
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); |
1498 | 1504 | dt_iop_gui_update(self); |
1499 | | - //_update_pivot_exposure_slider_range(self); |
1500 | | - |
1501 | 1505 | dt_dev_add_history_item(darktable.develop, self, TRUE); |
1502 | 1506 | } |
1503 | 1507 | } |
@@ -2151,7 +2155,8 @@ static GtkWidget* _create_basic_curve_controls_box(dt_iop_module_t *self, |
2151 | 2155 | gtk_widget_set_tooltip_text(slider, _("darken or brighten the pivot (linear output power)")); |
2152 | 2156 | dt_bauhaus_widget_set_quad_tooltip(slider, _("the average luminance of the selected region will be\n" |
2153 | 2157 | "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")); |
2155 | 2160 |
|
2156 | 2161 | // curve_contrast_around_pivot |
2157 | 2162 | slider = dt_bauhaus_slider_from_params(section, "curve_contrast_around_pivot"); |
@@ -2953,10 +2958,12 @@ void reload_defaults(dt_iop_module_t *self) |
2953 | 2958 | { |
2954 | 2959 | dt_iop_agx_params_t *const p = self->default_params; |
2955 | 2960 | _set_scene_referred_default_params(p); |
2956 | | - const float exposure = dt_dev_exposure_get_effective_exposure(self->dev); |
2957 | 2961 |
|
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 | + } |
2960 | 2967 | } |
2961 | 2968 | } |
2962 | 2969 |
|
|
0 commit comments