53#define __STDC_FORMAT_MACROS
100 return _(
"tone mapping");
116 return _(
"this module is deprecated. please use the local contrast or tone equalizer module instead.");
141 const float inv_sigma_r = 1.0 / 0.4;
149 inv_sigma_s = (data->
Fsize / 100.0) * fminf(iw, ih);
150 if(inv_sigma_s < 3.0) inv_sigma_s = 3.0;
151 inv_sigma_s = 1.0 / inv_sigma_s;
158#pragma omp parallel for shared(lattice)
160 for(
int j = 0; j <
height; j++)
162 size_t index = (size_t)j *
width;
164 const float *in = (
const float *)ivoid + (
size_t)j *
width *
ch;
165 for(
int i = 0;
i <
width;
i++, index++, in +=
ch)
167 float L = 0.2126 * in[0] + 0.7152 * in[1] + 0.0722 * in[2];
168 if(
L <= 0.0)
L = 1e-6;
170 float pos[3] = {
i * inv_sigma_s, j * inv_sigma_s,
L * inv_sigma_r };
171 float val[2] = {
L, 1.0 };
172 lattice.
splat(pos, val, index, thread);
201 const float contr = 1. / data->
contrast;
203#pragma omp parallel for
205 for(
int j = 0; j <
height; j++)
207 size_t index = (size_t)j *
width;
208 const float *in = (
const float *)ivoid + (
size_t)j *
width *
ch;
213 lattice.
slice(val, index);
214 float L = 0.2126 * in[0] + 0.7152 * in[1] + 0.0722 * in[2];
215 if(
L <= 0.0)
L = 1e-6;
217 const float B = val[0] / val[1];
218 const float detail =
L -
B;
219 const float Ln = expf(
B * (contr - 1.0f) + detail - 1.0f);
238 d->contrast =
p->contrast;
241 const float contr = 1.0f /
d->contrast;
245 if(
L <= 0.0f)
L = 1e-6f;
248 const float Ln = expf(
L * (contr - 1.0f) - 1.0f);
void dt_bauhaus_slider_set_format(GtkWidget *widget, const char *format)
static const dt_aligned_pixel_simd_t const dt_adaptation_t const float p
void slice(float *col, size_t replay_index) const
void merge_splat_threads()
void splat(float *position, float *value, size_t replay_index, int thread_index=0) const
const dt_colormatrix_t dt_aligned_pixel_t out
#define dt_free_align(ptr)
static void * dt_calloc_align(size_t size)
#define omp_get_max_threads()
#define DT_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)
#define omp_get_thread_num()
#define __DT_CLONE_TARGETS__
@ IOP_FLAGS_SUPPORTS_BLENDING
#define IOP_GUI_ALLOC(module)
GtkWidget * dt_bauhaus_slider_from_params(dt_iop_module_t *self, const char *param)
float *const restrict const size_t k
float *const restrict const size_t const size_t ch
struct _GtkWidget GtkWidget
dt_iop_buffer_dsc_t dsc_out
dt_iop_buffer_dsc_t dsc_in
struct dt_iop_module_t *void * data
dt_aligned_pixel_t processed_maximum
Region of interest passed through the pixelpipe.
void commit_params(struct dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
__DT_CLONE_TARGETS__ int process(struct 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)
void init_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
void output_format(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc)
void gui_init(struct dt_iop_module_t *self)
int default_colorspace(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
void cleanup_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
const char * deprecated_msg()