71 for(
int k = 0;
k < 2;
k++)
p[
k] = aabb[2 * ((
i >>
k) & 1) +
k];
76 aabb[0] = fminf(aabb[0],
p[0]);
77 aabb[1] = fminf(aabb[1],
p[1]);
78 aabb[2] = fmaxf(aabb[2],
p[0]);
79 aabb[3] = fmaxf(aabb[3],
p[1]);
85 return C_(
"modulename",
"rotate pixels");
112 _(
"internal module to setup technical specificities of raw sensor.\n\n"
113 "you should not touch values here !"),
114 NULL, NULL, NULL, NULL);
124 float pi[2] = {
x[0] -
d->rx * scale,
x[1] -
d->ry * scale };
136 float rt[] = {
d->m[0], -
d->m[1], -
d->m[2],
d->m[3] };
139 o[0] +=
d->rx * scale;
140 o[1] +=
d->ry * scale;
144 float *
const restrict points,
size_t points_count)
148 for(
size_t i = 0;
i < points_count * 2;
i += 2)
153 pi[1] = points[
i + 1];
158 points[
i + 1] = po[1];
165 float *
const restrict points,
size_t points_count)
169 for(
size_t i = 0;
i < points_count * 2;
i += 2)
174 pi[1] = points[
i + 1];
179 points[
i + 1] = po[1];
186 const float *
const in,
float *
const out,
const dt_iop_roi_t *
const roi_in,
192 fprintf(stderr,
"TODO: implement %s() in %s\n", __FUNCTION__, __FILE__);
225 const float scale = roi_in->
scale;
226 const float T = (float)
d->ry * scale;
228 const float y = sqrtf(2.0f * T * T),
229 x = sqrtf(2.0f * ((
float)roi_in->
width - T) * ((
float)roi_in->
width - T));
232 const float IW = (float)interpolation->
width * scale;
234 roi_out->
width = y - IW;
248 const float scale = roi_in->
scale;
254 for(
int c = 0; c < 4; c++)
268 const float IW = (float)interpolation->
width * scale;
273 roi_in->
x = fmaxf(0.0f, aabb_in[0] - IW);
274 roi_in->
y = fmaxf(0.0f, aabb_in[1] - IW);
275 roi_in->
width = fminf(orig_w - roi_in->
x, aabb_in[2] - roi_in->
x + IW);
276 roi_in->
height = fminf(orig_h - roi_in->
y, aabb_in[3] - roi_in->
y + IW);
279 roi_in->
x = CLAMP(roi_in->
x, 0, (
int)floorf(orig_w));
280 roi_in->
y = CLAMP(roi_in->
y, 0, (
int)floorf(orig_h));
281 roi_in->
width = CLAMP(roi_in->
width, 1, (
int)ceilf(orig_w) - roi_in->
x);
282 roi_in->
height = CLAMP(roi_in->
height, 1, (
int)ceilf(orig_h) - roi_in->
y);
289 const void *
const ivoid,
void *
const ovoid)
295 const int ch_width =
ch * roi_in->
width;
297 const float scale = roi_in->
scale;
303 for(
int j = 0; j < roi_out->
height; j++)
310 pi[0] = roi_out->
x +
i;
311 pi[1] = roi_out->
y + j;
319 roi_in->
height, ch_width);
334 const float angle =
p->angle *
M_PI / 180.0f;
336 float rt[] = { cosf(angle), sinf(angle), -sinf(angle), cosf(angle) };
337 for(
int k = 0;
k < 4;
k++)
d->m[
k] = rt[
k];
341 if((
d->rx == 0u) && (
d->ry == 0u)) piece->
enabled = 0;
371 ? _(
"automatic pixel rotation")
372 : _(
"automatic pixel rotation\nonly works for the sensors that need it."));
383 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)
float dt_boundingbox_t[4]
#define DT_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)
#define __OMP_DECLARE_SIMD__(...)
#define __DT_CLONE_TARGETS__
#define __OMP_PARALLEL_FOR__(...)
#define __OMP_PARALLEL_FOR_SIMD__(...)
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 k
float *const restrict const size_t const size_t ch
static void mul_mat_vec_2(const float *m, const float *p, float *o)
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)
int distort_backtransform(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *const restrict points, size_t points_count)
int distort_transform(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *const restrict points, size_t points_count)
void gui_update(dt_iop_module_t *self)
Refresh GUI controls from current params and configuration.
static void get_corner(const float *aabb, const int i, float *p)
__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)
void commit_params(dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
void reload_defaults(dt_iop_module_t *self)
static void transform(const dt_dev_pixelpipe_iop_t *const piece, const float scale, const float *const x, float *o)
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)
dt_iop_rotatepixels_gui_data_t dummy
static void adjust_aabb(const float *p, float *aabb)
void init_pipe(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
static void backtransform(const dt_dev_pixelpipe_iop_t *const piece, const float scale, const float *const x, float *o)
dt_iop_buffer_dsc_t dsc_in
struct dt_iop_module_t *void * data
uint32_t fuji_rotation_pos
int32_t hide_enable_button
dt_iop_params_t * default_params
struct dt_develop_t * dev
Region of interest passed through the pixelpipe.