69 return C_(
"modulename",
"scale pixels");
96 _(
"internal module to setup technical specificities of raw sensor.\n\n"
97 "you should not touch values here !"),
98 NULL, NULL, NULL, NULL);
105 if(
d->pixel_aspect_ratio < 1.0f)
107 p[1] /=
d->pixel_aspect_ratio;
111 p[0] *=
d->pixel_aspect_ratio;
125 self->modify_roi_in(self, pipe, &piece_copy, &roi_out, &roi_in);
129 float *points,
size_t points_count)
134 for(
size_t i = 0;
i < points_count * 2;
i += 2)
136 points[
i] /=
d->x_scale;
137 points[
i+1] /=
d->y_scale;
144 float *points,
size_t points_count)
149 for(
size_t i = 0;
i < points_count * 2;
i += 2)
151 points[
i] *=
d->x_scale;
152 points[
i+1] *=
d->y_scale;
159 const float *
const in,
float *
const out,
const dt_iop_roi_t *
const roi_in,
165 fprintf(stderr,
"TODO: implement %s() in %s\n", __FUNCTION__, __FILE__);
174 float xy[2] = { roi_out->
x, roi_out->
y };
180 roi_out->
x = (int)floorf(xy[0]);
181 roi_out->
y = (int)floorf(xy[1]);
182 roi_out->
width = (int)ceilf(wh[0]);
183 roi_out->
height = (int)ceilf(wh[1]);
186 if(roi_out->
x < 0) roi_out->
x = 0;
187 if(roi_out->
y < 0) roi_out->
y = 0;
202 roi_in->
width = hw[1];
205 if (reduction_ratio > 1.0f)
207 roi_in->
height /= reduction_ratio;
208 roi_in->
width /= reduction_ratio;
212 d->x_scale = (roi_in->
width * 1.0f) / (roi_out->
width * 1.0f);
213 d->y_scale = (roi_in->
height * 1.0f) / (roi_out->
height * 1.0f);
216 roi_in->
x = roi_out->
x *
d->x_scale;
217 roi_in->
y = roi_out->
y *
d->y_scale;
222 const void *
const ivoid,
void *
const ovoid)
228 const int ch_width =
ch * roi_in->
width;
234 for(
int j = 0; j < roi_out->
height; j++)
236 float *
out = ((
float *)
ovoid) + (size_t)4 * j * roi_out->
width;
239 float x =
i*
d->x_scale;
240 float y = j*
d->y_scale;
243 roi_in->
height, ch_width);
255 d->pixel_aspect_ratio =
p->pixel_aspect_ratio;
259 if(isnan(
p->pixel_aspect_ratio) ||
p->pixel_aspect_ratio <= 0.0f ||
p->pixel_aspect_ratio == 1.0f)
284 d->pixel_aspect_ratio > 0.0f &&
285 d->pixel_aspect_ratio != 1.0f);
292 ? _(
"automatic pixel scaling")
293 :_(
"automatic pixel scaling\nonly works for the sensors that need it."));
305 gtk_label_set_line_wrap(GTK_LABEL(self->
widget),
TRUE);
static const dt_aligned_pixel_simd_t const dt_adaptation_t const float p
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__(...)
static GtkWidget * dt_ui_label_new(const gchar *str)
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_TILING_FULL_ROI
#define IOP_GUI_ALLOC(module)
const struct dt_interpolation * dt_interpolation_new(enum dt_interpolation_type type)
__DT_CLONE_TARGETS__ void dt_interpolation_compute_pixel4c(const struct dt_interpolation *itor, const float *in, float *out, const float x, const float y, const int width, const int height, const int linestride)
@ DT_INTERPOLATION_USERPREF
float *const restrict const size_t const size_t ch
void distort_mask(struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece, const float *const in, float *const out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
const char ** description(struct dt_iop_module_t *self)
void modify_roi_out(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_roi_t *roi_out, const dt_iop_roi_t *const roi_in)
void gui_update(dt_iop_module_t *self)
Refresh GUI controls from current params and configuration.
__DT_CLONE_TARGETS__ int process(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 modify_roi_in(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *const roi_out, dt_iop_roi_t *roi_in)
void gui_init(dt_iop_module_t *self)
int distort_backtransform(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *points, size_t points_count)
void reload_defaults(dt_iop_module_t *self)
void cleanup_pipe(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
int default_colorspace(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
void commit_params(dt_iop_module_t *self, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
static void transform(const dt_dev_pixelpipe_iop_t *const piece, float *p)
void init_pipe(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
int distort_transform(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *points, size_t points_count)
static void precalculate_scale(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
dt_iop_buffer_dsc_t dsc_in
struct dt_iop_module_t *void * data
int32_t hide_enable_button
dt_iop_params_t * default_params
struct dt_develop_t * dev
Region of interest passed through the pixelpipe.