void commit_params(struct dt_iop_module_t *self, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) { dt_iop_invert_params_t *p = (dt_iop_invert_params_t *)params; dt_iop_invert_data_t *d = (dt_iop_invert_data_t *)piece->data; for(int k = 0; k < 3; k++) d->color[k] = p->color[k]; // x-trans images not implemented in OpenCL yet if(pipe->image.filters == 9u) piece->process_cl_ready = 0; if (self->dev->image_storage.flags & DT_IMAGE_4BAYER) { // 4Bayer images not implemented in OpenCL yet piece->process_cl_ready = 0; char *camera = self->dev->image_storage.camera_makermodel; if (!dt_colorspaces_conversion_matrices_rgb(camera, d->RGB_to_CAM, NULL, NULL)) { fprintf(stderr, "[invert] `%s' color matrix not found for 4bayer image!\n", camera); dt_control_log(_("`%s' color matrix not found for 4bayer image!\n"), camera); } } }
int legacy_params(dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version) { if(old_version == 1 && new_version == 2) { typedef struct dt_iop_invert_params_v1_t { float color[3]; // color of film material } dt_iop_invert_params_v1_t; dt_iop_invert_params_v1_t *o = (dt_iop_invert_params_v1_t *)old_params; dt_iop_invert_params_t *n = (dt_iop_invert_params_t *)new_params; n->color[0] = o->color[0]; n->color[1] = o->color[1]; n->color[2] = o->color[2]; n->color[3] = NAN; if(self->dev && self->dev->image_storage.flags & DT_IMAGE_4BAYER) { const char *camera = self->dev->image_storage.camera_makermodel; double RGB_to_CAM[4][3]; // Get and store the matrix to go from camera to RGB for 4Bayer images (used for spot WB) if(!dt_colorspaces_conversion_matrices_rgb(camera, RGB_to_CAM, NULL, NULL)) { fprintf(stderr, "[invert] `%s' color matrix not found for 4bayer image\n", camera); dt_control_log(_("`%s' color matrix not found for 4bayer image"), camera); } else { dt_colorspaces_rgb_to_cygm(n->color, 1, RGB_to_CAM); } } return 0; } return 1; }
void reload_defaults(dt_iop_module_t *self) { dt_iop_invert_params_t tmp = (dt_iop_invert_params_t){ { 1.0f, 1.0f, 1.0f } }; memcpy(self->params, &tmp, sizeof(dt_iop_invert_params_t)); memcpy(self->default_params, &tmp, sizeof(dt_iop_invert_params_t)); self->default_enabled = 0; if(self->dev && self->dev->image_storage.flags & DT_IMAGE_4BAYER && self->gui_data) { dt_iop_invert_gui_data_t *g = self->gui_data; const char *camera = self->dev->image_storage.camera_makermodel; // Get and store the matrix to go from camera to RGB for 4Bayer images (used for spot WB) if(!dt_colorspaces_conversion_matrices_rgb(camera, g->RGB_to_CAM, g->CAM_to_RGB, NULL)) { fprintf(stderr, "[invert] `%s' color matrix not found for 4bayer image\n", camera); dt_control_log(_("`%s' color matrix not found for 4bayer image"), camera); } } }