Skip to content

Commit 052f56c

Browse files
committed
denoiseprofile: hide highlight preservation toggle if not applicable
Like in the exposure module, there's no point in showing this control if the image was not shot in a (supported) highlight preservation mode.
1 parent 9bc115f commit 052f56c

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

src/iop/denoiseprofile.c

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2822,6 +2822,20 @@ void init(dt_iop_module_t *self)
28222822
}
28232823
}
28242824

2825+
static int _get_iso_highlight_preservation_shift(dt_image_t *img)
2826+
{
2827+
const float hilight_pres = img->exif_highlight_preservation;
2828+
// Only compensate whole EV steps, as non-whole steps are (based on
2829+
// experience and discussion in #19624) handled by different means in the
2830+
// camera.
2831+
const int shift = floorf(hilight_pres);
2832+
if(shift <= 0)
2833+
{
2834+
return 0;
2835+
}
2836+
return shift;
2837+
}
2838+
28252839
/** this will be called to init new defaults if a new image is loaded
28262840
* from film strip mode. */
28272841
void reload_defaults(dt_iop_module_t *self)
@@ -2983,19 +2997,8 @@ static dt_noiseprofile_t dt_iop_denoiseprofile_get_auto_profile(dt_iop_module_t
29832997
int shift = 0;
29842998
if(compensate_hilite_pres)
29852999
{
2986-
const float hilight_pres = self->dev->image_storage.exif_highlight_preservation;
2987-
// Only compensate whole EV steps, as non-whole steps are (based on
2988-
// experience and discussion in #19624) handled by different means in the
2989-
// camera.
2990-
shift = floorf(hilight_pres);
2991-
if(shift >= 0)
2992-
{
2993-
iso >>= shift;
2994-
}
2995-
else
2996-
{
2997-
shift = 0;
2998-
}
3000+
shift = _get_iso_highlight_preservation_shift(&self->dev->image_storage);
3001+
iso >>= shift;
29993002
}
30003003
dt_noiseprofile_t *last = NULL;
30013004
for(GList *iter = profiles; iter; iter = g_list_next(iter))
@@ -3289,6 +3292,10 @@ void gui_update(dt_iop_module_t *self)
32893292
!p->fix_anscombe_and_nlmeans_norm);
32903293
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->use_new_vst), p->use_new_vst);
32913294
gtk_widget_set_visible(g->use_new_vst, !p->use_new_vst);
3295+
3296+
const int iso_shift = _get_iso_highlight_preservation_shift(&self->dev->image_storage);
3297+
gtk_widget_set_visible(g->compensate_hilite_pres, iso_shift > 0);
3298+
32923299
if((p->wavelet_color_mode == MODE_Y0U0V0) && (g->channel < DT_DENOISE_PROFILE_Y0))
32933300
{
32943301
g->channel = DT_DENOISE_PROFILE_Y0;

0 commit comments

Comments
 (0)