90 return _(
"contrast brightness saturation");
97 _(
"non-linear, Lab, display-referred"),
99 _(
"non-linear, Lab, display-referred"));
133 float *in = (
float *)ivoid;
142 float L = (in[
k *
ch + 0] < 100.0f)
143 ? data->
ctable[CLAMP((
int)(in[
k *
ch + 0] / 100.0f * 0x10000ul), 0, 0xffff)]
145 out[
k *
ch + 0] = (
L < 100.0f) ? data->
ltable[CLAMP((
int)(
L / 100.0f * 0x10000ul), 0, 0xffff)]
161 d->contrast =
p->contrast + 1.0f;
162 d->brightness =
p->brightness * 2.0f;
163 d->saturation =
p->saturation + 1.0f;
166 if(
d->contrast <= 1.0f)
170 for(
int k = 0;
k < 0x10000;
k++)
d->ctable[
k] =
d->contrast * (100.0f *
k / 0x10000 - 50.0f) + 50.0f;
175 const float boost = 20.0f;
176 const float contrastm1sq = boost * (
d->contrast - 1.0f) * (
d->contrast - 1.0f);
177 const float contrastscale = sqrtf(1.0f + contrastm1sq);
179 for(
int k = 0;
k < 0x10000;
k++)
181 float kx2m1 = 2.0f * (float)
k / 0x10000 - 1.0f;
182 d->ctable[
k] = 50.0f * (contrastscale * kx2m1 / sqrtf(1.0f + contrastm1sq * kx2m1 * kx2m1) + 1.0f);
187 const float xc[4] = { 0.7f, 0.8f, 0.9f, 1.0f };
188 const float yc[4] = {
d->ctable[CLAMP((
int)(xc[0] * 0x10000ul), 0, 0xffff)],
189 d->ctable[CLAMP((
int)(xc[1] * 0x10000ul), 0, 0xffff)],
190 d->ctable[CLAMP((
int)(xc[2] * 0x10000ul), 0, 0xffff)],
191 d->ctable[CLAMP((
int)(xc[3] * 0x10000ul), 0, 0xffff)] };
196 const float gamma = (
d->brightness >= 0.0f) ? 1.0f / (1.0f +
d->brightness) : (1.0f -
d->brightness);
198 for(
int k = 0;
k < 0x10000;
k++)
200 d->ltable[
k] = 100.0f * powf((
float)
k / 0x10000, gamma);
204 const float xl[4] = { 0.7f, 0.8f, 0.9f, 1.0f };
205 const float yl[4] = {
d->ltable[CLAMP((
int)(xl[0] * 0x10000ul), 0, 0xffff)],
206 d->ltable[CLAMP((
int)(xl[1] * 0x10000ul), 0, 0xffff)],
207 d->ltable[CLAMP((
int)(xl[2] * 0x10000ul), 0, 0xffff)],
208 d->ltable[CLAMP((
int)(xl[3] * 0x10000ul), 0, 0xffff)] };
215 piece->
data = (
void *)
d;
217 for(
int k = 0;
k < 0x10000;
k++)
d->ctable[
k] =
d->ltable[
k] = 100.0f *
k / 0x10000;
234 gtk_widget_set_tooltip_text(
g->contrast, _(
"contrast adjustment"));
235 gtk_widget_set_tooltip_text(
g->brightness, _(
"brightness adjustment"));
236 gtk_widget_set_tooltip_text(
g->saturation, _(
"color saturation adjustment"));
static const dt_aligned_pixel_simd_t const dt_adaptation_t const float p
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)
const char ** description(struct dt_iop_module_t *self)
__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 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 input_format(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc)
void cleanup_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
const dt_colormatrix_t dt_aligned_pixel_t out
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
#define dt_free_align(ptr)
static void * dt_calloc_align(size_t size)
#define DT_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)
#define __DT_CLONE_TARGETS__
#define __OMP_PARALLEL_FOR__(...)
const char ** dt_iop_set_description(dt_iop_module_t *module, const char *main_text, const char *purpose, const char *input, const char *process, const char *output)
@ IOP_FLAGS_INCLUDE_IN_STYLES
@ IOP_FLAGS_SUPPORTS_BLENDING
#define IOP_GUI_ALLOC(module)
GtkWidget * dt_bauhaus_slider_from_params(dt_iop_module_t *self, const char *param)
static void dt_iop_estimate_exp(const float *const x, const float *const y, const int num, float *coeff)
static float dt_iop_eval_exp(const float *const coeff, const float x)
float *const restrict const size_t k
float *const restrict const size_t const size_t ch
struct _GtkWidget GtkWidget
struct dt_iop_module_t *void * data
dt_iop_buffer_type_t datatype
float lunbounded_coeffs[3]
float cunbounded_coeffs[3]
Region of interest passed through the pixelpipe.