![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "bauhaus/bauhaus.h"#include "common/imageio_rawspeed.h"#include "common/opencl.h"#include "common/imagebuf.h"#include "common/image.h"#include "develop/imageop.h"#include "develop/imageop_gui.h"#include "develop/tiling.h"#include "common/image_cache.h"#include "gui/gtk.h"#include "gui/presets.h"#include "iop/iop_api.h"#include "common/dng_opcode.h"#include <gtk/gtk.h>#include <stdint.h>#include <stdlib.h>
Include dependency graph for rawprepare.c:Go to the source code of this file.
Data Structures | |
| struct | dt_iop_rawprepare_params_t |
| struct | dt_iop_rawprepare_gui_data_t |
| struct | dt_iop_rawprepare_data_t |
| struct | dt_iop_rawprepare_global_data_t |
Typedefs | |
| typedef enum dt_iop_rawprepare_flat_field_t | dt_iop_rawprepare_flat_field_t |
| typedef struct dt_iop_rawprepare_params_t | dt_iop_rawprepare_params_t |
| typedef struct dt_iop_rawprepare_gui_data_t | dt_iop_rawprepare_gui_data_t |
| typedef struct dt_iop_rawprepare_data_t | dt_iop_rawprepare_data_t |
| typedef struct dt_iop_rawprepare_global_data_t | dt_iop_rawprepare_global_data_t |
Enumerations | |
| enum | dt_iop_rawprepare_flat_field_t { FLAT_FIELD_OFF = 0 , FLAT_FIELD_EMBEDDED = 1 } |
Functions | |
| const char * | name () |
| int | operation_tags () |
| int | flags () |
| int | default_group () |
| int | default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece) |
| int | legacy_params (dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version) |
| const char ** | description (struct dt_iop_module_t *self) |
| void | init_presets (dt_iop_module_so_t *self) |
| static | __attribute__ ((always_inline)) |
| static void | _update_output_cfa_descriptor (const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *const roi_in, dt_iop_buffer_dsc_t *dsc) |
| 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) |
| 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) |
| 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) |
| 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 | 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 | 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 | 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 | autoset (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, const void *input) |
| RawSpeed tends to under-evaluate the white point of RAW images, which leads to RGB values > 1 after normalization. We sanitize it here. It does the same for black point, which leads to negative RGB values, but detecting the min RGB here is not more robust to figure out black level per channel than RawSpeed reading black pixels (does it though ?). | |
| __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) |
| int | process_cl (dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out) |
| static int | image_is_normalized (const dt_image_t *const image) |
| static gboolean | image_set_rawcrops (const int32_t imgid, int dx, int dy) |
| gboolean | check_gain_maps (dt_iop_module_t *self, dt_dng_gain_map_t **gainmaps_out) |
| void | commit_params (dt_iop_module_t *self, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| void | init_pipe (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| void | cleanup_pipe (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece) |
| static gboolean | enable (const dt_image_t *image) |
| gboolean | force_enable (struct dt_iop_module_t *self, const gboolean current_state) |
| void | reload_defaults (dt_iop_module_t *self) |
| void | init_global (dt_iop_module_so_t *self) |
| void | cleanup_global (dt_iop_module_so_t *self) |
| void | gui_update (dt_iop_module_t *self) |
| Refresh GUI controls from current params and configuration. | |
| void | gui_changed (dt_iop_module_t *self, GtkWidget *w, void *previous) |
| void | gui_init (dt_iop_module_t *self) |
Variables | |
| const gchar * | black_label [] |
| typedef struct dt_iop_rawprepare_data_t dt_iop_rawprepare_data_t |
| typedef struct dt_iop_rawprepare_global_data_t dt_iop_rawprepare_global_data_t |
| typedef struct dt_iop_rawprepare_gui_data_t dt_iop_rawprepare_gui_data_t |
| typedef struct dt_iop_rawprepare_params_t dt_iop_rawprepare_params_t |
| Enumerator | |
|---|---|
| FLAT_FIELD_OFF | |
| FLAT_FIELD_EMBEDDED | |
Definition at line 62 of file rawprepare.c.
|
inlinestatic |
Definition at line 199 of file rawprepare.c.
References dt_iop_roi_t::scale, and value.
|
static |
XTrans doc: XTrans sensors work by color filter tiles of 6x6 pixels, which are expected to start at the top-left corner of the image. When cropping images, depending on the number of trimmed pixels, we generally cut in the middle of the 6x6 pattern. So this corrects the phase shift to account for the current trimming, aka we reorder the filter coefficients for the current phase shift.
Definition at line 205 of file rawprepare.c.
References d, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_t::dev, dt_image_t::dsc, dt_rawspeed_crop_dcraw_filters(), dt_iop_buffer_dsc_t::filters, i, dt_develop_t::image_storage, IS_NULL_PTR, dt_iop_roi_t::x, dt_iop_buffer_dsc_t::xtrans, and dt_iop_roi_t::y.
Referenced by modify_roi_in(), modify_roi_out(), and output_format().
| void autoset | ( | struct dt_iop_module_t * | self, |
| const struct dt_dev_pixelpipe_t * | pipe, | ||
| const struct dt_dev_pixelpipe_iop_t * | piece, | ||
| const void * | input | ||
| ) |
RawSpeed tends to under-evaluate the white point of RAW images, which leads to RGB values > 1 after normalization. We sanitize it here. It does the same for black point, which leads to negative RGB values, but detecting the min RGB here is not more robust to figure out black level per channel than RawSpeed reading black pixels (does it though ?).
| self | |
| pipe | |
| piece | |
| input |
Definition at line 384 of file rawprepare.c.
References __OMP_PARALLEL_FOR__, dt_iop_buffer_dsc_t::channels, dt_iop_buffer_dsc_t::datatype, dt_dev_pixelpipe_t::dev, dt_dev_pixelpipe_iop_t::dsc_in, dt_iop_buffer_dsc_t::filters, dt_iop_roi_t::height, i, dt_develop_t::image_storage, MAX, max, p, dt_iop_module_t::params, dt_image_t::raw_white_point, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, TYPE_UINT16, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
| gboolean check_gain_maps | ( | dt_iop_module_t * | self, |
| dt_dng_gain_map_t ** | gainmaps_out | ||
| ) |
Definition at line 745 of file rawprepare.c.
References dt_iop_module_t::dev, dt_image_t::dng_gain_maps, FALSE, g, dt_image_t::height, i, dt_develop_t::image_storage, IS_NULL_PTR, TRUE, and dt_image_t::width.
Referenced by commit_params(), gui_update(), and reload_defaults().
| void cleanup_global | ( | dt_iop_module_so_t * | self | ) |
| void cleanup_pipe | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 869 of file rawprepare.c.
References dt_dev_pixelpipe_iop_t::data, and dt_free_align.
| void commit_params | ( | dt_iop_module_t * | self, |
| dt_iop_params_t * | params, | ||
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 791 of file rawprepare.c.
References dt_iop_buffer_dsc_t::channels, check_gain_maps(), dt_iop_buffer_dsc_t::cst, d, darktable, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_t::dev, dt_image_t::dsc, dt_dev_pixelpipe_iop_t::dsc_out, DT_DEBUG_CONTROL_SIGNAL_RAISE, dt_image_is_hdr(), dt_image_needs_rawprepare(), dt_image_pipe_class(), dt_image_pipe_class_name(), dt_iop_fmt_log, DT_SIGNAL_METADATA_UPDATE, dt_dev_pixelpipe_iop_t::enabled, FALSE, dt_iop_buffer_dsc_t::filters, FLAT_FIELD_EMBEDDED, i, dt_image_t::id, image_is_normalized(), image_set_rawcrops(), dt_develop_t::image_storage, IOP_CS_RAW, k, p, dt_dev_pixelpipe_iop_t::process_cl_ready, dt_iop_buffer_dsc_t::processed_maximum, dt_iop_buffer_dsc_t::raw_black_level, dt_iop_buffer_dsc_t::raw_white_point, dt_iop_buffer_dsc_t::rawprepare, darktable_t::signals, and dt_image_t::width.
| int default_colorspace | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 137 of file rawprepare.c.
References dt_iop_buffer_dsc_t::cst, dt_dev_pixelpipe_iop_t::dsc_in, IOP_CS_RAW, and IOP_CS_RGB.
| int default_group | ( | ) |
Definition at line 132 of file rawprepare.c.
References IOP_GROUP_TECHNICAL.
| const char ** description | ( | struct dt_iop_module_t * | self | ) |
Definition at line 170 of file rawprepare.c.
References dt_iop_set_description().
| 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 | ||
| ) |
Definition at line 274 of file rawprepare.c.
References __OMP_PARALLEL_FOR_SIMD__, dt_dev_pixelpipe_iop_t::buf_in, d, dt_dev_pixelpipe_iop_t::data, double(), i, dt_iop_roi_t::scale, void(), and x.
| 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 | ||
| ) |
Definition at line 298 of file rawprepare.c.
References dt_iop_copy_image_roi(), out, TRUE, and void().
| 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 | ||
| ) |
Definition at line 250 of file rawprepare.c.
References __OMP_PARALLEL_FOR_SIMD__, dt_dev_pixelpipe_iop_t::buf_in, d, dt_dev_pixelpipe_iop_t::data, double(), i, dt_iop_roi_t::scale, void(), and x.
|
static |
Definition at line 876 of file rawprepare.c.
References dt_image_needs_rawprepare(), and image_is_normalized().
Referenced by force_enable(), and reload_defaults().
| int flags | ( | ) |
Definition at line 126 of file rawprepare.c.
References IOP_FLAGS_ALLOW_TILING, IOP_FLAGS_ONE_INSTANCE, IOP_FLAGS_TILING_FULL_ROI, and IOP_FLAGS_UNSAFE_COPY.
| gboolean force_enable | ( | struct dt_iop_module_t * | self, |
| const gboolean | current_state | ||
| ) |
Definition at line 884 of file rawprepare.c.
References dt_iop_module_t::dev, dt_image_pipe_class(), dt_image_pipe_class_name(), dt_iop_fmt_log, enable(), dt_develop_t::image_storage, and state.
| void gui_changed | ( | dt_iop_module_t * | self, |
| GtkWidget * | w, | ||
| void * | previous | ||
| ) |
Definition at line 971 of file rawprepare.c.
References dt_iop_module_t::dev, dt_bauhaus_slider_set(), DT_IMAGE_MONOCHROME, DT_IMAGE_MONOCHROME_BAYER, dt_image_t::flags, g, dt_iop_module_t::gui_data, i, dt_develop_t::image_storage, p, and dt_iop_module_t::params.
| void gui_init | ( | dt_iop_module_t * | self | ) |
Definition at line 994 of file rawprepare.c.
References black_label, dt_bauhaus_combobox_from_params(), dt_bauhaus_slider_from_params(), dt_bauhaus_slider_set_soft_max(), dt_bauhaus_widget_set_label(), dt_free, DT_GUI_BOX_SPACING, dt_ui_label_new(), dt_ui_section_label_new(), FALSE, g, i, IOP_GUI_ALLOC, and dt_iop_module_t::widget.
| void gui_update | ( | dt_iop_module_t * | self | ) |
Refresh GUI controls from current params and configuration.
Definition at line 946 of file rawprepare.c.
References check_gain_maps(), dt_iop_module_t::dev, dt_bauhaus_combobox_set(), dt_bauhaus_slider_set(), DT_IMAGE_MONOCHROME, DT_IMAGE_MONOCHROME_BAYER, dt_image_t::flags, g, dt_iop_module_t::gui_data, i, dt_develop_t::image_storage, p, and dt_iop_module_t::params.
|
static |
Definition at line 703 of file rawprepare.c.
References dt_iop_buffer_dsc_t::channels, dt_iop_buffer_dsc_t::datatype, dt_image_t::dsc, dt_image_is_hdr(), f, dt_image_t::raw_white_point, and TYPE_FLOAT.
Referenced by commit_params(), and enable().
|
static |
Definition at line 722 of file rawprepare.c.
References darktable, dt_image_cache_get(), dt_image_cache_read_release(), DT_IMAGE_CACHE_RELAXED, dt_image_cache_write_release(), FALSE, dt_image_t::height, darktable_t::image_cache, IS_NULL_PTR, dt_image_t::p_height, dt_image_t::p_width, TRUE, and dt_image_t::width.
Referenced by commit_params().
| void init_global | ( | dt_iop_module_so_t * | self | ) |
Definition at line 924 of file rawprepare.c.
References dt_iop_module_so_t::data, dt_opencl_create_kernel(), dt_iop_rawprepare_global_data_t::kernel_rawprepare_1f, dt_iop_rawprepare_global_data_t::kernel_rawprepare_1f_gainmap, dt_iop_rawprepare_global_data_t::kernel_rawprepare_1f_unnormalized, dt_iop_rawprepare_global_data_t::kernel_rawprepare_1f_unnormalized_gainmap, and dt_iop_rawprepare_global_data_t::kernel_rawprepare_4f.
| void init_pipe | ( | dt_iop_module_t * | self, |
| dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_pixelpipe_iop_t * | piece | ||
| ) |
Definition at line 863 of file rawprepare.c.
References dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_iop_t::data_size, and dt_calloc_align().
| void init_presets | ( | dt_iop_module_so_t * | self | ) |
Definition at line 180 of file rawprepare.c.
References darktable, darktable_t::db, DEVELOP_BLEND_CS_NONE, dt_database_release_transaction, dt_database_start_transaction, dt_gui_presets_add_generic(), and dt_iop_module_so_t::op.
| 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 | ||
| ) |
Definition at line 358 of file rawprepare.c.
References dt_dev_pixelpipe_t::dev, dt_image_t::dsc, and dt_develop_t::image_storage.
| int legacy_params | ( | dt_iop_module_t * | self, |
| const void *const | old_params, | ||
| const int | old_version, | ||
| void * | new_params, | ||
| const int | new_version | ||
| ) |
Definition at line 144 of file rawprepare.c.
References FLAT_FIELD_OFF, height, n, width, x, and dt_iop_rawprepare_params_t::y.
| 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 | ||
| ) |
Definition at line 332 of file rawprepare.c.
References _update_output_cfa_descriptor(), d, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_iop_t::dsc_out, dt_iop_roi_t::height, dt_iop_roi_t::scale, dt_iop_roi_t::width, and x.
| 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 | ||
| ) |
Definition at line 310 of file rawprepare.c.
References _update_output_cfa_descriptor(), d, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_iop_t::dsc_out, dt_iop_roi_t::height, dt_iop_roi_t::scale, dt_iop_roi_t::width, x, dt_iop_roi_t::x, and dt_iop_roi_t::y.
| const char * name | ( | ) |
Definition at line 116 of file rawprepare.c.
| int operation_tags | ( | ) |
Definition at line 121 of file rawprepare.c.
References IOP_TAG_DISTORT.
| 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 | ||
| ) |
Definition at line 350 of file rawprepare.c.
References _update_output_cfa_descriptor(), default_output_format(), dt_dev_pixelpipe_iop_t::dsc_out, and dt_dev_pixelpipe_iop_t::roi_in.
| __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 | ||
| ) |
Definition at line 419 of file rawprepare.c.
References __OMP_PARALLEL_FOR__, dt_dev_pixelpipe_iop_t::buf_in, ch, dt_iop_buffer_dsc_t::channels, d, dt_dev_pixelpipe_iop_t::data, dt_iop_buffer_dsc_t::datatype, dt_dev_pixelpipe_iop_t::dsc_in, f, dt_iop_buffer_dsc_t::filters, height, dt_iop_roi_t::height, i, k, MIN, out, ovoid, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, TYPE_FLOAT, TYPE_UINT16, width, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
| int process_cl | ( | dt_iop_module_t * | self, |
| const dt_dev_pixelpipe_t * | pipe, | ||
| const dt_dev_pixelpipe_iop_t * | piece, | ||
| cl_mem | dev_in, | ||
| cl_mem | dev_out | ||
| ) |
Definition at line 588 of file rawprepare.c.
References dt_dev_pixelpipe_iop_t::buf_in, dt_iop_buffer_dsc_t::channels, d, dt_dev_pixelpipe_iop_t::data, dt_iop_buffer_dsc_t::datatype, dt_dev_pixelpipe_t::devid, dt_dev_pixelpipe_iop_t::dsc_in, DT_DEBUG_OPENCL, dt_opencl_alloc_device(), dt_opencl_copy_host_to_device_constant(), dt_opencl_enqueue_kernel_2d(), dt_opencl_release_mem_object(), dt_opencl_set_kernel_arg(), dt_opencl_write_host_to_device(), dt_print(), error(), FALSE, dt_iop_buffer_dsc_t::filters, dt_iop_module_t::global_data, height, dt_iop_roi_t::height, i, IS_NULL_PTR, kernel(), dt_iop_rawprepare_global_data_t::kernel_rawprepare_1f, dt_iop_rawprepare_global_data_t::kernel_rawprepare_1f_gainmap, dt_iop_rawprepare_global_data_t::kernel_rawprepare_1f_unnormalized, dt_iop_rawprepare_global_data_t::kernel_rawprepare_1f_unnormalized_gainmap, dt_iop_rawprepare_global_data_t::kernel_rawprepare_4f, dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, ROUNDUPDHT, ROUNDUPDWD, TRUE, TYPE_FLOAT, TYPE_UINT16, width, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.
| void reload_defaults | ( | dt_iop_module_t * | self | ) |
Definition at line 896 of file rawprepare.c.
References check_gain_maps(), dt_image_t::crop_height, dt_image_t::crop_width, dt_image_t::crop_x, dt_image_t::crop_y, d, dt_iop_module_t::default_enabled, dt_iop_module_t::default_params, dt_iop_module_t::dev, dt_image_print_debug_info(), enable(), FLAT_FIELD_EMBEDDED, FLAT_FIELD_OFF, dt_iop_module_t::hide_enable_button, dt_develop_t::image_storage, dt_image_t::raw_black_level_separate, dt_image_t::raw_white_point, and dt_iop_module_t::widget.
| const gchar* black_label[] |
Definition at line 988 of file rawprepare.c.
Referenced by gui_init().